Skip to content
Snippets Groups Projects
Commit 098da6ea authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Initial version of bob.db.swan

parent ce71659d
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -12,3 +12,4 @@ develop-eggs ...@@ -12,3 +12,4 @@ develop-eggs
sphinx sphinx
dist dist
conda conda
*.sql3
include README.rst bootstrap-buildout.py buildout.cfg COPYING version.txt requirements.txt include README.rst LICENSE version.txt requirements.txt
recursive-include doc *.py *.rst *.ico *.png recursive-include doc *.py *.rst *.ico *.png
This diff is collapsed.
...@@ -59,26 +59,43 @@ class File(Base, bob.db.base.File): ...@@ -59,26 +59,43 @@ class File(Base, bob.db.base.File):
# Key identifier for the file # Key identifier for the file
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
# Key identifier of the client associated with this file
client_id = Column(Integer, ForeignKey('client.id')) # for SQL
# Unique path to this file inside the database # Unique path to this file inside the database
path = Column(String(100), unique=True) path = Column(String(100), unique=True)
# Identifier of the session # Identifier of the session
session_id = Column(Integer) session = Column(Integer)
# Identifier of the device # Identifier of the device
device_choices = ('mobile', 'tablet') device_choices = ('iPhone', 'iPad')
device = Column(Enum(*device_choices)) device = Column(Enum(*device_choices))
modality_choices = ('face', 'voice', 'eye', 'finger')
modality = Column(Enum(*modality_choices))
camera_choices = ('rear', 'front')
camera = Column(Enum(*camera_choices))
recording_choices = ('video', 'photo')
recording = Column(Enum(*recording_choices))
nrecording = Column(Integer)
# Key identifier of the client associated with this file
client_id = Column(Integer, ForeignKey('client.id')) # for SQL
# For Python: A direct link to the client object that this file belongs to # For Python: A direct link to the client object that this file belongs to
client = relationship("Client", backref=backref("files", order_by=id)) client = relationship("Client", backref=backref("files", order_by=id))
def __init__(self, client_id, path, session_id, device): def __init__(self, path, client, session, device, modality,
camera, recording, nrecording):
# call base class constructor # call base class constructor
bob.db.base.File.__init__(self, path=path) bob.db.base.File.__init__(self, path=path)
# fill the remaining bits of the file information # fill the remaining bits of the file information
self.client_id = client_id self.client = client
self.session = session
self.device = device self.device = device
self.modality = modality
self.camera = camera
self.recording = recording
self.nrecording = nrecording
class Protocol(Base): class Protocol(Base):
......
This diff is collapsed.
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""Prints the version of bob and exits
"""
def main():
"""Main routine, called by the script that gets the configuration of bob.blitz"""
import bob.blitz
print (bob.blitz.get_config())
return 0
...@@ -3,3 +3,54 @@ ...@@ -3,3 +3,54 @@
"""Test Units """Test Units
""" """
from .query import Database
def test_idiap0_audio():
protocol = 'idiap0-audio'
db = Database()
files = db.objects(protocol=protocol, groups='world', purposes='train')
# 20 clients, 8 recordings, (2 devices in session 1 and 1 device in
# sessions 2-6) == like it is 1 device and 7 sessions
assert len(files) == 20 * 8 * 1 * 7, len(files)
assert len(set(f.client.id for f in files)) == 20
assert len(set(f.nrecording for f in files)) == 8
assert len(set(f.device for f in files)) == 2
assert len(set(f.session for f in files)) == 6
assert set(f.client.institute for f in files) == set(['IDIAP'])
assert all(f.client.orig_id < 25 for f in files)
files = db.objects(protocol=protocol, groups='dev', purposes='enroll')
assert len(files) == 15 * 8 * 1 * 1, len(files)
assert len(set(f.client.id for f in files)) == 15
assert len(set(f.nrecording for f in files)) == 8
assert len(set(f.device for f in files)) == 1
assert all(f.session == 1 for f in files)
assert set(f.client.institute for f in files) == set(['IDIAP'])
assert all(f.client.orig_id >= 25 and f.client.orig_id < 41 for f in files)
files = db.objects(protocol=protocol, groups='dev', purposes='probe')
assert len(files) == 15 * 8 * 1 * 5, len(files)
assert len(set(f.client.id for f in files)) == 15
assert len(set(f.nrecording for f in files)) == 8
assert len(set(f.device for f in files)) == 1
assert len(set(f.session for f in files)) == 5
assert all(f.session > 1 for f in files)
assert set(f.client.institute for f in files) == set(['IDIAP'])
assert all(f.client.orig_id >= 25 and f.client.orig_id < 41 for f in files)
files = db.objects(protocol=protocol, groups='eval', purposes='enroll')
assert len(files) == 15 * 8 * 1 * 1, len(files)
assert len(set(f.client.id for f in files)) == 15
assert len(set(f.nrecording for f in files)) == 8
assert len(set(f.device for f in files)) == 1
assert all(f.session == 1 for f in files)
assert set(f.client.institute for f in files) == set(['IDIAP'])
assert all(f.client.orig_id >= 41 and f.client.orig_id < 61 for f in files)
files = db.objects(protocol=protocol, groups='eval', purposes='probe')
assert len(files) == 15 * 8 * 1 * 5, len(files)
assert len(set(f.client.id for f in files)) == 15
assert len(set(f.nrecording for f in files)) == 8
assert len(set(f.device for f in files)) == 1
assert len(set(f.session for f in files)) == 5
assert all(f.session > 1 for f in files)
assert set(f.client.institute for f in files) == set(['IDIAP'])
assert all(f.client.orig_id >= 41 and f.client.orig_id < 61 for f in files)
...@@ -232,7 +232,6 @@ autodoc_member_order = 'bysource' ...@@ -232,7 +232,6 @@ autodoc_member_order = 'bysource'
autodoc_default_flags = [ autodoc_default_flags = [
'members', 'members',
'undoc-members', 'undoc-members',
'inherited-members',
'show-inheritance', 'show-inheritance',
] ]
......
.. vim: set fileencoding=utf-8 : .. vim: set fileencoding=utf-8 :
.. Andre Anjos <andre.anjos@idiap.ch>
.. Mon 13 Aug 2012 12:36:40 CEST
.. _bob.db.swan: .. _bob.db.swan:
===================== ==================================
Bob Example Project SWAN Database Access API for Bob
===================== ==================================
To use this database, you may need to download additional files:
.. code-block:: sh
$ bob_dbmanage.py swan download --missing
Package Documentation Package Documentation
--------------------- ---------------------
.. automodule:: bob.db.swan .. automodule:: bob.db.swan
.. automodule:: bob.db.swan.query
.. automodule:: bob.db.swan.models
py:class sqlalchemy.ext.declarative.api.Base
py:exc ValueError
setuptools setuptools
-egit+git@gitlab.idiap.ch:bob/bob.extension.git#egg=bob.extension -egit+git@gitlab.idiap.ch:bob/bob.extension.git#egg=bob.extension
bob.extension
-egit+git@gitlab.idiap.ch:bob/bob.blitz.git#egg=bob.blitz -egit+git@gitlab.idiap.ch:bob/bob.blitz.git#egg=bob.blitz
bob.blitz
-egit+git@gitlab.idiap.ch:bob/bob.core.git#egg=bob.core -egit+git@gitlab.idiap.ch:bob/bob.core.git#egg=bob.core
bob.core
-egit+git@gitlab.idiap.ch:bob/bob.io.base.git#egg=bob.io.base -egit+git@gitlab.idiap.ch:bob/bob.io.base.git#egg=bob.io.base
bob.io.base
-egit+git@gitlab.idiap.ch:bob/bob.io.image.git#egg=bob.io.image -egit+git@gitlab.idiap.ch:bob/bob.io.image.git#egg=bob.io.image
bob.io.image
-egit+git@gitlab.idiap.ch:bob/bob.io.video.git#egg=bob.io.video -egit+git@gitlab.idiap.ch:bob/bob.io.video.git#egg=bob.io.video
bob.io.video
-egit+git@gitlab.idiap.ch:bob/bob.db.base.git#egg=bob.db.base -egit+git@gitlab.idiap.ch:bob/bob.db.base.git#egg=bob.db.base
bob.db.base
-egit+git@gitlab.idiap.ch:bob/bob.bio.base.git#egg=bob.bio.base
bob.bio.base
-egit+git@gitlab.idiap.ch:bob/bob.bio.spear.git#egg=bob.bio.spear
bob.bio.spear
...@@ -12,7 +12,7 @@ setup( ...@@ -12,7 +12,7 @@ setup(
version=open("version.txt").read().rstrip(), version=open("version.txt").read().rstrip(),
description='SWAN Database Access API for Bob', description='SWAN Database Access API for Bob',
url='', url='https://gitlab.idiap.ch/bob/bob.db.swan',
license='BSD', license='BSD',
author='Amir Mohammadi', author='Amir Mohammadi',
author_email='amir.mohammadi@idiap.ch', author_email='amir.mohammadi@idiap.ch',
...@@ -37,10 +37,6 @@ setup( ...@@ -37,10 +37,6 @@ setup(
entry_points={ entry_points={
'bob.db': ['swan = bob.db.swan.driver:Interface'], 'bob.db': ['swan = bob.db.swan.driver:Interface'],
'console_scripts': [
'bob_db_swan_generate_filelist = '
'bob.db.swan.script.generate_filelist:main',
],
}, },
classifiers=[ classifiers=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment