Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.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.bio.face
Commits
d3859cf5
There was a problem fetching the pipeline summary.
Commit
d3859cf5
authored
8 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
[refactoring2016] Added more tests
parent
12bbf122
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Issue 8 remove database configuration
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/test/test_databases.py
+67
-60
67 additions, 60 deletions
bob/bio/face/test/test_databases.py
with
67 additions
and
60 deletions
bob/bio/face/test/test_databases.py
+
67
−
60
View file @
d3859cf5
...
@@ -18,47 +18,11 @@
...
@@ -18,47 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
import
bob.bio.base
import
bob.bio.base
from
bob.bio.base.test.utils
import
db_available
from
bob.bio.base.test.utils
import
db_available
from
bob.bio.base.test.test_database_implementations
import
check_database
,
check_database_zt
def
_check_database
(
database
,
groups
=
(
'
dev
'
,),
protocol
=
None
,
training_depends
=
False
,
models_depend
=
False
):
assert
isinstance
(
database
,
bob
.
bio
.
base
.
database
.
BioDatabase
)
# load the directories
if
'
HOME
'
in
os
.
environ
:
database
.
replace_directories
(
os
.
path
.
join
(
os
.
environ
[
'
HOME
'
],
'
.bob_bio_databases.txt
'
))
if
protocol
:
database
.
protocol
=
protocol
if
protocol
is
None
:
protocol
=
database
.
protocol
assert
len
(
database
.
all_files
())
>
0
assert
len
(
database
.
training_files
(
'
train_extractor
'
))
>
0
assert
len
(
database
.
arrange_by_client
(
database
.
training_files
(
'
train_enroller
'
)))
>
0
for
group
in
groups
:
model_ids
=
database
.
model_ids_with_protocol
(
group
,
protocol
=
protocol
)
assert
len
(
model_ids
)
>
0
assert
database
.
client_id_from_model_id
(
model_ids
[
0
])
is
not
None
assert
len
(
database
.
enroll_files
(
model_ids
[
0
],
group
))
>
0
assert
len
(
database
.
probe_files
(
model_ids
[
0
],
group
))
>
0
assert
database
.
training_depends_on_protocol
==
training_depends
assert
database
.
models_depend_on_protocol
==
models_depend
def
_check_database_zt
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
),
protocol
=
None
,
training_depends
=
False
,
models_depend
=
False
):
_check_database
(
database
,
groups
,
protocol
,
training_depends
,
models_depend
)
assert
isinstance
(
database
,
bob
.
bio
.
base
.
database
.
ZTBioDatabase
)
for
group
in
groups
:
t_model_ids
=
database
.
t_model_ids
(
group
)
assert
len
(
t_model_ids
)
>
0
assert
database
.
client_id_from_model_id
(
t_model_ids
[
0
])
is
not
None
assert
len
(
database
.
t_enroll_files
(
t_model_ids
[
0
],
group
))
>
0
assert
len
(
database
.
z_probe_files
(
group
))
>
0
def
_check_annotations
(
database
):
def
_check_annotations
(
database
):
...
@@ -74,7 +38,18 @@ def _check_annotations(database):
...
@@ -74,7 +38,18 @@ def _check_annotations(database):
def
test_arface
():
def
test_arface
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
arface
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
arface
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
))
check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
))
_check_annotations
(
database
)
except
IOError
as
e
:
raise
SkipTest
(
"
The database could not queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
@db_available
(
'
atnt
'
)
def
test_atnt
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
atnt
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
check_database
(
database
)
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
@@ -85,7 +60,7 @@ def test_arface():
...
@@ -85,7 +60,7 @@ def test_arface():
def
test_banca
():
def
test_banca
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
banca
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
banca
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_
check_database_zt
(
database
)
check_database_zt
(
database
)
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
@@ -96,8 +71,8 @@ def test_banca():
...
@@ -96,8 +71,8 @@ def test_banca():
def
test_caspeal
():
def
test_caspeal
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
caspeal
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
caspeal
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_
check_database
(
database
)
check_database
(
database
)
_
check_database
(
database
,
protocol
=
'
aging
'
)
check_database
(
database
,
protocol
=
'
aging
'
)
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
@@ -116,14 +91,35 @@ def test_caspeal():
...
@@ -116,14 +91,35 @@ def test_caspeal():
# raise SkipTest(
# raise SkipTest(
# "The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e)
# "The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e)
@db_available
(
'
cuhk_cufs
'
)
def
test_cuhk_cufs
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
cuhk_cufs
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
check_database
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
raise
SkipTest
(
"
The database could not queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
@db_available
(
'
gbu
'
)
@db_available
(
'
gbu
'
)
def
test_gbu
():
def
test_gbu
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
gbu
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
gbu
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_check_database
(
database
,
models_depend
=
True
)
check_database
(
database
,
models_depend
=
True
)
_check_database
(
database
,
protocol
=
'
Bad
'
,
models_depend
=
True
)
check_database
(
database
,
protocol
=
'
Bad
'
,
models_depend
=
True
)
_check_database
(
database
,
protocol
=
'
Ugly
'
,
models_depend
=
True
)
check_database
(
database
,
protocol
=
'
Ugly
'
,
models_depend
=
True
)
_check_annotations
(
database
)
except
IOError
as
e
:
raise
SkipTest
(
"
The database could not queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
@db_available
(
'
ijba
'
)
def
test_ijba
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
ijba
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
check_database
(
database
)
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
@@ -134,10 +130,10 @@ def test_gbu():
...
@@ -134,10 +130,10 @@ def test_gbu():
def
test_lfw
():
def
test_lfw
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
lfw-restricted
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
lfw-restricted
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_
check_database
(
database
,
training_depends
=
True
,
models_depend
=
True
)
check_database
(
database
,
training_depends
=
True
,
models_depend
=
True
)
_
check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
),
protocol
=
'
fold1
'
,
training_depends
=
True
,
models_depend
=
True
)
check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
),
protocol
=
'
fold1
'
,
training_depends
=
True
,
models_depend
=
True
)
_
check_database
(
bob
.
bio
.
base
.
load_resource
(
'
lfw-unrestricted
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
check_database
(
bob
.
bio
.
base
.
load_resource
(
'
lfw-unrestricted
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
training_depends
=
True
,
models_depend
=
True
)
training_depends
=
True
,
models_depend
=
True
)
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
@@ -148,12 +144,12 @@ def test_lfw():
...
@@ -148,12 +144,12 @@ def test_lfw():
def
test_mobio
():
def
test_mobio
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
mobio-image
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
mobio-image
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_
check_database_zt
(
database
,
models_depend
=
True
)
check_database_zt
(
database
,
models_depend
=
True
)
_
check_database_zt
(
database
,
protocol
=
'
female
'
,
models_depend
=
True
)
check_database_zt
(
database
,
protocol
=
'
female
'
,
models_depend
=
True
)
_
check_database_zt
(
bob
.
bio
.
base
.
load_resource
(
'
mobio-male
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
check_database_zt
(
bob
.
bio
.
base
.
load_resource
(
'
mobio-male
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
models_depend
=
True
)
models_depend
=
True
)
_
check_database_zt
(
bob
.
bio
.
base
.
load_resource
(
'
mobio-female
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
check_database_zt
(
bob
.
bio
.
base
.
load_resource
(
'
mobio-female
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
models_depend
=
True
)
models_depend
=
True
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
"
The database could not be queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
"
The database could not be queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
...
@@ -169,9 +165,9 @@ def test_mobio():
...
@@ -169,9 +165,9 @@ def test_mobio():
def
test_multipie
():
def
test_multipie
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
multipie
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
multipie
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_
check_database_zt
(
database
,
training_depends
=
True
)
check_database_zt
(
database
,
training_depends
=
True
)
_
check_database_zt
(
bob
.
bio
.
base
.
load_resource
(
'
multipie-pose
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
check_database_zt
(
bob
.
bio
.
base
.
load_resource
(
'
multipie-pose
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
),
training_depends
=
True
)
training_depends
=
True
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
"
The database could not queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
"
The database could not queried; probably the db.sql3 file is missing. Here is the error:
'
%s
'"
%
e
)
...
@@ -190,7 +186,7 @@ def test_multipie():
...
@@ -190,7 +186,7 @@ def test_multipie():
def
test_scface
():
def
test_scface
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
scface
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
scface
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_
check_database_zt
(
database
)
check_database_zt
(
database
)
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
@@ -201,8 +197,19 @@ def test_scface():
...
@@ -201,8 +197,19 @@ def test_scface():
def
test_xm2vts
():
def
test_xm2vts
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
xm2vts
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
database
=
bob
.
bio
.
base
.
load_resource
(
'
xm2vts
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
try
:
_check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
))
check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
))
_check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
),
protocol
=
'
darkened-lp1
'
)
check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
),
protocol
=
'
darkened-lp1
'
)
_check_annotations
(
database
)
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
(
'
replay
'
)
def
test_replay
():
database
=
bob
.
bio
.
base
.
load_resource
(
'
replay
'
,
'
database
'
,
preferred_package
=
'
bob.bio.face
'
)
try
:
check_database
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
))
_check_annotations
(
database
)
_check_annotations
(
database
)
except
IOError
as
e
:
except
IOError
as
e
:
raise
SkipTest
(
raise
SkipTest
(
...
...
This diff is collapsed.
Click to expand it.
Tiago de Freitas Pereira
@tiago.pereira
mentioned in issue
bob.bio.base#37 (closed)
·
8 years ago
mentioned in issue
bob.bio.base#37 (closed)
mentioned in issue bob/bob.bio.base#37
Toggle commit list
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