From 604ee59816b5ee660d184fdec9a922487c522f0c Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Tue, 17 May 2011 14:11:52 +0200 Subject: [PATCH] remove obsolete loaders --- loaders/__init__.py | 80 --------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 loaders/__init__.py diff --git a/loaders/__init__.py b/loaders/__init__.py deleted file mode 100644 index 118def0..0000000 --- a/loaders/__init__.py +++ /dev/null @@ -1,80 +0,0 @@ -import os - -class Loader: - def __init__(self): - pass - - def load(self, filename): - pass - - def save(self, filename, annotations): - pass - -class RectIdLoader(Loader): - def load(self, filename): - annotations = [] - - print "loading ", filename - filename_helper = {} - - f = open(filename) - basedir = "" - try: - for line in f: - s = line.split() - print s - image_fname = s[0] - if basedir == "": - basedir = os.path.dirname(image_fname) - else: - assert basedir == os.path.dirname(image_fname) - num_rects = int(s[1]) - assert num_rects == 0 or num_rects == 1 - if image_fname not in filename_helper: - annotation = { - 'type': 'image', - 'filename': image_fname, - 'annotations': [] - } - annotations.append(annotation) - filename_helper[image_fname] = annotation - - rects = filename_helper[image_fname]['annotations'] - - for i in range(0, 4*num_rects, 4): - rects.append({ - 'type': 'rect', - 'x': s[i+2], - 'y': s[i+3], - 'width': s[i+4], - 'height': s[i+5] - }) - if len(s) > i+6: - rects[-1]['id'] = s[i+6] - except Exception, e: - print e - - print annotations - return annotations - -class FeretLoader(Loader): - def load(self, filename): - basedir = os.path.dirname(filename) - f = open(filename) - - annotations = [] - for line in f: - s = line.split() - fileitem = { - 'filename': os.path.join(basedir, s[0]+".bmp"), - 'type': 'image', - } - fileitem['annotations'] = [ - {'type': 'point', 'class': 'left_eye', 'x': int(s[1]), 'y': int(s[2])}, - {'type': 'point', 'class': 'right_eye', 'x': int(s[3]), 'y': int(s[4])}, - {'type': 'point', 'class': 'mouth', 'x': int(s[5]), 'y': int(s[6])} - ] - annotations.append(fileitem) - - return annotations -