Commit d1c68a54 authored by Laurent COLBOIS's avatar Laurent COLBOIS

More fixes : swap reye and leye in some wrongly annotated images. Ensure probe...

More fixes : swap reye and leye in some wrongly annotated images. Ensure probe templates samplesets are correctly formed in protocol 2.0.2. Add additional database tests
parent 0db8a67d
Pipeline #53250 passed with stage
in 50 minutes and 55 seconds
......@@ -25,7 +25,9 @@ class FRGCDatabase(CSVDataset):
# Downloading model if not exists
urls = FRGCDatabase.urls()
filename = get_file(
"frgc.tar.gz", urls, file_hash="cbe17a5129b15312ce73e5e930d927dcfa9b15a4c9798af5206bda3c1c22852a"
"frgc.tar.gz",
urls,
file_hash="270394e3eee9a80b6a68a5a1b6f7db2ff0773738b48284561cb1996358e5a3c1",
)
super().__init__(
......@@ -35,13 +37,18 @@ class FRGCDatabase(CSVDataset):
csv_to_sample_loader=make_pipeline(
CSVToSampleLoaderBiometrics(
data_loader=bob.io.base.load,
dataset_original_directory=rc.get("bob.bio.face.frgc.directory", ""),
dataset_original_directory=rc.get(
"bob.bio.face.frgc.directory", ""
),
extension="",
reference_id_equal_subject_id=False,
),
EyesAnnotations(),
),
annotation_type=annotation_type,
fixed_positions=fixed_positions,
allow_scoring_with_all_biometric_references=True,
group_probes_by_reference_id=True,
)
@staticmethod
......@@ -56,6 +63,6 @@ class FRGCDatabase(CSVDataset):
@staticmethod
def urls():
return [
"https://www.idiap.ch/software/bob/databases/latest/frgc-cbe17a51.tar.gz",
"http://www.idiap.ch/software/bob/databases/latest/frgc-cbe17a51.tar.gz",
"https://www.idiap.ch/software/bob/databases/latest/frgc-270394e3.tar.gz",
"http://www.idiap.ch/software/bob/databases/latest/frgc-270394e3.tar.gz",
]
......@@ -423,21 +423,40 @@ def test_frgc():
from bob.bio.face.database import FRGCDatabase
database = FRGCDatabase("2.0.1")
def _check_samples(samples, n_templates, n_subjects, template_size=0):
assert len(samples) == n_templates
assert len(set([x.reference_id for x in samples])) == n_templates
assert len(set([x.subject_id for x in samples])) == n_subjects
if template_size > 0:
assert all([len(x) == template_size for x in samples])
assert len(database.background_model_samples()) == 12776
assert len(database.references()) == 7572
assert len(database.probes()) == 8456
database = FRGCDatabase("2.0.1")
_check_samples(
database.background_model_samples(), n_templates=12776, n_subjects=222
)
_check_samples(
database.references(), n_templates=7572, n_subjects=370, template_size=1
)
_check_samples(database.probes(), n_templates=8456, n_subjects=345, template_size=1)
database = FRGCDatabase("2.0.2")
assert len(database.background_model_samples()) == 12776
assert len(database.references()) == 1893
assert len(database.probes()) == 8456
_check_samples(
database.background_model_samples(), n_templates=12776, n_subjects=222
)
_check_samples(
database.references(), n_templates=1893, n_subjects=370, template_size=4
)
_check_samples(database.probes(), n_templates=2114, n_subjects=345, template_size=4)
database = FRGCDatabase("2.0.4")
assert len(database.background_model_samples()) == 12776
assert len(database.references()) == 7572
assert len(database.probes()) == 4228
_check_samples(
database.background_model_samples(), n_templates=12776, n_subjects=222
)
_check_samples(
database.references(), n_templates=7572, n_subjects=370, template_size=1
)
_check_samples(database.probes(), n_templates=4228, n_subjects=345, template_size=1)
def test_polathermal():
......@@ -500,4 +519,3 @@ def test_gbu():
assert len(database.probes()) == 1085
assert len(database.background_model_samples()) == 3910
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