Commit 65769016 authored by Vedrana KRIVOKUCA's avatar Vedrana KRIVOKUCA

Add new full protocol for UTFVP database

parent 89f4dfee
Pipeline #11772 passed with stages
in 33 minutes and 21 seconds
......@@ -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']
protocol_list = ['1vsall', 'nom','nomLeftRing','nomLeftMiddle','nomLeftIndex','nomRightIndex','nomRightMiddle','nomRightRing', 'full']
for proto in protocol_list:
p = Protocol(proto)
# Add protocol
......@@ -457,6 +457,28 @@ def add_protocols(session, file_list, verbose):
if verbose>1: print(" Adding file ('%s') to protocol purpose ('%s', '%s','%s')..." % (f_file.path, p.name, 'world', 'train'))
if proto == 'full': # calculate match score between every client (model) and every probe (no training/world set)
model_dict = {}
for f_file in file_list:
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.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'))
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()
def create_tables(args):
"""Creates all necessary tables (only to be used at the first time)"""
......
......@@ -32,6 +32,8 @@ class Database(bob.db.base.SQLiteDatabase):
if protocol == '1vsall':
return ('world', 'dev')
elif protocol == 'full':
return('dev')
else:
return ('world', 'dev', 'eval')
......@@ -51,6 +53,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
groups (:py:class:`str`, Optional): ignored (The clients belong both to
``world`` and ``dev``)
......@@ -102,6 +105,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of:
......@@ -133,6 +137,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of:
......@@ -177,6 +182,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of:
......@@ -238,6 +244,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex``
* ``nomRightMiddle``
* ``nomRightRing``
* ``full``
purposes (:py:class:`str`, :py:class:`list`, optional): One or several
of:
......@@ -384,3 +391,4 @@ class Database(bob.db.base.SQLiteDatabase):
def purposes(self):
return ('train', 'enroll', 'probe')
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