Commit ae7fb2df authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

[refactoring_2016] Migrating the database entry points to point to the High Level Interfaces

parent 51718618
Pipeline #3286 failed with stage
in 5 minutes and 43 seconds
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.arface from bob.bio.db import ARFaceBioDatabase
import bob.bio.base
arface_directory = "[YOUR_ARFACE_DIRECTORY]" arface_directory = "[YOUR_ARFACE_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob( database = ARFaceBioDatabase(
database = bob.db.arface.Database( original_directory=arface_directory,
original_directory = arface_directory original_extension=".png",
), protocol='all'
name = 'arface',
protocol = 'all'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.atnt from bob.bio.db import AtntBioDatabase
import bob.bio.base
atnt_directory = "[YOUR_ATNT_DIRECTORY]" atnt_directory = "[YOUR_CAS-PEAL_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob( database = AtntBioDatabase(
database = bob.db.atnt.Database( original_directory=atnt_directory,
original_directory = atnt_directory
),
name = 'atnt'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.banca from bob.bio.db import BancaBioDatabase
import bob.bio.base
banca_directory = "[YOUR_BANCA_DIRECTORY]" banca_directory = "[YOUR_BANCA_DIRECTORY]"
database = bob.bio.base.database.DatabaseBobZT( database = BancaBioDatabase(
database = bob.db.banca.Database( original_directory=banca_directory,
original_directory = banca_directory, original_extension=".ppm",
original_extension = '.ppm' protocol='P'
),
name = "banca",
protocol = 'P'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.caspeal from bob.bio.db import CaspealBioDatabase
import bob.bio.base
caspeal_directory = "[YOUR_CAS-PEAL_DIRECTORY]" caspeal_directory = "[YOUR_CAS-PEAL_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob( database = CaspealBioDatabase(
database = bob.db.caspeal.Database( original_directory=caspeal_directory,
original_directory = caspeal_directory protocol='lighting'
),
name = "caspeal",
protocol = 'lighting'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.gbu from bob.bio.db import GBUBioDatabase
import bob.bio.base
mbgc_v1_directory = "[YOUR_MBGC-V1_DIRECTORY]" mbgc_v1_directory = "[YOUR_MBGC-V1_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob( database = GBUBioDatabase(
database = bob.db.gbu.Database( original_directory=mbgc_v1_directory,
original_directory = mbgc_v1_directory protocol='Good',
), models_depend_on_protocol=True,
name = "gbu",
protocol = 'Good',
models_depend_on_protocol = True,
all_files_options = { 'subworld': 'x2' }, all_files_options={'subworld': 'x2'},
extractor_training_options = { 'subworld': 'x2' }, extractor_training_options={'subworld': 'x2'},
projector_training_options = { 'subworld': 'x2' }, projector_training_options={'subworld': 'x2'},
enroller_training_options = { 'subworld': 'x2' } enroller_training_options={'subworld': 'x2'}
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.lfw from bob.bio.db import LFWBioDatabase
import bob.bio.base
lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]" lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob( database = LFWBioDatabase(
database = bob.db.lfw.Database( original_directory=lfw_directory,
original_directory = lfw_directory, annotation_type='funneled',
annotation_type = 'funneled'
),
name = 'lfw',
protocol = 'view1',
training_depends_on_protocol = True,
models_depend_on_protocol = True,
all_files_options = { 'world_type' : 'restricted' }, protocol='view1',
extractor_training_options = { 'world_type' : 'restricted' }, # 'subworld' : 'twofolds' training_depends_on_protocol=True,
projector_training_options = { 'world_type' : 'restricted' }, # 'subworld' : 'twofolds' models_depend_on_protocol=True,
enroller_training_options = { 'world_type' : 'restricted' } # 'subworld' : 'twofolds'
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'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.lfw from bob.bio.db import LFWBioDatabase
import bob.bio.base
lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]" lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob( database = LFWBioDatabase(
database = bob.db.lfw.Database( original_directory=lfw_directory,
original_directory = lfw_directory, annotation_type='funneled',
annotation_type = 'funneled'
), protocol='view1',
name = 'lfw', training_depends_on_protocol=True,
protocol = 'view1', models_depend_on_protocol=True,
training_depends_on_protocol = True,
models_depend_on_protocol = True,
all_files_options = { 'world_type' : 'unrestricted' }, all_files_options = { 'world_type' : 'unrestricted' },
extractor_training_options = { 'world_type' : 'unrestricted' }, # 'subworld' : 'twofolds' extractor_training_options = { 'world_type' : 'unrestricted' }, # 'subworld' : 'twofolds'
projector_training_options = { 'world_type' : 'unrestricted' }, # 'subworld' : 'twofolds' projector_training_options = { 'world_type' : 'unrestricted' }, # 'subworld' : 'twofolds'
enroller_training_options = { 'world_type' : 'unrestricted' } # 'subworld' : 'twofolds' enroller_training_options = { 'world_type' : 'unrestricted' } # 'subworld' : 'twofolds'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.mobio from bob.bio.db import MobioBioDatabase
import bob.bio.base
mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]" mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]"
mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]" mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]"
database = bob.bio.base.database.DatabaseBobZT( database = MobioBioDatabase(
database = bob.db.mobio.Database( original_directory=mobio_image_directory,
original_directory = mobio_image_directory, original_extension=".png",
original_extension = ".png", annotation_directory=mobio_annotation_directory,
annotation_directory = mobio_annotation_directory,
),
name = "mobio-female",
protocol = 'female', protocol = 'female',
models_depend_on_protocol = True, models_depend_on_protocol=True,
all_files_options = { 'gender' : 'female' }, all_files_options={'gender': 'female'},
extractor_training_options = { 'gender' : 'female' }, extractor_training_options={'gender': 'female'},
projector_training_options = { 'gender' : 'female' }, projector_training_options={'gender': 'female'},
enroller_training_options = { 'gender' : 'female' }, enroller_training_options={'gender': 'female'},
z_probe_options = { 'gender' : 'female' } z_probe_options={'gender': 'female'}
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.mobio from bob.bio.db import MobioBioDatabase
import bob.bio.base
mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]" mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]"
mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]" mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]"
database = bob.bio.base.database.DatabaseBobZT( database = MobioBioDatabase(
database = bob.db.mobio.Database( original_directory=mobio_image_directory,
original_directory = mobio_image_directory, original_extension=".png",
original_extension = '.png', annotation_directory=mobio_annotation_directory,
annotation_directory = mobio_annotation_directory,
), protocol='male',
name = "mobio", models_depend_on_protocol = True,
protocol = 'male',
models_depend_on_protocol = True
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.mobio from bob.bio.db import MobioBioDatabase
import bob.bio.base
mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]" mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]"
mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]" mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]"
database = bob.bio.base.database.DatabaseBobZT( database = MobioBioDatabase(
database = bob.db.mobio.Database( original_directory=mobio_image_directory,
original_directory = mobio_image_directory, original_extension=".png",
original_extension = ".png", annotation_directory=mobio_annotation_directory,
annotation_directory = mobio_annotation_directory,
), protocol='male',
name = "mobio-male",
protocol = 'male',
models_depend_on_protocol = True, models_depend_on_protocol = True,
all_files_options = { 'gender' : 'male' }, all_files_options={'gender': 'male'},
extractor_training_options = { 'gender' : 'male' }, extractor_training_options={'gender': 'male'},
projector_training_options = { 'gender' : 'male' }, projector_training_options={'gender': 'male'},
enroller_training_options = { 'gender' : 'male' }, enroller_training_options={'gender': 'male'},
z_probe_options = { 'gender' : 'male' } z_probe_options={'gender': 'male'}
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.multipie from bob.bio.db import MultipieBioDatabase
import bob.bio.base
multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]" multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]"
multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]" multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]"
database = bob.bio.base.database.DatabaseBobZT( database = MultipieBioDatabase(
database = bob.db.multipie.Database( original_directory=multipie_image_directory,
original_directory = multipie_image_directory, annotation_directory=multipie_annotation_directory,
annotation_directory = multipie_annotation_directory protocol='U',
),
name = "multipie",
protocol = 'U',
training_depends_on_protocol = True training_depends_on_protocol = True
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.multipie
import bob.bio.base
multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]" from bob.bio.db import MultipieBioDatabase
multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]"
# here, we only want to have the cameras that are used in the P protocol # 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') 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( multipie_image_directory = "[YOUR_MULTI-PIE_IMAGE_DIRECTORY]"
database = bob.db.multipie.Database( multipie_annotation_directory = "[YOUR_MULTI-PIE_ANNOTATION_DIRECTORY]"
original_directory = multipie_image_directory,
annotation_directory = multipie_annotation_directory database = MultipieBioDatabase(
), original_directory=multipie_image_directory,
name = "multipie-pose", annotation_directory=multipie_annotation_directory,
protocol = 'P', protocol = 'P',
training_depends_on_protocol = True, training_depends_on_protocol = True,
all_files_options = {'cameras' : cameras}, all_files_options={'cameras': cameras},
extractor_training_options = {'cameras' : cameras}, extractor_training_options={'cameras': cameras},
projector_training_options = {'cameras' : cameras, 'world_sampling': 3, 'world_first': True}, projector_training_options={'cameras': cameras, 'world_sampling': 3, 'world_first': True},
enroller_training_options = {'cameras' : cameras} enroller_training_options={'cameras': cameras}
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.scface from bob.bio.db import SCFaceBioDatabase
import bob.bio.base
scface_directory = "[YOUR_SC_FACE_DIRECTORY]" scface_directory = "[YOUR_SC_FACE_DIRECTORY]"
# setup for SCface database database = SCFaceBioDatabase(
database = bob.bio.base.database.DatabaseBobZT( original_directory=scface_directory,
database = bob.db.scface.Database( protocol='combined'
original_directory = scface_directory
),
name = 'scface',
protocol = 'combined'
) )
#!/usr/bin/env python #!/usr/bin/env python
import bob.db.xm2vts from bob.bio.db import XM2VTSBioDatabase
import bob.bio.base
xm2vts_directory = "[YOUR_XM2VTS_DIRECTORY]" xm2vts_directory = "[YOUR_XM2VTS_DIRECTORY]"
# setup for XM2VTS database = XM2VTSBioDatabase(
database = bob.bio.base.database.DatabaseBob( original_directory=xm2vts_directory,
database = bob.db.xm2vts.Database( protocol='lp1'
original_directory = xm2vts_directory
),
name = "xm2vts",
protocol = 'lp1'
) )
...@@ -24,8 +24,9 @@ from nose.plugins.skip import SkipTest ...@@ -24,8 +24,9 @@ from nose.plugins.skip import SkipTest
import bob.bio.base import bob.bio.base
from bob.bio.base.test.utils import db_available 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) def _check_database(database, groups=('dev',), protocol=None, training_depends=False, models_depend=False):
assert isinstance(database, bob.bio.db.BioDatabase)
# load the directories # load the directories
if 'HOME' in os.environ: if 'HOME' in os.environ:
...@@ -47,9 +48,9 @@ def _check_database(database, groups = ('dev',), protocol = None, training_depen ...@@ -47,9 +48,9 @@ def _check_database(database, groups = ('dev',), protocol = None, training_depen
assert database.models_depend_on_protocol == models_depend assert database.models_depend_on_protocol == models_depend
def _check_database_zt(database, groups = ('dev', 'eval'), protocol = None, training_depends = False, models_depend = False): 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) _check_database(database, groups, protocol, training_depends, models_depend)
assert isinstance(database, bob.bio.base.database.DatabaseBobZT) assert isinstance(database, bob.bio.db.ZTBioDatabase)
for group in groups: for group in groups:
t_model_ids = database.t_model_ids(group) t_model_ids = database.t_model_ids(group)
assert len(t_model_ids) > 0 assert len(t_model_ids) > 0
...@@ -74,7 +75,8 @@ def test_arface(): ...@@ -74,7 +75,8 @@ def test_arface():
_check_database(database, groups=('dev', 'eval')) _check_database(database, groups=('dev', 'eval'))
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
def test_atnt(): def test_atnt():
...@@ -88,7 +90,8 @@ def test_banca(): ...@@ -88,7 +90,8 @@ def test_banca():
_check_database_zt(database) _check_database_zt(database)
_check_annotations(database) _check_annotations(database)
except IOError as e: 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) raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('caspeal') @db_available('caspeal')
...@@ -96,10 +99,11 @@ def test_caspeal(): ...@@ -96,10 +99,11 @@ def test_caspeal():
database = bob.bio.base.load_resource('caspeal', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('caspeal', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database) _check_database(database)
_check_database(database, protocol = 'aging') _check_database(database, protocol='aging')
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('frgc') @db_available('frgc')
...@@ -107,11 +111,12 @@ def test_frgc(): ...@@ -107,11 +111,12 @@ def test_frgc():
import xml.sax import xml.sax
database = bob.bio.base.load_resource('frgc', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('frgc', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, models_depend = True) _check_database(database, models_depend=True)
_check_database(database, protocol = '2.0.2', models_depend = True) _check_database(database, protocol='2.0.2', models_depend=True)
_check_annotations(database) _check_annotations(database)
except xml.sax.SAXException as e: 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) raise SkipTest(
"The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e)
@db_available('gbu') @db_available('gbu')
...@@ -119,23 +124,26 @@ def test_gbu(): ...@@ -119,23 +124,26 @@ def test_gbu():
database = bob.bio.base.load_resource('gbu', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('gbu', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, models_depend=True) _check_database(database, models_depend=True)
_check_database(database, protocol = 'Bad', models_depend=True) _check_database(database, protocol='Bad', models_depend=True)
_check_database(database, protocol = 'Ugly', models_depend=True) _check_database(database, protocol = 'Ugly', models_depend=True)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('lfw') @db_available('lfw')
def test_lfw(): def test_lfw():
database = bob.bio.base.load_resource('lfw-restricted', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('lfw-restricted', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, training_depends = True, models_depend = True) _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(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_database(bob.bio.base.load_resource('lfw-unrestricted', 'database', preferred_package='bob.bio.face'),
training_depends=True, models_depend=True)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest("The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)