Commit ff10845f authored by André Anjos's avatar André Anjos 💬
Browse files

Updates to support stitched protocol

parent bfb88631
Pipeline #10451 failed with stages
in 10 minutes and 16 seconds
......@@ -36,7 +36,7 @@ def add_clients(session, verbose):
print("Created %s" % client)
FILENAME_RE = re.compile(r'^(?P<id>\d{3})\-(?P<age>\d{3})\-(?P<gender>[fm])(?P<skin>[1-6x])(?P<occ>[0-9x])(?P<side>[lr])(?P<finger>[timlr])(?P<session>[1-3])(?P<attempt>[1-5])(?P<snap>[1-5])(?P<cam>[1-3])$')
FILENAME_RE = re.compile(r'^(?P<id>\d{3})\-(?P<age>\d{3})\-(?P<gender>[fm])(?P<skin>[1-6x])(?P<occ>[0-9x])(?P<side>[lr])(?P<finger>[timlr])(?P<session>[1-3])(?P<attempt>[1-5])(?P<snap>[1-5])(?P<cam>[1-3S])$')
def try_get_metadata(path):
'''Returns the metadata from a path or ``None`` if no match occurs'''
......@@ -56,7 +56,7 @@ def try_get_metadata(path):
'session': str(int(m.group('session'))),
'attempt': str(int(m.group('attempt'))),
'snap': str(int(m.group('snap'))),
'cam': str(int(m.group('cam'))),
'cam': m.group('cam'),
}
......@@ -143,6 +143,8 @@ def add_protocols(session, verbose):
model = Model(model_ref.decode(), 'dev', file_.finger, protocol)
if verbose:
print("Created model %s" % (model,))
else:
model = model.one()
model.files.append(file_)
if verbose:
print("Added %s to %s" % (file_, model))
......
......@@ -188,7 +188,7 @@ class File(Base, bob.db.base.File):
* session = int > 0
* attempt = int > 0
* snap = int > 0
* cam = int, one of 1, 2 or 3
* cam = str, one of '1', '2', '3' or 'S' ('stitched')
"""
......@@ -208,7 +208,7 @@ class File(Base, bob.db.base.File):
snapshot_choices = ('1', '2', '3', '4', '5')
snapshot = Column(Enum(*snapshot_choices))
camera_choices = ('1', '2', '3')
camera_choices = ('1', '2', '3', 'S')
camera = Column(Enum(*camera_choices))
UniqueConstraint('finger_id', 'session', 'attempt', 'snapshot', 'camera')
......
......@@ -104,11 +104,11 @@ class Database(bob.db.base.SQLiteDatabase):
groups = tuple(k for k in groups if k != 'train')
valid_protocols = self.protocol_names()
protocols = self.check_parameters_for_validity(protocol, "protocol",
valid_protocols)
protocols = bob.db.base.utils.check_parameters_for_validity(protocol,
"protocol", valid_protocols)
valid_groups = Model.group_choices
groups = self.check_parameters_for_validity(groups, "group",
groups = bob.db.base.utils.check_parameters_for_validity(groups, "group",
valid_groups)
retval = self.query(Model).join(Protocol)
......@@ -170,16 +170,18 @@ class Database(bob.db.base.SQLiteDatabase):
"""
import ipdb; ipdb.set_trace()
valid_protocols = self.protocol_names()
protocols = self.check_parameters_for_validity(protocol, "protocol",
valid_protocols)
protocols = bob.db.base.utils.check_parameters_for_validity(protocol,
"protocol", valid_protocols)
valid_groups = self.groups()
groups = self.check_parameters_for_validity(groups, "group", valid_groups)
groups = bob.db.base.utils.check_parameters_for_validity(groups, "group",
valid_groups)
valid_purposes = self.purposes()
purposes = self.check_parameters_for_validity(purposes, "purpose",
valid_purposes)
purposes = bob.db.base.utils.check_parameters_for_validity(purposes,
"purpose", valid_purposes)
# cleans up groups and purposes to solve for the minimum
if ('train' in purposes and not ('train' in groups)):
......@@ -198,23 +200,24 @@ class Database(bob.db.base.SQLiteDatabase):
if model_ids:
valid_model_ids = self.model_ids(protocol, groups)
model_ids = self.check_parameters_for_validity(model_ids, "model_ids",
valid_model_ids)
model_ids = bob.db.base.utils.check_parameters_for_validity(model_ids,
"model_ids", valid_model_ids)
valid_genders = self.genders()
genders = self.check_parameters_for_validity(genders, "genders",
valid_genders)
genders = bob.db.base.utils.check_parameters_for_validity(genders,
"genders", valid_genders)
valid_fingers = self.fingers()
fingers = self.check_parameters_for_validity(fingers, "fingers",
valid_fingers)
fingers = bob.db.base.utils.check_parameters_for_validity(fingers,
"fingers", valid_fingers)
valid_sides = self.sides()
sides = self.check_parameters_for_validity(sides, "sides", valid_sides)
sides = bob.db.base.utils.check_parameters_for_validity(sides, "sides",
valid_sides)
valid_sessions = self.sessions()
sessions = self.check_parameters_for_validity(sessions, "sessions",
valid_sessions)
sessions = bob.db.base.utils.check_parameters_for_validity(sessions,
"sessions", valid_sessions)
# this database contains 3 sets of "files" for each protocol: the ones
# related to the training_set, models and probes related to both dev and
......
......@@ -41,7 +41,7 @@ Each field can have these values:
* session = int > 0
* attempt = int > 0
* snap = int > 0
* cam = int, one of 1, 2 or 3 (1 is left, 2 is central, 3 is right)
* cam = int, one of 1, 2, 3 or S (1 is left, 2 is central, 3 is right and S means the "stitched" image using the three cameras)
......@@ -64,6 +64,11 @@ the prototype (camera 2). Each finger is supposed to be considered a
this protocol, 1 snapshot image generates one model for the subject.
Stitched
========
The ``stitched`` protocol is the same as ``central``, but uses the stitched
images for training and development.
.. Place your references here
......
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