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
751a2488
Commit
751a2488
authored
Feb 15, 2017
by
Pavel KORSHUNOV
Browse files
asvspoo2017 corrections, tensorflow gmm for hdf5
parent
bc6bc98a
Changes
2
Hide whitespace changes
Inline
Side-by-side
bob/pad/voice/algorithm/tensorflow_algorithm.py
View file @
751a2488
...
...
@@ -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 @
751a2488
...
...
@@ -48,7 +48,7 @@ class ASVspoof2017PadDatabase(PadDatabase):
if
names
is
None
:
return
None
mapping
=
dict
(
zip
(
low
_level_names
,
high
_level_names
))
mapping
=
dict
(
zip
(
high
_level_names
,
low
_level_names
))
if
isinstance
(
names
,
str
):
return
mapping
.
get
(
names
)
return
[
mapping
[
g
]
for
g
in
names
]
...
...
@@ -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
.
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