Commit 92072b7d authored by Guillaume HEUSCH's avatar Guillaume HEUSCH

[database] fixed HQWMCA high-level DB, added tests

parent f7aba2f1
Pipeline #36676 failed with stage
in 4 minutes and 20 seconds
#!/usr/bin/env python
# encoding: utf-8
from bob.pad.face.database import HQWMCAPadDatabase
from bob.extension import rc
database = HQWMCAPadDatabase()
......@@ -131,7 +131,7 @@ class HQWMCAPadDatabase(PadDatabase):
def objects(self,
groups=None,
protocol='grand_test',
protocol=None,
purposes=None,
model_ids=None,
attack_types=None,
......@@ -170,7 +170,7 @@ class HQWMCAPadDatabase(PadDatabase):
if not isinstance(groups, list) and groups is not None and groups is not str:
groups = list(groups)
files = self.db.objects(protocol=self.protocol,
files = self.db.objects(protocol=protocol,
groups=groups,
purposes=purposes,
attacks=attack_types,
......@@ -180,10 +180,9 @@ class HQWMCAPadDatabase(PadDatabase):
def annotations(self, file):
""" Generate / retrieve annotations
""" retrieve annotations
This function will retrieve annotations (if exisiting and provided).
Otherwise, it will generate them using the MTCNN landmarks detector.
"""
if self.annotations_dir is not None:
......
......@@ -232,6 +232,37 @@ def test_casiasurf():
% e)
# Test the HQ-WMCA database
@db_available('hqwmca')
def test_hqwmca():
hqwmca = bob.bio.base.load_resource(
'hqwmca',
'database',
preferred_package='bob.pad.face',
package_prefix='bob.pad.')
try:
assert len(hqwmca.objects(protocol='grand_test')) == 2904
assert len(hqwmca.objects(protocol='impersonation')) == 1843
assert len(hqwmca.objects(protocol='obfuscation')) == 1616
assert len(hqwmca.objects(protocol='grand_test', groups=('train',))) == 970
assert len(hqwmca.objects(protocol='grand_test', groups=('dev',))) == 968
assert len(hqwmca.objects(protocol='grand_test', groups=('eval',))) == 966
assert len(hqwmca.objects(protocol='impersonation', groups=('train',))) == 612
assert len(hqwmca.objects(protocol='impersonation', groups=('dev',))) == 609
assert len(hqwmca.objects(protocol='impersonation', groups=('eval',))) == 622
assert len(hqwmca.objects(protocol='obfuscation', groups=('train',))) == 586
assert len(hqwmca.objects(protocol='obfuscation', groups=('dev',))) == 504
assert len(hqwmca.objects(protocol='obfuscation', groups=('eval',))) == 526
except IOError as e:
raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
% e)
@db_available('brsu')
def test_brsu():
brsu = bob.bio.base.load_resource(
......
......@@ -79,6 +79,7 @@ setup(
'casiasurf-color = bob.pad.face.config.casiasurf_color:database',
'casiasurf = bob.pad.face.config.casiasurf:database',
'brsu = bob.pad.face.config.brsu:database',
'hqwmca = bob.pad.face.config.hqwmca:database',
],
# registered configurations:
......
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