Skip to content
Snippets Groups Projects
Commit bef3514f authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[test] added unit test for maskattack database

parent 7b409d32
No related branches found
No related tags found
1 merge request!72Add maskattack db
...@@ -109,6 +109,38 @@ def test_msu_mfsd(): ...@@ -109,6 +109,38 @@ def test_msu_mfsd():
% e) % e)
# Test the maskattack database
@db_available('maskattack')
def test_maskattack():
maskattack = bob.bio.base.load_resource(
'maskattack',
'database',
preferred_package='bob.pad.face',
package_prefix='bob.pad.')
try:
# all real sequences: 2 sessions, 5 recordings for 17 individuals
assert len(maskattack.objects(groups=['train', 'dev', 'eval'], purposes='real')) == 170
# all attacks: 1 session, 5 recordings for 17 individuals
assert len(maskattack.objects(groups=['train', 'dev', 'eval'], purposes='attack')) == 85
# training real: 7 subjects, 2 sessions, 5 recordings
assert len(maskattack.objects(groups=['train'], purposes='real')) == 70
# training real: 7 subjects, 1 session, 5 recordings
assert len(maskattack.objects(groups=['train'], purposes='attack')) == 35
# dev and test contains the same number of sequences:
# real: 5 subjects, 2 sessions, 5 recordings
# attack: 5 subjects, 1 sessions, 5 recordings
assert len(maskattack.objects(groups=['dev'], purposes='real')) == 50
assert len(maskattack.objects(groups=['eval'], purposes='real')) == 50
assert len(maskattack.objects(groups=['dev'], purposes='attack')) == 25
assert len(maskattack.objects(groups=['eval'], purposes='attack')) == 25
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)
# Test the Aggregated database, which doesn't have a package # Test the Aggregated database, which doesn't have a package
def test_aggregated_db(): def test_aggregated_db():
aggregated_db = bob.bio.base.load_resource( aggregated_db = bob.bio.base.load_resource(
...@@ -168,20 +200,3 @@ def test_aggregated_db(): ...@@ -168,20 +200,3 @@ def test_aggregated_db():
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
% e) % e)
# Test the Aggregated database, which doesn't have a package
def test_maskattack_db():
aggregated_db = bob.bio.base.load_resource(
'maskattack',
'database',
preferred_package='bob.pad.face',
package_prefix='bob.pad.')
try:
assert len(aggregated_db.objects(groups=['train', 'dev', 'eval'])) == 255
assert len(aggregated_db.objects(groups=['train', 'dev'])) == 150
assert len(aggregated_db.objects(groups=['train'])) == 105
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)
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