Commit ae480e9c authored by André Anjos's avatar André Anjos 💬

Merge branch 'add_new_full_protocol' into 'master'

Add new full protocol

See merge request !7
parents 2174a5f9 65769016
Pipeline #11838 passed with stages
in 30 minutes and 44 seconds
...@@ -62,7 +62,7 @@ def add_protocols(session, file_list, verbose): ...@@ -62,7 +62,7 @@ def add_protocols(session, file_list, verbose):
"""Adds protocols""" """Adds protocols"""
# 2. ADDITIONS TO THE SQL DATABASE # 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: for proto in protocol_list:
p = Protocol(proto) p = Protocol(proto)
# Add protocol # Add protocol
...@@ -457,6 +457,28 @@ def add_protocols(session, file_list, verbose): ...@@ -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 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): def create_tables(args):
"""Creates all necessary tables (only to be used at the first time)""" """Creates all necessary tables (only to be used at the first time)"""
......
...@@ -32,6 +32,8 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -32,6 +32,8 @@ class Database(bob.db.base.SQLiteDatabase):
if protocol == '1vsall': if protocol == '1vsall':
return ('world', 'dev') return ('world', 'dev')
elif protocol == 'full':
return('dev')
else: else:
return ('world', 'dev', 'eval') return ('world', 'dev', 'eval')
...@@ -51,6 +53,7 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -51,6 +53,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex`` * ``nomRightIndex``
* ``nomRightMiddle`` * ``nomRightMiddle``
* ``nomRightRing`` * ``nomRightRing``
* ``full``
groups (:py:class:`str`, Optional): ignored (The clients belong both to groups (:py:class:`str`, Optional): ignored (The clients belong both to
``world`` and ``dev``) ``world`` and ``dev``)
...@@ -102,6 +105,7 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -102,6 +105,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex`` * ``nomRightIndex``
* ``nomRightMiddle`` * ``nomRightMiddle``
* ``nomRightRing`` * ``nomRightRing``
* ``full``
groups (:py:class:`str`, optional): Groups the clients belong to. Should groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of: be one of:
...@@ -133,6 +137,7 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -133,6 +137,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex`` * ``nomRightIndex``
* ``nomRightMiddle`` * ``nomRightMiddle``
* ``nomRightRing`` * ``nomRightRing``
* ``full``
groups (:py:class:`str`, optional): Groups the clients belong to. Should groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of: be one of:
...@@ -177,6 +182,7 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -177,6 +182,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex`` * ``nomRightIndex``
* ``nomRightMiddle`` * ``nomRightMiddle``
* ``nomRightRing`` * ``nomRightRing``
* ``full``
groups (:py:class:`str`, optional): Groups the clients belong to. Should groups (:py:class:`str`, optional): Groups the clients belong to. Should
be one of: be one of:
...@@ -238,6 +244,7 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -238,6 +244,7 @@ class Database(bob.db.base.SQLiteDatabase):
* ``nomRightIndex`` * ``nomRightIndex``
* ``nomRightMiddle`` * ``nomRightMiddle``
* ``nomRightRing`` * ``nomRightRing``
* ``full``
purposes (:py:class:`str`, :py:class:`list`, optional): One or several purposes (:py:class:`str`, :py:class:`list`, optional): One or several
of: of:
...@@ -384,3 +391,4 @@ class Database(bob.db.base.SQLiteDatabase): ...@@ -384,3 +391,4 @@ class Database(bob.db.base.SQLiteDatabase):
def purposes(self): def purposes(self):
return ('train', 'enroll', 'probe') 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