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.voice
Commits
654b484d
Commit
654b484d
authored
Dec 13, 2016
by
Pavel KORSHUNOV
Browse files
tensorflow algo suports new model format
parent
b7475dee
Pipeline
#5809
failed with stages
in 12 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/pad/voice/algorithm/tensorflow_algorithm.py
View file @
654b484d
...
...
@@ -32,11 +32,11 @@ class TensorflowAlgo(Algorithm):
)
self
.
data_reader
=
DiskAudio
([
0
],
[
0
])
self
.
session
=
tf
.
Session
()
#
self.session = tf.Session()
self
.
dnn_model
=
None
def
__del__
(
self
):
self
.
session
.
close
()
#
def __del__(self):
#
self.session.close()
def
_check_feature
(
self
,
feature
):
"""Checks that the features are appropriate."""
...
...
@@ -47,7 +47,8 @@ class TensorflowAlgo(Algorithm):
def
load_projector
(
self
,
projector_file
):
logger
.
info
(
"Loading pretrained model from {0}"
.
format
(
projector_file
))
self
.
dnn_model
=
SequenceNetwork
()
self
.
dnn_model
.
load
(
bob
.
io
.
base
.
HDF5File
(
projector_file
),
session
=
self
.
session
)
# self.dnn_model.load(bob.io.base.HDF5File(projector_file), session=self.session)
self
.
dnn_model
.
load
(
projector_file
,
True
)
def
project_feature
(
self
,
feature
):
...
...
@@ -56,8 +57,9 @@ class TensorflowAlgo(Algorithm):
frames
=
numpy
.
asarray
(
frames
)
logger
.
debug
(
" .... And %d frames are extracted to pass into DNN model"
%
frames
.
shape
[
0
])
frames
=
numpy
.
reshape
(
frames
,
(
frames
.
shape
[
0
],
-
1
,
1
))
forward_output
=
self
.
dnn_model
(
frames
,
session
=
self
.
session
)
return
tf
.
nn
.
log_softmax
(
tf
.
nn
.
log_softmax
(
forward_output
)).
eval
(
session
=
self
.
session
)
forward_output
=
self
.
dnn_model
(
frames
)
# return tf.nn.log_softmax(tf.nn.log_softmax(forward_output)).eval(session=self.session)
return
forward_output
def
project
(
self
,
feature
):
"""project(feature) -> projected
...
...
develop.cfg
View file @
654b484d
...
...
@@ -58,7 +58,7 @@ bob.pad.base = git git@gitlab.idiap.ch:bob/bob.pad.base.git
bob.ap = git git@gitlab.idiap.ch:bob/bob.ap.git
bob.db.voicepa = git git@gitlab.idiap.ch:bob/bob.db.voicepa.git
bob.extension = git git@gitlab.idiap.ch:bob/bob.extension.git
bob.learn.tensorflow = git branch=
audio-support git@gitlab.idiap.ch:tiago.pereira
/bob.learn.tensorflow.git
bob.learn.tensorflow = git branch=
epoch git@gitlab.ch:bob
/bob.learn.tensorflow.git
bob.bio.db = git git@gitlab.idiap.ch:bob/bob.bio.db.git
bob.pad.db = git git@gitlab.idiap.ch:bob/bob.pad.db.git
bob.bio.spear = git branch=cpqd git@gitlab.idiap.ch:bob/bob.bio.spear.git
...
...
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