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
Anthony Larcher
sidekit
Commits
795baf42
Commit
795baf42
authored
Jun 23, 2021
by
Anthony Larcher
Browse files
debug xvector extraction on a sliding window
parent
2edd99d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
nnet/xvector.py
View file @
795baf42
...
...
@@ -314,7 +314,7 @@ class TrainingMonitor():
"""
# TODO
self
.
logger
.
critical
(
f
"***Validation metrics - Cross validation accuracy =
{
self
.
val_acc
[
-
1
]
}
%, EER =
{
self
.
val_eer
[
-
1
]
*
100
}
%"
)
self
.
logger
.
critical
(
f
"***Test metrics - Test EER =
{
self
.
test_eer
[
-
1
]
*
100
}
%"
)
#
self.logger.critical(f"***Test metrics - Test EER = {self.test_eer[-1] * 100} %")
def
display_final
(
self
):
"""
...
...
@@ -1673,7 +1673,7 @@ def cross_validation(model, validation_loader, device, validation_shape, tar_ind
return
(
100.
*
accuracy
.
cpu
().
numpy
()
/
validation_shape
[
0
],
loss
.
cpu
().
numpy
()
/
((
batch_idx
+
1
)
*
batch_size
),
equal_error_rate
)
return
0
,
0
,
0
#
return 0, 0, 0
def
extract_embeddings
(
idmap_name
,
...
...
@@ -1715,6 +1715,7 @@ def extract_embeddings(idmap_name,
checkpoint
=
torch
.
load
(
model_filename
,
map_location
=
device
)
speaker_number
=
checkpoint
[
"speaker_number"
]
model_opts
=
checkpoint
[
"model_archi"
]
model_opts
[
"embedding_size"
]
=
256
model
=
Xtractor
(
speaker_number
,
model_archi
=
model_opts
[
"model_type"
],
loss
=
model_opts
[
"loss"
][
"type"
],
...
...
@@ -1770,11 +1771,11 @@ def extract_embeddings(idmap_name,
for
td
in
tmp_data
:
_
,
vec
=
model
(
x
=
td
.
to
(
device
),
is_eval
=
True
,
norm_embedding
=
norm_embeddings
)
embed
.
append
(
vec
.
detach
().
cpu
())
modelset
.
extend
(
mod
*
data
.
shape
[
0
])
segset
.
extend
(
seg
*
data
.
shape
[
0
])
if
sliding_window
:
starts
.
extend
(
numpy
.
arange
(
start
,
start
+
data
.
shape
[
0
]
*
win_shift
,
win_shift
))
tmp_start
=
numpy
.
arange
(
0
,
data
.
shape
[
0
]
*
win_shift
,
win_shift
)
starts
.
extend
(
tmp_start
*
sample_rate
+
start
.
detach
().
cpu
().
numpy
())
else
:
starts
.
append
(
start
)
...
...
Write
Preview
Markdown
is supported
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