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
b182c3d2
Commit
b182c3d2
authored
4 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Finished the app compare samples
parent
4bef9554
No related branches found
No related tags found
2 merge requests
!192
Redoing baselines
,
!180
[dask] Preparing bob.bio.base for dask pipelines
Pipeline
#40567
passed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/script/compare_samples.py
+28
-39
28 additions, 39 deletions
bob/bio/base/script/compare_samples.py
with
28 additions
and
39 deletions
bob/bio/base/script/compare_samples.py
+
28
−
39
View file @
b182c3d2
...
...
@@ -13,41 +13,27 @@ from bob.extension.scripts.click_helper import (
ConfigCommand
,
)
import
bob.io.base
import
bob.io.image
import
logging
import
os
import
itertools
import
dask.bag
# from bob.bio.base.pipelines.vanilla_biometrics import (
# VanillaBiometricsPipeline,
# BioAlgorithmCheckpointWrapper,
# BioAlgorithmDaskWrapper,
# checkpoint_vanilla_biometrics,
# dask_vanilla_biometrics,
# dask_get_partition_size,
# FourColumnsScoreWriter,
# CSVScoreWriter,
# )
# from dask.delayed import Delayed
# import pkg_resources
from
bob.extension.config
import
load
as
chain_load
from
bob.pipelines.utils
import
isinstance_nested
from
bob.bio.base.utils
import
get_resource_filename
from
.vanilla_biometrics
import
compute_scores
,
load_database_pipeline
from
tabulate
import
tabulate
from
bob.bio.base.pipelines.vanilla_biometrics
import
dask_vanilla_biometrics
from
bob.pipelines
import
Sample
,
SampleSet
logger
=
logging
.
getLogger
(
__name__
)
EPILOG
=
"""
\b
Command line examples
\n
-----------------------
>>>
bob
bio
compare
-
samples
.
/
imgs
/
1.
png
.
/
imgs
/
2.
png
-
p
inception_resnetv2_msceleb
\
b
\
b
\
b
All vs All comparison
\b
------------------- -------------------
\b
./imgs/1.png ./imgs/2.png
\b
0.0 -0.5430189337666903
\b
-0.5430189337666903 0.0
\b
------------------- -------------------
\b
"""
...
...
@@ -67,34 +53,37 @@ EPILOG = """\b
"
-l
"
,
required
=
False
,
cls
=
ResourceOption
,
entry_point_group
=
"
bob.pipeline.dask_client
"
,
help
=
"
Dask client for the execution of the pipeline.
"
,
)
@verbosity_option
(
cls
=
ResourceOption
)
def
compare_samples
(
samples
,
pipeline
,
dask_client
,
**
kwargs
,
samples
,
pipeline
,
dask_client
):
"""
Compare several samples all vs all using one vanilla biometrics pipeline
"""
Compare several samples in a All vs All fashion.
"""
if
len
(
samples
)
==
1
:
raise
ValueError
(
"
It
'
s necessary to have at least two samples for the comparison
"
)
sample_sets
=
[
SampleSet
([
Sample
(
bob
.
io
.
base
.
load
(
s
),
key
=
str
(
i
))],
key
=
str
(
i
))
SampleSet
([
Sample
(
bob
.
io
.
base
.
load
(
s
),
key
=
str
(
i
))],
key
=
str
(
i
)
,
subject
=
str
(
i
)
)
for
i
,
s
in
enumerate
(
samples
)
]
import
ipdb
;
ipdb
.
set_trace
()
for
e
in
sample_sets
:
biometric_references
=
pipeline
.
create_biometric_reference
([
e
])
scores
=
pipeline
.
compute_scores
(
biometric_references
,
sample_sets
)
pass
if
dask_client
is
not
None
:
pipeline
=
dask_vanilla_biometrics
(
pipeline
)
table
=
[[
s
for
s
in
samples
]]
biometric_references
=
pipeline
.
create_biometric_reference
(
sample_sets
)
scores
,
_
=
pipeline
.
compute_scores
(
sample_sets
,
biometric_references
)
if
dask_client
is
not
None
:
scores
=
scores
.
compute
(
scheduler
=
dask_client
)
for
sset
in
scores
:
table
.
append
([
str
(
s
.
data
)
for
s
in
sset
])
# B = bob.io.base.load(p
)
# pipeline.biometric_algorithm
print
(
f
"
All vs All comparison
"
)
print
(
tabulate
(
table
))
if
dask_client
is
not
None
:
dask_client
.
shutdown
()
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