Skip to content
Snippets Groups Projects
Commit 90213c31 authored by Laurent COLBOIS's avatar Laurent COLBOIS
Browse files

Set all ids to strings which is expected. Fix annotation-type. Fix incomplete probe caching

parent 2ad9af6f
No related branches found
No related tags found
1 merge request!124Resolve "IJBC database will fail on non-Idiap filesystems"
Pipeline #51872 passed
...@@ -17,8 +17,8 @@ def _make_sample_from_template_row(row, image_directory): ...@@ -17,8 +17,8 @@ def _make_sample_from_template_row(row, image_directory):
return DelayedSample( return DelayedSample(
load=partial(bob.io.image.load, os.path.join(image_directory, row["FILENAME"])), load=partial(bob.io.image.load, os.path.join(image_directory, row["FILENAME"])),
reference_id=row["TEMPLATE_ID"], reference_id=str(row["TEMPLATE_ID"]),
subject_id=row["SUBJECT_ID"], subject_id=str(row["SUBJECT_ID"]),
key=os.path.splitext(row["FILENAME"])[0] + "-" + hashstr, key=os.path.splitext(row["FILENAME"])[0] + "-" + hashstr,
annotations={ annotations={
"topleft": (float(row["FACE_Y"]), float(row["FACE_X"])), "topleft": (float(row["FACE_Y"]), float(row["FACE_X"])),
...@@ -39,7 +39,10 @@ def _make_sample_set_from_template_group(template_group, image_directory): ...@@ -39,7 +39,10 @@ def _make_sample_set_from_template_group(template_group, image_directory):
) )
) )
return SampleSet( return SampleSet(
samples, reference_id=samples[0].reference_id, subject_id=samples[0].subject_id samples,
reference_id=samples[0].reference_id,
subject_id=samples[0].subject_id,
key=samples[0].reference_id,
) )
...@@ -102,7 +105,7 @@ class IJBCDatabase(Database): ...@@ -102,7 +105,7 @@ class IJBCDatabase(Database):
name="ijbc", name="ijbc",
protocol=protocol, protocol=protocol,
allow_scoring_with_all_biometric_references=False, allow_scoring_with_all_biometric_references=False,
annotation_type="eyes-center", annotation_type="bounding-box",
fixed_positions=None, fixed_positions=None,
memory_demanding=True, memory_demanding=True,
) )
...@@ -136,7 +139,7 @@ class IJBCDatabase(Database): ...@@ -136,7 +139,7 @@ class IJBCDatabase(Database):
self.matches = pd.read_csv( self.matches = pd.read_csv(
os.path.join(self.protocol_directory, "ijbc_11_G1_G2_matches.csv"), os.path.join(self.protocol_directory, "ijbc_11_G1_G2_matches.csv"),
names=["REFERENCE_TEMPLATE_ID", "PROBE_TEMPLATE_ID"], names=["REFERENCE_TEMPLATE_ID", "PROBE_TEMPLATE_ID"],
) ).astype("str")
else: else:
raise ValueError( raise ValueError(
f"Protocol `{protocol}` not supported. We do accept merge requests :-)" f"Protocol `{protocol}` not supported. We do accept merge requests :-)"
...@@ -155,15 +158,15 @@ class IJBCDatabase(Database): ...@@ -155,15 +158,15 @@ class IJBCDatabase(Database):
) )
) )
# Link probes to the references they have to be compared with # Link probes to the references they have to be compared with
# We might make that faster if we manage to write it as a Panda instruction # We might make that faster if we manage to write it as a Panda instruction
grouped_matches = self.matches.groupby("PROBE_TEMPLATE_ID") grouped_matches = self.matches.groupby("PROBE_TEMPLATE_ID")
for probe_sampleset in self._cached_probes: for probe_sampleset in self._cached_probes:
probe_sampleset.references = list( probe_sampleset.references = list(
grouped_matches.get_group(probe_sampleset.reference_id)[ grouped_matches.get_group(probe_sampleset.reference_id)[
"REFERENCE_TEMPLATE_ID" "REFERENCE_TEMPLATE_ID"
] ]
) )
return self._cached_probes return self._cached_probes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment