Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.voice
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
Container registry
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.pad.voice
Commits
690b5fcd
There was a problem fetching the pipeline summary.
Commit
690b5fcd
authored
7 years ago
by
Pavel KORSHUNOV
Browse files
Options
Downloads
Patches
Plain Diff
corrected eval algo
parent
c7404221
No related branches found
No related tags found
1 merge request
!10
Some refactoring and tensorflow support
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pad/voice/algorithm/LSTMEval.py
+13
-11
13 additions, 11 deletions
bob/pad/voice/algorithm/LSTMEval.py
with
13 additions
and
11 deletions
bob/pad/voice/algorithm/LSTMEval.py
+
13
−
11
View file @
690b5fcd
...
...
@@ -38,18 +38,19 @@ class LSTMEval(Algorithm):
self
.
data_std
=
None
# import ipdb
# ipdb.set_trace()
features_length
=
input_shape
[
1
]
if
normalization_file
and
os
.
path
.
exists
(
normalization_file
):
npzfile
=
numpy
.
load
(
normalization_file
)
self
.
data_mean
=
npzfile
[
'
data_mean
'
]
self
.
data_std
=
npzfile
[
'
data_std
'
]
if
not
self
.
data_std
.
shape
:
# if std was saved as scalar
self
.
data_std
=
numpy
.
ones
(
input_shape
)
if
self
.
data_mean
.
shape
[
0
]
>
input_shape
[
0
]:
self
.
data_mean
=
self
.
data_mean
[:
input_shape
[
0
]]
self
.
data_mean
=
numpy
.
reshape
(
self
.
data_mean
,
input_shape
)
if
self
.
data_std
.
shape
[
0
]
>
input_shape
[
0
]:
self
.
data_std
=
self
.
data_std
[:
input_shape
[
0
]]
self
.
data_std
=
numpy
.
reshape
(
self
.
data_std
,
input_shape
)
self
.
data_std
=
numpy
.
ones
(
features_length
)
#
if self.data_mean.shape[0] > input_shape[0]:
#
self.data_mean = self.data_mean[:input_shape[0]]
#
self.data_mean = numpy.reshape(self.data_mean, input_shape)
#
if self.data_std.shape[0] > input_shape[0]:
#
self.data_std = self.data_std[:input_shape[0]]
#
self.data_std = numpy.reshape(self.data_std, input_shape)
else
:
self
.
data_mean
=
0
self
.
data_std
=
1
...
...
@@ -74,7 +75,7 @@ class LSTMEval(Algorithm):
# Creating an LSTM network
graph
=
lstm
(
inputs
,
lstm_cell_size
,
num_time_steps
=
num_time_steps
,
batch_size
=
batch_size
,
output_activation_size
=
num_classes
,
scope
=
'
lstm
'
,
output_activation_size
=
num_classes
,
scope
=
'
lstm
'
,
name
=
'
sync_cell
'
,
weights_initializer
=
initializer
,
activation
=
tf
.
nn
.
sigmoid
,
reuse
=
reuse
)
# fully connect the LSTM output to the classes
...
...
@@ -126,6 +127,10 @@ class LSTMEval(Algorithm):
if
not
self
.
data_reader
:
self
.
data_reader
=
DiskAudio
([
0
],
[
0
],
[
1
]
+
self
.
input_shape
)
# normalize the feature using pre-loaded normalization parameters
if
self
.
data_std
is
not
None
and
self
.
data_std
.
all
()
>
0
:
feature
=
numpy
.
divide
(
feature
-
self
.
data_mean
,
self
.
data_std
)
# split the feature in the sliding window frames
frames
,
_
=
self
.
data_reader
.
split_features_in_windows
(
features
=
feature
,
label
=
1
,
win_size
=
self
.
num_time_steps
,
...
...
@@ -138,9 +143,6 @@ class LSTMEval(Algorithm):
for
i
in
range
(
frames
.
shape
[
0
]):
frame
=
frames
[
i
]
frame
=
numpy
.
reshape
(
frame
,
[
1
]
+
self
.
input_shape
)
# normalize the frame using pre-loaded normalization parameters
if
self
.
data_std
is
not
None
and
self
.
data_std
.
all
()
>
0
:
frame
=
numpy
.
divide
(
frame
-
self
.
data_mean
,
self
.
data_std
)
#logger.info(" .... projecting frame of shape {0} onto DNN model".format(frame.shape))
if
self
.
session
is
not
None
:
...
...
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