Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.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.pad.base
Commits
f01d2bda
Commit
f01d2bda
authored
5 years ago
by
Anjith GEORGE
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Should work for audio too..
parent
bd4a2e59
No related branches found
No related tags found
1 merge request
!64
Scikit wrapper
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pad/base/algorithm/ScikitClassifier.py
+6
-11
6 additions, 11 deletions
bob/pad/base/algorithm/ScikitClassifier.py
with
6 additions
and
11 deletions
bob/pad/base/algorithm/ScikitClassifier.py
+
6
−
11
View file @
f01d2bda
...
@@ -16,7 +16,7 @@ import bob.io.base
...
@@ -16,7 +16,7 @@ import bob.io.base
import
pickle
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):
...
@@ -300,11 +300,11 @@ class ScikitClassifier(Algorithm):
if
self
.
subsample_videos_flag
:
# subsample videos of the real class
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
:
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
:
if
self
.
subsample_train_data_flag
:
...
@@ -312,11 +312,11 @@ class ScikitClassifier(Algorithm):
...
@@ -312,11 +312,11 @@ class ScikitClassifier(Algorithm):
if
self
.
subsample_videos_flag
:
# subsample videos of the real class
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
:
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
:
if
self
.
subsample_train_data_flag
:
...
@@ -419,13 +419,8 @@ class ScikitClassifier(Algorithm):
...
@@ -419,13 +419,8 @@ class ScikitClassifier(Algorithm):
"""
"""
# 1. Convert input array to numpy array if necessary.
# 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
)
features_array
=
convert_and_prepare_features
(
feature
)
else
:
features_array
=
feature
.
copy
()
features_array_norm
=
self
.
_normalize
(
features_array
,
train
=
False
)
features_array_norm
=
self
.
_normalize
(
features_array
,
train
=
False
)
...
...
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