Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pad.base
Commits
f01d2bda
Commit
f01d2bda
authored
Aug 21, 2019
by
Anjith GEORGE
Browse files
WIP: Should work for audio too..
parent
bd4a2e59
Changes
1
Show whitespace changes
Inline
Side-by-side
bob/pad/base/algorithm/ScikitClassifier.py
View file @
f01d2bda
...
...
@@ -16,7 +16,7 @@ import bob.io.base
import
pickle
from
bob.pad.base.utils
import
convert_frame_cont_to_array
,
convert_list_of_frame_cont_to_array
from
bob.pad.base.utils
import
convert_frame_cont_to_array
,
convert_list_of_frame_cont_to_array
,
convert_and_prepare_features
#==============================================================================
...
...
@@ -300,11 +300,11 @@ class ScikitClassifier(Algorithm):
if
self
.
subsample_videos_flag
:
# subsample videos of the real class
real
=
convert_
list_of_frame_cont_to_array
(
self
.
subsample_train_videos
(
training_features
[
0
],
self
.
video_subsampling_step
))
# output is array
real
=
convert_
and_prepare_features
(
self
.
subsample_train_videos
(
training_features
[
0
],
self
.
video_subsampling_step
))
# output is array
else
:
real
=
convert_
list_of_frame_cont_to_array
(
training_features
[
0
])
# output is array
real
=
convert_
and_prepare_features
(
training_features
[
0
])
# output is array
if
self
.
subsample_train_data_flag
:
...
...
@@ -312,11 +312,11 @@ class ScikitClassifier(Algorithm):
if
self
.
subsample_videos_flag
:
# subsample videos of the real class
attack
=
convert_
list_of_frame_cont_to_array
(
self
.
subsample_train_videos
(
training_features
[
1
],
self
.
video_subsampling_step
))
# output is array
attack
=
convert_
and_prepare_features
(
self
.
subsample_train_videos
(
training_features
[
1
],
self
.
video_subsampling_step
))
# output is array
else
:
attack
=
convert_
list_of_frame_cont_to_array
(
training_features
[
1
])
# output is array
attack
=
convert_
and_prepare_features
(
training_features
[
1
])
# output is array
if
self
.
subsample_train_data_flag
:
...
...
@@ -419,13 +419,8 @@ class ScikitClassifier(Algorithm):
"""
# 1. Convert input array to numpy array if necessary.
if
isinstance
(
feature
,
FrameContainer
):
# if FrameContainer convert to 2D numpy array
features_array
=
convert_frame_cont_to_array
(
feature
)
else
:
features_array
=
feature
.
copy
()
features_array
=
convert_and_prepare_features
(
feature
)
features_array_norm
=
self
.
_normalize
(
features_array
,
train
=
False
)
...
...
Write
Preview
Markdown
is supported
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