mirror of
https://github.com/wassname/sloth.git
synced 2026-07-29 11:27:41 +08:00
Add option to appendfiles to mark appended files as unlabeled
This commit is contained in:
@@ -255,6 +255,7 @@ class RootModelItem(ModelItem):
|
||||
def appendFileItem(self, fileinfo):
|
||||
item = FileModelItem.create(fileinfo)
|
||||
self.appendChild(item)
|
||||
return item
|
||||
|
||||
def appendFileItems(self, fileinfos):
|
||||
start1 = time.time()
|
||||
|
||||
@@ -76,6 +76,10 @@ class AppendFilesCommand(BaseCommand):
|
||||
"""
|
||||
args = '<labelfile> <file1> [<file2> ...]'
|
||||
help = __doc__.strip()
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option('-u', '--unlabeled', action='store_true', default=False,
|
||||
help='Mark appended files as unlabeled.'),
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if len(args) < 2:
|
||||
@@ -88,7 +92,9 @@ class AppendFilesCommand(BaseCommand):
|
||||
rel_filename = os.path.relpath(filename, os.path.dirname(args[0]))
|
||||
except:
|
||||
pass
|
||||
self.labeltool.addImageFile(rel_filename)
|
||||
item = self.labeltool.addImageFile(rel_filename)
|
||||
if options['unlabeled']:
|
||||
item.setUnlabeled(True)
|
||||
self.labeltool.saveAnnotations(args[0])
|
||||
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ class LabelTool(QObject):
|
||||
'class': 'image',
|
||||
'annotations': [ ],
|
||||
}
|
||||
self._model._root.appendFileItem(fileitem)
|
||||
return self._model._root.appendFileItem(fileitem)
|
||||
|
||||
def addVideoFile(self, fname):
|
||||
fileitem = {
|
||||
|
||||
Reference in New Issue
Block a user