Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.base
Commits
d320fbc6
Commit
d320fbc6
authored
May 11, 2016
by
Manuel Günther
Browse files
Allowing feature extraction and projection to fail, when --allow-missing-files is enabled
parent
f71b04c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
bob/bio/base/tools/algorithm.py
View file @
d320fbc6
...
...
@@ -128,6 +128,15 @@ def project(algorithm, extractor, groups = None, indices = None, allow_missing_f
feature
=
extractor
.
read_feature
(
feature_file
)
# project feature
projected
=
algorithm
.
project
(
feature
)
if
projected
is
None
:
if
allow_missing_files
:
logger
.
debug
(
"... Projection for extracted file %s failed; skipping"
,
feature_file
)
continue
else
:
logger
.
error
(
"Projection of file '%s' was not successful"
,
feature_file
)
continue
# write it
algorithm
.
write_feature
(
projected
,
projected_file
)
...
...
@@ -265,6 +274,15 @@ def enroll(algorithm, extractor, compute_zt_norm, indices = None, groups = ['dev
enroll_features
=
[
reader
.
read_feature
(
enroll_file
)
for
enroll_file
in
enroll_files
]
model
=
algorithm
.
enroll
(
enroll_features
)
if
model
is
None
:
if
allow_missing_files
:
logger
.
debug
(
"... Enrollment for model %s failed; skipping"
,
model_id
)
continue
else
:
logger
.
error
(
"Enrollemnt of model '%s' was not successful"
,
model_id
)
continue
# save the model
algorithm
.
write_model
(
model
,
model_file
)
...
...
@@ -303,6 +321,15 @@ def enroll(algorithm, extractor, compute_zt_norm, indices = None, groups = ['dev
t_enroll_features
=
[
reader
.
read_feature
(
t_enroll_file
)
for
t_enroll_file
in
t_enroll_files
]
t_model
=
algorithm
.
enroll
(
t_enroll_features
)
if
t_model
is
None
:
if
allow_missing_files
:
logger
.
debug
(
"... Enrollment for T-model %s failed; skipping"
,
t_model_id
)
continue
else
:
logger
.
error
(
"Enrollemnt of T-model '%s' was not successful"
,
t_model_id
)
continue
# save model
algorithm
.
write_model
(
t_model
,
t_model_file
)
else
:
...
...
bob/bio/base/tools/extractor.py
View file @
d320fbc6
...
...
@@ -117,6 +117,15 @@ def extract(extractor, preprocessor, groups=None, indices = None, allow_missing_
data
=
preprocessor
.
read_data
(
data_file
)
# extract feature
feature
=
extractor
(
data
)
if
feature
is
None
:
if
allow_missing_files
:
logger
.
debug
(
"... Feature extraction for data file %s failed; skipping"
,
data_file
)
continue
else
:
logger
.
error
(
"Feature extraction of file '%s' was not successful"
,
data_file
)
continue
# write feature
extractor
.
write_feature
(
feature
,
feature_file
)
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment