Commit b59ab3fb authored by Philip ABBET's avatar Philip ABBET

Overall changes to the databases

parent 77907d16
......@@ -189,14 +189,14 @@ class Templates:
"""Outputs:
- image: "{{ system_user.username }}/array_2d_uint8/1"
- file_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
- template_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
- (optional) eye_centers: "{{ system_user.username }}/eye_positions/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -208,14 +208,14 @@ class Templates:
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -228,17 +228,18 @@ class Templates:
# Open the database and load the objects to provide via the outputs
self.db = bob.db.atnt.Database()
template_ids = sorted(self.db.model_ids(groups='dev'), key=lambda x: int(x))
template_ids = self.db.model_ids(groups='dev')
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(groups='dev', purposes='enroll',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(groups='dev', purposes='enroll',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -530,8 +531,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'image',
],
......@@ -540,8 +541,8 @@ if __name__ == '__main__':
DatabaseTester('Templates (with eye centers)', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'eye_centers',
'image',
......
......@@ -98,12 +98,12 @@ class Templates:
"""Outputs:
- keystroke: "{{ user.username }}/atvs_keystroke/1
- file_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/text/1"
- template_id: "{{ system_user.username }}/text/1"
- client_id: "{{ system_user.username }}/text/1"
One "file_id" is associated with a given "keystroke".
Several "keystroke" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "keystroke" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| keystroke | | keystroke | | keystroke | | keystroke | | keystroke | | keystroke |
......@@ -112,14 +112,14 @@ class Templates:
| file_id | | file_id | | file_id | | file_id | | file_id | | file_id |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -133,21 +133,21 @@ class Templates:
# Open the database and load the objects to provide via the outputs
self.db = bob.db.atvskeystroke.Database()
template_ids = sorted(self.db.model_ids(groups='eval',
protocol=parameters['protocol']),
key=lambda x: int(x))
template_ids = self.db.model_ids(groups='eval',
protocol=parameters['protocol'])
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(groups='eval',
protocol=self.parameters['protocol'],
purposes='enrol',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(groups='eval',
protocol=self.parameters['protocol'],
purposes='enrol',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -296,7 +296,7 @@ class Probes:
if obj.id in template_probes[template_id] ]
self.objs.append( (templates, obj) )
self.objs = sorted(self.objs, key=lambda x: (x[0], x[1].client_id, x[1].id))
self.objs = sorted(self.objs, key=lambda x: (len(x[0]), x[0], x[1].client_id, x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
......@@ -410,8 +410,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'keystroke',
],
......
......@@ -178,12 +178,12 @@ class RecognitionTemplates:
"""Outputs:
- speech: "{{ system_user.username }}/array_1d_floats/1"
- file_id: "{{ system_user.username }}/text/1"
- client_id: "{{ system_user.username }}/text/1"
- template_id: "{{ system_user.username }}/text/1"
- client_id: "{{ system_user.username }}/text/1"
One "file_id" is associated with a given "speech".
Several "speech" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "speech" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| speech | | speech | | speech | | speech | | speech | | speech |
......@@ -192,14 +192,14 @@ class RecognitionTemplates:
| file_id | | file_id | | file_id | | file_id | | file_id | | file_id |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -221,19 +221,20 @@ class RecognitionTemplates:
if parameters['group'] == "test":
template_ids = sorted([18, 33])
else:
template_ids = sorted([ client.id for client in self.db.clients(groups=self.parameters['group']) ])
template_ids = [ client.id for client in self.db.clients(groups=self.parameters['group']) ]
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(groups=self.parameters['group'],
protocol=self.parameters['protocol'],
cls=self.parameters['purpose'],
clients=(template_id,)),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(groups=self.parameters['group'],
protocol=self.parameters['protocol'],
cls=self.parameters['purpose'],
clients=(template_id,))
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -691,8 +692,8 @@ if __name__ == '__main__':
DatabaseTester('RecognitionTemplates', RecognitionTemplates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'speech',
],
......
......@@ -194,13 +194,13 @@ class Templates:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/uint64/1"
- eye_centers: "{{ system_user.username }}/eye_positions/1"
- client_id: "{{ system_user.username }}/uint64/1"
- template_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -212,14 +212,14 @@ class Templates:
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -233,21 +233,21 @@ class Templates:
# Open the database and load the objects to provide via the outputs
self.db = bob.db.banca.Database()
template_ids = sorted(self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group']),
key=lambda x: int(x))
template_ids = self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group'])
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enroll',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enroll',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -414,7 +414,7 @@ class Probes:
if obj.id in template_probes[template_id] ]
self.objs.append( (templates, obj) )
self.objs = sorted(self.objs, key=lambda x: (x[0], x[1].client_id, x[1].id))
self.objs = sorted(self.objs, key=lambda x: (len(x[0]), x[0], x[1].client_id, x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
......@@ -553,8 +553,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'eye_centers',
'image',
......
......@@ -172,12 +172,12 @@ class Templates:
"""Outputs:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
- template_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
One "file_id" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -186,14 +186,14 @@ class Templates:
| file_id | | file_id | | file_id | | file_id | | file_id | | file_id |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -207,21 +207,21 @@ class Templates:
# Open the database and load the objects to provide via the outputs
self.db = bob.db.biosecurid.face.Database()
template_ids = sorted(self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group']),
key=lambda x: int(x))
template_ids = self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group'])
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enrol',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enrol',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......
This diff is collapsed.
......@@ -202,13 +202,13 @@ class Templates:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/text/1"
- eye_centers: "{{ system_user.username }}/eye_positions/1"
- client_id: "{{ system_user.username }}/text/1"
- template_id: "{{ system_user.username }}/text/1"
- client_id: "{{ system_user.username }}/text/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -220,10 +220,10 @@ class Templates:
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
"""
......@@ -240,21 +240,21 @@ class Templates:
annotation_directory=os.path.join(root_folder, 'annotations')
)
template_ids = sorted(self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group']),
key=lambda x: int(x))
template_ids = self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group'])
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enroll',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enroll',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -428,7 +428,7 @@ class Probes:
if obj.id in template_probes[template_id] ]
self.objs.append( (templates, obj) )
self.objs = sorted(self.objs, key=lambda x: (x[0], x[1].client_id, x[1].id))
self.objs = sorted(self.objs, key=lambda x: (len(x[0]), x[0], x[1].client_id, x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
......@@ -580,8 +580,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'eye_centers',
'image',
......
......@@ -204,13 +204,13 @@ class Templates:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/uint64/1"
- eye_centers: "{{ system_user.username }}/eye_positions/1"
- client_id: "{{ system_user.username }}/uint64/1"
- template_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -222,14 +222,14 @@ class Templates:
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -246,20 +246,21 @@ class Templates:
self.db = bob.db.cpqd.Database()
template_ids = sorted(self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group']))
template_ids = self.db.model_ids(protocol=parameters['protocol'],
groups=parameters['group'])
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enroll',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(protocol=parameters['protocol'],
groups=parameters['group'],
purposes='enroll',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -432,7 +433,7 @@ class Probes:
if obj.id in template_probes[template_id] ]
self.objs.append( (templates, obj) )
self.objs = sorted(self.objs, key=lambda x: (x[0], x[1].client_id, x[1].id))
self.objs = sorted(self.objs, key=lambda x: (len(x[0]), x[0], x[1].client_id, x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
......@@ -587,8 +588,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'eye_centers',
'image',
......
......@@ -200,13 +200,13 @@ class Templates:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/text/1"
- eye_centers: "{{ system_user.username }}/eye_positions/1"
- client_id: "{{ system_user.username }}/text/1"
- template_id: "{{ system_user.username }}/text/1"
- client_id: "{{ system_user.username }}/text/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -218,10 +218,10 @@ class Templates:
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
"""
......@@ -236,22 +236,23 @@ class Templates:
# Open the database and load the objects to provide via the outputs
self.db = bob.db.frgc.Database()
template_ids = sorted(self.db.model_ids(protocol=parameters['protocol'],
groups='dev',
mask_type=parameters['mask']))
template_ids = self.db.model_ids(protocol=parameters['protocol'],
groups='dev',
mask_type=parameters['mask'])
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(protocol=parameters['protocol'],
groups='dev',
purposes='enroll',
mask_type=parameters['mask'],
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(protocol=parameters['protocol'],
groups='dev',
purposes='enroll',
mask_type=parameters['mask'],
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -425,7 +426,7 @@ class Probes:
if obj.id in template_probes[template_id] ]
self.objs.append( (templates, obj) )
self.objs = sorted(self.objs, key=lambda x: (x[0], x[1].client_id, x[1].id))
self.objs = sorted(self.objs, key=lambda x: (len(x[0]), x[0], x[1].client_id, x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
......@@ -577,8 +578,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',
'template_id',
'file_id',
'eye_centers',
'image',
......
......@@ -196,13 +196,13 @@ class Templates:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/uint64/1"
- eye_centers: "{{ system_user.username }}/eye_positions/1"
- client_id: "{{ system_user.username }}/uint64/1"
- template_id: "{{ system_user.username }}/uint64/1"
- client_id: "{{ system_user.username }}/uint64/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
Several "client_id" are associated with a given "template_id".
Several "image" are associated with a given "template_id".
Several "template_id" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
......@@ -214,14 +214,14 @@ class Templates:
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
| template_id | | template_id |
----------------------------------------------- -----------------------------------------------
-----------------------------------------------------------------------------------------------
| template_id |
| client_id |
-----------------------------------------------------------------------------------------------
Note: for this particular database, there is only one "client_id"
per "template_id".
Note: for this particular database, there is only one "template_id"
per "client_id".
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
......@@ -235,21 +235,21 @@ class Templates:
# Open the database and load the objects to provide via the outputs
self.db = bob.db.gbu.Database()
template_ids = sorted(self.db.model_ids(protocol=parameters['protocol'],
groups='dev'),
key=lambda x: int(x))
template_ids = self.db.model_ids(protocol=parameters['protocol'],
groups='dev')
self.objs = []
for template_id in template_ids:
objs = sorted(self.db.objects(protocol=parameters['protocol'],
groups='dev',
purposes='enroll',
model_ids=[template_id]),
key=lambda x: (x.client_id, x.id))
objs = self.db.objects(protocol=parameters['protocol'],
groups='dev',
purposes='enroll',
model_ids=[template_id])
self.objs.extend([ (template_id, obj) for obj in objs ])
self.objs = sorted(self.objs, key=lambda x: (x[1].client_id, x[0], x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
self.end_index = force_end_index if force_end_index is not None else len(self.objs) - 1
......@@ -416,7 +416,7 @@ class Probes:
if obj.id in template_probes[template_id] ]
self.objs.append( (templates, obj) )
self.objs = sorted(self.objs, key=lambda x: (x[0], x[1].client_id, x[1].id))
self.objs = sorted(self.objs, key=lambda x: (len(x[0]), x[0], x[1].client_id, x[1].id))
# Determine the range of indices that must be provided
self.start_index = force_start_index if force_start_index is not None else 0
......@@ -558,8 +558,8 @@ if __name__ == '__main__':
DatabaseTester('Templates', Templates,
[
'template_id',
'client_id',