[refactoring2016] Moved database implementation from bob.bio.db to bob.bio.vein

Testing CI

[refactoring2016] Moved database implementation from bob.bio.db to bob.bio.vein
parent 331bd283
Pipeline #3659 passed with stages
in 158 minutes and 38 seconds
......@@ -33,10 +33,13 @@ variables:
variables: &build_variables
BOB_DOCUMENTATION_SERVER: "http://www.idiap.ch/software/bob/docs/latest/bob/%s/master/"
script:
- ./bin/buildout
- ./bin/buildout -c develop.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}
- cd ./src/bob.bio.base
- ../../bin/python setup.py bdist_wheel --dist-dir ../../dist --python-tag ${WHEEL_TAG}
- cd ../../
after_script:
- rm -rf ${CONDA_PREFIX}
artifacts:
......@@ -76,7 +79,7 @@ variables:
before_script:
- ./bootstrap-conda.sh ${CONDA_FOLDER} ${PYTHON_VER} ${CONDA_PREFIX}
- source ${CONDA_FOLDER}/bin/activate ${CONDA_PREFIX}
- pip install --use-wheel --no-index --pre dist/*.whl
- pip install --use-wheel --upgrade --no-index --pre dist/*.whl
script:
- cd ${CONDA_PREFIX}
- python -c "from ${CI_PROJECT_NAME} import get_config; print(get_config())"
......
#!/usr/bin/env python
from bob.bio.vein.database import BiowaveTestBioDatabase
biowave_test_image_directory = "[YOUR_BIOWAVE_TEST_IMAGE_DIRECTORY]"
database = BiowaveTestBioDatabase(
original_directory=biowave_test_image_directory,
original_extension='.png',
protocol='all'
)
#!/usr/bin/env python
from bob.bio.vein.database import UtfvpBioDatabase
utfvp_directory = "[YOUR_UTFVP_DIRECTORY]"
database = UtfvpBioDatabase(
original_directory = utfvp_directory,
extension = ".png",
)
#!/usr/bin/env python
from bob.bio.vein.database import VerafingerBioDatabase
vera_finger_directory = "[YOUR_VERAFINGER_DIRECTORY]"
database = VerafingerBioDatabase(
original_directory = vera_finger_directory,
original_extension = '.png',
)
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from .biowave_test import BiowaveTestBioDatabase
from .verafinger import VerafingerBioDatabase
from .utfvp import UtfvpBioDatabase
# 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 :
# Teodors Eglitis <teodors.eglitis@idiap.ch>
# Wed 20 Jul
"""
BIOWAVE_TEST database implementation of bob.bio.db.BioDatabase interface.
It is an extension of an SQL-based database interface, which directly talks to BIOWAVE_TEST database for
verification experiments (good to use in bob.bio.base framework).
"""
from .database import VeinBioFile
from bob.bio.base.database import BioDatabase, BioFile
class BiowaveTestBioDatabase(BioDatabase):
"""
Implements verification API for querying BIOWAVE_TEST database.
"""
def __init__(
self,
**kwargs
):
# before it was also "name" in the init.
#
# the BioDatabase class is defined in:
# bob.bio.db/bob/bio/db/database.py
#
# In this -- the high level implementation we call base class constructors to
# open a session to the database. We use **kwargs so that we could pass
# the arguments later, e.g. from the default database configuration.
super(BiowaveTestBioDatabase, self).__init__(name='biowave_test', **kwargs)
from bob.db.biowave_test.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
def client_id_from_model_id(self, model_id, group='dev'):
"""Required as ``model_id != client_id`` on this database"""
return self.__db.client_id_from_model_id(model_id)
def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
return self.__db.model_ids(protocol=protocol, groups=groups)
def objects(self, protocol=None, groups=None, purposes=None, model_ids=None, **kwargs):
retval = self.__db.objects(protocol=protocol, groups=groups, purposes=purposes, model_ids=model_ids)
return [VeinBioFile(f) for f in retval]
# the methodes are derived from:
# bob.bio.db/bob/bio/db/database.py
# this means that methodes defined there need to have certain arguments, e.g.:
# model_ids_with_protocol:
# groups;
# protocol;
# objects:
# groups;
# protocol;
# purposes;
# model_ids;
# If you have some other arguments to pass, use **kwargs, if your methods doesn't have some
# arguments, just don't pass them (e.g. see the model_ids).
#!/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 VeinBioFile(BioFile):
def __init__(self, f):
"""
Initializes this File object with an File equivalent for
VoxForge database.
"""
super(VeinBioFile, 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 :
from .database import VeinBioFile
from bob.bio.base.database import BioDatabase, BioFile
class UtfvpBioDatabase(BioDatabase):
"""
Implements verification API for querying UTFVP Fingervein database.
"""
def __init__(self, **kwargs):
super(UtfvpBioDatabase, self).__init__(name='utfvp',
**kwargs)
from bob.db.utfvp.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
protocol = protocol if protocol is not None else self.protocol
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 [VeinBioFile(f) for f in retval]
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from .database import VeinBioFile
from bob.bio.base.database import BioDatabase, BioFile
class VerafingerBioDatabase(BioDatabase):
"""
Implements verification API for querying Vera Fingervein database.
"""
def __init__(self, **kwargs):
super(VerafingerBioDatabase, self).__init__(name='verafinger',
**kwargs)
from bob.db.verafinger.query import Database as LowLevelDatabase
self.__db = LowLevelDatabase()
self.low_level_group_names = ('train', 'dev')
self.high_level_group_names = ('world', 'dev')
def groups(self):
return self.convert_names_to_highlevel(self.__db.groups(),
self.low_level_group_names, self.high_level_group_names)
def client_id_from_model_id(self, model_id, group='dev'):
"""Required as ``model_id != client_id`` on this database"""
return self.__db.finger_name_from_model_id(model_id)
def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
groups = self.convert_names_to_lowlevel(groups,
self.low_level_group_names, self.high_level_group_names)
return self.__db.model_ids(groups=groups, protocol=protocol)
def objects(self, groups=None, protocol=None, purposes=None,
model_ids=None, **kwargs):
groups = self.convert_names_to_lowlevel(groups,
self.low_level_group_names, self.high_level_group_names)
retval = self.__db.objects(groups=groups, protocol=protocol,
purposes=purposes, model_ids=model_ids, **kwargs)
return [VeinBioFile(f) for f in retval]
; vim: set fileencoding=utf-8 :
; Fri 19 Aug 2016 13:14:15 CEST
; Manuel Guenther <manuel.guenther@idiap.ch>
; Thu Oct 9 16:51:06 CEST 2014
[buildout]
parts = scripts
......@@ -12,7 +13,6 @@ eggs = bob.bio.vein
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = src/bob.extension
src/bob.blitz
......@@ -28,10 +28,10 @@ develop = src/bob.extension
src/bob.db.verafinger
src/bob.db.utfvp
src/bob.db.putvein
src/bob.db.biowave_test
src/bob.learn.activation
src/bob.learn.linear
src/bob.learn.em
src/bob.bio.db
src/bob.bio.base
.
......@@ -55,11 +55,13 @@ bob.db.base = git git@gitlab.idiap.ch:bob/bob.db.base
bob.db.verafinger = git git@gitlab.idiap.ch:bob/bob.db.verafinger
bob.db.utfvp = git git@gitlab.idiap.ch:bob/bob.db.utfvp
bob.db.putvein = git git@gitlab.idiap.ch:bob/bob.db.putvein
bob.db.biowave_test = git git@gitlab.idiap.ch:bob/bob.db.biowave_test
bob.learn.activation = git git@gitlab.idiap.ch:bob/bob.learn.activation
bob.learn.linear = git git@gitlab.idiap.ch:bob/bob.learn.linear
bob.learn.em = git git@gitlab.idiap.ch:bob/bob.learn.em
bob.bio.db = git git@gitlab.idiap.ch:bob/bob.bio.db
bob.bio.base = git git@gitlab.idiap.ch:bob/bob.bio.base
bob.bio.base = git git@gitlab.idiap.ch:bob/bob.bio.base branch=issue-8-remove-database-configuration
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
......@@ -32,8 +32,8 @@ setup(
entry_points={
'bob.bio.database': [
'verafinger = bob.bio.db.default_configs.verafinger:database',
'utfvp = bob.bio.db.default_configs.utfvp:database',
'verafinger = bob.bio.base.configurations.database.verafinger:database',
'utfvp = bob.bio.base.configurations.database.utfvp:database',
],
'bob.bio.preprocessor': [
......
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