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
19d860e6
Commit
19d860e6
authored
Jun 03, 2021
by
Anthony Larcher
Browse files
clean
parent
3cf12ccc
Changes
2
Hide whitespace changes
Inline
Side-by-side
features_server.py
View file @
19d860e6
...
@@ -221,7 +221,7 @@ class FeaturesServer(object):
...
@@ -221,7 +221,7 @@ class FeaturesServer(object):
feat
=
pca_dct
(
feat
,
self
.
dct_pca_config
[
0
],
self
.
dct_pca_config
[
1
],
self
.
dct_pca_config
[
2
])
feat
=
pca_dct
(
feat
,
self
.
dct_pca_config
[
0
],
self
.
dct_pca_config
[
1
],
self
.
dct_pca_config
[
2
])
elif
self
.
sdc
:
elif
self
.
sdc
:
feat
=
shifted_delta_cepstral
(
feat
,
d
=
self
.
sdc_config
[
0
],
p
=
self
.
sdc_config
[
1
],
k
=
self
.
sdc_config
[
2
])
feat
=
shifted_delta_cepstral
(
feat
,
d
=
self
.
sdc_config
[
0
],
p
=
self
.
sdc_config
[
1
],
k
=
self
.
sdc_config
[
2
])
# Apply a mask on the features
# Apply a mask on the features
if
self
.
mask
is
not
None
:
if
self
.
mask
is
not
None
:
feat
=
self
.
_mask
(
feat
)
feat
=
self
.
_mask
(
feat
)
...
@@ -488,6 +488,7 @@ class FeaturesServer(object):
...
@@ -488,6 +488,7 @@ class FeaturesServer(object):
feat
,
label
=
self
.
post_processing
(
feat
,
label
,
global_mean
,
global_std
)
feat
,
label
=
self
.
post_processing
(
feat
,
label
,
global_mean
,
global_std
)
else
:
else
:
feat
,
label
=
self
.
post_processing
(
feat
,
label
)
feat
,
label
=
self
.
post_processing
(
feat
,
label
)
return
feat
,
label
return
feat
,
label
def
get_features_per_speaker
(
self
,
show
,
idmap
,
channel
=
0
,
input_feature_filename
=
None
,
label
=
None
):
def
get_features_per_speaker
(
self
,
show
,
idmap
,
channel
=
0
,
input_feature_filename
=
None
,
label
=
None
):
...
...
nnet/xvector.py
View file @
19d860e6
...
@@ -1687,6 +1687,7 @@ def extract_embeddings(idmap_name,
...
@@ -1687,6 +1687,7 @@ def extract_embeddings(idmap_name,
model_filename
,
model_filename
,
data_root_name
,
data_root_name
,
device
,
device
,
batch_size
=
1
,
file_extension
=
"wav"
,
file_extension
=
"wav"
,
transform_pipeline
=
{},
transform_pipeline
=
{},
sliding_window
=
False
,
sliding_window
=
False
,
...
@@ -1712,6 +1713,10 @@ def extract_embeddings(idmap_name,
...
@@ -1712,6 +1713,10 @@ def extract_embeddings(idmap_name,
:param mixed_precision:
:param mixed_precision:
:return:
:return:
"""
"""
if
sliding_window
:
batch_size
=
1
# Load the model
# Load the model
if
isinstance
(
model_filename
,
str
):
if
isinstance
(
model_filename
,
str
):
checkpoint
=
torch
.
load
(
model_filename
,
map_location
=
device
)
checkpoint
=
torch
.
load
(
model_filename
,
map_location
=
device
)
...
@@ -1741,7 +1746,7 @@ def extract_embeddings(idmap_name,
...
@@ -1741,7 +1746,7 @@ def extract_embeddings(idmap_name,
)
)
dataloader
=
DataLoader
(
dataset
,
dataloader
=
DataLoader
(
dataset
,
batch_size
=
1
,
batch_size
=
batch_size
,
shuffle
=
False
,
shuffle
=
False
,
drop_last
=
False
,
drop_last
=
False
,
pin_memory
=
True
,
pin_memory
=
True
,
...
...
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