Reimplemented the inheritance mechanism

parent 44df55d2
Pipeline #3697 canceled with stage
in 1 minute and 44 seconds
......@@ -12,14 +12,12 @@ from bob.bio.video.utils.FrameSelector import FrameSelector
class VideoBioFile(BioFile):
def __init__(self, f):
def __init__(self, client_id, path, file_id):
"""
Initializes this File object with an File equivalent for
VoxForge database.
"""
super(VideoBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id)
self.__f = f
super(VideoBioFile, self).__init__(client_id=client_id, path=path, file_id=file_id)
def load(self, directory=None, extension='.avi'):
return FrameSelector()(self.make_path(directory, extension))
......
......@@ -53,12 +53,12 @@ class YoutubeBioDatabase(ZTBioDatabase):
def objects(self, groups=None, protocol=None, purposes=None, model_ids=None, **kwargs):
retval = self.__db.objects(groups=groups, protocol=protocol, purposes=purposes, model_ids=model_ids, **kwargs)
return [YoutubeBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
return [YoutubeBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
def tobjects(self, groups=None, protocol=None, model_ids=None, **kwargs):
retval = self.__db.tobjects(groups=groups, protocol=protocol, model_ids=model_ids, **kwargs)
return [YoutubeBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
return [YoutubeBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
def zobjects(self, groups=None, protocol=None, **kwargs):
retval = self.__db.zobjects(groups=groups, protocol=protocol, **kwargs)
return [YoutubeBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
return [YoutubeBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
......@@ -31,7 +31,7 @@ class DummyDatabase(ZTBioDatabase):
self.__db = bob.db.atnt.Database()
def _make_bio(self, files):
return [DummyBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in files]
return [DummyBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in files]
def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
return self.__db.model_ids(groups, protocol)
......@@ -54,11 +54,6 @@ class DummyDatabase(ZTBioDatabase):
def z_probe_files(self, group='dev'):
return self.probe_files(None, group)
# override all_files to return a one-element lists of files
#def all_files(self, groups):
#return [[n] for n in super(DummyDatabase, self).all_files(groups)]
#return [[n] for n in super(DummyDatabase, self).all_files(groups)]
def file_names(self, files, directory, extension):
if isinstance(files[0], list):
files = list(list(zip(*files))[0])
......
......@@ -16,7 +16,7 @@ regenerate_refs = False
def test_annotations():
original_path = pkg_resources.resource_filename("bob.bio.face.test", "")
image_files = DummyBioFile(bob.bio.base.database.BioFile(client_id=1, file_id=1, path="data/testimage"))
image_files = DummyBioFile(client_id=1, file_id=1, path="data/testimage")
# use annotations to grep
annotations = {os.path.basename(image_files.make_path(original_path, ".jpg")): bob.db.base.read_annotation_file(
......@@ -49,8 +49,7 @@ def test_detect():
# load test video
original_path = pkg_resources.resource_filename("bob.bio.video.test", "")
video_object = bob.bio.video.database.VideoBioFile(bob.bio.base.database.BioFile(
client_id=1, file_id=1, path="data/testvideo"))
video_object = bob.bio.video.database.VideoBioFile(client_id=1, file_id=1, path="data/testvideo")
frame_selector = bob.bio.video.FrameSelector(max_number_of_frames=3, selection_style="spread")
preprocessor = bob.bio.video.preprocessor.Wrapper('face-detect', frame_selector, compressed_io=False,
......@@ -76,8 +75,7 @@ def test_flandmark():
return frame_selector(video_object.make_path(original_path, original_extension))
original_path = pkg_resources.resource_filename("bob.bio.video.test", "")
video_object = bob.bio.video.database.VideoBioFile(bob.bio.base.database.BioFile(
client_id=1, file_id=1, path="data/testvideo"))
video_object = bob.bio.video.database.VideoBioFile(client_id=1, file_id=1, path="data/testvideo")
frame_selector = bob.bio.video.FrameSelector(max_number_of_frames=3, selection_style="spread")
preprocessor = bob.bio.video.preprocessor.Wrapper('landmark-detect', frame_selector, compressed_io=False,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment