Skip to content
Snippets Groups Projects
Commit 9d8dfd03 authored by Amir Mohammadi's avatar Amir Mohammadi
Browse files

[mobio] fix the annotation loading

parent 3f377801
No related branches found
No related tags found
1 merge request!15Resolve "Some database interfaces do not provide access to the annotations stored in the low-level databases", Add replay mobile bob.db.replaymobile
Pipeline #
......@@ -14,6 +14,14 @@ from .database import FaceBioFile
from bob.bio.base.database import ZTBioDatabase
class MobioBioFile(FaceBioFile):
"""FaceBioFile implementation of the Replay Mobile Database"""
def __init__(self, f):
super(FaceBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id)
self._f = f
class MobioBioDatabase(ZTBioDatabase):
"""
Implements verification API for querying Mobio database.
......@@ -21,29 +29,42 @@ class MobioBioDatabase(ZTBioDatabase):
def __init__(
self,
original_directory=None,
original_extension=None,
annotation_directory=None,
annotation_extension='.pos',
**kwargs
):
# call base class constructors to open a session to the database
super(MobioBioDatabase, self).__init__(name='mobio',
**kwargs)
super(MobioBioDatabase, self).__init__(
name='mobio',
original_directory=original_directory,
original_extension=original_extension,
annotation_directory=annotation_directory,
annotation_extension=annotation_extension,
**kwargs)
from bob.db.mobio.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
self._db = LowLevelDatabase(original_directory, original_extension,
annotation_directory, annotation_extension)
def model_ids_with_protocol(self, groups=None, protocol=None, gender=None):
return self.__db.model_ids(groups=groups, protocol=protocol, gender=gender)
return self._db.model_ids(groups=groups, protocol=protocol, gender=gender)
def tmodel_ids_with_protocol(self, protocol=None, groups=None, **kwargs):
return self.__db.tmodel_ids(protocol=protocol, groups=groups, **kwargs)
return self._db.tmodel_ids(protocol=protocol, groups=groups, **kwargs)
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 [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
retval = self._db.objects(groups=groups, protocol=protocol, purposes=purposes, model_ids=model_ids, **kwargs)
return [MobioBioFile(f) 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 [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
retval = self._db.tobjects(groups=groups, protocol=protocol, model_ids=model_ids, **kwargs)
return [MobioBioFile(f) for f in retval]
def zobjects(self, groups=None, protocol=None, **kwargs):
retval = self.__db.zobjects(groups=groups, protocol=protocol, **kwargs)
return [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
retval = self._db.zobjects(groups=groups, protocol=protocol, **kwargs)
return [MobioBioFile(f) for f in retval]
def annotations(self, myfile):
return self._db.annotations(myfile._f)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment