Add FileNameListContainer

It can be used to initialize the list of images to be annotated.
This commit is contained in:
Mika Fischer
2011-06-07 16:31:18 +02:00
parent 022b0c2882
commit d5f629d806
+25
View File
@@ -224,6 +224,31 @@ class YamlContainer(AnnotationContainer):
yaml.dump(self.annotations(), f)
class FileNameListContainer(AnnotationContainer):
"""
Simple container to initialize the files to be annotated.
"""
def parseFromFile(self, filename):
self.basedir_ = os.path.dirname(filename)
f = open(filename, "r")
print "Opening", filename
annotations = []
for line in f:
line = line.strip()
fileitem = {
'filename': line,
'type': 'image',
'annotations': [],
}
annotations.append(fileitem)
return annotations
def serializeToFile(self, filename):
raise NotImplemented("FileNameListContainer.save() is not implemented yet.")
class FeretContainer(AnnotationContainer):
"""
Container for Feret labels.