[refactoring2016] Moved highlevel interface to bob.bio.face

parent c988740d
Pipeline #3651 failed with stages
in 72 minutes and 32 seconds
......@@ -33,7 +33,7 @@ variables:
variables: &build_variables
BOB_DOCUMENTATION_SERVER: "http://www.idiap.ch/software/bob/docs/latest/bob/%s/master/"
script:
- ./bin/buildout
- ./bin/buildout -c buildout-dev.cfg
- if [ -x ./bin/bob_dbmanage.py ]; then ./bin/bob_dbmanage.py all download --force; fi
- ./bin/sphinx-build doc sphinx
- ./bin/python setup.py bdist_wheel --python-tag ${WHEEL_TAG}
......
#!/usr/bin/env python
from bob.bio.face.database import ARFaceBioDatabase
arface_directory = "[YOUR_ARFACE_DIRECTORY]"
database = ARFaceBioDatabase(
original_directory=arface_directory,
original_extension=".png",
protocol='all'
)
#!/usr/bin/env python
from bob.bio.face.database import AtntBioDatabase
atnt_directory = "[YOUR_ATNT_DIRECTORY]"
database = AtntBioDatabase(
original_directory=atnt_directory,
)
#!/usr/bin/env python
from bob.bio.face.database import BancaBioDatabase
banca_directory = "[YOUR_BANCA_DIRECTORY]"
database = BancaBioDatabase(
original_directory=banca_directory,
original_extension=".ppm",
protocol='P'
)
#!/usr/bin/env python
from bob.bio.face.database import CaspealBioDatabase
caspeal_directory = "[YOUR_CAS-PEAL_DIRECTORY]"
database = CaspealBioDatabase(
original_directory=caspeal_directory,
protocol='lighting'
)
#!/usr/bin/env python
from bob.bio.face.database import FRGCBioDatabase
frgc_directory = "[YOUR_FRGC_DIRECTORY]"
database = FRGCBioDatabase(
original_directory=frgc_directory,
protocol='2.0.1',
models_depend_on_protocol=True
)
#!/usr/bin/env python
from bob.bio.face.database import GBUBioDatabase
mbgc_v1_directory = "[YOUR_MBGC-V1_DIRECTORY]"
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'}
)
#!/usr/bin/env python
from bob.bio.face.database import LFWBioDatabase
lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]"
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': '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
from bob.bio.face.database import LFWBioDatabase
lfw_directory = "[YOUR_LFW_FUNNELED_DIRECTORY]"
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
from bob.bio.face.database import MobioBioDatabase
mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]"
mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]"
database = MobioBioDatabase(
original_directory=mobio_image_directory,
original_extension=".png",
annotation_directory=mobio_annotation_directory,
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'}
)
#!/usr/bin/env python
from bob.bio.face.database import MobioBioDatabase
mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]"
mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]"
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
from bob.bio.face.database import MobioBioDatabase
mobio_image_directory = "[YOUR_MOBIO_IMAGE_DIRECTORY]"
mobio_annotation_directory = "[YOUR_MOBIO_ANNOTATION_DIRECTORY]"
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'}
)
#!/usr/bin/env python
from bob.bio.face.database import MultipieBioDatabase
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='U',
training_depends_on_protocol = True
)
#!/usr/bin/env python
from bob.bio.face.database 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')
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}
)
#!/usr/bin/env python
from bob.bio.face.database import SCFaceBioDatabase
scface_directory = "[YOUR_SC_FACE_DIRECTORY]"
database = SCFaceBioDatabase(
original_directory=scface_directory,
protocol='combined'
)
#!/usr/bin/env python
from bob.bio.face.database import XM2VTSBioDatabase
xm2vts_directory = "[YOUR_XM2VTS_DIRECTORY]"
database = XM2VTSBioDatabase(
original_directory=xm2vts_directory,
protocol='lp1'
)
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from .mobio import MobioBioDatabase
from .replay import ReplayBioDatabase
from .atnt import AtntBioDatabase
from .banca import BancaBioDatabase
from .gbu import GBUBioDatabase
from .arface import ARFaceBioDatabase
from .caspeal import CaspealBioDatabase
from .lfw import LFWBioDatabase
from .multipie import MultipieBioDatabase
from .ijba import IJBABioDatabase
from .xm2vts import XM2VTSBioDatabase
from .frgc import FRGCBioDatabase
from .cuhk_cufs import CUHK_CUFSBioDatabase
from .scface import SCFaceBioDatabase
# gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')]
#!/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
"""
ARFACE database implementation of bob.bio.base.database.ZTDatabase interface.
It is an extension of an SQL-based database interface, which directly talks to ARFACE database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class ARFaceBioDatabase(BioDatabase):
"""
Implements verification API for querying ARFACE database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(ARFaceBioDatabase, self).__init__(name='arface', **kwargs)
from bob.db.arface.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
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 [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Amir Mohammadi <amir.mohammadi@idiap.ch>
# Wed 13 Jul 16:43:22 CEST 2016
"""
Atnt database implementation of bob.bio.base.database.Database interface.
It is an extension of an SQL-based database interface, which directly talks to Atnt database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class AtntBioDatabase(BioDatabase):
"""
Implements verification API for querying Atnt database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(AtntBioDatabase, self).__init__(name='atnt', **kwargs)
from bob.db.atnt.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
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 [FaceBioFile(f) for f in retval]
#!/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
"""
BANCA database implementation of bob.bio.base.database.ZTDatabase interface.
It is an extension of an SQL-based database interface, which directly talks to Banca database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import ZTBioDatabase, BioFile
class BancaBioDatabase(ZTBioDatabase):
"""
Implements verification API for querying Banca database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(BancaBioDatabase, self).__init__(name='banca', **kwargs)
from bob.db.banca.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
return self.__db.model_ids(groups=groups, protocol=protocol)
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 [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
def tobjects(self, groups=None, protocol=None, model_ids=None, **kwargs):
retval = self.__db.tobjects(groups=groups, protocol=protocol, model_ids=model_ids, **kwargs)
return [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
def zobjects(self, groups=None, protocol=None, **kwargs):
retval = self.__db.zobjects(groups=groups, protocol=protocol, **kwargs)
return [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
#!/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
"""
CASPEAL database implementation of bob.bio.base.database.Database interface.
It is an extension of an SQL-based database interface, which directly talks to CASPEAL database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class CaspealBioDatabase(BioDatabase):
"""
Implements verification API for querying Caspeal database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(CaspealBioDatabase, self).__init__(name='caspeal', **kwargs)
from bob.db.caspeal.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
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 [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
#!/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
"""
CUHK_CUFS database implementation of bob.bio.base.database.ZTDatabase interface.
It is an extension of an SQL-based database interface, which directly talks to CUHK_CUFS database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import ZTBioDatabase, BioFile
class CUHK_CUFSBioDatabase(ZTBioDatabase):
"""
Implements verification API for querying CUHK_CUFS database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(CUHK_CUFSBioDatabase, self).__init__(name='cuhk_cufs', **kwargs)
from bob.db.cuhk_cufs.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
def model_ids_with_protocol(self, groups=None, protocol="search_split1_p2s", **kwargs):
return self.__db.model_ids(groups=groups, protocol=protocol)
def tmodel_ids_with_protocol(self, protocol="search_split1_p2s", groups=None, **kwargs):
return self.__db.tmodel_ids(protocol=protocol, groups=groups, **kwargs)
def objects(self, groups=None, protocol="search_split1_p2s", purposes=None, model_ids=None, **kwargs):
retval = self.__db.objects(groups=groups, protocol=protocol, purposes=purposes, model_ids=model_ids, **kwargs)
return [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
def tobjects(self, groups=None, protocol="search_split1_p2s", model_ids=None, **kwargs):
retval = self.__db.tobjects(groups=groups, protocol=protocol, model_ids=model_ids, **kwargs)
return [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
def zobjects(self, groups=None, protocol="search_split1_p2s", **kwargs):
retval = self.__db.zobjects(groups=groups, protocol=protocol, **kwargs)
return [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# Wed 20 July 14:43:22 CEST 2016
"""
Verification API for bob.db.voxforge
"""
from bob.bio.base.database.file import BioFile
class FaceBioFile(BioFile):
def __init__(self, f):
"""
Initializes this File object with an File equivalent for
VoxForge database.
"""
super(FaceBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id)
self.__f = f
#!/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
"""
FRGC database implementation of bob.bio.base.database.Database interface.
It is an extension of an SQL-based database interface, which directly talks to FRGC database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class FRGCBioDatabase(BioDatabase):
"""
Implements verification API for querying FRGC database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(FRGCBioDatabase, self).__init__(name='frgc', **kwargs)
from bob.db.frgc.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
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 [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
#!/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
"""
GBU database implementation of bob.bio.base.database.ZTDatabase interface.
It is an extension of an SQL-based database interface, which directly talks to GBU database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class GBUBioDatabase(BioDatabase):
"""
Implements verification API for querying gbu database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(GBUBioDatabase, self).__init__(name='GBU', **kwargs)
from bob.db.gbu.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
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 [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
#!/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
"""
IJBA database implementation of bob.bio.base.database.Database interface.
It is an extension of an SQL-based database interface, which directly talks to IJBA database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class IJBABioDatabase(BioDatabase):
"""
Implements verification API for querying IJBA database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(IJBABioDatabase, self).__init__(name='ijba', **kwargs)
from bob.db.ijba.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
def model_ids_with_protocol(self, groups=None, protocol="search_split1", **kwargs):
return self.__db.model_ids(groups=groups, protocol=protocol)
def objects(self, groups=None, protocol="search_split1", purposes=None, model_ids=None, **kwargs):
retval = self.__db.objects(groups=groups, protocol=protocol, purposes=purposes, model_ids=model_ids, **kwargs)
return [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
#!/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
"""
LFW database implementation of bob.bio.base.database.Database interface.
It is an extension of an SQL-based database interface, which directly talks to LFW database, for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFile
class LFWBioDatabase(BioDatabase):
"""
Implements verification API for querying LFW database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database
super(LFWBioDatabase, self).__init__(name='lfw', **kwargs)
from bob.db.lfw.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
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 [FaceBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in retval]
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Amir Mohammadi <amir.mohammadi@idiap.ch>
# Wed 13 Jul 16:43:22 CEST 2016
"""
MOBIO database implementation of bob.bio.base.database.ZTDatabase 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).
"""
from .database import FaceBioFile
from bob.bio.base.database import ZTBioDatabase, BioFile
class MobioBioDatabase(ZTBioDatabase):
"""
Implements verification API for querying Mobio database.
"""
def __init__(
self,
**kwargs
):
# call base class constructors to open a session to the database