diff --git a/bob/bio/face/config/database/mobio.py b/bob/bio/face/config/database/mobio.py deleted file mode 100644 index c2f40b0d9b286415424d766735443acc10d7979b..0000000000000000000000000000000000000000 --- a/bob/bio/face/config/database/mobio.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -from bob.bio.face.database import MobioBioDatabase -from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector -from bob.extension import rc - -database = DatabaseConnector( - MobioBioDatabase( - original_directory=rc["bob.db.mobio.directory"], - annotation_directory=rc["bob.db.mobio.annotation_directory"], - original_extension=".png", - protocol="mobile0-male", - ) -) -database.allow_scoring_with_all_biometric_references = True - - -mobio_image_directory = rc["bob.db.mobio.directory"] -mobio_annotation_directory = rc["bob.db.mobio.annotation_directory"] - -allow_scoring_with_all_biometric_references = True -annotation_type = "eyes-center" -fixed_positions = None - - -mobio_image = DatabaseConnector( - MobioBioDatabase( - original_directory=mobio_image_directory, - original_extension=".png", - annotation_directory=mobio_annotation_directory, - annotation_type="eyecenter", - protocol="male", - models_depend_on_protocol=True, - ), - allow_scoring_with_all_biometric_references=allow_scoring_with_all_biometric_references, - annotation_type=annotation_type, - fixed_positions=fixed_positions, -) - - -mobio_male = DatabaseConnector( - MobioBioDatabase( - original_directory=mobio_image_directory, - original_extension=".png", - annotation_directory=mobio_annotation_directory, - annotation_type="eyecenter", - protocol="male", - models_depend_on_protocol=True, - all_files_options={"gender": "male"}, - extractor_training_options={"gender": "male"}, - projector_training_options={"gender": "male"}, - enroller_training_options={"gender": "male"}, - z_probe_options={"gender": "male"}, - ), - allow_scoring_with_all_biometric_references=allow_scoring_with_all_biometric_references, - annotation_type=annotation_type, - fixed_positions=fixed_positions, -) - - -mobio_female = DatabaseConnector( - MobioBioDatabase( - original_directory=mobio_image_directory, - original_extension=".png", - annotation_directory=mobio_annotation_directory, - annotation_type="eyecenter", - protocol="female", - models_depend_on_protocol=True, - all_files_options={"gender": "female"}, - extractor_training_options={"gender": "female"}, - projector_training_options={"gender": "female"}, - enroller_training_options={"gender": "female"}, - z_probe_options={"gender": "female"}, - ), - allow_scoring_with_all_biometric_references=allow_scoring_with_all_biometric_references, - annotation_type=annotation_type, - fixed_positions=fixed_positions, -) diff --git a/bob/bio/face/config/database/mobio_all.py b/bob/bio/face/config/database/mobio_all.py index 8492d8cb54eb3b20b568133803f379deb7e4372b..bb2d0c0c1be80cec28913848fb520eaa4586cd77 100644 --- a/bob/bio/face/config/database/mobio_all.py +++ b/bob/bio/face/config/database/mobio_all.py @@ -1,17 +1,5 @@ #!/usr/bin/env python -from bob.bio.face.database import MobioBioDatabase -from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector -from bob.extension import rc - -database = DatabaseConnector( - MobioBioDatabase( - original_directory=rc["bob.db.mobio.directory"], - annotation_directory=rc["bob.db.mobio.annotation_directory"], - original_extension=".png", - protocol="mobile0-male-female", - ), - annotation_type = "eyes-center", - fixed_positions = None -) +from bob.bio.face.database import MobioDatabase +database = MobioDatabase(protocol="mobile0-male-female") diff --git a/bob/bio/face/config/database/mobio_male.py b/bob/bio/face/config/database/mobio_male.py index b33f356031fc28d93ab79d76671f4d712ad379af..49a4da62497678448354e81e1c0ed2d8ef460f31 100644 --- a/bob/bio/face/config/database/mobio_male.py +++ b/bob/bio/face/config/database/mobio_male.py @@ -1,17 +1,5 @@ #!/usr/bin/env python -from bob.bio.face.database import MobioBioDatabase -from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector -from bob.extension import rc - -database = DatabaseConnector( - MobioBioDatabase( - original_directory=rc["bob.db.mobio.directory"], - annotation_directory=rc["bob.db.mobio.annotation_directory"], - original_extension=".png", - protocol="mobile0-male", - ), - annotation_type = "eyes-center", - fixed_positions = None -) +from bob.bio.face.database import MobioDatabase +database = MobioDatabase(protocol="mobile0-male") diff --git a/bob/bio/face/config/database/multipie.py b/bob/bio/face/config/database/multipie.py index 4eff5ff4ad37f957654960bd8f92a0a8229e0600..c0ffdfee6baff64faab10ff97c1fb57fc8dfad31 100644 --- a/bob/bio/face/config/database/multipie.py +++ b/bob/bio/face/config/database/multipie.py @@ -1,18 +1,5 @@ #!/usr/bin/env python -from bob.bio.face.database import MultipieBioDatabase -from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector -from bob.extension import rc +from bob.bio.face.database import MultipieDatabase - -multipie_image_directory = rc["bob.db.multipie.directory"] -multipie_annotation_directory = rc["bob.db.multipie.annotations"] - -database = DatabaseConnector( - MultipieBioDatabase( - original_directory=multipie_image_directory, - annotation_directory=multipie_annotation_directory, - protocol="U", - training_depends_on_protocol=True, - ) -) +database = MultipieDatabase(protocol="U") diff --git a/bob/bio/face/config/database/multipie_pose.py b/bob/bio/face/config/database/multipie_pose.py index 95e13bf90c064199c65d8c0badf149df9b3919f4..a4d10d061ec959b2c31a8e4904f3cd2bf62c00f6 100644 --- a/bob/bio/face/config/database/multipie_pose.py +++ b/bob/bio/face/config/database/multipie_pose.py @@ -1,44 +1,3 @@ -#!/usr/bin/env python +from bob.bio.face.database import MultipieDatabase - -from bob.bio.face.database import MultipieBioDatabase -from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector -from bob.extension import rc - - -# here, we only want to have the cameras that are used in the P protocol -cameras = ( - "24_0", - "01_0", - "20_0", - "19_0", - "04_1", - "05_0", - "05_1", - "14_0", - "13_0", - "08_0", - "09_0", - "12_0", - "11_0", -) - -multipie_image_directory = rc["bob.db.multipie.directory"] -multipie_annotation_directory = rc["bob.db.multipie.annotations"] - -database = DatabaseConnector( - MultipieBioDatabase( - original_directory=multipie_image_directory, - annotation_directory=multipie_annotation_directory, - protocol="P", - training_depends_on_protocol=True, - all_files_options={"cameras": cameras}, - extractor_training_options={"cameras": cameras}, - projector_training_options={ - "cameras": cameras, - "world_sampling": 3, - "world_first": True, - }, - enroller_training_options={"cameras": cameras}, - ) -) +database = MultipieDatabase(protocol="P") diff --git a/bob/bio/face/database/__init__.py b/bob/bio/face/database/__init__.py index 3c0429f2e189eaacd4280f9ee99cdf78e3da237f..8450b9f7f12e7966d70cd86da37d304e94d5b758 100644 --- a/bob/bio/face/database/__init__.py +++ b/bob/bio/face/database/__init__.py @@ -2,13 +2,13 @@ # vim: set fileencoding=utf-8 : from .database import FaceBioFile -from .mobio import MobioBioDatabase +from .mobio import MobioDatabase from .replay import ReplayBioDatabase from .atnt import AtntBioDatabase from .gbu import GBUBioDatabase from .arface import ARFaceBioDatabase from .lfw import LFWBioDatabase -from .multipie import MultipieBioDatabase +from .multipie import MultipieDatabase from .ijbc import IJBCBioDatabase from .replaymobile import ReplayMobileBioDatabase from .fargo import FargoBioDatabase @@ -35,13 +35,13 @@ def __appropriate__(*args): __appropriate__( FaceBioFile, - MobioBioDatabase, + MobioDatabase, ReplayBioDatabase, AtntBioDatabase, GBUBioDatabase, ARFaceBioDatabase, LFWBioDatabase, - MultipieBioDatabase, + MultipieDatabase, IJBCBioDatabase, ReplayMobileBioDatabase, FargoBioDatabase, diff --git a/bob/bio/face/database/mobio.py b/bob/bio/face/database/mobio.py index f09b4fe49ff8da219cf449513944793de97a2d29..839ad3174ceb876669eade1e827c4c119d12d9bc 100644 --- a/bob/bio/face/database/mobio.py +++ b/bob/bio/face/database/mobio.py @@ -1,92 +1,96 @@ #!/usr/bin/env python # vim: set fileencoding=utf-8 : -# Amir Mohammadi <amir.mohammadi@idiap.ch> -# Wed 13 Jul 16:43:22 CEST 2016 +# Tiago de Freitas Pereira <tiago.pereira@idiap.ch> """ - MOBIO database implementation of bob.bio.base.database.ZTBioDatabase interface. - It is an extension of an SQL-based database interface, which directly talks to Mobio database, for - verification experiments (good to use in bob.bio.base framework). + MOBIO database implementation """ +from bob.bio.base.database import ( + CSVDataset, + CSVDatasetZTNorm, +) +from bob.pipelines.datasets import CSVToSampleLoader +from bob.bio.face.database.sample_loaders import EyesAnnotations +from bob.extension import rc +from bob.extension.download import get_file +import bob.io.base +from sklearn.pipeline import make_pipeline -from .database import FaceBioFile -from bob.bio.base.database import ZTBioDatabase - -class MobioBioFile(FaceBioFile): - """FaceBioFile implementation of the Mobio Database""" - - def __init__(self, f): - super(MobioBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id) - self._f = f - - -class MobioBioDatabase(ZTBioDatabase): - """ - MOBIO database implementation of bob.bio.base.database.ZTBioDatabase interface. - It is an extension of an SQL-based database interface, which directly talks to Mobio database, for - verification experiments (good to use in bob.bio.base framework). +class MobioDatabase(CSVDatasetZTNorm): """ + The MOBIO dataset is a video database containing bimodal data (face/speaker). + It is composed by 152 people (split in the two genders male and female), mostly Europeans, split in 5 sessions (few weeks time lapse between sessions). + The database was recorded using two types of mobile devices: mobile phones (NOKIA N93i) and laptop + computers(standard 2008 MacBook). + + For face recognition images are used instead of videos. + One image was extracted from each video by choosing the video frame after 10 seconds. + The eye positions were manually labelled and distributed with the database. + + For more information check: + + .. code-block:: latex + + @article{McCool_IET_BMT_2013, + title = {Session variability modelling for face authentication}, + author = {McCool, Chris and Wallace, Roy and McLaren, Mitchell and El Shafey, Laurent and Marcel, S{\'{e}}bastien}, + month = sep, + journal = {IET Biometrics}, + volume = {2}, + number = {3}, + year = {2013}, + pages = {117-129}, + issn = {2047-4938}, + doi = {10.1049/iet-bmt.2012.0059}, + } - def __init__( - self, - original_directory=None, - original_extension=None, - annotation_directory=None, - annotation_extension='.pos', - **kwargs - ): - from bob.db.mobio.query import Database as LowLevelDatabase - self._db = LowLevelDatabase(original_directory, original_extension, - annotation_directory, annotation_extension) - - # call base class constructors to open a session to the database - super(MobioBioDatabase, self).__init__( - name='mobio', - original_directory=original_directory, - original_extension=original_extension, - annotation_directory=annotation_directory, - annotation_extension=annotation_extension, - **kwargs) - - @property - def original_directory(self): - return self._db.original_directory - - @original_directory.setter - def original_directory(self, value): - self._db.original_directory = value - - @property - def annotation_directory(self): - return self._db.annotation_directory - - @annotation_directory.setter - def annotation_directory(self, value): - self._db.annotation_directory = value - - def model_ids_with_protocol(self, groups=None, protocol=None, gender=None): - 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) - - 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 [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 [MobioBioFile(f) for f in retval] - - def zobjects(self, groups=None, protocol=None, **kwargs): - 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) - - def groups(self, protocol=None, **kwargs): - return self._db.groups(protocol=protocol) + """ + def __init__(self, protocol): + + # Downloading model if not exists + urls = [ + "https://www.idiap.ch/software/bob/databases/latest/mobio.tar.gz", + "http://www.idiap.ch/software/bob/databases/latest/mobio.tar.gz", + ] + filename = get_file("mobio.tar.gz", urls) + + self.annotation_type = "eyes-center" + self.fixed_positions = None + + database = CSVDataset( + filename, + protocol, + csv_to_sample_loader=make_pipeline( + CSVToSampleLoader( + data_loader=bob.io.base.load, + dataset_original_directory=rc["bob.db.mobio.directory"] + if rc["bob.db.mobio.directory"] + else "", + extension=".png", + ), + EyesAnnotations(), + ), + ) + + super().__init__(database) + + # def zprobes(self, proportion=0.20): + # return super().zprobes(proportion=proportion) + + @staticmethod + def protocols(): + # TODO: Until we have (if we have) a function that dumps the protocols, let's use this one. + return [ + "laptop1-female", + "laptop_mobile1-female", + "mobile0-female", + "mobile0-male-female", + "mobile1-male", + "laptop1-male", + "laptop_mobile1-male", + "mobile0-male", + "mobile1-female", + ] diff --git a/bob/bio/face/database/multipie.py b/bob/bio/face/database/multipie.py index 04cd418bd582522377adb6910def2c4f5e32ac99..f296d243d13060db0265fd1925499fc1ccc61b8b 100644 --- a/bob/bio/face/database/multipie.py +++ b/bob/bio/face/database/multipie.py @@ -1,80 +1,74 @@ #!/usr/bin/env python # vim: set fileencoding=utf-8 : # Tiago de Freitas Pereira <tiago.pereira@idiap.ch> -# Sat 20 Aug 15:43:10 CEST 2016 """ - Multipie database implementation of bob.bio.base.database.Database interface. - It is an extension of an SQL-based database interface, which directly talks to Multipie database, for - verification experiments (good to use in bob.bio.base framework). + Multipie database implementation """ -from .database import FaceBioFile -from bob.bio.base.database import ZTBioDatabase +from bob.bio.base.database import CSVDataset +from bob.pipelines.datasets import CSVToSampleLoader +from bob.bio.face.database.sample_loaders import MultiposeAnnotations +from bob.extension import rc +from bob.extension.download import get_file +import bob.io.base +from sklearn.pipeline import make_pipeline -class MultipieBioFile(FaceBioFile): - - def __init__(self, f): - super(MultipieBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id) - self._f = f - - -class MultipieBioDatabase(ZTBioDatabase): +class MultipieDatabase(CSVDataset): """ - Multipie database implementation of bob.bio.base.database.Database interface. - It is an extension of an SQL-based database interface, which directly talks to Multipie database, for - verification experiments (good to use in bob.bio.base framework). + The Multipie database.. """ - def __init__( - self, - original_directory=None, - original_extension='.png', - annotation_directory=None, - annotation_extension='.pos', - **kwargs - ): - from bob.db.multipie.query import Database as LowLevelDatabase - self._db = LowLevelDatabase(original_directory, - original_extension, - annotation_directory, - annotation_extension) - - # call base class constructors to open a session to the database - super(MultipieBioDatabase, self).__init__( - name='multipie', - original_directory=original_directory, - original_extension=original_extension, - annotation_directory=annotation_directory, - annotation_extension=annotation_extension, - **kwargs) - - @property - def original_directory(self): - return self._db.original_directory - - @original_directory.setter - def original_directory(self, value): - self._db.original_directory = value - - def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs): - return self._db.model_ids(groups=groups, protocol=protocol) - - 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 [MultipieBioFile(f) for f in retval] - - def tmodel_ids_with_protocol(self, protocol=None, groups=None, **kwargs): - return self._db.tmodel_ids(protocol=protocol, groups=groups, **kwargs) - - 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 [MultipieBioFile(f) for f in retval] - - def zobjects(self, groups=None, protocol=None, **kwargs): - retval = self._db.zobjects(groups=groups, protocol=protocol, **kwargs) - return [MultipieBioFile(f) for f in retval] - - def annotations(self, myfile): - return self._db.annotations(myfile._f) + def __init__(self, protocol): + + # Downloading model if not exists + urls = [ + "https://www.idiap.ch/software/bob/databases/latest/multipie.tar.gz", + "http://www.idiap.ch/software/bob/databases/latest/multipie.tar.gz", + ] + filename = get_file("multipie.tar.gz", urls) + + self.annotation_type = ["eyes-center", "left-profile", "right-profile"] + self.fixed_positions = None + + super().__init__( + filename, + protocol, + csv_to_sample_loader=make_pipeline( + CSVToSampleLoader( + data_loader=bob.io.base.load, + dataset_original_directory=rc["bob.db.multipie.directory"] + if rc["bob.db.multipie.directory"] + else "", + extension=".png", + ), + MultiposeAnnotations(), + ), + ) + + @staticmethod + def protocols(): + # TODO: Until we have (if we have) a function that dumps the protocols, let's use this one. + return [ + "P240", + "P191", + "P130", + "G", + "P010", + "P041", + "P051", + "P050", + "M", + "P110", + "P", + "P140", + "U", + "P200", + "E", + "P190", + "P120", + "P080", + "P081", + "P090", + ] diff --git a/bob/bio/face/database/sample_loaders.py b/bob/bio/face/database/sample_loaders.py index 607145ea69ed22831199765542cf924b5acdee86..bc6b553f231239c7f3685e0395c356928c18dfe3 100644 --- a/bob/bio/face/database/sample_loaders.py +++ b/bob/bio/face/database/sample_loaders.py @@ -8,6 +8,13 @@ from bob.pipelines import DelayedSample, Sample, SampleSet from sklearn.base import TransformerMixin, BaseEstimator +def find_attribute(x, attribute): + if hasattr(x, attribute): + return getattr(x, attribute) + else: + ValueError(f"Attribute not found in the dataset: {attribute}") + + class EyesAnnotations(TransformerMixin, BaseEstimator): def fit(self, X, y=None): return self @@ -23,12 +30,6 @@ class EyesAnnotations(TransformerMixin, BaseEstimator): Convert leye_x, leye_y, reye_x, reye_y attributes to `annotations = (leye, reye)` """ - def find_attribute(x, attribute): - if hasattr(x, attribute): - return getattr(x, attribute) - else: - ValueError(f"Attribute not found in the dataset: {attribute}") - annotated_samples = [] for x in X: eyes = { @@ -47,3 +48,85 @@ class EyesAnnotations(TransformerMixin, BaseEstimator): annotated_samples.append(sample) return annotated_samples + + +class MultiposeAnnotations(TransformerMixin, BaseEstimator): + def fit(self, X, y=None): + return self + + def _more_tags(self): + return { + "stateless": True, + "requires_fit": False, + } + + def transform(self, X): + + annotated_samples = [] + for x in X: + annotations = dict() + if find_attribute(x, "leye_x") != "" and find_attribute(x, "reye_x") != "": + # Normal profile + annotations = { + "leye": ( + float(find_attribute(x, "leye_x")), + float(find_attribute(x, "leye_y")), + ), + "reye": ( + float(find_attribute(x, "reye_x")), + float(find_attribute(x, "reye_y")), + ), + } + elif ( + find_attribute(x, "leye_x") != "" and find_attribute(x, "reye_x") == "" + ): + # Left profile + annotations = { + "leye": ( + float(find_attribute(x, "leye_x")), + float(find_attribute(x, "leye_y")), + ), + "mouth": ( + float(find_attribute(x, "mouthl_x")), + float(find_attribute(x, "mouthl_y")), + ), + } + elif ( + find_attribute(x, "leye_x") == "" and find_attribute(x, "reye_x") != "" + ): + # Right profile + annotations = { + "reye": ( + float(find_attribute(x, "reye_x")), + float(find_attribute(x, "reye_y")), + ), + "mouth": ( + float(find_attribute(x, "mouthr_x")), + float(find_attribute(x, "mouthr_y")), + ), + } + else: + raise ValueError("Annotations not available") + + sample = DelayedSample(x._load, parent=x, annotations=annotations) + [ + delattr(sample, a) + for a in [ + "reye_x", + "reye_y", + "leye_x", + "leye_y", + "nose_x", + "nose_y", + "mouthr_x", + "mouthr_y", + "mouthl_x", + "mouthl_y", + "chin_x", + "chin_y", + ] + ] + + annotated_samples.append(sample) + + return annotated_samples diff --git a/bob/bio/face/test/test_databases.py b/bob/bio/face/test/test_databases.py index 856ac9f0134d224bb6151915f30501ed49d3f6d9..4d55ff7e91dbf0eb684ae581a333f92b1e228c9c 100644 --- a/bob/bio/face/test/test_databases.py +++ b/bob/bio/face/test/test_databases.py @@ -156,74 +156,58 @@ def test_lfw(): ) -@db_available("mobio") def test_mobio(): - database = bob.bio.base.load_resource( - "mobio-image", "database", preferred_package="bob.bio.face" - ) - try: - check_database_zt(database, models_depend=True) - check_database_zt(database, protocol="female", models_depend=True) - check_database_zt( - bob.bio.base.load_resource( - "mobio-male", "database", preferred_package="bob.bio.face" - ), - models_depend=True, - ) - check_database_zt( - bob.bio.base.load_resource( - "mobio-female", "database", preferred_package="bob.bio.face" - ), - models_depend=True, - ) - except IOError as e: - raise SkipTest( - "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" - % e - ) + from bob.bio.face.database import MobioDatabase - try: - _check_annotations(database, limit_files=1000) - except IOError as e: - raise SkipTest( - "The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'" - % e - ) + protocols = MobioDatabase.protocols() + for p in protocols: + database = MobioDatabase(protocol=p) + assert len(database.background_model_samples()) > 0 + assert len(database.treferences()) > 0 + assert len(database.zprobes()) > 0 + + assert len(database.references(group="dev")) > 0 + assert len(database.probes(group="dev")) > 0 + + assert len(database.references(group="eval")) > 0 + assert len(database.probes(group="eval")) > 0 + + # Sanity check on mobio-male + database = MobioDatabase(protocol="mobile0-male") + assert len(database.treferences()) == 8 + assert len(database.zprobes()) == 960 + assert len(database.background_model_samples()) == 9600 + + assert len(database.references()) == 24 + assert len(database.probes()) == 2520 + + assert len(database.references(group="eval")) == 38 + assert len(database.probes(group="eval")) == 3990 -@db_available("multipie") def test_multipie(): - database = bob.bio.base.load_resource( - "multipie", "database", preferred_package="bob.bio.face" - ) - try: - check_database_zt(database, training_depends=True) - check_database_zt( - bob.bio.base.load_resource( - "multipie-pose", "database", preferred_package="bob.bio.face" - ), - training_depends=True, - ) - except IOError as e: - raise SkipTest( - "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" - % e - ) - except ValueError as e: - raise SkipTest( - "The database could not queried; probably the protocol is missing inside the db.sql3 file. Here is the error: '%s'" - % e - ) + from bob.bio.face.database import MultipieDatabase - try: - if database.database.annotation_directory is None: - raise SkipTest("The annotation directory is not set") - _check_annotations(database) - except IOError as e: - raise SkipTest( - "The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'" - % e - ) + protocols = MultipieDatabase.protocols() + + for p in protocols: + database = MultipieDatabase(protocol=p) + assert len(database.background_model_samples()) > 0 + + assert len(database.references(group="dev")) > 0 + assert len(database.probes(group="dev")) > 0 + + assert len(database.references(group="eval")) > 0 + assert len(database.probes(group="eval")) > 0 + + database = MultipieDatabase(protocol="P") + assert len(database.background_model_samples()) == 7725 + + assert len(database.references(group="dev")) == 64 + assert len(database.probes(group="dev")) == 3328 + + assert len(database.references(group="eval")) == 65 + assert len(database.probes(group="eval")) == 3380 @db_available("replay") diff --git a/conda/meta.yaml b/conda/meta.yaml index 88f4cb414d98950e6f5ed8e1d2dd504946793888..fa99e5132883676c719f5b3457b67678bb5eaa38 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -75,8 +75,6 @@ test: - bob.db.gbu - bob.db.ijbc - bob.db.lfw - - bob.db.mobio - - bob.db.multipie - bob.db.replay - bob.db.replaymobile - bob.db.xm2vts diff --git a/doc/implemented.rst b/doc/implemented.rst index 0deac2602496a6ed7390588ea7b7666459ef43d3..a4de538e10395f752443a1c4082c3f919b3e279e 100644 --- a/doc/implemented.rst +++ b/doc/implemented.rst @@ -13,12 +13,12 @@ Databases .. autosummary:: bob.bio.face.database.ARFaceBioDatabase bob.bio.face.database.AtntBioDatabase - bob.bio.face.database.MobioBioDatabase + bob.bio.face.database.MobioDatabase bob.bio.face.database.ReplayBioDatabase bob.bio.face.database.ReplayMobileBioDatabase bob.bio.face.database.GBUBioDatabase bob.bio.face.database.LFWBioDatabase - bob.bio.face.database.MultipieBioDatabase + bob.bio.face.database.MultipieDatabase bob.bio.face.database.FargoBioDatabase bob.bio.face.database.MEDSDatabase bob.bio.face.database.MorphDatabase diff --git a/test-requirements.txt b/test-requirements.txt index d151d8fa1e53521dfd0dea36d9484920572b5a5b..b29263ceba31349e85f5fe7ed0f84268d51c8775 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,9 +4,7 @@ bob.db.banca bob.db.gbu bob.db.ijbc bob.db.lfw -bob.db.mobio -bob.db.multipie bob.db.replay bob.db.replaymobile bob.db.xm2vts -bob.db.fargo +bob.db.fargo \ No newline at end of file