Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.face
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pad.face
Commits
bef3514f
Commit
bef3514f
authored
6 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[test] added unit test for maskattack database
parent
7b409d32
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!72
Add maskattack db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pad/face/test/test_databases.py
+32
-17
32 additions, 17 deletions
bob/pad/face/test/test_databases.py
with
32 additions
and
17 deletions
bob/pad/face/test/test_databases.py
+
32
−
17
View file @
bef3514f
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment