...
 
Commits (103)
*~
*.swp
*.pyc
*.so
*.dylib
bin
eggs
parts
.installed.cfg
.mr.developer.cfg
*.egg-info
src
develop-eggs
built-docs
dist
sphinx
dist
.nfs*
.gdb_history
build
*.egg
src/
db.sql3
record.txt
include: 'https://gitlab.idiap.ch/bob/bob.devtools/raw/master/bob/devtools/data/gitlab-ci/single-package.yaml'
This diff is collapsed.
Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
Written by Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
include README.rst
recursive-include docs *.py *.rst
recursive-include xbob *.sql3
include README.rst bootstrap-buildout.py buildout.cfg develop.cfg COPYING version.txt requirements.txt
recursive-include doc *.py *.rst
recursive-include bob *.sql3
================
BANCA Database
================
.. vim: set fileencoding=utf-8 :
.. Wed 17 Aug 08:26:55 CEST 2016
.. image:: http://img.shields.io/badge/docs-stable-yellow.svg
:target: https://www.idiap.ch/software/bob/docs/bob/bob.db.banca/stable/index.html
.. image:: http://img.shields.io/badge/docs-latest-orange.svg
:target: https://www.idiap.ch/software/bob/docs/bob/bob.db.banca/master/index.html
.. image:: https://gitlab.idiap.ch/bob/bob.db.banca/badges/master/build.svg
:target: https://gitlab.idiap.ch/bob/bob.db.banca/commits/master
.. image:: https://gitlab.idiap.ch/bob/bob.db.banca/badges/master/coverage.svg
:target: https://gitlab.idiap.ch/bob/bob.db.banca/commits/master
.. image:: https://img.shields.io/badge/gitlab-project-0000c0.svg
:target: https://gitlab.idiap.ch/bob/bob.db.banca
.. image:: http://img.shields.io/pypi/v/bob.db.banca.svg
:target: https://pypi.python.org/pypi/bob.db.banca
.. image:: https://img.shields.io/badge/original-data--files-a000a0.png
:target: http://www.ee.surrey.ac.uk/CVSSP/banca
This package contains the access API and descriptions for the `BANCA English
Database <http://www.ee.surrey.ac.uk/CVSSP/banca/>`_. The actual raw data for
the database should be downloaded from the original URL. This API is only
compatible with the images from the BANCA English database. This package only
contains the `Bob <http://www.idiap.ch/software/bob/>`_ accessor methods to use
the DB directly from python, with our certified protocols.
================================
BANCA Database Interface for Bob
================================
You would normally not install this package unless you are maintaining it. What
you would do instead is to tie it in at the package you need to **use** it.
There are a few ways to achieve this:
This package is part of the signal-processing and machine learning toolbox
Bob_.
This package contains an interface for the evaluation protocol of the BANCA database, particularly for the English protocol of BANCA. This package does not contain the original BANCA data files, which need to be obtained through the link above.
1. You can add this package as a requirement at the ``setup.py`` for your own
`satellite package
<https://github.com/idiap/bob/wiki/Virtual-Work-Environments-with-Buildout>`_
or to your Buildout ``.cfg`` file, if you prefer it that way. With this
method, this package gets automatically downloaded and installed on your
working environment, or
2. You can manually download and install this package using commands like
``easy_install`` or ``pip``.
Installation
------------
The package is available in two different distribution formats:
Complete Bob's `installation`_ instructions. Then, to install this package,
run::
1. You can download it from `PyPI <http://pypi.python.org/pypi>`_, or
$ conda install bob.db.banca
2. You can download it in its source form from `its git repository
<https://github.com/bioidiap/xbob.db.banca>`_. When you download the
version at the git repository, you will need to run a command to recreate
the backend SQLite file required for its operation. This means that the
database raw files must be installed somewhere in this case. With option
``a`` you can run in `dummy` mode and only download the raw data files for
the database once you are happy with your setup.
You can mix and match points 1/2 and a/b above based on your requirements. Here
are some examples:
Contact
-------
Modify your setup.py and download from PyPI
===========================================
For questions or reporting issues to this software package, contact our
development `mailing list`_.
That is the easiest. Edit your ``setup.py`` in your satellite package and add
the following entry in the ``install_requires`` section (note: ``...`` means
`whatever extra stuff you may have in-between`, don't put that on your
script)::
install_requires=[
...
"xbob.db.banca",
],
Proceed normally with your ``boostrap/buildout`` steps and you should be all
set. That means you can now import the ``xbob.db.banca`` namespace into your scripts.
Modify your buildout.cfg and download from git
==============================================
You will need to add a dependence to `mr.developer
<http://pypi.python.org/pypi/mr.developer/>`_ to be able to install from our
git repositories. Your ``buildout.cfg`` file should contain the following
lines::
[buildout]
...
extensions = mr.developer
auto-checkout = *
eggs = bob
...
xbob.db.banca
[sources]
xbob.db.banca = git https://github.com/bioidiap/xbob.db.banca.git
...
.. Place your references here:
.. _bob: https://www.idiap.ch/software/bob
.. _installation: https://www.idiap.ch/software/bob/install
.. _mailing list: https://www.idiap.ch/software/bob/discuss
# see https://docs.python.org/3/library/pkgutil.html
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# see https://docs.python.org/3/library/pkgutil.html
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""The BANCA Database for face verification
"""
from .query import Database
from .models import Client, Subworld, File, Protocol, ProtocolPurpose, Annotation
def get_config():
"""Returns a string containing the configuration information.
"""
import bob.extension
return bob.extension.get_config(__name__)
# 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 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Bob Database Driver entry-point for the BANCA
"""
import os
import sys
from bob.db.driver import Interface as BaseInterface
from bob.db.base.driver import Interface as BaseInterface
def dumplist(args):
......@@ -19,7 +33,7 @@ def dumplist(args):
r = db.objects(
protocol=args.protocol,
purposes=args.purpose,
model_ids=(args.client,),
model_ids=args.model_id,
groups=args.group,
languages=args.language,
classes=args.sclass
......@@ -27,7 +41,7 @@ def dumplist(args):
output = sys.stdout
if args.selftest:
from bob.db.utils import null
from bob.db.base.utils import null
output = null()
for f in r:
......@@ -56,7 +70,7 @@ def checkfiles(args):
# report
output = sys.stdout
if args.selftest:
from bob.db.utils import null
from bob.db.base.utils import null
output = null()
if bad:
......@@ -76,11 +90,11 @@ def reverse(args):
output = sys.stdout
if args.selftest:
from bob.db.utils import null
from bob.db.base.utils import null
output = null()
r = db.reverse(args.path)
for id in r: output.write('%d\n' % id)
for f in r: output.write('%d\n' % f.id)
if not r: return 1
......@@ -95,7 +109,7 @@ def path(args):
output = sys.stdout
if args.selftest:
from bob.db.utils import null
from bob.db.base.utils import null
output = null()
r = db.paths(args.id, prefix=args.directory, suffix=args.extension)
......@@ -113,7 +127,7 @@ class Interface(BaseInterface):
def version(self):
import pkg_resources # part of setuptools
return pkg_resources.require('xbob.db.%s' % self.name())[0].version
return pkg_resources.require('bob.db.%s' % self.name())[0].version
def files(self):
......@@ -145,7 +159,7 @@ class Interface(BaseInterface):
parser.add_argument('-e', '--extension', default='', help="if given, this extension will be appended to every entry returned.")
parser.add_argument('-p', '--protocol', help="if given, limits the dump to a particular subset of the data that corresponds to the given protocol.", choices=db.protocol_names() if db.is_valid() else ())
parser.add_argument('-u', '--purpose', help="if given, this value will limit the output files to those designed for the given purposes.", choices=db.purposes() if db.is_valid() else ())
parser.add_argument('-C', '--client', type=int, help="if given, limits the dump to a particular client", choices=db.model_ids() if db.is_valid() else ())
parser.add_argument('-m', '--model-id', type=int, help="if given, limits the dump to a particular model", choices=db.model_ids() if db.is_valid() else ())
parser.add_argument('-g', '--group', help="if given, this value will limit the output files to those belonging to a particular protocolar group.", choices=db.groups() if db.is_valid() else ())
parser.add_argument('-l', '--language', help="if given, this value will limit the output files to those belonging to the given languages.", choices=db.languages() if db.is_valid() else ())
parser.add_argument('-c', '--class', dest='sclass', help="if given, this value will limit the output files to those belonging to the given classes.", choices=('client', 'impostor'))
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Table models and functionality for the BANCA database.
"""
import os, numpy
import bob.db.utils
import bob.db.base.utils
from sqlalchemy import Table, Column, Integer, String, ForeignKey, or_, and_
from bob.db.sqlalchemy_migration import Enum, relationship
from bob.db.base.sqlalchemy_migration import Enum, relationship
from sqlalchemy.orm import backref
from sqlalchemy.ext.declarative import declarative_base
import xbob.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')))
......@@ -70,7 +85,7 @@ class Subworld(Base):
def __repr__(self):
return "Subworld('%s')" % (self.name)
class File(Base, xbob.db.verification.utils.File):
class File(Base, bob.db.base.File):
"""Generic file container"""
__tablename__ = 'file'
......@@ -90,15 +105,46 @@ class File(Base, xbob.db.verification.utils.File):
# For Python: A direct link to the client object that this file belongs to
real_client = relationship("Client", backref=backref("files", order_by=id))
annotation = relationship("Annotation", backref=backref("file"), uselist=False)
def __init__(self, client_id, path, claimed_id, shot_id, session_id):
# call base class constructor
xbob.db.verification.utils.File.__init__(self, client_id = client_id, path = path)
bob.db.base.File.__init__(self, path = path)
self.client_id = client_id
self.claimed_id = claimed_id
self.shot_id = shot_id
self.session_id = session_id
class Annotation(Base):
"""Annotations of the BANCA database consists only of the left and right eye positions.
There is exactly one annotation for each file."""
__tablename__ = 'annotation'
id = Column(Integer, primary_key=True)
file_id = Column(Integer, ForeignKey('file.id'))
le_x = Column(Integer) # left eye
le_y = Column(Integer)
re_x = Column(Integer) # right eye
re_y = Column(Integer)
def __init__(self, file_id, eyes):
self.file_id = file_id
assert len(eyes) == 4
self.re_x = int(eyes[0])
self.re_y = int(eyes[1])
self.le_x = int(eyes[2])
self.le_y = int(eyes[3])
def __call__(self):
"""Returns the annotations of this database in a dictionary: {'reye' : (re_y, re_x), 'leye' : (le_y, le_x)}."""
return {'reye' : (self.re_y, self.re_x), 'leye' : (self.le_y, self.le_x) }
def __repr__(self):
return "<Annotation('%s': 'reye'=%dx%d, 'leye'=%dx%d)>" % (self.file_id, self.re_y, self.re_x, self.le_y, self.le_x)
class Protocol(Base):
"""BANCA protocols"""
......@@ -129,7 +175,7 @@ class ProtocolPurpose(Base):
group_choices = ('world', 'dev', 'eval')
sgroup = Column(Enum(*group_choices))
# Purpose associated with this protocol purpose object
purpose_choices = ('train', 'enrol', 'probe')
purpose_choices = ('train', 'enroll', 'probe')
purpose = Column(Enum(*purpose_choices))
# For Python: A direct link to the Protocol object that this ProtocolPurpose belongs to
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""A few checks at the BANCA database.
"""
import os, sys
import bob.db.banca
def db_available(test):
"""Decorator for detecting if the database file is available"""
from bob.io.base.test_utils import datafile
from nose.plugins.skip import SkipTest
import functools
@functools.wraps(test)
def wrapper(*args, **kwargs):
dbfile = datafile("db.sql3", __name__, None)
if os.path.exists(dbfile):
return test(*args, **kwargs)
else:
raise SkipTest("The database file '%s' is not available; did you forget to run 'bob_dbmanage.py %s create' ?" % (dbfile, 'banca'))
return wrapper
@db_available
def test_clients():
# test whether the correct number of clients is returned
db = bob.db.banca.Database()
assert len(db.groups()) == 3
assert len(db.clients()) == 82
assert len(db.clients(groups='world')) == 30
assert len(db.clients(groups='world', subworld='onethird')) == 10
assert len(db.clients(groups='world', subworld='twothirds')) == 20
assert len(db.clients(groups='dev')) == 26
assert len(db.clients(groups='eval')) == 26
assert len(db.tclients(groups='dev')) == 26
assert len(db.tclients(groups='eval')) == 26
assert len(db.clients(genders='f')) == 41
assert len(db.clients(genders='m')) == 41
@db_available
def test_objects():
# tests if the right number of File objects is returned
db = bob.db.banca.Database()
assert len(db.objects()) == 6540
assert len(db.objects(groups='world')) == 300
assert len(db.objects(groups='world', subworld='onethird')) == 100
assert len(db.objects(groups='world', subworld='twothirds')) == 200
assert len(db.objects(groups='dev')) == 3120
assert len(db.objects(groups='eval')) == 3120
# test for the different protocols
for protocol in db.protocols():
# assure that the number of enroll files is independent from the protocol
for group in ('dev', 'eval'):
assert len(db.objects(groups=group, purposes='enroll')) == 390
for model_id in db.model_ids(groups=group):
assert len(db.objects(groups=group, purposes='enroll', model_ids=model_id)) == 15
for model_id in db.tmodel_ids(groups=group):
assert len(db.tobjects(groups=group, model_ids=model_id)) == 15
# check the number of probe files
for group in ('dev', 'eval'):
assert len(db.objects(groups=group, purposes='probe')) == 2730
for model_id in db.model_ids(groups=group):
assert len(db.objects(groups=group, purposes='probe', model_ids=model_id)) == 105
for model_id in db.tmodel_ids(groups=group):
assert len(db.zobjects(groups=group, model_ids=model_id)) == 105
@db_available
def test_annotations():
# Tests that for all files the annotated eye positions exist and are in correct order
db = bob.db.banca.Database()
for f in db.objects():
annotations = db.annotations(f)
assert annotations is not None
assert len(annotations) == 2
assert 'leye' in annotations
assert 'reye' in annotations
assert len(annotations['reye']) == 2
assert len(annotations['leye']) == 2
# assert that the eye positions are not exchanged
assert annotations['leye'][1] > annotations['reye'][1]
@db_available
def test_driver_api():
# Tests the bob_dbmanage.py driver API
from bob.db.base.script.dbmanage import main
assert main('banca dumplist --self-test'.split()) == 0
assert main('banca dumplist --protocol=P --class=client --group=dev --purpose=enroll --model-id=1008 --self-test'.split()) == 0
assert main('banca checkfiles --self-test'.split()) == 0
assert main('banca reverse 05/1021_f_g2_s05_1026_en_3 --self-test'.split()) == 0
assert main('banca path 2327 --self-test'.split()) == 0
This diff is collapsed.
; vim: set fileencoding=utf-8 :
; Andre Anjos <andre.anjos@idiap.ch>
; Mon 16 Apr 08:29:18 2012 CEST
; Wed 17 Aug 08:26:54 CEST 2016
[buildout]
parts = external tests sphinx python
newest = false
parts = scripts
develop = .
versions = versions
eggs = bob
xbob.db.banca
[versions]
;If you would like to pin-down the recipes package version so you are not
;bothered with eventual updates, do it here. Note that, by pinning the version
;of the package, you will be also excluded from bug fixes.
;xbob.buildout = 0.1
[external]
recipe = xbob.buildout:external
egg-directories = /idiap/group/torch5spro/nightlies/last/install/linux-x86_64-release/lib
[tests]
recipe = xbob.buildout:nose
eggs = ${buildout:eggs}
script = tests.py
[sphinx]
recipe = xbob.buildout:sphinx
eggs = ${buildout:eggs}
source = ${buildout:directory}/docs
build = ${buildout:directory}/sphinx
eggs = bob.db.banca
extensions = bob.buildout
newest = false
verbose = true
[python]
recipe = zc.recipe.egg
eggs = ${buildout:eggs}
interpreter = python
dependent-scripts = true
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
\ No newline at end of file
{% set name = 'bob.db.banca' %}
{% set project_dir = environ.get('RECIPE_DIR') + '/..' %}
package:
name: {{ name }}
version: {{ environ.get('BOB_PACKAGE_VERSION', '0.0.1') }}
build:
number: {{ environ.get('BOB_BUILD_NUMBER', 0) }}
run_exports:
- {{ pin_subpackage(name) }}
script:
- cd {{ project_dir }}
{% if environ.get('BUILD_EGG') %}
- python setup.py sdist --formats=zip
{% endif %}
- python setup.py install --single-version-externally-managed --record record.txt
- bob_dbmanage.py {{ name.replace('bob.db.', '') }} download --missing
requirements:
host:
- python {{ python }}
- setuptools {{ setuptools }}
- six {{ six }}
- bob.io.base
- bob.db.base
run:
- python
- setuptools
- six
test:
imports:
- {{ name }}
commands:
- nosetests --with-coverage --cover-package={{ name }} -sv {{ name }}
- sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx
- sphinx-build -aEb doctest {{ project_dir }}/doc sphinx
- conda inspect linkages -p $PREFIX {{ name }} # [not win]
- conda inspect objects -p $PREFIX {{ name }} # [osx]
requires:
- bob-devel {{ bob_devel }}.*
- nose
- coverage
- sphinx
- sphinx_rtd_theme
about:
home: https://www.idiap.ch/software/bob/
license: BSD License
summary: BANCA Database Access API for Bob
license_family: BSD
; vim: set fileencoding=utf-8 :
; Manuel Guenther <manuel.guenther@idiap.ch>
; Fri Aug 29 14:07:33 CEST 2014
[buildout]
parts = scripts
eggs = bob.db.banca
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = src/bob.extension
src/bob.blitz
src/bob.core
src/bob.io.base
src/bob.db.base
.
; options for bob.buildout extension
debug = true
verbose = true
newest = false
[sources]
bob.extension = git https://gitlab.idiap.ch/bob/bob.extension
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
[scripts]
recipe = bob.buildout:scripts
dependent-scripts=true
This diff is collapsed.
.. vim: set fileencoding=utf-8 :
.. @author: Manuel Guenther <Manuel.Guenther@idiap.ch>
.. @date: Fri Oct 31 16:01:33 CET 2014
==============
User's Guide
==============
This package contains the access API and descriptions for the BANCA_ English Database.
The actual raw data for the database should be downloaded from the original URL.
This API is only compatible with the images from the BANCA English database.
This package only contains the Bob_ accessor methods to use the DB directly from python, with our certified protocols.
The BANCA_ database interface provides several face verification protocols, i.e., ``'P'``, ``'G'``, ``'Mc'``, ``'Md'``, ``'Ma'``, ``'Ud'``, ``'Ua'``.
These protocols are defined in detail in [Bail2003]_.
.. [Bail2003] **Enrique Bailly-Bailliére and others**. *The BANCA Database and Evaluation Protocol*, Lecture Notes in Computer Science Vol. 2688, pages 625-638, 2003.
The Database Interface
----------------------
The :py:class:`bob.db.banca.Database` complies with the standard biometric verification database as described in `bob.db.base <bob.db.base>`.
.. todo::
Explain the particularities of the :py:class:`bob.db.banca.Database` database.
.. _banca: http://www.ee.surrey.ac.uk/CVSSP/banca
.. _bob: https://www.idiap.ch/software/bob
.. vim: set fileencoding=utf-8 :
.. @author: Manuel Guenther <Manuel.Guenther@idiap.ch>
.. @date: Tue Aug 26 09:42:18 CEST 2014
.. _bob.db.banca:
=======================================
BANCA Database Verification Protocols
=======================================
.. todolist::
Documentation
-------------
.. toctree::
:maxdepth: 2
guide
py_api
Indices and tables
------------------
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
py:obj list
py:class list
py:class sqlalchemy.ext.declarative.api.Base
py:exc ValueError
.. vim: set fileencoding=utf-8 :
.. Laurent El Shafey <laurent.el-shafey@idiap.ch>
.. Tue 28 Aug 2012 18:09:40 CEST
.. Tue 28 Aug 2012 18:09:40 CEST
================
BANCA Database
================
============
Python API
============
.. automodule:: xbob.db.banca
.. automodule:: bob.db.banca
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup, find_packages
from setuptools import setup, find_packages, dist
dist.Distribution(dict(setup_requires=['bob.extension']))
from bob.extension.utils import load_requirements
install_requires = load_requirements()
# Define package version
version = open("version.txt").read().rstrip()
# The only thing we do in this file is to call the setup() function with all
# parameters that define our package.
setup(
name='xbob.db.banca',
version='1.0.0a1',
name='bob.db.banca',
version=version,
description='BANCA Database Access API for Bob',
url='http://github.com/bioidiap/xbob.db.banca',
license='GPLv3',
url='https://gitlab.idiap.ch/bob/bob.db.banca',
license='BSD',
author='Laurent El Shafey',
author_email='laurent.el-shafey@idiap.ch',
keywords='face recognition, bob, bob.db, BANCA',
long_description=open('README.rst').read(),
# This line is required for any distutils based packaging.
......@@ -22,36 +44,27 @@ setup(
include_package_data=True,
zip_safe=False,
install_requires=[
'setuptools',
'bob', # base signal proc./machine learning library
'xbob.db.verification.utils' # defines a set of utilities for face verification databases like this one.
],
namespace_packages = [
'xbob',
'xbob.db',
],
install_requires = install_requires,
entry_points = {
# bob database declaration
'bob.db': [
'banca = xbob.db.banca.driver:Interface',
],
# bob unittest declaration
'bob.test': [
'banca = xbob.db.banca.test:BancaDatabaseTest',
],
},
# bob database declaration
'bob.db': [
'banca = bob.db.banca.driver:Interface',
],
},
classifiers = [
'Framework :: Bob',
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Database :: Front-Ends',
],
],
)
2.1.10b0
\ No newline at end of file
#see http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
__import__('pkg_resources').declare_namespace(__name__)
#see http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
__import__('pkg_resources').declare_namespace(__name__)
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
"""The BANCA Database for face verification
"""
from .query import Database
from .models import Client, Subworld, File, Protocol, ProtocolPurpose
__all__ = dir()
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
# Copyright (C) 2011-2012 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""A few checks at the BANCA database.
"""
import os, sys
import unittest
import xbob.db.banca
class BancaDatabaseTest(unittest.TestCase):
"""Performs various tests on the BANCA database."""
def test01_clients(self):
# test whether the correct number of clients is returned
db = xbob.db.banca.Database()
self.assertEqual(len(db.clients()), 82)
self.assertEqual(len(db.clients(groups='world')), 30)
self.assertEqual(len(db.clients(groups='dev')), 26)
self.assertEqual(len(db.clients(groups='eval')), 26)
self.assertEqual(len(db.tclients(groups='dev')), 26)
self.assertEqual(len(db.tclients(groups='eval')), 26)
self.assertEqual(len(db.clients(genders='f')), 41)
self.assertEqual(len(db.clients(genders='m')), 41)
def test02_objects(self):
# tests if the right number of File objects is returned
db = xbob.db.banca.Database()
self.assertEqual(len(db.objects()), 6540)
self.assertEqual(len(db.objects(groups='world')), 300)
self.assertEqual(len(db.objects(groups='dev')), 3120)
self.assertEqual(len(db.objects(groups='eval')), 3120)
# test for the different protocols
for protocol in db.protocols():
# assure that the number of enroll files is independent from the protocol
for group in ('dev', 'eval'):
self.assertEqual(len(db.objects(groups=group, purposes='enrol')), 390)
for model_id in db.model_ids(groups=group):
self.assertEqual(len(db.objects(groups=group, purposes='enrol', model_ids=model_id)), 15)
for model_id in db.tmodel_ids(groups=group):
self.assertEqual(len(db.tobjects(groups=group, model_ids=model_id)), 15)
# check the number of probe files
for group in ('dev', 'eval'):
self.assertEqual(len(db.objects(groups=group, purposes='probe')), 2730)
for model_id in db.model_ids(groups=group):
self.assertEqual(len(db.objects(groups=group, purposes='probe', model_ids=model_id)), 105)
for model_id in db.tmodel_ids(groups=group):
self.assertEqual(len(db.zobjects(groups=group, model_ids=model_id)), 105)
def test03_driver_api(self):
from bob.db.script.dbmanage import main
self.assertEqual(main('banca dumplist --self-test'.split()), 0)
self.assertEqual(main('banca dumplist --protocol=P --class=client --group=dev --purpose=enrol --client=1008 --self-test'.split()), 0)
self.assertEqual(main('banca checkfiles --self-test'.split()), 0)
self.assertEqual(main('banca reverse 05/1021_f_g2_s05_1026_en_3 --self-test'.split()), 0)
self.assertEqual(main('banca path 2327 --self-test'.split()), 0)