Skip to content

Commit

Permalink
[refactoring_2016] Redefinition of the low level API
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofrepereira2012 committed Aug 17, 2016
1 parent 09bf498 commit 4d685c2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bob/db/xm2vts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sqlalchemy.orm import backref
from sqlalchemy.ext.declarative import declarative_base

import bob.db.verification.utils
import bob.db.base

Base = declarative_base()

Expand Down Expand Up @@ -55,7 +55,7 @@ def __init__(self, id, group):
def __repr__(self):
return "Client(%d, '%s')" % (self.id, self.sgroup)

class File(Base, bob.db.verification.utils.File):
class File(Base, bob.db.base.File):
"""Generic file container"""

__tablename__ = 'file'
Expand All @@ -79,7 +79,7 @@ class File(Base, bob.db.verification.utils.File):

def __init__(self, client_id, path, session_id, darkened, shot_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.session_id = session_id
self.darkened = darkened
Expand Down
26 changes: 23 additions & 3 deletions bob/db/xm2vts/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
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):
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
Expand All @@ -39,7 +39,10 @@ class Database(bob.db.verification.utils.SQLiteDatabase):

def __init__(self, original_directory = None, original_extension = '.ppm'):
# call base class constructor
bob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File, original_directory=original_directory, original_extension=original_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 'client' and 'eval' by 'client' in a list of groups, and
Expand Down Expand Up @@ -288,3 +291,20 @@ def purposes(self):

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))



2 changes: 0 additions & 2 deletions develop.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The actual raw data for the XM2VTS_ database should be downloaded from the origi
The Database Interface
----------------------

The :py:class:`bob.db.xm2vts.Database` complies with the standard biometric verification database as described in :ref:`commons`, implementing the interface :py:class:`bob.db.verification.utils.SQLiteDatabase`.
The :py:class:`bob.db.xm2vts.Database` complies with the standard biometric verification database as described in :ref:`commons`, implementing the interface :py:class:`bob.db.base.SQLiteDatabase`.

.. todo::
Explain the particularities of the :py:class:`bob.db.xm2vts.Database`.
Expand Down

0 comments on commit 4d685c2

Please sign in to comment.