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
df4792ad
Commit
df4792ad
authored
5 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the scoring function
parent
9e460bd8
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!180
[dask] Preparing bob.bio.base for dask pipelines
Pipeline
#38440
failed
5 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/base/pipelines/vanilla_biometrics/abstract_classes.py
+8
-16
8 additions, 16 deletions
...bio/base/pipelines/vanilla_biometrics/abstract_classes.py
bob/bio/base/pipelines/vanilla_biometrics/mixins.py
+4
-6
4 additions, 6 deletions
bob/bio/base/pipelines/vanilla_biometrics/mixins.py
with
12 additions
and
22 deletions
bob/bio/base/pipelines/vanilla_biometrics/abstract_classes.py
+
8
−
16
View file @
df4792ad
...
...
@@ -96,7 +96,6 @@ class BioAlgorithm(metaclass=ABCMeta):
# a sampleset either after or before scoring.
# To be honest, this should be the default behaviour
retval
=
[]
for
subprobe_id
,
(
s
,
parent
)
in
enumerate
(
zip
(
data
,
sampleset
.
samples
)):
# Creating one sample per comparison
subprobe_scores
=
[]
...
...
@@ -104,7 +103,9 @@ class BioAlgorithm(metaclass=ABCMeta):
r
for
r
in
biometric_references
if
r
.
key
in
sampleset
.
references
]:
score
=
self
.
score
(
ref
.
data
,
s
)
data
=
make_score_line
(
ref
.
subject
,
sampleset
.
subject
,
sampleset
.
path
,
score
)
data
=
make_four_colums_score
(
ref
.
subject
,
sampleset
.
subject
,
sampleset
.
path
,
score
)
subprobe_scores
.
append
(
Sample
(
data
,
parent
=
ref
))
# Creating one sampleset per probe
...
...
@@ -195,32 +196,23 @@ class Database(metaclass=ABCMeta):
pass
def
make_
score_lin
e
(
def
make_
four_colums_scor
e
(
biometric_reference_subject
,
probe_subject
,
probe_path
,
score
,
):
data
=
"
{0} {1} {2} {3}
\n
"
.
format
(
biometric_reference_subject
,
probe_subject
,
probe_path
,
score
,
biometric_reference_subject
,
probe_subject
,
probe_path
,
score
,
)
return
data
def
sav
e_score
s_four_columns
(
path
,
probe
):
def
creat
e_score
_delayed_sample
(
path
,
probe
):
"""
Write scores in the four columns format
"""
with
open
(
path
,
"
w
"
)
as
f
:
for
biometric_reference
in
probe
.
samples
:
line
=
make_score_line
(
biometric_reference
.
subject
,
probe
.
subject
,
probe
.
path
,
biometric_reference
.
data
,
)
f
.
write
(
line
)
for
score_line
in
probe
.
samples
:
f
.
write
(
score_line
.
data
)
def
load
():
with
open
(
path
)
as
f
:
...
...
This diff is collapsed.
Click to expand it.
bob/bio/base/pipelines/vanilla_biometrics/mixins.py
+
4
−
6
View file @
df4792ad
...
...
@@ -4,7 +4,7 @@ import bob.io.base
import
os
import
functools
import
dask
from
.abstract_classes
import
sav
e_score
s_four_columns
from
.abstract_classes
import
creat
e_score
_delayed_sample
class
BioAlgCheckpointMixin
(
CheckpointMixin
):
...
...
@@ -61,9 +61,7 @@ class BioAlgCheckpointMixin(CheckpointMixin):
else
:
# If sample already there, just load
delayed_enrolled_sample
=
self
.
load
(
path
)
delayed_enrolled_sample
.
key
=
sampleset
.
key
delayed_enrolled_sample
.
subject
=
sampleset
.
subject
delayed_enrolled_sample
=
self
.
load
(
sampleset
,
path
)
return
delayed_enrolled_sample
...
...
@@ -76,9 +74,9 @@ class BioAlgCheckpointMixin(CheckpointMixin):
for
s
in
scored_sample_set
:
# Checkpointing score
path
=
os
.
path
.
join
(
self
.
score_dir
,
str
(
s
.
path
)
+
"
.txt
"
)
bob
.
io
.
base
.
create_directories_safe
(
os
.
path
.
dirname
(
path
))
os
.
makedirs
(
os
.
path
.
dirname
(
path
)
,
exist_ok
=
True
)
delayed_scored_sample
=
sav
e_score
s_four_columns
(
path
,
s
)
delayed_scored_sample
=
creat
e_score
_delayed_sample
(
path
,
s
)
s
.
samples
=
[
delayed_scored_sample
]
return
scored_sample_set
...
...
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