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
ebc2cb4c
"README.md" did not exist on "77c107fd5a01f03fbc51b86f05249100c757f6de"
Commit
ebc2cb4c
authored
4 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Patched with new VanillaBiometricsPipeline
parent
ba36a5cf
No related branches found
No related tags found
2 merge requests
!185
Wrappers and aggregators
,
!180
[dask] Preparing bob.bio.base for dask pipelines
Pipeline
#39605
failed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/script/vanilla_biometrics.py
+41
-36
41 additions, 36 deletions
bob/bio/base/script/vanilla_biometrics.py
with
41 additions
and
36 deletions
bob/bio/base/script/vanilla_biometrics.py
+
41
−
36
View file @
ebc2cb4c
...
@@ -14,6 +14,14 @@ from bob.extension.scripts.click_helper import (
...
@@ -14,6 +14,14 @@ from bob.extension.scripts.click_helper import (
)
)
import
logging
import
logging
import
os
import
itertools
import
dask.bag
from
bob.bio.base.pipelines.vanilla_biometrics
import
(
VanillaBiometricsPipeline
,
BioAlgorithmCheckpointWrapper
,
)
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -96,9 +104,7 @@ TODO: Work out this help
...
@@ -96,9 +104,7 @@ TODO: Work out this help
help
=
"
Name of output directory
"
,
help
=
"
Name of output directory
"
,
)
)
@verbosity_option
(
cls
=
ResourceOption
)
@verbosity_option
(
cls
=
ResourceOption
)
def
vanilla_biometrics
(
def
vanilla_biometrics
(
pipeline
,
database
,
dask_client
,
groups
,
output
,
**
kwargs
):
pipeline
,
database
,
dask_client
,
groups
,
output
,
**
kwargs
):
"""
Runs the simplest biometrics pipeline.
"""
Runs the simplest biometrics pipeline.
Such pipeline consists into three sub-pipelines.
Such pipeline consists into three sub-pipelines.
...
@@ -143,43 +149,42 @@ def vanilla_biometrics(
...
@@ -143,43 +149,42 @@ def vanilla_biometrics(
"""
"""
from
bob.bio.base.pipelines.vanilla_biometrics.pipeline
import
VanillaBiometrics
import
dask.bag
import
itertools
import
os
from
bob.pipelines.sample
import
Sample
,
DelayedSample
if
not
os
.
path
.
exists
(
output
):
if
not
os
.
path
.
exists
(
output
):
os
.
makedirs
(
output
,
exist_ok
=
True
)
os
.
makedirs
(
output
,
exist_ok
=
True
)
for
group
in
groups
:
for
group
in
groups
:
with
open
(
os
.
path
.
join
(
output
,
f
"
scores-
{
group
}
"
),
"
w
"
)
as
f
:
score_file_name
=
os
.
path
.
join
(
output
,
f
"
scores-
{
group
}
.txt
"
)
biometric_references
=
database
.
references
(
group
=
group
)
biometric_references
=
database
.
references
(
group
=
group
)
logger
.
info
(
f
"
Running vanilla biometrics for group
{
group
}
"
)
logger
.
info
(
f
"
Running vanilla biometrics for group
{
group
}
"
)
allow_scoring_with_all_biometric_references
=
(
allow_scoring_with_all_biometric_references
=
(
database
.
allow_scoring_with_all_biometric_references
database
.
allow_scoring_with_all_biometric_references
if
hasattr
(
database
,
"
allow_scoring_with_all_biometric_references
"
)
if
hasattr
(
database
,
"
allow_scoring_with_all_biometric_references
"
)
else
False
else
False
)
)
result
=
pipeline
(
database
.
background_model_samples
(),
result
=
pipeline
(
biometric_references
,
database
.
background_model_samples
(),
database
.
probes
(
group
=
group
),
biometric_references
,
allow_scoring_with_all_biometric_references
=
allow_scoring_with_all_biometric_references
database
.
probes
(
group
=
group
),
)
allow_scoring_with_all_biometric_references
=
allow_scoring_with_all_biometric_references
,
)
if
isinstance
(
result
,
dask
.
bag
.
core
.
Bag
):
if
dask_client
is
not
None
:
if
isinstance
(
result
,
dask
.
bag
.
core
.
Bag
):
result
=
result
.
compute
(
scheduler
=
dask_client
)
if
dask_client
is
not
None
:
else
:
result
=
result
.
compute
(
scheduler
=
dask_client
)
logger
.
warning
(
else
:
"
`dask_client` not set. Your pipeline will run locally
"
logger
.
warning
(
)
"
`dask_client` not set. Your pipeline will run locally
"
result
=
result
.
compute
(
scheduler
=
"
single-threaded
"
)
)
result
=
result
.
compute
(
scheduler
=
"
single-threaded
"
)
# Check if there's a score writer hooked in
if
isinstance
(
pipeline
.
biometric_algorithm
,
BioAlgorithmCheckpointWrapper
):
pipeline
.
biometric_algorithm
.
score_writer
.
concatenate_write_scores
(
result
,
score_file_name
)
else
:
# Flatting out the list
# Flatting out the list
result
=
itertools
.
chain
(
*
result
)
result
=
itertools
.
chain
(
*
result
)
for
probe
in
result
:
for
probe
in
result
:
...
...
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