diff --git a/bob/bio/face/config/database/arface.py b/bob/bio/face/config/database/arface.py index 344fe2785bfb9fec51dfa403e59289e5b5c212ee..c378304070cd810f86e9fd0fbc84f469589281a7 100644 --- a/bob/bio/face/config/database/arface.py +++ b/bob/bio/face/config/database/arface.py @@ -1,14 +1,11 @@ #!/usr/bin/env python -import bob.db.arface -import bob.bio.base +from bob.bio.db import ARFaceBioDatabase arface_directory = "[YOUR_ARFACE_DIRECTORY]" -database = bob.bio.base.database.DatabaseBob( - database = bob.db.arface.Database( - original_directory = arface_directory - ), - name = 'arface', - protocol = 'all' +database = ARFaceBioDatabase( + original_directory=arface_directory, + original_extension=".png", + protocol='all' ) diff --git a/bob/bio/face/config/database/atnt.py b/bob/bio/face/config/database/atnt.py index c5cf04331ab9601f54f042d29352fe8a4152c400..08ed0d265c6b9f5c5f37ba0a791bff6568e19836 100644 --- a/bob/bio/face/config/database/atnt.py +++ b/bob/bio/face/config/database/atnt.py @@ -1,13 +1,9 @@ #!/usr/bin/env python -import bob.db.atnt -import bob.bio.base +from bob.bio.db import AtntBioDatabase -atnt_directory = "[YOUR_ATNT_DIRECTORY]" +atnt_directory = "[YOUR_CAS-PEAL_DIRECTORY]" -database = bob.bio.base.database.DatabaseBob( - database = bob.db.atnt.Database( - original_directory = atnt_directory - ), - name = 'atnt' +database = AtntBioDatabase( + original_directory=atnt_directory, ) diff --git a/bob/bio/face/config/database/banca_english.py b/bob/bio/face/config/database/banca_english.py index e8919ef3065b5b509f04a108b50c63ec3dff2cb7..76c765db0369ded5679a4a3f15db8fb7d29dadb0 100644 --- a/bob/bio/face/config/database/banca_english.py +++ b/bob/bio/face/config/database/banca_english.py @@ -1,15 +1,12 @@ #!/usr/bin/env python -import bob.db.banca -import bob.bio.base +from bob.bio.db import BancaBioDatabase banca_directory = "[YOUR_BANCA_DIRECTORY]" -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.banca.Database( - original_directory = banca_directory, - original_extension = '.ppm' - ), - name = "banca", - protocol = 'P' +database = BancaBioDatabase( + original_directory=banca_directory, + original_extension=".ppm", + protocol='P' ) + diff --git a/bob/bio/face/config/database/caspeal.py b/bob/bio/face/config/database/caspeal.py index 677cffd758906bc75d17f2e127f70b28a5037dbd..d92dbf50df517251ff366e7f28c545d7951d9644 100644 --- a/bob/bio/face/config/database/caspeal.py +++ b/bob/bio/face/config/database/caspeal.py @@ -1,14 +1,11 @@ #!/usr/bin/env python -import bob.db.caspeal -import bob.bio.base +from bob.bio.db import CaspealBioDatabase caspeal_directory = "[YOUR_CAS-PEAL_DIRECTORY]" -database = bob.bio.base.database.DatabaseBob( - database = bob.db.caspeal.Database( - original_directory = caspeal_directory - ), - name = "caspeal", - protocol = 'lighting' +database = CaspealBioDatabase( + original_directory=caspeal_directory, + protocol='lighting' ) + diff --git a/bob/bio/face/config/database/gbu.py b/bob/bio/face/config/database/gbu.py index f7fdc7f802d09ac000a9580382c6abd3d26958a9..6da69eb940628af703271d0fb08f6028f9e682bf 100644 --- a/bob/bio/face/config/database/gbu.py +++ b/bob/bio/face/config/database/gbu.py @@ -1,20 +1,17 @@ #!/usr/bin/env python -import bob.db.gbu -import bob.bio.base +from bob.bio.db import GBUBioDatabase mbgc_v1_directory = "[YOUR_MBGC-V1_DIRECTORY]" -database = bob.bio.base.database.DatabaseBob( - database = bob.db.gbu.Database( - original_directory = mbgc_v1_directory - ), - name = "gbu", - protocol = 'Good', - models_depend_on_protocol = True, +database = GBUBioDatabase( + original_directory=mbgc_v1_directory, + protocol='Good', + models_depend_on_protocol=True, - all_files_options = { 'subworld': 'x2' }, - extractor_training_options = { 'subworld': 'x2' }, - projector_training_options = { 'subworld': 'x2' }, - enroller_training_options = { 'subworld': 'x2' } + all_files_options={'subworld': 'x2'}, + extractor_training_options={'subworld': 'x2'}, + projector_training_options={'subworld': 'x2'}, + enroller_training_options={'subworld': 'x2'} ) + diff --git a/bob/bio/face/config/database/lfw_restricted.py b/bob/bio/face/config/database/lfw_restricted.py index d8a95a23f9dd6f1a109f2f84d807a515528799e1..1844f9f697c36e97ec00dc4407e50073f1701186 100644 --- a/bob/bio/face/config/database/lfw_restricted.py +++ b/bob/bio/face/config/database/lfw_restricted.py @@ -1,22 +1,19 @@ #!/usr/bin/env python -import bob.db.lfw -import bob.bio.base +from bob.bio.db import LFWBioDatabase lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]" -database = bob.bio.base.database.DatabaseBob( - database = bob.db.lfw.Database( - original_directory = lfw_directory, - annotation_type = 'funneled' - ), - name = 'lfw', - protocol = 'view1', - training_depends_on_protocol = True, - models_depend_on_protocol = True, +database = LFWBioDatabase( + original_directory=lfw_directory, + annotation_type='funneled', - all_files_options = { 'world_type' : 'restricted' }, - extractor_training_options = { 'world_type' : 'restricted' }, # 'subworld' : 'twofolds' - projector_training_options = { 'world_type' : 'restricted' }, # 'subworld' : 'twofolds' - enroller_training_options = { 'world_type' : 'restricted' } # 'subworld' : 'twofolds' + protocol='view1', + training_depends_on_protocol=True, + models_depend_on_protocol=True, + + all_files_options={'world_type': 'restricted'}, + extractor_training_options={'world_type': 'restricted'}, # 'subworld' : 'twofolds' + projector_training_options={'world_type': 'restricted'}, # 'subworld' : 'twofolds' + enroller_training_options={'world_type': 'restricted'} # 'subworld' : 'twofolds' ) diff --git a/bob/bio/face/config/database/lfw_unrestricted.py b/bob/bio/face/config/database/lfw_unrestricted.py index 2d626de610d0b078a39e5c177f094882838b3f0d..b05a354ac71ba06fb6c4babcb23fef1f7e16c1bc 100644 --- a/bob/bio/face/config/database/lfw_unrestricted.py +++ b/bob/bio/face/config/database/lfw_unrestricted.py @@ -1,22 +1,20 @@ #!/usr/bin/env python -import bob.db.lfw -import bob.bio.base +from bob.bio.db import LFWBioDatabase lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]" -database = bob.bio.base.database.DatabaseBob( - database = bob.db.lfw.Database( - original_directory = lfw_directory, - annotation_type = 'funneled' - ), - name = 'lfw', - protocol = 'view1', - training_depends_on_protocol = True, - models_depend_on_protocol = True, +database = LFWBioDatabase( + original_directory=lfw_directory, + annotation_type='funneled', + + protocol='view1', + training_depends_on_protocol=True, + models_depend_on_protocol=True, all_files_options = { 'world_type' : 'unrestricted' }, extractor_training_options = { 'world_type' : 'unrestricted' }, # 'subworld' : 'twofolds' projector_training_options = { 'world_type' : 'unrestricted' }, # 'subworld' : 'twofolds' enroller_training_options = { 'world_type' : 'unrestricted' } # 'subworld' : 'twofolds' ) + diff --git a/bob/bio/face/config/database/mobio_female.py b/bob/bio/face/config/database/mobio_female.py index e4a4fa2f93b917d6a919202a7b33cbb7d7088e50..73508e5c0a691a50fa24f2ac24c473a65adced72 100644 --- a/bob/bio/face/config/database/mobio_female.py +++ b/bob/bio/face/config/database/mobio_female.py @@ -1,24 +1,21 @@ #!/usr/bin/env python -import bob.db.mobio -import bob.bio.base +from bob.bio.db import MobioBioDatabase mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]" mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]" -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.mobio.Database( - original_directory = mobio_image_directory, - original_extension = ".png", - annotation_directory = mobio_annotation_directory, - ), - name = "mobio-female", +database = MobioBioDatabase( + original_directory=mobio_image_directory, + original_extension=".png", + annotation_directory=mobio_annotation_directory, + protocol = 'female', - models_depend_on_protocol = True, + 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' } + 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'} ) diff --git a/bob/bio/face/config/database/mobio_image.py b/bob/bio/face/config/database/mobio_image.py index cfe979c85e94ed6a0c94633eacf9493dd571957f..59c3565155e184791f82acbd3a72c36d54bd16ea 100644 --- a/bob/bio/face/config/database/mobio_image.py +++ b/bob/bio/face/config/database/mobio_image.py @@ -1,18 +1,19 @@ #!/usr/bin/env python -import bob.db.mobio -import bob.bio.base +from bob.bio.db import MobioBioDatabase mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]" mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]" -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.mobio.Database( - original_directory = mobio_image_directory, - original_extension = '.png', - annotation_directory = mobio_annotation_directory, - ), - name = "mobio", - protocol = 'male', - models_depend_on_protocol = True +database = MobioBioDatabase( + original_directory=mobio_image_directory, + original_extension=".png", + annotation_directory=mobio_annotation_directory, + + protocol='male', + models_depend_on_protocol = True, ) + + + + diff --git a/bob/bio/face/config/database/mobio_male.py b/bob/bio/face/config/database/mobio_male.py index cc92efe819f9f6db706e83c003c0454a2b2ee532..214fea4560d6534be3b755355aa73f7c7461858f 100644 --- a/bob/bio/face/config/database/mobio_male.py +++ b/bob/bio/face/config/database/mobio_male.py @@ -1,24 +1,22 @@ #!/usr/bin/env python -import bob.db.mobio -import bob.bio.base +from bob.bio.db import MobioBioDatabase mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]" mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]" -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.mobio.Database( - original_directory = mobio_image_directory, - original_extension = ".png", - annotation_directory = mobio_annotation_directory, - ), - name = "mobio-male", - protocol = 'male', +database = MobioBioDatabase( + original_directory=mobio_image_directory, + original_extension=".png", + annotation_directory=mobio_annotation_directory, + + 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' } + 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'} ) + diff --git a/bob/bio/face/config/database/multipie.py b/bob/bio/face/config/database/multipie.py index c8ba598b156baa5f07f0c32baf70436d6c36af5f..9324389bc4fa645068d1f08d2f04d947ee077cf4 100644 --- a/bob/bio/face/config/database/multipie.py +++ b/bob/bio/face/config/database/multipie.py @@ -1,17 +1,13 @@ #!/usr/bin/env python -import bob.db.multipie -import bob.bio.base +from bob.bio.db import MultipieBioDatabase multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]" multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]" -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.multipie.Database( - original_directory = multipie_image_directory, - annotation_directory = multipie_annotation_directory - ), - name = "multipie", - protocol = 'U', +database = MultipieBioDatabase( + original_directory=multipie_image_directory, + annotation_directory=multipie_annotation_directory, + protocol='U', training_depends_on_protocol = True ) diff --git a/bob/bio/face/config/database/multipie_pose.py b/bob/bio/face/config/database/multipie_pose.py index c00f69004ae3dff89a74ffe2df594137039d49df..a67930ffd3913a094ca3c1c9e013178cf6c1741b 100644 --- a/bob/bio/face/config/database/multipie_pose.py +++ b/bob/bio/face/config/database/multipie_pose.py @@ -1,25 +1,24 @@ #!/usr/bin/env python -import bob.db.multipie -import bob.bio.base -multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]" -multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]" +from bob.bio.db import MultipieBioDatabase # 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') -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.multipie.Database( - original_directory = multipie_image_directory, - annotation_directory = multipie_annotation_directory - ), - name = "multipie-pose", +multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]" +multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]" + +database = 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} + 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} + ) + diff --git a/bob/bio/face/config/database/scface.py b/bob/bio/face/config/database/scface.py index e83fb6554d95729a51b4542897621edeeac38de3..9f4e339d8794e3d1d172f2577b190a61e00d796a 100644 --- a/bob/bio/face/config/database/scface.py +++ b/bob/bio/face/config/database/scface.py @@ -1,15 +1,10 @@ #!/usr/bin/env python -import bob.db.scface -import bob.bio.base +from bob.bio.db import SCFaceBioDatabase scface_directory = "[YOUR_SC_FACE_DIRECTORY]" -# setup for SCface database -database = bob.bio.base.database.DatabaseBobZT( - database = bob.db.scface.Database( - original_directory = scface_directory - ), - name = 'scface', - protocol = 'combined' +database = SCFaceBioDatabase( + original_directory=scface_directory, + protocol='combined' ) diff --git a/bob/bio/face/config/database/xm2vts.py b/bob/bio/face/config/database/xm2vts.py index 5e80205207e5f099edb01b910653add75cbeff72..54a3533d64d6f9fc81a042e2d82d341c1b831a6f 100644 --- a/bob/bio/face/config/database/xm2vts.py +++ b/bob/bio/face/config/database/xm2vts.py @@ -1,15 +1,10 @@ #!/usr/bin/env python -import bob.db.xm2vts -import bob.bio.base +from bob.bio.db import XM2VTSBioDatabase xm2vts_directory = "[YOUR_XM2VTS_DIRECTORY]" -# setup for XM2VTS -database = bob.bio.base.database.DatabaseBob( - database = bob.db.xm2vts.Database( - original_directory = xm2vts_directory - ), - name = "xm2vts", - protocol = 'lp1' +database = XM2VTSBioDatabase( + original_directory=xm2vts_directory, + protocol='lp1' ) diff --git a/bob/bio/face/test/test_databases.py b/bob/bio/face/test/test_databases.py index fbebbfbe98ccacaf1ce36fe3a8842d1575c4cb69..fcc36657f8ad609d6cd0d89ad17f4e544f80b19c 100644 --- a/bob/bio/face/test/test_databases.py +++ b/bob/bio/face/test/test_databases.py @@ -24,170 +24,188 @@ from nose.plugins.skip import SkipTest import bob.bio.base from bob.bio.base.test.utils import db_available -def _check_database(database, groups = ('dev',), protocol = None, training_depends = False, models_depend = False): - assert isinstance(database, bob.bio.base.database.DatabaseBob) - # load the directories - if 'HOME' in os.environ: - database.replace_directories(os.path.join(os.environ['HOME'], '.bob_bio_databases.txt')) +def _check_database(database, groups=('dev',), protocol=None, training_depends=False, models_depend=False): + assert isinstance(database, bob.bio.db.BioDatabase) - if protocol: database.protocol = protocol - assert len(database.all_files()) > 0 - assert len(database.training_files('train_extractor')) > 0 - assert len(database.arrange_by_client(database.training_files('train_enroller'))) > 0 + # load the directories + if 'HOME' in os.environ: + database.replace_directories(os.path.join(os.environ['HOME'], '.bob_bio_databases.txt')) - for group in groups: - model_ids = database.model_ids(group) - assert len(model_ids) > 0 - assert database.client_id_from_model_id(model_ids[0]) is not None - assert len(database.enroll_files(model_ids[0], group)) > 0 - assert len(database.probe_files(model_ids[0], group)) > 0 + if protocol: database.protocol = protocol + assert len(database.all_files()) > 0 + assert len(database.training_files('train_extractor')) > 0 + assert len(database.arrange_by_client(database.training_files('train_enroller'))) > 0 - assert database.training_depends_on_protocol == training_depends - assert database.models_depend_on_protocol == models_depend + for group in groups: + model_ids = database.model_ids(group) + assert len(model_ids) > 0 + assert database.client_id_from_model_id(model_ids[0]) is not None + assert len(database.enroll_files(model_ids[0], group)) > 0 + assert len(database.probe_files(model_ids[0], group)) > 0 + assert database.training_depends_on_protocol == training_depends + assert database.models_depend_on_protocol == models_depend -def _check_database_zt(database, groups = ('dev', 'eval'), protocol = None, training_depends = False, models_depend = False): - _check_database(database, groups, protocol, training_depends, models_depend) - assert isinstance(database, bob.bio.base.database.DatabaseBobZT) - for group in groups: - t_model_ids = database.t_model_ids(group) - assert len(t_model_ids) > 0 - assert database.client_id_from_model_id(t_model_ids[0]) is not None - assert len(database.t_enroll_files(t_model_ids[0], group)) > 0 - assert len(database.z_probe_files(group)) > 0 + +def _check_database_zt(database, groups=('dev', 'eval'), protocol=None, training_depends=False, models_depend=False): + _check_database(database, groups, protocol, training_depends, models_depend) + assert isinstance(database, bob.bio.db.ZTBioDatabase) + for group in groups: + t_model_ids = database.t_model_ids(group) + assert len(t_model_ids) > 0 + assert database.client_id_from_model_id(t_model_ids[0]) is not None + assert len(database.t_enroll_files(t_model_ids[0], group)) > 0 + assert len(database.z_probe_files(group)) > 0 def _check_annotations(database): - for file in database.all_files(): - annotations = database.annotations(file) - if annotations is not None: - assert isinstance(annotations, dict) - assert 'reye' in annotations - assert 'leye' in annotations + for file in database.all_files(): + annotations = database.annotations(file) + if annotations is not None: + assert isinstance(annotations, dict) + assert 'reye' in annotations + assert 'leye' in annotations @db_available('arface') def test_arface(): - database = bob.bio.base.load_resource('arface', 'database', preferred_package='bob.bio.face') - try: - _check_database(database, groups=('dev', 'eval')) - _check_annotations(database) - except IOError as e: - raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + database = bob.bio.base.load_resource('arface', 'database', preferred_package='bob.bio.face') + try: + _check_database(database, groups=('dev', 'eval')) + _check_annotations(database) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) def test_atnt(): - _check_database(bob.bio.base.load_resource('atnt', 'database', preferred_package='bob.bio.face')) + _check_database(bob.bio.base.load_resource('atnt', 'database', preferred_package='bob.bio.face')) @db_available('banca') def test_banca(): - database = bob.bio.base.load_resource('banca', 'database', preferred_package='bob.bio.face') - try: - _check_database_zt(database) - _check_annotations(database) - 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) + database = bob.bio.base.load_resource('banca', 'database', preferred_package='bob.bio.face') + try: + _check_database_zt(database) + _check_annotations(database) + 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) @db_available('caspeal') def test_caspeal(): - database = bob.bio.base.load_resource('caspeal', 'database', preferred_package='bob.bio.face') - try: - _check_database(database) - _check_database(database, protocol = 'aging') - _check_annotations(database) - except IOError as e: - raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + database = bob.bio.base.load_resource('caspeal', 'database', preferred_package='bob.bio.face') + try: + _check_database(database) + _check_database(database, protocol='aging') + _check_annotations(database) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) @db_available('frgc') def test_frgc(): - import xml.sax - database = bob.bio.base.load_resource('frgc', 'database', preferred_package='bob.bio.face') - try: - _check_database(database, models_depend = True) - _check_database(database, protocol = '2.0.2', models_depend = True) - _check_annotations(database) - except xml.sax.SAXException as e: - raise SkipTest("The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e) + import xml.sax + database = bob.bio.base.load_resource('frgc', 'database', preferred_package='bob.bio.face') + try: + _check_database(database, models_depend=True) + _check_database(database, protocol='2.0.2', models_depend=True) + _check_annotations(database) + except xml.sax.SAXException as e: + raise SkipTest( + "The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e) @db_available('gbu') def test_gbu(): - database = bob.bio.base.load_resource('gbu', 'database', preferred_package='bob.bio.face') - try: - _check_database(database, models_depend=True) - _check_database(database, protocol = 'Bad', models_depend=True) - _check_database(database, protocol = 'Ugly', models_depend=True) - _check_annotations(database) - except IOError as e: - raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + database = bob.bio.base.load_resource('gbu', 'database', preferred_package='bob.bio.face') + try: + _check_database(database, models_depend=True) + _check_database(database, protocol='Bad', models_depend=True) + _check_database(database, protocol = 'Ugly', models_depend=True) + _check_annotations(database) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) @db_available('lfw') def test_lfw(): - database = bob.bio.base.load_resource('lfw-restricted', 'database', preferred_package='bob.bio.face') - try: - _check_database(database, training_depends = True, models_depend = True) - _check_database(database, groups = ('dev', 'eval'), protocol = 'fold1', training_depends = True, models_depend = True) - _check_database(bob.bio.base.load_resource('lfw-unrestricted', 'database', preferred_package='bob.bio.face'), training_depends = True, models_depend = True) - _check_annotations(database) - except IOError as e: - raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + database = bob.bio.base.load_resource('lfw-restricted', 'database', preferred_package='bob.bio.face') + try: + _check_database(database, training_depends=True, models_depend=True) + _check_database(database, groups=('dev', 'eval'), protocol='fold1', training_depends=True, models_depend=True) + _check_database(bob.bio.base.load_resource('lfw-unrestricted', 'database', preferred_package='bob.bio.face'), + training_depends=True, models_depend=True) + _check_annotations(database) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) @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) - - try: - _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) + 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) + + try: + _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) @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) - - try: - _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) + 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) + + try: + _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) @db_available('scface') def test_scface(): - database = bob.bio.base.load_resource('scface', 'database', preferred_package='bob.bio.face') - try: - _check_database_zt(database) - _check_annotations(database) - 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) + database = bob.bio.base.load_resource('scface', 'database', preferred_package='bob.bio.face') + try: + _check_database_zt(database) + _check_annotations(database) + 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) @db_available('xm2vts') def test_xm2vts(): - database = bob.bio.base.load_resource('xm2vts', 'database', preferred_package='bob.bio.face') - try: - _check_database(database, groups=('dev', 'eval')) - _check_database(database, groups=('dev', 'eval'), protocol = 'darkened-lp1') - _check_annotations(database) - 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) + database = bob.bio.base.load_resource('xm2vts', 'database', preferred_package='bob.bio.face') + try: + _check_database(database, groups=('dev', 'eval')) + _check_database(database, groups=('dev', 'eval'), protocol='darkened-lp1') + _check_annotations(database) + 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)