Commit a4d68ab6 authored by Manuel Günther's avatar Manuel Günther
Browse files

Switched to new bob version.

parent 5a3053e2
language: python
matrix:
include:
- python: 2.6
- python: 2.7
env:
- secure: IsIuB+1cKlkdqXxNmAGp/me3JrYcuTzrZVcP2x9XWsJR43AW7jlPet9fB1lsU6pzfymCww3eody+J4ZiTcKWjL91BLHLNbBcny6EdzwZzdt26sH7moF53WEe678bwcmrkBEDbbaTODPKJDKFNHWy2QjBd46KzFBsvUBMzPL8skA=
- secure: RyfuwYiUnkICmUMqV/oV1X0rckwa3FHxwt2zCf/uDPzQitccXf64byZp+yh6Va1epIc4pLXZ4nI2UBg2P222Q7xjOciXJShQZAXANeajhIfoLdC/mM/TvwJLOqviFrSh2fJlnuj1/Rwya3yhW0fkDlwJjyoc7vrJthIy1wgRExo=
- python: 3.2
env:
- NUMPYSPEC===1.8.0
- python: 3.3
env:
- NUMPYSPEC===1.8.0
before_install:
- sudo add-apt-repository -y ppa:biometrics/bob
- sudo apt-get update -qq
- sudo apt-get install -qq --force-yes libboost-all-dev libblitz1-dev libhdf5-serial-dev libatlas-dev libatlas-base-dev liblapack-dev
- if [ -n "${NUMPYSPEC}" ]; then sudo apt-get install -qq gfortran; fi
- if [ -n "${NUMPYSPEC}" ]; then pip install --upgrade pip setuptools; fi
- if [ -n "${NUMPYSPEC}" ]; then pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel numpy$NUMPYSPEC matplotlib==1.3.0 sphinx nose==1.3.0; fi
- pip install coveralls
install:
- python bootstrap.py
- ./bin/buildout
script:
- ./bin/python -c 'from bob.db.banca import get_config; print(get_config())'
- ./bin/coverage run --source=bob.db.banca ./bin/nosetests -sv
- ./bin/sphinx-build -b doctest doc sphinx
- ./bin/sphinx-build -b html doc sphinx
after_success:
- coveralls
- ./src/bob.extension/scripts/upload-sphinx.sh
include README.rst bootstrap.py buildout.cfg COPYING
recursive-include docs *.py *.rst
recursive-include xbob *.sql3
recursive-include doc *.py *.rst
recursive-include bob *.sql3
......@@ -5,7 +5,7 @@
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
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.
......@@ -29,7 +29,7 @@ The package is available in two different distribution formats:
1. You can download it from `PyPI <http://pypi.python.org/pypi>`_, or
2. You can download it in its source form from `its git repository
<https://github.com/bioidiap/xbob.db.banca>`_. When you download the
<https://github.com/bioidiap/bob.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
......@@ -49,11 +49,11 @@ script)::
install_requires=[
...
"xbob.db.banca",
"bob.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.
set. That means you can now import the ``bob.db.banca`` namespace into your scripts.
Modify your buildout.cfg and download from git
==============================================
......@@ -69,8 +69,8 @@ lines::
auto-checkout = *
eggs = bob
...
xbob.db.banca
bob.db.banca
[sources]
xbob.db.banca = git https://github.com/bioidiap/xbob.db.banca.git
bob.db.banca = git https://github.com/bioidiap/bob.db.banca.git
...
......@@ -22,4 +22,21 @@
from .query import Database
from .models import Client, Subworld, File, Protocol, ProtocolPurpose
__all__ = dir()
def get_config():
"""Returns a string containing the configuration information.
"""
import pkg_resources
packages = pkg_resources.require(__name__)
this = packages[0]
deps = packages[1:]
retval = "%s: %s (%s)\n" % (this.key, this.version, this.location)
retval += " - python dependencies:\n"
for d in deps: retval += " - %s: %s (%s)\n" % (d.key, d.version, d.location)
return retval.strip()
# gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')]
......@@ -211,7 +211,7 @@ def add_protocols(session, verbose):
def create_tables(args):
"""Creates all necessary tables (only to be used at the first time)"""
from bob.db.utils import create_engine_try_nolock
from bob.db.base.utils import create_engine_try_nolock
engine = create_engine_try_nolock(args.type, args.files[0], echo=(args.verbose > 2))
Base.metadata.create_all(engine)
......@@ -222,7 +222,7 @@ def create_tables(args):
def create(args):
"""Creates or re-creates this database"""
from bob.db.utils import session_try_nolock
from bob.db.base.utils import session_try_nolock
dbfile = args.files[0]
......
......@@ -21,7 +21,7 @@
import os
import sys
from bob.db.driver import Interface as BaseInterface
from bob.db.base.driver import Interface as BaseInterface
def dumplist(args):
......@@ -41,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:
......@@ -70,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:
......@@ -90,7 +90,7 @@ 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)
......@@ -109,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)
......@@ -127,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):
......
......@@ -20,13 +20,13 @@
"""
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
import bob.db.verification.utils
Base = declarative_base()
......@@ -84,7 +84,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.verification.utils.File):
"""Generic file container"""
__tablename__ = 'file'
......@@ -107,7 +107,7 @@ class File(Base, xbob.db.verification.utils.File):
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.verification.utils.File.__init__(self, client_id = client_id, path = path)
self.claimed_id = claimed_id
self.shot_id = shot_id
......
......@@ -22,15 +22,15 @@ BANCA database in the most obvious ways.
import os
import six
from bob.db import utils
from bob.db.base import utils
from .models import *
from .driver import Interface
import xbob.db.verification.utils
import bob.db.verification.utils
SQLITE_FILE = Interface().files()[0]
class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.utils.ZTDatabase):
class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.utils.ZTDatabase):
"""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 +39,8 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
def __init__(self, original_directory = None, original_extension = None):
# call base class constructors
xbob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File)
xbob.db.verification.utils.ZTDatabase.__init__(self, original_directory=original_directory, original_extension=original_extension)
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)
def __group_replace_alias__(self, l):
"""Replace 'dev' by 'g1' and 'eval' by 'g2' in a list of groups, and
......@@ -275,7 +275,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
return self.query(Client).filter(Client.id==id).one()
def get_client_id_from_model_id(self, model_id):
def get_client_id_from_model_id(self, model_id, **kwargs):
"""Returns the client_id attached to the given model_id
Keyword Parameters:
......@@ -287,7 +287,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
"""
return model_id
def get_client_id_from_tmodel_id(self, tmodel_id):
def get_client_id_from_tmodel_id(self, tmodel_id, **kwargs):
"""Returns the client_id attached to the given T-Norm model_id
Keyword Parameters:
......
#!/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
db = bob.db.banca.Database()
def test_clients():
# test whether the correct number of clients is returned
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
def test_objects():
# tests if the right number of File objects is returned
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='enrol')) == 390
for model_id in db.model_ids(groups=group):
assert len(db.objects(groups=group, purposes='enrol', 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
def test_annotations():
# Tests that for all files the annotated eye positions exist and are in correct order
for f in db.objects():
annotations = db.annotations(f.id)
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]
def test_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=enrol --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
; vim: set fileencoding=utf-8 :
; author: Manuel Guenther <manuel.guenther@idiap.ch>
; date: Wed Feb 13 12:35:29 CET 2013
; Manuel Guenther <manuel.guenther@idiap.ch>
; Fri Aug 29 14:07:33 CEST 2014
[buildout]
parts = scripts
develop = .
eggs = xbob.db.banca
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
src/bob.db.verification.utils
.
; options for bob.buildout extension
debug = true
verbose = true
newest = false
[sources]
bob.extension = git https://github.com/bioidiap/bob.extension
bob.blitz = git https://github.com/bioidiap/bob.blitz
bob.core = git https://github.com/bioidiap/bob.core
bob.io.base = git https://github.com/bioidiap/bob.io.base
bob.db.base = git https://github.com/bioidiap/bob.db.base
bob.db.verification.utils = git https://github.com/bioidiap/bob.db.verification.utils
[scripts]
recipe = xbob.buildout:scripts
dependent-scripts = true
recipe = bob.buildout:scripts
dependent-scripts=true
......@@ -4,16 +4,16 @@
# Mon 13 Aug 2012 12:38:15 CEST
#
# 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/>.
......@@ -40,7 +40,6 @@ extensions = [
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'bob.sphinxext.plot', # ours add source copying to install directory
]
# The viewcode extension appeared only on Sphinx >= 1.0.0
......@@ -77,7 +76,7 @@ copyright = u'%s, Idiap Research Institute' % time.strftime('%Y')
# built documents.
#
# The short X.Y version.
from xbob.db.banca.driver import Interface
from bob.db.banca.driver import Interface
version = Interface().version()
# The full version, including alpha/beta/rc tags.
release = version
......@@ -151,7 +150,7 @@ html_favicon = ''
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
......@@ -248,7 +247,7 @@ man_pages = [
]
# We want to remove all private (i.e. _. or __.__) members
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = ['__call__']
......@@ -263,10 +262,10 @@ def member_function_test(app, what, name, obj, skip, options):
# test if the method is documented
if not hasattr(obj, '__doc__') or not obj.__doc__:
return True
# Skips selected members in auto-generated documentation. Unfortunately, old
# versions of Boost.Python will not generate a __self__ member for static
# methods and that screws-up Sphinx processing.
# methods and that screws-up Sphinx processing.
if sphinx.__version__ < "1.0":
# We have to remove objects that do not have a __self__ attribute set
import types
......@@ -276,7 +275,7 @@ def member_function_test(app, what, name, obj, skip, options):
return True
return False
# Default processing flags for sphinx
autoclass_content = 'both'
autodoc_member_order = 'bysource'
......
.. vim: set fileencoding=utf-8 :
.. @author: Manuel Guenther <Manuel.Guenther@idiap.ch>
.. @date: Thu Dec 6 12:28:25 CET 2012
==============
User's Guide
==============
.. todo::
Write users guide.
.. vim: set fileencoding=utf-8 :
.. @author: Manuel Guenther <Manuel.Guenther@idiap.ch>
.. @date: Tue Aug 26 09:42:18 CEST 2014
===============================================
BANCA Database of Faces Verification Protocol
===============================================
.. todolist::
Documentation
-------------
.. toctree::
:maxdepth: 2
guide
py_api
Indices and tables
------------------
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. 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
================
.. automodule:: xbob.db.banca
.. automodule:: bob.db.banca
......@@ -22,14 +22,14 @@ from setuptools import setup, find_packages
# parameters that define our package.
setup(
name='xbob.db.banca',
version='1.2.3a0',
name='bob.db.banca',
version='2.0.0a0',
description='BANCA Database Access API for Bob',
url='https://pypi.python.org/pypi/xbob.db.banca',
url='https://pypi.python.org/pypi/bob.db.banca',
license='GPLv3',
author='Laurent El Shafey',
author_email='laurent.el-shafey@idiap.ch',
keywords='face recognition, bob, xbob, xbob.db, BANCA',
keywords='face recognition, bob, bob.db, BANCA',
long_description=open('README.rst').read(),
# This line is required for any distutils based packaging.
......@@ -40,29 +40,30 @@ setup(
install_requires=[
'setuptools',
'six', # py2/3 compatibility library
'bob', # base signal proc./machine learning library
'xbob.db.verification.utils>=1.0.0' # defines a set of utilities for face verification databases like this one.
'bob.io.base',
'bob.db.base',
'bob.db.verification.utils>=1.0.0' # defines a set of utilities for face verification databases like this one.
],
namespace_packages = [
'xbob',
'xbob.db',
],
'bob',
'bob.db',
],
entry_points = {
# bob database declaration
'bob.db': [
'banca = xbob.db.banca.driver:Interface',
],
'banca = bob.db.banca.driver:Interface',
],
# bob unittest declaration
'bob.test': [
'banca = xbob.db.banca.test:BancaDatabaseTest',
],
},
'banca = bob.db.banca.test',
],
},
classifiers = [
'Development Status :: 5 - Production/Stable',
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
......@@ -73,5 +74,5 @@ setup(
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Database :: Front-Ends',
],
],
)
#!/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 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.groups()), 3)
self.assertEqual(len(db.clients()), 82)
self.assertEqual(len(db.clients(groups='world')), 30)
self.assertEqual(len(db.clients(groups='world', subworld='onethird')), 10)
self.assertEqual(len(db.clients(groups='world', subworld='twothirds')), 20)
self.assertEqual(len(db.clients(groups='dev')), 26)
self.assertEqual(len(db.clients(groups='eval')), 26)