Commit d46da634 authored by Pedro TOME's avatar Pedro TOME
Browse files

adding new protocol B

parent dd90ce97
......@@ -23,7 +23,7 @@ from setuptools import setup, find_packages
setup(
name='xbob.db.utfvp',
version='1.0.0',
version='1.1.0',
description='UTFVP Database Access API for Bob',
url='https://pypi.python.org/pypi/xbob.db.utfvp',
license='GPLv3',
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Laurent El Shafey <Laurent.El-Shafey@idiap.ch>
# Wed Feb 19 10:53:53 CET 2014
#
# Copyright (C) 2014 Idiap Research Institute, Martigny, Switzerland
#
......@@ -90,7 +89,7 @@ def add_files(session, imagedir, verbose):
def add_protocols(session, client_dict, model_dict, file_dict, verbose):
"""Adds protocols"""
# 2. ADDITIONS TO THE SQL DATABASE
protocol_list = ['master', 'paper']
protocol_list = ['master', 'paper', 'B']
protocolPurpose_list = [('world', 'train'), ('dev', 'enrol'), ('dev', 'probe')]
for proto in protocol_list:
p = Protocol(proto)
......@@ -111,12 +110,16 @@ def add_protocols(session, client_dict, model_dict, file_dict, verbose):
for f_id, f_file in cfile_dict.iteritems():
if f_file.client.subclient_id == 19 and proto == 'master':
continue
if not ((f_file.finger_id == 3 or f_file.finger_id == 4) and (f_file.session_id == 1 or f_file.session_id == 2)) and proto == 'B':
continue
if verbose>1: print(" Adding file ('%s') to protocol purpose ('%s', '%s','%s')..." % (f_file.path, p.name, purpose[0], purpose[1]))
pu.files.append(f_file)
for m_id, model in model_dict.iteritems():
if model.client.subclient_id == 19 and proto == 'master':
continue
if not ((model.file.finger_id == 3 or model.file.finger_id == 4) and (model.file.session_id == 1 or model.file.session_id == 2)) and proto == 'B':
continue
p.models.append(model)
......
......@@ -31,23 +31,27 @@ class UTFVPDatabaseTest(unittest.TestCase):
db = xbob.db.utfvp.Database()
self.assertEqual(len(db.groups()), 2)
self.assertEqual(len(db.protocols()), 2)
self.assertEqual(len(db.protocol_names()), 2)
self.assertEqual(len(db.protocols()), 3)
self.assertEqual(len(db.protocol_names()), 3)
self.assertEqual(len(db.purposes()), 3)
self.assertEqual(len(db.clients()), 360)
self.assertEqual(len(db.clients(protocol='master')), 354)
self.assertEqual(len(db.clients(protocol='paper')), 360)
self.assertEqual(len(db.clients(protocol='B')), 360)
self.assertEqual(len(db.client_ids()), 360)
self.assertEqual(len(db.client_ids(protocol='master')), 354)
self.assertEqual(len(db.client_ids(protocol='paper')), 360)
self.assertEqual(len(db.client_ids(protocol='B')), 360)
self.assertEqual(len(db.models()), 1300)
self.assertEqual(len(db.models(protocol='master')), 1276)
self.assertEqual(len(db.models(protocol='paper')), 1300)
self.assertEqual(len(db.models(protocol='B')), 216)
self.assertEqual(len(db.model_ids()), 1300)
self.assertEqual(len(db.model_ids(protocol='master')), 1276)
self.assertEqual(len(db.model_ids(protocol='paper')), 1300)
self.assertEqual(len(db.model_ids(protocol='B')), 216)
def test02_objects(self):
......@@ -66,6 +70,10 @@ class UTFVPDatabaseTest(unittest.TestCase):
self.assertEqual(len(db.objects(protocol='paper', groups='world')), 140)
self.assertEqual(len(db.objects(protocol='paper', groups='dev')), 1300)
self.assertEqual(len(db.objects(protocol='B')), 240)
self.assertEqual(len(db.objects(protocol='B', groups='world')), 24)
self.assertEqual(len(db.objects(protocol='B', groups='dev')), 216)
self.assertEqual(len(db.objects(protocol='master', groups='dev', model_ids=('1_2_3',))), 1276)
self.assertEqual(len(db.objects(protocol='master', groups='dev', model_ids=('1_2_3',), purposes='enrol')), 1)
self.assertEqual(len(db.objects(protocol='master', groups='dev', model_ids=('1_2_3',), purposes='probe')), 1275)
......@@ -78,6 +86,12 @@ class UTFVPDatabaseTest(unittest.TestCase):
self.assertEqual(len(db.objects(protocol='paper', groups='dev', model_ids=('1_2_3',), purposes='probe', classes='client')), 3)
self.assertEqual(len(db.objects(protocol='paper', groups='dev', model_ids=('1_2_3',), purposes='probe', classes='impostor')), 1296)
self.assertEqual(len(db.objects(protocol='B', groups='dev', model_ids=('1_3_1',))), 216)
self.assertEqual(len(db.objects(protocol='B', groups='dev', model_ids=('1_3_1',), purposes='enrol')), 1)
self.assertEqual(len(db.objects(protocol='B', groups='dev', model_ids=('1_3_1',), purposes='probe')), 215)
self.assertEqual(len(db.objects(protocol='B', groups='dev', model_ids=('1_3_1',), purposes='probe', classes='client')), 1)
self.assertEqual(len(db.objects(protocol='B', groups='dev', model_ids=('1_3_1',), purposes='probe', classes='impostor')), 214)
def test03_driver_api(self):
from bob.db.script.dbmanage import main
......@@ -86,4 +100,3 @@ class UTFVPDatabaseTest(unittest.TestCase):
self.assertEqual(main('utfvp checkfiles --self-test'.split()), 0)
self.assertEqual(main('utfvp reverse 0001/0001_1_1_120509-135315 --self-test'.split()), 0)
self.assertEqual(main('utfvp path 37 --self-test'.split()), 0)
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