mirror of
https://github.com/wassname/sloth.git
synced 2026-06-28 23:58:13 +08:00
make appendfiles use relative filenames to the label file location
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import sys
|
||||
import os
|
||||
import sloth
|
||||
import shutil
|
||||
from pprint import pprint
|
||||
from sloth.core.cli import BaseCommand, CommandError
|
||||
from sloth.annotations.container import *
|
||||
from optparse import make_option, OptionParser
|
||||
from optparse import make_option
|
||||
|
||||
class ConvertCommand(BaseCommand):
|
||||
"""
|
||||
@@ -82,7 +83,12 @@ class AppendFilesCommand(BaseCommand):
|
||||
|
||||
self.labeltool.loadAnnotations(args[0])
|
||||
for filename in args[1:]:
|
||||
self.labeltool.addImageFile(filename)
|
||||
rel_filename = filename
|
||||
try:
|
||||
rel_filename = os.path.relpath(filename, os.path.dirname(args[0]))
|
||||
except:
|
||||
pass
|
||||
self.labeltool.addImageFile(rel_filename)
|
||||
self.labeltool.saveAnnotations(args[0])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user