Commit 322bd9f3 authored by André Anjos's avatar André Anjos 💬

Merge branch 'add_full_protocols_for_individual_finger_types' into 'master'

Add new full protocols for individual finger types for UTFVP database

See merge request !10
parents d0c90689 62f8b74e
Pipeline #12327 passed with stages
in 76 minutes and 47 seconds
......@@ -15,5 +15,28 @@ def get_config():
return bob.extension.get_config(__name__)
# gets sphinx autodoc done right - don't remove it
def __appropriate__(*args):
"""Says object was actually declared here, an not on the import module.
Parameters:
*args: An iterable of objects to modify
Resolves `Sphinx referencing issues
<https://github.com/sphinx-doc/sphinx/issues/3048>`
"""
for obj in args: obj.__module__ = __name__
__appropriate__(
Database,
Client,
File,
Protocol,
Model,
)
# gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')]
......@@ -62,7 +62,7 @@ def add_protocols(session, file_list, verbose):
"""Adds protocols"""
# 2. ADDITIONS TO THE SQL DATABASE
protocol_list = ['1vsall', 'nom','nomLeftRing','nomLeftMiddle','nomLeftIndex','nomRightIndex','nomRightMiddle','nomRightRing', 'full']
protocol_list = ['1vsall', 'nom','nomLeftRing','nomLeftMiddle','nomLeftIndex','nomRightIndex','nomRightMiddle','nomRightRing', 'full', 'fullLeftRing', 'fullLeftMiddle', 'fullLeftIndex', 'fullRightIndex', 'fullRightMiddle', 'fullRightRing']
for proto in protocol_list:
p = Protocol(proto)
# Add protocol
......@@ -72,34 +72,34 @@ def add_protocols(session, file_list, verbose):
session.refresh(p)
if proto == '1vsall':
# Helper function
# Helper function
def isWorldFile(f_file):
return f_file.client.subclient_id <= 35 and f_file.finger_id == ((f_file.client.subclient_id-1) % 6) + 1
return f_file.client.subclient_id <= 35 and f_file.finger_id == ((f_file.client.subclient_id-1) % 6) + 1 # defines what it means for file to belong to "world" class
model_dict = {}
for f_file in file_list:
if not isWorldFile(f_file):
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
model_dict = {} # dictionary of models
for f_file in file_list: # for every file in the database
if not isWorldFile(f_file): # if the file does not belong to the "world" class, then continue processing it
model_id = "%s_%d" % (f_file.client_id, f_file.session_id) # the ID of the model as personID_finger_ID_session_ID
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
if not model_id in model_dict: # if we haven't already stored the model in the model dictionary ...
model = Model(model_id, f_file.client_id, 'dev') # create a model for this particular file
p.models.append(model) # add the model to the list of models for this particular protocol
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.id != f_file.id and not isWorldFile(f_pfile):
model.probe_files.append(f_pfile)
for f_pfile in file_list: # for every file in the database
if f_pfile.id != f_file.id and not isWorldFile(f_pfile): # if the file is not the same as the current model file and it is not in the "world" group ...
model.probe_files.append(f_pfile) # add the file to the list of probe files for this particular model
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
model_dict[model_id] = model
model_dict[model_id] = model # add this model to the model dictionary, indexed by its model id
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
model_dict[model_id].enrollment_files.append(f_file) # add the enrollment files associated with this model
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
else:
p.train_files.append(f_file)
p.train_files.append(f_file) # if the file is part of the "world" group then add it to the training set
if verbose>1: print(" Adding file ('%s') to protocol purpose ('%s', '%s','%s')..." % (f_file.path, p.name, 'world', 'train'))
......@@ -479,6 +479,181 @@ def add_protocols(session, file_list, verbose):
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
if proto == 'fullLeftRing': # calculate match score between every client (model) and every probe (no training/world set) using only the Left Ring fingers
model_dict = {}
for f_file in file_list:
if f_file.finger_id == 1: # ensures only Left Ring fingers are used
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.finger_id == 1:
if f_pfile.id != f_file.id:
model.probe_files.append(f_pfile)
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
elif f_pfile.finger_id != 1:
continue
model_dict[model_id] = model
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
elif f_file.session_id != 1:
continue
if proto == 'fullLeftMiddle': # calculate match score between every client (model) and every probe (no training/world set) using only the Left Middle fingers
model_dict = {}
for f_file in file_list:
if f_file.finger_id == 2: # ensures only Left Middle fingers are used
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.finger_id == 2:
if f_pfile.id != f_file.id:
model.probe_files.append(f_pfile)
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
elif f_pfile.finger_id != 2:
continue
model_dict[model_id] = model
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
elif f_file.session_id != 2:
continue
if proto == 'fullLeftIndex': # calculate match score between every client (model) and every probe (no training/world set) using only the Left Index fingers
model_dict = {}
for f_file in file_list:
if f_file.finger_id == 3: # ensures only Left Index fingers are used
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.finger_id == 3:
if f_pfile.id != f_file.id:
model.probe_files.append(f_pfile)
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
elif f_pfile.finger_id != 3:
continue
model_dict[model_id] = model
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
elif f_file.session_id != 3:
continue
if proto == 'fullRightIndex': # calculate match score between every client (model) and every probe (no training/world set) using only the Right Index fingers
model_dict = {}
for f_file in file_list:
if f_file.finger_id == 4: # ensures only Right Index fingers are used
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.finger_id == 4:
if f_pfile.id != f_file.id:
model.probe_files.append(f_pfile)
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
elif f_pfile.finger_id != 4:
continue
model_dict[model_id] = model
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
elif f_file.session_id != 4:
continue
if proto == 'fullRightMiddle': # calculate match score between every client (model) and every probe (no training/world set) using only the Right Middle fingers
model_dict = {}
for f_file in file_list:
if f_file.finger_id == 5: # ensures only Right Middle fingers are used
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.finger_id == 5:
if f_pfile.id != f_file.id:
model.probe_files.append(f_pfile)
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
elif f_pfile.finger_id != 5:
continue
model_dict[model_id] = model
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
elif f_file.session_id != 5:
continue
if proto == 'fullRightRing': # calculate match score between every client (model) and every probe (no training/world set) using only the Right Ring fingers
model_dict = {}
for f_file in file_list:
if f_file.finger_id == 6: # ensures only Right Ring fingers are used
model_id = "%s_%d" % (f_file.client_id, f_file.session_id)
if verbose>1: print(" Adding Model '%s'..." %(model_id, ))
if not model_id in model_dict:
model = Model(model_id, f_file.client_id, 'dev')
p.models.append(model)
session.add(model)
session.flush()
session.refresh(model)
# Append probe files
for f_pfile in file_list:
if f_pfile.finger_id == 6:
if f_pfile.id != f_file.id:
model.probe_files.append(f_pfile)
if verbose>1: print(" Adding probe entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_pfile.path, model_id, p.name, 'dev', 'probe'))
elif f_pfile.finger_id != 6:
continue
model_dict[model_id] = model
# Append enrollment file
model_dict[model_id].enrollment_files.append(f_file)
if verbose>1: print(" Adding enrollment entry ('%s') to Model ('%s') for protocol purpose ('%s', '%s','%s')..." % (f_file.path, model_id, p.name, 'dev', 'enroll'))
session.flush()
elif f_file.session_id != 6:
continue
def create_tables(args):
"""Creates all necessary tables (only to be used at the first time)"""
......@@ -523,3 +698,4 @@ def add_command(subparsers):
parser.add_argument('-D', '--imagedir', metavar='DIR', default='/idiap/resource/database/UTFVP/data', help="Change the relative path to the directory containing the images of the UTFVP database (defaults to %(default)s)")
parser.set_defaults(func=create) #action
......@@ -32,7 +32,7 @@ class Database(bob.db.base.SQLiteDatabase):
if protocol == '1vsall':
return ('world', 'dev')
elif protocol == 'full':
elif protocol == 'full' or protocol == 'fullLeftRing' or protocol == 'fullLeftMiddle' or protocol == 'fullLeftIndex' or protocol == 'fullRightIndex' or protocol == 'fullRightMiddle' or protocol == 'fullRightRing':
return('dev')
else:
return ('world', 'dev', 'eval')
......@@ -53,7 +53,13 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
* ``full``
* ``fullLeftRing``
* ``fullLeftMiddle``
* ``fullLeftIndex``
* ``fullRightIndex``
* ``fullRightMiddle``
* ``fullRightRing``
groups (:py:class:`str`, Optional): ignored (The clients belong both to
``world`` and ``dev``)
......@@ -105,7 +111,13 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
* ``full``
* ``fullLeftRing``
* ``fullLeftMiddle``
* ``fullLeftIndex``
* ``fullRightIndex``
* ``fullRightMiddle``
* ``fullRightRing``
groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of:
......@@ -137,7 +149,13 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
* ``full``
* ``fullLeftRing``
* ``fullLeftMiddle``
* ``fullLeftIndex``
* ``fullRightIndex``
* ``fullRightMiddle``
* ``fullRightRing``
groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of:
......@@ -182,7 +200,13 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
* ``full``
* ``fullLeftRing``
* ``fullLeftMiddle``
* ``fullLeftIndex``
* ``fullRightIndex``
* ``fullRightMiddle``
* ``fullRightRing``
groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of:
......@@ -244,7 +268,13 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
* ``full``
* ``fullLeftRing``
* ``fullLeftMiddle``
* ``fullLeftIndex``
* ``fullRightIndex``
* ``fullRightMiddle``
* ``fullRightRing``
purposes (:py:class:`str`, :py:class:`list`, optional): One or several
of:
......
......@@ -58,8 +58,8 @@ def test_clients():
db = Database()
nose.tools.eq_(len(db.groups()), 3)
nose.tools.eq_(len(db.protocols()), 9)
nose.tools.eq_(len(db.protocol_names()), 9)
nose.tools.eq_(len(db.protocols()), 15)
nose.tools.eq_(len(db.protocol_names()), 15)
nose.tools.eq_(len(db.purposes()), 3)
nose.tools.eq_(len(db.clients()), 360)
......@@ -72,6 +72,12 @@ def test_clients():
nose.tools.eq_(len(db.clients(protocol='nomRightMiddle')), 60)
nose.tools.eq_(len(db.clients(protocol='nomRightRing')), 60)
nose.tools.eq_(len(db.clients(protocol='full')), 360)
nose.tools.eq_(len(db.clients(protocol='fullLeftRing')), 60)
nose.tools.eq_(len(db.clients(protocol='fullLeftMiddle')), 60)
nose.tools.eq_(len(db.clients(protocol='fullLeftIndex')), 60)
nose.tools.eq_(len(db.clients(protocol='fullRightIndex')), 60)
nose.tools.eq_(len(db.clients(protocol='fullRightMiddle')), 60)
nose.tools.eq_(len(db.clients(protocol='fullRightRing')), 60)
nose.tools.eq_(len(db.client_ids()), 360)
nose.tools.eq_(len(db.client_ids(protocol='1vsall')), 360)
......@@ -83,8 +89,14 @@ def test_clients():
nose.tools.eq_(len(db.client_ids(protocol='nomRightMiddle')), 60)
nose.tools.eq_(len(db.client_ids(protocol='nomRightRing')), 60)
nose.tools.eq_(len(db.client_ids(protocol='full')), 360)
nose.tools.eq_(len(db.models()), 3340) #1300 + 300 + 50 * 6 + 1440
nose.tools.eq_(len(db.client_ids(protocol='fullLeftRing')), 60)
nose.tools.eq_(len(db.client_ids(protocol='fullLeftMiddle')), 60)
nose.tools.eq_(len(db.client_ids(protocol='fullLeftIndex')), 60)
nose.tools.eq_(len(db.client_ids(protocol='fullRightIndex')), 60)
nose.tools.eq_(len(db.client_ids(protocol='fullRightMiddle')), 60)
nose.tools.eq_(len(db.client_ids(protocol='fullRightRing')), 60)
nose.tools.eq_(len(db.models()), 4780) #1300 + 300 + 50 * 6 + 1440 + 240 * 6
nose.tools.eq_(len(db.models(protocol='1vsall')), 1300) # (35 clients * 5 fingers per client * 4 samples per finger) + (25 clients * 6 fingers per client * 4 samples per finger)
nose.tools.eq_(len(db.models(protocol='nom')), 300) # (1 model per finger * 6 fingers per client) * (18 "dev" clients + 32 "eval" clients)
nose.tools.eq_(len(db.models(protocol='nomLeftRing')), 50) # 1 model per client * (18 "dev" clients + 32 "eval" clients)
......@@ -94,8 +106,14 @@ def test_clients():
nose.tools.eq_(len(db.models(protocol='nomRightMiddle')), 50) # 1 model per client * (18 "dev" clients + 32 "eval" clients)
nose.tools.eq_(len(db.models(protocol='nomRightRing')), 50) # 1 model per client * (18 "dev" clients + 32 "eval" clients)
nose.tools.eq_(len(db.models(protocol='full')), 1440) # 60 clients * 6 fingers per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids()), 3340) #1300 + 300 + 50 * 6 + 1440
nose.tools.eq_(len(db.models(protocol='fullLeftRing')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.models(protocol='fullLeftMiddle')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.models(protocol='fullLeftIndex')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.models(protocol='fullRightIndex')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.models(protocol='fullRightMiddle')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.models(protocol='fullRightRing')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids()), 4780) #1300 + 300 + 50 * 6 + 1440 + 240 * 6
nose.tools.eq_(len(db.model_ids(protocol='1vsall')), 1300)
nose.tools.eq_(len(db.model_ids(protocol='nom')), 300)
nose.tools.eq_(len(db.model_ids(protocol='nom', groups='dev')), 108) #18 subjects *6 fingers
......@@ -127,6 +145,13 @@ def test_clients():
nose.tools.eq_(len(db.model_ids(protocol='full')), 1440)
nose.tools.eq_(len(db.model_ids(protocol='fullLeftRing')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids(protocol='fullLeftMiddle')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids(protocol='fullLeftIndex')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids(protocol='fullRightIndex')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids(protocol='fullRightMiddle')), 240) # 60 clients * 1 finger per client * 4 samples per finger
nose.tools.eq_(len(db.model_ids(protocol='fullRightRing')), 240) # 60 clients * 1 finger per client * 4 samples per finger
@sql3_available
def test_objects():
......@@ -380,6 +405,108 @@ def test_objects_5():
nose.tools.eq_(len(db.objects(protocol='full', groups='dev', model_ids=('1_2_3',), purposes='probe', classes='impostor')), 1436) # 1440 total samples - 4 genuine samples
@sql3_available
def test_objects_6():
# tests if the right number of File objects is returned
db = Database()
#####################################################
# Protocol 'fullLeftRing'
nose.tools.eq_(len(db.objects(protocol='fullLeftRing')), 240) # 60 clients * 1 finger per client * 4 samples per finger
# Dev group
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', model_ids=('1_1_1',))), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', purposes='enroll')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', model_ids=('1_1_1',), purposes='enroll')), 1)
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', model_ids=('1_1_1',), purposes='probe')), 239)
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', purposes='probe', classes='impostor')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', model_ids=('1_1_1',), purposes='probe', classes='client')), 3) # 3 genuine comparisons per sample
nose.tools.eq_(len(db.objects(protocol='fullLeftRing', groups='dev', model_ids=('1_1_1',), purposes='probe', classes='impostor')), 236) # 240 total samples - 4 genuine samples
#####################################################
# Protocol 'fullLeftMiddle'
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle')), 240) # 60 clients * 1 finger per client * 4 samples per finger
# Dev group
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', model_ids=('1_2_1',))), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', purposes='enroll')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', model_ids=('1_2_1',), purposes='enroll')), 1)
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', model_ids=('1_2_1',), purposes='probe')), 239)
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', purposes='probe', classes='impostor')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', model_ids=('1_2_1',), purposes='probe', classes='client')), 3) # 3 genuine comparisons per sample
nose.tools.eq_(len(db.objects(protocol='fullLeftMiddle', groups='dev', model_ids=('1_2_1',), purposes='probe', classes='impostor')), 236) # 240 total samples - 4 genuine samples
#####################################################
# Protocol 'fullLeftIndex'
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex')), 240) # 60 clients * 1 finger per client * 4 samples per finger
# Dev group
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', model_ids=('1_3_1',))), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', purposes='enroll')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', model_ids=('1_3_1',), purposes='enroll')), 1)
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', model_ids=('1_3_1',), purposes='probe')), 239)
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', purposes='probe', classes='impostor')), 240)
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', model_ids=('1_3_1',), purposes='probe', classes='client')), 3) # 3 genuine comparisons per sample
nose.tools.eq_(len(db.objects(protocol='fullLeftIndex', groups='dev', model_ids=('1_3_1',), purposes='probe', classes='impostor')), 236) # 240 total samples - 4 genuine samples
@sql3_available
def test_objects_7():
# tests if the right number of File objects is returned
db = Database()
#####################################################
# Protocol 'fullRightIndex'
nose.tools.eq_(len(db.objects(protocol='fullRightIndex')), 240) # 60 clients * 1 finger per client * 4 samples per finger
# Dev group
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', model_ids=('1_4_1',))), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', purposes='enroll')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', model_ids=('1_4_1',), purposes='enroll')), 1)
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', model_ids=('1_4_1',), purposes='probe')), 239)
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', purposes='probe', classes='impostor')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', model_ids=('1_4_1',), purposes='probe', classes='client')), 3) # 3 genuine comparisons per sample
nose.tools.eq_(len(db.objects(protocol='fullRightIndex', groups='dev', model_ids=('1_4_1',), purposes='probe', classes='impostor')), 236) # 240 total samples - 4 genuine samples
#####################################################
# Protocol 'fullRightMiddle'
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle')), 240) # 60 clients * 1 finger per client * 4 samples per finger
# Dev group
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', model_ids=('1_5_1',))), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', purposes='enroll')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', model_ids=('1_5_1',), purposes='enroll')), 1)
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', model_ids=('1_5_1',), purposes='probe')), 239)
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', purposes='probe', classes='impostor')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', model_ids=('1_5_1',), purposes='probe', classes='client')), 3) # 3 genuine comparisons per sample
nose.tools.eq_(len(db.objects(protocol='fullRightMiddle', groups='dev', model_ids=('1_5_1',), purposes='probe', classes='impostor')), 236) # 240 total samples - 4 genuine samples
#####################################################
# Protocol 'fullRightRing'
nose.tools.eq_(len(db.objects(protocol='fullRightRing')), 240) # 60 clients * 1 finger per client * 4 samples per finger
# Dev group
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', model_ids=('1_6_1',))), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', purposes='enroll')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', model_ids=('1_6_1',), purposes='enroll')), 1)
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', model_ids=('1_6_1',), purposes='probe')), 239)
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', purposes='probe', classes='impostor')), 240)
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', model_ids=('1_6_1',), purposes='probe', classes='client')), 3) # 3 genuine comparisons per sample
nose.tools.eq_(len(db.objects(protocol='fullRightRing', groups='dev', model_ids=('1_6_1',), purposes='probe', classes='impostor')), 236) # 240 total samples - 4 genuine samples
@sql3_available
def test_driver_api():
......
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