Commit 86317b81 authored by Manuel Günther's avatar Manuel Günther

Moved to new bob version.

parent 5ead8f75
language: python
matrix:
include:
- python: 2.6
- python: 2.7
env:
- secure: gGugdsOA/a9BEl/gD3d7Tx6aO4HIXkWPZ8FTH8tB8GyAJZoc3RBcjWzkzKcQzBSSGGYtb0NpVyBrTY8ZI8cyP3uiMF1TsTcezVqv46Lo0pgAq907eBdAzE2e8daMTHtu/BdNx/swTHeKh6CnwjbhtCfmj/Xc2NqJkZvRzl7ORJw=
- secure: Zvra/7t33S8E4SF6tGzEt99F0Jz4Os/3tOso0jS+CXCxIpE0EmHadFxXIXje7tDRlSSnV4dxhTaICiAzbwQsxbZMkKjhc75OU/C+mpHCbJpzxcTm/L8Dj9mPMzlWjqjaREFnUGThr2biERkFUrinHSSQm8h7bizH4qltMhRXYTQ=
- 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 ; fi
- pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel matplotlib==1.3.0 sphinx nose==1.3.0 jinja2==2.6 coveralls
install:
- python bootstrap.py
- ./bin/buildout
script:
- ./bin/python -c 'from bob.db.biosecure import get_config; print(get_config())'
- ./bin/coverage run --source=bob.db.biosecure ./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
.. vim: set fileencoding=utf-8 :
.. Manuel Guenther <manuel.guenther@idiap.ch>
.. Thu Sep 4 11:35:05 CEST 2014
.. image:: https://travis-ci.org/bioidiap/bob.db.biosecure.svg?branch=master
:target: https://travis-ci.org/bioidiap/bob.db.biosecure
.. image:: https://coveralls.io/repos/bioidiap/bob.db.biosecure/badge.png
:target: https://coveralls.io/r/bioidiap/bob.db.biosecure
.. image:: http://img.shields.io/github/tag/bioidiap/bob.db.biosecure.png
:target: https://github.com/bioidiap/bob.db.biosecure
.. image:: http://img.shields.io/pypi/v/bob.db.biosecure.png
:target: https://pypi.python.org/pypi/bob.db.biosecure
.. image:: http://img.shields.io/pypi/dm/bob.db.biosecure.png
:target: https://pypi.python.org/pypi/bob.db.biosecure
====================
Biosecure Database
====================
This package contains the access API and descriptions for the `Biosecure
Database <http://biosecure.it-sudparis.eu/AB/index.php?option=com_content&view=article&id=11&Itemid=14>`_.
The actual raw data for the database should be downloaded from the original URL.
This package only contains the `Bob <http://www.idiap.ch/software/bob/>`_
Database <http://biosecure.it-sudparis.eu/AB/index.php?option=com_content&view=article&id=11&Itemid=14>`_.
The actual raw data for the database should be downloaded from the original URL.
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.
You would normally not install this package unless you are maintaining it. What
......@@ -27,7 +42,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.biosecure>`_. When you download the
<https://github.com/bioidiap/bob.db.biosecure>`_. 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
......@@ -47,11 +62,11 @@ script)::
install_requires=[
...
"xbob.db.biosecure",
"bob.db.biosecure",
],
Proceed normally with your ``boostrap/buildout`` steps and you should be all
set. That means you can now import the ``xbob.db.biosecure`` namespace into your scripts.
set. That means you can now import the ``bob.db.biosecure`` namespace into your scripts.
Modify your buildout.cfg and download from git
==============================================
......@@ -67,8 +82,8 @@ lines::
auto-checkout = *
eggs = bob
...
xbob.db.biosecure
bob.db.biosecure
[sources]
xbob.db.biosecure = git https://github.com/bioidiap/xbob.db.biosecure.git
bob.db.biosecure = git https://github.com/bioidiap/bob.db.biosecure.git
...
......@@ -22,4 +22,21 @@
from .query import Database
from .models import Client, 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('_')]
......@@ -152,7 +152,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)
......@@ -163,7 +163,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
# Driver API
# ==========
......@@ -42,7 +42,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:
......@@ -71,7 +71,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:
......@@ -91,7 +91,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_, not_
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()
......@@ -54,7 +54,7 @@ class Client(Base):
__tablename__ = 'client'
class File(Base, xbob.db.verification.utils.File):
class File(Base, bob.db.verification.utils.File):
"""Generic file container"""
__tablename__ = 'file'
......@@ -78,7 +78,7 @@ class File(Base, xbob.db.verification.utils.File):
def __init__(self, client_id, path, session_id, camera, shot_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.session_id = session_id
self.camera = camera
......
......@@ -21,24 +21,23 @@ Biosecure database in the most obvious ways.
"""
import os
from bob.db 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):
class Database(bob.db.verification.utils.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
and for the data itself inside the database.
"""
def __init__(self):
def __init__(self, original_directory = None, original_extension = '.jpg'):
# call base class constructors
xbob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File)
bob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File, original_directory = original_directory, original_extension = original_extension)
def groups(self, protocol=None):
"""Returns the names of all registered groups"""
......@@ -109,7 +108,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase):
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:
......
......@@ -19,36 +19,53 @@
"""A few checks at the Biosecure database.
"""
import os, sys
import unittest
import xbob.db.biosecure
import os
import bob.db.biosecure
class BiosecureDatabaseTest(unittest.TestCase):
"""Performs various tests on the Biosecure database."""
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
def test01_clients(self):
# test that the clients() function returns reasonable output
db = xbob.db.biosecure.Database()
@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, 'biosecure'))
self.assertEqual(len(db.groups()), 3)
self.assertEqual(len(db.clients()), 210)
# TODO: more specific tests
return wrapper
def test02_objects(self):
# test that the objects() function returns reasonable output
db = xbob.db.biosecure.Database()
self.assertEqual(len(db.objects()), 2520)
# TODO: more specific tests
@db_available
def test_clients():
# test that the clients() function returns reasonable output
db = bob.db.biosecure.Database()
assert len(db.groups()) == 3
assert len(db.clients()) == 210
# TODO: more specific tests
def test03_driver_api(self):
from bob.db.script.dbmanage import main
@db_available
def test_objects():
# test that the objects() function returns reasonable output
db = bob.db.biosecure.Database()
self.assertEqual(main('biosecure dumplist --self-test'.split()), 0)
self.assertEqual(main('biosecure dumplist --protocol=ca0 --class=client --group=dev --purpose=enrol --client=141 --self-test'.split()), 0)
self.assertEqual(main('biosecure checkfiles --self-test'.split()), 0)
self.assertEqual(main('biosecure reverse ca0/u141_s02_face_ds2-ca-0i_02 --self-test'.split()), 0)
self.assertEqual(main('biosecure path 748 --self-test'.split()), 0)
assert len(db.objects()) == 2520
# TODO: more specific tests
@db_available
def test_driver_api():
from bob.db.base.script.dbmanage import main
assert main('biosecure dumplist --self-test'.split()) == 0
assert main('biosecure dumplist --protocol=ca0 --class=client --group=dev --purpose=enrol --client=141 --self-test'.split()) == 0
assert main('biosecure checkfiles --self-test'.split()) == 0
assert main('biosecure reverse ca0/u141_s02_face_ds2-ca-0i_02 --self-test'.split()) == 0
assert main('biosecure path 748 --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.biosecure
eggs = bob.db.biosecure
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.biosecure.driver import Interface
from bob.db.biosecure.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
===========================================
Biosecure Database Verification Protocols
===========================================
.. 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 19:37:20 CEST
.. Tue 28 Aug 2012 19:37:20 CEST
====================
Biosecure Database
====================
============
Python API
============
.. automodule:: xbob.db.biosecure
.. automodule:: bob.db.biosecure
......@@ -22,14 +22,14 @@ from setuptools import setup, find_packages
# parameters that define our package.
setup(
name='xbob.db.biosecure',
version='1.0.6a0',
name='bob.db.biosecure',
version='2.0.0a0',
description='Biosecure Database Access API for Bob',
url='https://pypi.python.org/pypi/xbob.db.biosecure',
url='https://pypi.python.org/pypi/bob.db.biosecure',
license='GPLv3',
author='Laurent El Shafey',
author_email='laurent.el-shafey@idiap.ch',
keywords='face recognition, bob, xbob, xbob.db, Biosecure',
keywords='face recognition, bob, bob.db, Biosecure',
long_description=open('README.rst').read(),
# This line is required for any distutils based packaging.
......@@ -39,29 +39,24 @@ setup(
install_requires=[
'setuptools',
'bob', # base signal proc./machine learning library
'xbob.db.verification.utils>=0.1.4' # defines a set of utilities for face verification databases like this one.
],
'bob.db.base',
'bob.db.verification.utils'
],
namespace_packages = [
'xbob',
'xbob.db',
],
'bob',
'bob.db',
],
entry_points = {
# bob database declaration
'bob.db': [
'biosecure = xbob.db.biosecure.driver:Interface',
],
# bob unittest declaration
'bob.test': [
'biosecure = xbob.db.biosecure.test:BiosecureDatabaseTest',
],
},
'biosecure = bob.db.biosecure.driver:Interface',
],
},
classifiers = [
'Development Status :: 5 - Production/Stable',
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
......
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