Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pad.base
Commits
ef993dd2
Commit
ef993dd2
authored
Oct 02, 2018
by
Amir MOHAMMADI
Browse files
convert features to float64 before using them in SVM
parent
3e83cf9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
bob/pad/base/algorithm/SVM.py
View file @
ef993dd2
...
...
@@ -477,6 +477,8 @@ class SVM(Algorithm):
features_array
=
feature
features_array
=
features_array
.
astype
(
'float64'
)
if
not
(
self
.
machine_type
==
'ONE_CLASS'
):
# two-class SVM case
probabilities
=
self
.
machine
.
predict_class_and_probabilities
(
...
...
bob/pad/base/utils/helper_functions.py
View file @
ef993dd2
...
...
@@ -66,9 +66,9 @@ def convert_and_prepare_features(features):
if
isinstance
(
features
[
0
],
bob
.
bio
.
video
.
FrameContainer
):
# if FrameContainer convert to 2D numpy array
return
convert_list_of_frame_cont_to_array
(
features
)
return
convert_list_of_frame_cont_to_array
(
features
)
.
astype
(
'float64'
)
else
:
return
np
.
vstack
(
features
)
return
np
.
vstack
(
features
)
.
astype
(
'float64'
)
def
convert_list_of_frame_cont_to_array
(
frame_containers
):
...
...
@@ -273,9 +273,9 @@ def mean_std_normalize(features,
features_mean
=
np
.
mean
(
features
,
axis
=
0
)
features_std
=
np
.
std
(
features
,
axis
=
0
)
features_std
[
features_std
==
0.0
]
=
1.0
row_norm_list
=
[]
for
row
in
features
:
# row is a sample
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment