[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
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'
)
#!/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,
)
#!/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'
)
#!/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'
)
#!/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'}
)
#!/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'
)
#!/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'
)
#!/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'}
)
#!/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,
)
#!/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'}
)
#!/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
)
#!/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}
)
#!/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'
)
#!/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'
)
......@@ -24,8 +24,9 @@ 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)
def _check_database(database, groups=('dev',), protocol=None, training_depends=False, models_depend=False):
assert isinstance(database, bob.bio.db.BioDatabase)
# load the directories
if 'HOME' in os.environ:
......@@ -47,9 +48,9 @@ def _check_database(database, groups = ('dev',), protocol = None, training_depen
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)
assert isinstance(database, bob.bio.base.database.DatabaseBobZT)
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
......@@ -74,7 +75,8 @@ def test_arface():
_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)
raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
def test_atnt():
......@@ -88,7 +90,8 @@ def test_banca():
_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)
raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('caspeal')
......@@ -96,10 +99,11 @@ 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_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)
raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('frgc')
......@@ -107,11 +111,12 @@ 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_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)
raise SkipTest(
"The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e)
@db_available('gbu')
......@@ -119,23 +124,26 @@ 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='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)
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_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)
raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('mobio')
......@@ -143,33 +151,41 @@ 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)
_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)
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)
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)
_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)
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)
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)
raise SkipTest(
"The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'" % e)
@db_available('scface')
......@@ -179,7 +195,8 @@ def test_scface():
_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)
raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('xm2vts')
......@@ -187,7 +204,8 @@ 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_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)
raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
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