Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
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.base
Commits
fc7f0908
Commit
fc7f0908
authored
9 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Added tests for the filelist database
parent
51c20142
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/base/test/test_databases.py
+64
-0
64 additions, 0 deletions
bob/bio/base/test/test_databases.py
bob/bio/base/tools/command_line.py
+3
-3
3 additions, 3 deletions
bob/bio/base/tools/command_line.py
with
67 additions
and
3 deletions
bob/bio/base/test/test_databases.py
0 → 100644
+
64
−
0
View file @
fc7f0908
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Manuel Guenther <Manuel.Guenther@idiap.ch>
# @date: Thu May 24 10:41:42 CEST 2012
#
# Copyright (C) 2011-2012 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
from
nose.plugins.skip
import
SkipTest
import
bob.bio.base
import
pkg_resources
dummy_dir
=
pkg_resources
.
resource_filename
(
'
bob.bio.base
'
,
'
test/dummy
'
)
def
test_verification_filelist
():
try
:
db1
=
bob
.
bio
.
base
.
load_resource
(
os
.
path
.
join
(
dummy_dir
,
'
database.py
'
),
'
database
'
)
except
Exception
as
e
:
raise
SkipTest
(
"
This test is skipped since the atnt database is not available.
"
)
try
:
db2
=
bob
.
bio
.
base
.
load_resource
(
os
.
path
.
join
(
dummy_dir
,
'
filelist.py
'
),
'
database
'
)
except
Exception
as
e
:
raise
SkipTest
(
"
This test is skipped since the verification.filelist database is not available.
"
)
# The test of the verification.filelist database is a bit different.
# here, we test the output of two different ways of querying the AT&T database
# where actually both ways are uncommon...
# assure that different kind of queries result in the same file lists
assert
set
([
str
(
id
)
for
id
in
db1
.
model_ids
()])
==
set
(
db2
.
model_ids
())
assert
set
([
str
(
id
)
for
id
in
db1
.
t_model_ids
()])
==
set
(
db2
.
t_model_ids
())
def
_check_files
(
f1
,
f2
):
assert
set
([
file
.
path
for
file
in
f1
])
==
set
([
file
.
path
for
file
in
f2
])
_check_files
(
db1
.
all_files
(),
db2
.
all_files
())
_check_files
(
db1
.
training_files
(
'
train_extractor
'
),
db2
.
training_files
(
'
train_extractor
'
))
_check_files
(
db1
.
enroll_files
(
model_id
=
22
),
db2
.
enroll_files
(
model_id
=
'
22
'
))
_check_files
(
db1
.
probe_files
(
model_id
=
22
),
db2
.
probe_files
(
model_id
=
'
22
'
))
_check_files
(
db1
.
t_enroll_files
(
model_id
=
22
),
db2
.
t_enroll_files
(
model_id
=
'
22
'
))
_check_files
(
db1
.
z_probe_files
(),
db2
.
z_probe_files
())
f1
=
db1
.
all_files
()[
0
]
f2
=
[
f
for
f
in
db2
.
all_files
()
if
f
.
path
==
f1
.
path
][
0
]
assert
f1
.
make_path
(
directory
=
'
xx
'
,
extension
=
'
.yy
'
)
==
f2
.
make_path
(
directory
=
'
xx
'
,
extension
=
'
.yy
'
)
m1
=
sorted
([
str
(
id
)
for
id
in
db1
.
model_ids
()])[
0
]
m2
=
sorted
([
str
(
id
)
for
id
in
db2
.
model_ids
()])[
0
]
assert
str
(
db1
.
client_id_from_model_id
(
m1
))
==
db2
.
client_id_from_model_id
(
m2
)
This diff is collapsed.
Click to expand it.
bob/bio/base/tools/command_line.py
+
3
−
3
View file @
fc7f0908
...
@@ -178,9 +178,9 @@ def initialize(parsers, command_line_parameters = None, skips = []):
...
@@ -178,9 +178,9 @@ def initialize(parsers, command_line_parameters = None, skips = []):
# sub-directorues that depend on the database
# sub-directorues that depend on the database
extractor_sub_dir
=
protocol
if
args
.
database
.
training_depends_on_protocol
and
args
.
extractor
.
requires_training
else
'
.
'
extractor_sub_dir
=
protocol
if
args
.
database
.
training_depends_on_protocol
and
args
.
extractor
.
requires_training
else
'
.
'
projector_sub_dir
=
protocol
if
args
.
database
.
training_depends_on_protocol
and
args
.
algorithm
.
requires_projector_training
else
'
.
'
projector_sub_dir
=
protocol
if
args
.
database
.
training_depends_on_protocol
and
args
.
algorithm
.
requires_projector_training
else
extractor_sub_dir
enroller_sub_dir
=
protocol
if
args
.
database
.
training_depends_on_protocol
and
args
.
algorithm
.
requires_enroller_training
else
'
.
'
enroller_sub_dir
=
protocol
if
args
.
database
.
training_depends_on_protocol
and
args
.
algorithm
.
requires_enroller_training
else
projector_sub_dir
model_sub_dir
=
protocol
if
args
.
database
.
models_depend_on_protocol
else
'
.
'
model_sub_dir
=
protocol
if
args
.
database
.
models_depend_on_protocol
else
enroller_sub_dir
# initialize the file selector
# initialize the file selector
FileSelector
.
create
(
FileSelector
.
create
(
...
...
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