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
da3111a1
There was a problem fetching the pipeline summary.
Commit
da3111a1
authored
6 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
Handle different verify scripts using an option
parent
35a19d65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+41
-24
41 additions, 24 deletions
bob/bio/base/script/baseline.py
with
41 additions
and
24 deletions
bob/bio/base/script/baseline.py
+
41
−
24
View file @
da3111a1
...
@@ -8,34 +8,40 @@ A script to run biometric recognition baselines
...
@@ -8,34 +8,40 @@ A script to run biometric recognition baselines
from
..
import
load_resource
from
..
import
load_resource
from
.verify
import
main
as
verify
import
os
import
os
from
..baseline
import
get_available_databases
,
search_preprocessor
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
click
import
tempfile
import
tempfile
import
logging
import
logging
import
os
logger
=
logging
.
getLogger
(
"
bob.bio.base
"
)
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
,
@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
(
'
baseline
'
,
required
=
True
)
@click.argument
(
'
database
'
,
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
()
@verbosity_option
()
@click.pass_context
@click.pass_context
def
baseline
(
ctx
,
baseline
,
database
,
**
kwargs
):
def
baseline
(
ctx
,
baseline
,
database
,
parallel_training
,
**
kwargs
):
"""
Run a biometric recognition baseline.
"""
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
\b
Check out all baselines available by running:
Check out all baselines available by running:
`resource.py --types baseline`
`resource.py --types baseline`
...
@@ -52,6 +58,8 @@ def baseline(ctx, baseline, database, **kwargs):
...
@@ -52,6 +58,8 @@ def baseline(ctx, baseline, database, **kwargs):
Hint: pass `--result-directory <dir>` to set the directory for resulting score files
Hint: pass `--result-directory <dir>` to set the directory for resulting score files
"""
"""
log_parameters
(
logger
)
# Triggering training for each baseline/database
# Triggering training for each baseline/database
loaded_baseline
=
load_resource
(
loaded_baseline
=
load_resource
(
baseline
,
'
baseline
'
,
package_prefix
=
"
bob.bio.
"
)
baseline
,
'
baseline
'
,
package_prefix
=
"
bob.bio.
"
)
...
@@ -90,22 +98,31 @@ verbose = {verbose}
...
@@ -90,22 +98,31 @@ verbose = {verbose}
verbose
=
ctx
.
meta
[
'
verbosity
'
],
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
),
with
tempfile
.
NamedTemporaryFile
(
mode
=
'
w+t
'
,
prefix
=
'
{}_
'
.
format
(
baseline
),
suffix
=
'
.py
'
,
delete
=
False
,
dir
=
'
.
'
)
as
f
:
suffix
=
'
.py
'
,
delete
=
False
,
dir
=
'
.
'
)
as
f
:
f
.
write
(
config
)
f
.
write
(
config
)
f
.
flush
()
f
.
flush
()
f
.
seek
(
0
)
f
.
seek
(
0
)
verify
([
f
.
name
]
+
ctx
.
args
)
main
([
f
.
name
]
+
ctx
.
args
)
click
.
echo
(
"
You may want to delete `{}
'
after the experiments are
"
click
.
echo
(
"
You may want to delete `{}
'
after the experiments are
"
"
finished running.
"
.
format
(
f
.
name
))
"
finished running.
"
.
format
(
f
.
name
))
if
"
gmm
"
in
loaded_baseline
.
algorithm
:
from
bob.bio.gmm.script.verify_gmm
import
main
as
verify
elif
"
isv
"
in
loaded_baseline
.
algorithm
:
from
bob.bio.gmm.script.verify_isv
import
main
as
verify
elif
"
ivector
"
in
loaded_baseline
.
algorithm
:
from
bob.bio.gmm.script.verify_ivector
import
main
as
verify
else
:
from
.verify
import
main
as
verify
verify
(
parameters
+
ctx
.
args
)
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