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
f97e3312
There was a problem fetching the pipeline summary.
Commit
f97e3312
authored
6 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-119' into 'master'
Using the proper verify script depending on system Closes
#119
See merge request
!156
parents
b404f0d5
da3111a1
No related branches found
No related tags found
1 merge request
!156
Using the proper verify script depending on system
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/script/baseline.py
+44
-16
44 additions, 16 deletions
bob/bio/base/script/baseline.py
with
44 additions
and
16 deletions
bob/bio/base/script/baseline.py
+
44
−
16
View file @
f97e3312
...
...
@@ -8,33 +8,40 @@ A script to run biometric recognition baselines
from
..
import
load_resource
from
.verify
import
main
as
verify
import
os
from
..baseline
import
get_available_databases
,
search_preprocessor
from
bob.extension.scripts.click_helper
import
verbosity_option
from
bob.extension.scripts.click_helper
import
(
verbosity_option
,
log_parameters
)
import
click
import
tempfile
import
logging
import
os
logger
=
logging
.
getLogger
(
"
bob.bio.base
"
)
EPILOG
=
'''
\b
Example:
$ bob bio baseline eigenface atnt -vvv
which will run the eigenface baseline (from bob.bio.face) on the atnt
database.
'''
@click.command
(
context_settings
=
{
'
ignore_unknown_options
'
:
True
,
'
allow_extra_args
'
:
True
})
'
allow_extra_args
'
:
True
}
,
epilog
=
EPILOG
)
@click.argument
(
'
baseline
'
,
required
=
True
)
@click.argument
(
'
database
'
,
required
=
True
)
@click.option
(
'
--parallel-training
'
,
default
=
'
verify
'
,
show_default
=
True
,
type
=
click
.
Choice
((
'
verify
'
,
'
gmm
'
,
'
isv
'
,
'
ivector
'
)),
help
=
'
Which script to use for training the algorithm. Some
'
'
algorithms would train more efficiently using a different
'
'
script.
'
)
@verbosity_option
()
@click.pass_context
def
baseline
(
ctx
,
baseline
,
database
,
**
kwargs
):
def
baseline
(
ctx
,
baseline
,
database
,
parallel_training
,
**
kwargs
):
"""
Run a biometric recognition baseline.
\b
Example:
$ bob bio baseline eigenface atnt -vvv
which will run the eigenface baseline (from bob.bio.face) on the atnt
database.
\b
Check out all baselines available by running:
`resource.py --types baseline`
...
...
@@ -51,6 +58,8 @@ def baseline(ctx, baseline, database, **kwargs):
Hint: pass `--result-directory <dir>` to set the directory for resulting score files
"""
log_parameters
(
logger
)
# Triggering training for each baseline/database
loaded_baseline
=
load_resource
(
baseline
,
'
baseline
'
,
package_prefix
=
"
bob.bio.
"
)
...
...
@@ -61,7 +70,7 @@ def baseline(ctx, baseline, database, **kwargs):
preprocessor
=
loaded_baseline
.
preprocessors
[
db
]
# this is the default sub-directory that is used
if
"
-T
"
in
ctx
.
args
or
"
--temp-directory
"
in
ctx
.
args
:
if
"
-T
"
in
ctx
.
args
or
"
--temp-directory
"
in
ctx
.
args
:
sub_directory
=
os
.
path
.
join
(
database
,
baseline
)
else
:
sub_directory
=
baseline
...
...
@@ -89,12 +98,31 @@ verbose = {verbose}
verbose
=
ctx
.
meta
[
'
verbosity
'
],
)
if
parallel_training
==
"
verify
"
:
from
.verify
import
main
elif
parallel_training
==
"
gmm
"
:
from
bob.bio.gmm.script.verify_gmm
import
main
elif
parallel_training
==
"
isv
"
:
from
bob.bio.gmm.script.verify_isv
import
main
elif
parallel_training
==
"
ivector
"
:
from
bob.bio.gmm.script.verify_ivector
import
main
algorithm
=
loaded_baseline
.
algorithm
if
'
gmm
'
in
algorithm
and
parallel_training
!=
'
gmm
'
:
logger
.
warning
(
"
GMM algorithms can train faster using the
"
"
``--parallel-training gmm`` option.
"
)
if
'
isv
'
in
algorithm
and
parallel_training
!=
'
isv
'
:
logger
.
warning
(
"
ISV algorithms can train faster using the
"
"
``--parallel-training isv`` option.
"
)
if
'
ivector
'
in
algorithm
and
parallel_training
!=
'
ivector
'
:
logger
.
warning
(
"
ivector algorithms can train faster using the
"
"
``--parallel-training ivector`` option.
"
)
with
tempfile
.
NamedTemporaryFile
(
mode
=
'
w+t
'
,
prefix
=
'
{}_
'
.
format
(
baseline
),
suffix
=
'
.py
'
,
delete
=
False
,
dir
=
'
.
'
)
as
f
:
f
.
write
(
config
)
f
.
flush
()
f
.
seek
(
0
)
verify
([
f
.
name
]
+
ctx
.
args
)
main
([
f
.
name
]
+
ctx
.
args
)
click
.
echo
(
"
You may want to delete `{}
'
after the experiments are
"
"
finished running.
"
.
format
(
f
.
name
))
"
finished running.
"
.
format
(
f
.
name
))
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