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
ebdf02a1
Commit
ebdf02a1
authored
3 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Creating a setter for AlgorithmTransformer that sets projector file
parent
00e9b63b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!269
Creating a setter for AlgorithmTransformer that sets projector file
Pipeline
#56836
passed
3 years ago
Stage: build
Changes
2
Pipelines
5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/base/pipelines/vanilla_biometrics/wrappers.py
+16
-0
16 additions, 0 deletions
bob/bio/base/pipelines/vanilla_biometrics/wrappers.py
bob/bio/base/transformers/algorithm.py
+11
-1
11 additions, 1 deletion
bob/bio/base/transformers/algorithm.py
with
27 additions
and
1 deletion
bob/bio/base/pipelines/vanilla_biometrics/wrappers.py
+
16
−
0
View file @
ebdf02a1
...
...
@@ -358,6 +358,22 @@ def checkpoint_vanilla_biometrics(
if
isinstance
(
pipeline
.
biometric_algorithm
,
BioAlgorithmLegacy
):
pipeline
.
biometric_algorithm
.
base_dir
=
bio_ref_scores_dir
# Here we need to check if the LAST transformer is
# 1. is instance of CheckpointWrapper
# 2. Its estimator is instance of AlgorithmTransformer
if
(
isinstance
(
pipeline
.
transformer
[
-
1
],
CheckpointWrapper
)
and
hasattr
(
pipeline
.
transformer
[
-
1
].
estimator
,
"
estimator
"
)
and
isinstance
(
pipeline
.
transformer
[
-
1
].
estimator
.
estimator
,
AlgorithmTransformer
)
):
pipeline
.
transformer
[
-
1
].
estimator
.
estimator
.
projector_file
=
bio_ref_scores_dir
else
:
pipeline
.
biometric_algorithm
=
BioAlgorithmCheckpointWrapper
(
pipeline
.
biometric_algorithm
,
base_dir
=
bio_ref_scores_dir
,
hash_fn
=
hash_fn
...
...
This diff is collapsed.
Click to expand it.
bob/bio/base/transformers/algorithm.py
+
11
−
1
View file @
ebdf02a1
...
...
@@ -51,7 +51,7 @@ class AlgorithmTransformer(TransformerMixin, BaseEstimator):
raise
ValueError
(
f
"
{
instance
}
needs to be picklable
"
)
self
.
instance
=
instance
self
.
projector_file
=
projector_file
self
.
_
projector_file
=
projector_file
super
().
__init__
(
**
kwargs
)
def
fit
(
self
,
X
,
y
=
None
):
...
...
@@ -74,6 +74,16 @@ class AlgorithmTransformer(TransformerMixin, BaseEstimator):
for
data
,
metadata
in
zip
(
X
,
metadata
)
]
@property
def
projector_file
(
self
):
return
self
.
_projector_file
@projector_file.setter
def
projector_file
(
self
,
v
):
base_dir
=
os
.
path
.
dirname
(
v
)
filename
=
os
.
path
.
basename
(
self
.
projector_file
)
self
.
_projector_file
=
os
.
path
.
join
(
base_dir
,
filename
)
def
_more_tags
(
self
):
return
{
"
stateless
"
:
not
self
.
instance
.
requires_projector_training
,
...
...
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