From ab46377de794f432ccf04825158df075a5393714 Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Wed, 29 Jun 2011 16:30:33 +0200 Subject: [PATCH] Rename type to class for FileModelItems --- examples/example1_labels.json | 4 ++-- sloth/annotations/container.py | 4 ++-- sloth/annotations/model.py | 6 +++--- sloth/core/labeltool.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/example1_labels.json b/examples/example1_labels.json index 5525d6f..112c90e 100644 --- a/examples/example1_labels.json +++ b/examples/example1_labels.json @@ -1,6 +1,6 @@ [ { - "type": "image", + "class": "image", "annotations": [ { "height": 60.0, @@ -20,7 +20,7 @@ "filename": "image1.jpg" }, { - "type": "image", + "class": "image", "annotations": [ { "y": 155.0, diff --git a/sloth/annotations/container.py b/sloth/annotations/container.py index 8545e9d..62ccde8 100644 --- a/sloth/annotations/container.py +++ b/sloth/annotations/container.py @@ -227,7 +227,7 @@ class FileNameListContainer(AnnotationContainer): line = line.strip() fileitem = { 'filename': line, - 'type': 'image', + 'class': 'image', 'annotations': [], } annotations.append(fileitem) @@ -255,7 +255,7 @@ class FeretContainer(AnnotationContainer): s = line.split() fileitem = { 'filename': s[0] + ".bmp", - 'type': 'image', + 'class': 'image', } fileitem['annotations'] = [ {'class': 'left_eye', diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index 382f12c..509a47d 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -240,7 +240,7 @@ class KeyValueModelItem(ModelItem, MutableMapping): return res class FileModelItem(KeyValueModelItem): - def __init__(self, fileinfo, hidden=['filename', 'type']): + def __init__(self, fileinfo, hidden=['filename', 'class']): KeyValueModelItem.__init__(self, hidden=hidden) self.update(fileinfo) @@ -251,9 +251,9 @@ class FileModelItem(KeyValueModelItem): @staticmethod def create(fileinfo): - if fileinfo['type'] == 'image': + if fileinfo['class'] == 'image': return ImageFileModelItem(fileinfo) - elif fileinfo['type'] == 'video': + elif fileinfo['class'] == 'video': return VideoFileModelItem(fileinfo) class ImageModelItem(ModelItem): diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index e3f6f92..c0c036a 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -316,7 +316,7 @@ class LabelTool(QObject): def addImageFile(self, fname): fileitem = { 'filename': fname, - 'type': 'image', + 'class': 'image', 'annotations': [ ], } self._model._root.appendFileItem(fileitem) @@ -324,7 +324,7 @@ class LabelTool(QObject): def addVideoFile(self, fname): fileitem = { 'filename': fname, - 'type': 'video', + 'class': 'video', 'frames': [ ], }