Skip to content
GitLab
Menu
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
7de67590
Commit
7de67590
authored
Feb 15, 2017
by
Pavel KORSHUNOV
Browse files
Merge branch 'master' of gitlab.idiap.ch:bob/bob.pad.voice
parents
9f90dce2
db5aedf8
Pipeline
#7285
failed with stages
in 12 minutes and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/pad/voice/algorithm/tensorflow_algorithm.py
View file @
7de67590
...
...
@@ -32,7 +32,7 @@ class TensorflowAlgo(Algorithm):
)
self
.
data_reader
=
DiskAudio
([
0
],
[
0
])
#
self.session = tf.Session()
self
.
session
=
tf
.
Session
()
self
.
dnn_model
=
None
# def __del__(self):
...
...
@@ -47,8 +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), s
ession=self.session
)
self
.
dnn_model
.
load
(
projector_file
,
True
)
self
.
dnn_model
.
load
_hdf5
(
bob
.
io
.
base
.
HDF5File
(
projector_file
),
s
hape
=
[
1
,
6560
,
1
]
)
#
self.dnn_model.load(projector_file, True)
def
project_feature
(
self
,
feature
):
...
...
@@ -58,8 +58,8 @@ class TensorflowAlgo(Algorithm):
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
)
#
return tf.nn.log_softmax(tf.nn.log_softmax(forward_output)).eval(session=self.session)
return
forward_output
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
...
...
bob/pad/voice/database/asvspoof2017.py
View file @
7de67590
...
...
@@ -78,5 +78,6 @@ class ASVspoof2017PadDatabase(PadDatabase):
Returns: A set of Files with the specified properties.
"""
purposes
=
self
.
convert_purposes
(
purposes
,
(
'genuine'
,
'spoof'
),
(
'real'
,
'attack'
))
objects
=
self
.
__db
.
objects
(
protocol
=
protocol
,
groups
=
groups
,
purposes
=
purposes
,
**
kwargs
)
return
[
ASVspoof2017PadFile
(
f
)
for
f
in
objects
]
Write
Preview
Supports
Markdown
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