Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.face
Commits
9b1b0303
Commit
9b1b0303
authored
Jun 09, 2021
by
Yannick DAYER
Browse files
Change tests for replay-mobile to csv dataset
parent
1533b950
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/test/test_databases.py
View file @
9b1b0303
...
...
@@ -26,6 +26,7 @@ from bob.bio.base.test.utils import db_available
from
bob.bio.base.test.test_database_implementations
import
check_database
import
bob.core
from
bob.extension.download
import
get_file
from
nose.plugins.skip
import
SkipTest
logger
=
bob
.
core
.
log
.
setup
(
"bob.bio.face"
)
...
...
@@ -271,60 +272,36 @@ def test_replay_spoof():
)
@
db_available
(
"replaymobile"
)
def
test_replaymobile_csv
():
from
bob.bio.face.database.replaymobile_csv
import
ReplayMobileDatabase
# TODO: load resource instead
database
=
ReplayMobileDatabase
(
"grandtest"
,
protocol_definition_path
=
"./csv_datasets"
,
data_path
=
""
)
samples
=
database
.
all_samples
(
groups
=
(
"dev"
,
"eval"
))
assert
len
(
samples
)
==
8300
,
len
(
samples
)
assert
all
([
s
.
path
for
s
in
samples
])
# assert samples[0].data.shape == (3, 1280, 720)# TODO data sample?
assert
hasattr
(
samples
[
0
],
"annotations"
)
assert
"topleft"
in
samples
[
0
].
annotations
assert
"bottomright"
in
samples
[
0
].
annotations
assert
hasattr
(
samples
[
0
],
"frame"
)
@
db_available
(
"replaymobile"
)
def
test_replaymobile_licit
():
def
test_replaymobile
():
database
=
bob
.
bio
.
base
.
load_resource
(
"replaymobile-img
-licit
"
,
"database"
,
preferred_package
=
"bob.bio.face"
"replaymobile-img"
,
"database"
,
preferred_package
=
"bob.bio.face"
)
samples
=
database
.
all_samples
(
groups
=
(
"dev"
,
"eval"
))
assert
len
(
samples
)
==
8300
,
len
(
samples
)
sample
=
samples
[
0
]
assert
hasattr
(
sample
,
"annotations"
)
assert
"reye"
in
sample
.
annotations
assert
"leye"
in
sample
.
annotations
assert
hasattr
(
sample
,
"path"
)
assert
hasattr
(
sample
,
"frame"
)
assert
len
(
database
.
references
())
==
16
assert
len
(
database
.
references
(
group
=
"eval"
))
==
12
assert
len
(
database
.
probes
())
==
4160
assert
len
(
database
.
probes
(
group
=
"eval"
))
==
3020
try
:
check_database
(
database
,
groups
=
(
"dev"
,
"eval"
))
except
IOError
as
e
:
pytest
.
skip
(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
%
e
)
try
:
_check_annotations
(
database
,
topleft
=
True
,
limit_files
=
20
)
except
IOError
as
e
:
pytest
.
skip
(
"The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'"
%
e
)
@
db_available
(
"replaymobile"
)
def
test_replaymobile_spoof
():
database
=
bob
.
bio
.
base
.
load_resource
(
"replaymobile-img-spoof"
,
"database"
,
preferred_package
=
"bob.bio.face"
)
try
:
check_database
(
database
,
groups
=
(
"dev"
,
"eval"
))
except
IOError
as
e
:
pytest
.
skip
(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
%
e
)
try
:
_check_annotations
(
database
,
topleft
=
True
,
limit_files
=
20
)
except
IOError
as
e
:
pytest
.
skip
(
"The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'"
%
e
)
assert
sample
.
annotations
==
{
"bottomright"
:
[
785
,
395
],
"topleft"
:
[
475
,
167
],
"leye"
:
[
587
,
336
],
"reye"
:
[
588
,
238
],
"mouthleft"
:
[
705
,
252
],
"mouthright"
:
[
706
,
326
],
"nose"
:
[
643
,
295
],
}
assert
sample
.
data
.
shape
==
(
3
,
1280
,
720
)
assert
sample
.
data
[
0
,
0
,
0
]
==
87
except
RuntimeError
as
e
:
raise
SkipTest
(
e
)
def
test_ijbc
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment