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

[refactoring_2016] Redefinition of the low level interface

parent 170bb2d0
Pipeline #3191 passed with stages
in 12 minutes and 48 seconds
......@@ -26,10 +26,11 @@ from bob.db.base.sqlalchemy_migration import Enum, relationship
from sqlalchemy.orm import backref
from sqlalchemy.ext.declarative import declarative_base
import bob.db.verification.utils
Base = declarative_base()
import bob.db.base
subworld_client_association = Table('subworld_client_association', Base.metadata,
Column('subworld_id', Integer, ForeignKey('subworld.id')),
Column('client_id', Integer, ForeignKey('client.id')))
......@@ -84,7 +85,7 @@ class Subworld(Base):
def __repr__(self):
return "Subworld('%s')" % (self.name)
class File(Base, bob.db.verification.utils.File):
class File(Base, bob.db.base.File):
"""Generic file container"""
__tablename__ = 'file'
......@@ -108,7 +109,7 @@ class File(Base, bob.db.verification.utils.File):
def __init__(self, client_id, path, claimed_id, shot_id, session_id):
# call base class constructor
bob.db.verification.utils.File.__init__(self, client_id = client_id, path = path)
bob.db.base.File.__init__(self, client_id = client_id, path = path)
self.claimed_id = claimed_id
self.shot_id = shot_id
......
......@@ -25,12 +25,11 @@ import six
from bob.db.base import utils
from .models import *
from .driver import Interface
import bob.db.verification.utils
import bob.db.base
SQLITE_FILE = Interface().files()[0]
class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.utils.ZTDatabase):
class Database(bob.db.base.SQLiteDatabase):
"""The dataset class opens and maintains a connection opened to the Database.
It provides many different ways to probe for the characteristics of the data
......@@ -39,8 +38,12 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti
def __init__(self, original_directory = None, original_extension = None):
# call base class constructors
bob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File)
bob.db.verification.utils.ZTDatabase.__init__(self, original_directory=original_directory, original_extension=original_extension)
# copy original file name and extension
super(Database, self).__init__(SQLITE_FILE, File)
self.original_directory = original_directory
self.original_extension = original_extension
def __group_replace_alias__(self, l):
"""Replace 'dev' by 'g1' and 'eval' by 'g2' in a list of groups, and
......@@ -518,3 +521,18 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti
return ProtocolPurpose.purpose_choices
def t_model_ids(self, protocol, groups = 'dev', **kwargs):
"""Returns the list of model ids used for T-Norm of the given protocol for the given group that satisfy your query.
For possible keyword arguments, please check the :py:meth:`tmodel_ids` function."""
return self.uniquify(self.tmodel_ids(protocol=protocol, groups=groups, **kwargs))
def t_enroll_files(self, protocol, model_id, groups = 'dev', **kwargs):
"""Returns the list of T-Norm model enrollment File objects from the given model id of the given protocol for the given group that satisfy your query.
For possible keyword arguments, please check the :py:meth:`tobjects` function."""
return self.uniquify(self.tobjects(protocol=protocol, groups=groups, model_ids=(model_id,), **kwargs))
def z_probe_files(self, protocol, groups = 'dev', **kwargs):
"""Returns the list of Z-Norm probe File objects to probe the model with the given model id of the given protocol for the given group that satisfy your query.
For possible keyword arguments, please check the :py:meth:`zobjects` function."""
return self.uniquify(self.zobjects(protocol=protocol, groups=groups, **kwargs))
......@@ -13,7 +13,6 @@ develop = src/bob.extension
src/bob.core
src/bob.io.base
src/bob.db.base
src/bob.db.verification.utils
.
; options for bob.buildout extension
......@@ -27,7 +26,6 @@ bob.blitz = git https://gitlab.idiap.ch/bob/bob.blitz
bob.core = git https://gitlab.idiap.ch/bob/bob.core
bob.io.base = git https://gitlab.idiap.ch/bob/bob.io.base
bob.db.base = git https://gitlab.idiap.ch/bob/bob.db.base
bob.db.verification.utils = git https://gitlab.idiap.ch/bob/bob.db.verification.utils
[scripts]
recipe = bob.buildout:scripts
......
......@@ -21,7 +21,7 @@ These protocols are defined in detail in [Bail2003]_.
The Database Interface
----------------------
The :py:class:`bob.db.banca.Database` complies with the standard biometric verification database as described in :ref:`commons`, implementing both interfaces :py:class:`bob.db.verification.utils.ZTDatabase` and :py:class:`bob.db.verification.utils.SQLiteDatabase`.
The :py:class:`bob.db.banca.Database` complies with the standard biometric verification database as described in :ref:`commons`.
.. todo::
Explain the particularities of the :py:class:`bob.db.banca.Database` database.
......
......@@ -46,13 +46,7 @@ setup(
install_requires = install_requires,
entry_points = {
# bob database declaration
'bob.db': [
'banca = bob.db.banca.driver:Interface',
],
},
classifiers = [
......@@ -62,7 +56,7 @@ setup(
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
......
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