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
Ambuj Mehrish
sidekit
Commits
e7b00592
Commit
e7b00592
authored
Sep 25, 2020
by
Anthony Larcher
Browse files
cleaning
parent
feb27cb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
nnet/xsets.py
View file @
e7b00592
...
...
@@ -603,16 +603,10 @@ class IdMapSet(Dataset):
stop
=
int
(
self
.
idmap
.
stop
[
index
])
# add this in case the segment is too short
if
stop
-
start
<=
self
.
min_duration
*
nfo
.
samplerate
:
print
(
"Segment trop court"
)
print
(
f
"Get:
{
stop
-
start
}
and need
{
self
.
min_duration
*
nfo
.
samplerate
}
"
)
print
(
f
"self.min_duration =
{
self
.
min_duration
}
, nfo.samplerate =
{
nfo
.
samplerate
}
"
)
print
(
f
"start =
{
start
}
, stop =
{
stop
}
\t
start//160
{
start
//
160
}
, stop
{
stop
//
160
}
"
)
middle
=
start
+
(
stop
-
start
)
//
2
print
(
f
"middle =
{
middle
}
"
)
start
=
max
(
0
,
int
(
middle
-
(
self
.
min_duration
*
nfo
.
samplerate
/
2
)))
stop
=
int
(
start
+
self
.
min_duration
*
nfo
.
samplerate
)
print
(
f
"Apres modification: start =
{
start
}
, stop =
{
stop
}
total duration:
{
stop
-
start
}
"
)
sig
,
_
=
soundfile
.
read
(
f
"
{
self
.
data_root_path
}
/
{
self
.
idmap
.
rightids
[
index
]
}
.
{
self
.
file_extension
}
"
,
start
=
start
,
stop
=
stop
)
...
...
@@ -621,7 +615,6 @@ class IdMapSet(Dataset):
if
self
.
transform_pipeline
is
not
None
:
sig
,
_
,
___
,
_____
,
_t
,
_s
=
self
.
transforms
((
sig
,
0
,
0
,
0
,
0
,
0
))
return
torch
.
from_numpy
(
sig
).
type
(
torch
.
FloatTensor
),
\
self
.
idmap
.
leftids
[
index
],
\
self
.
idmap
.
rightids
[
index
],
\
...
...
nnet/xvector.py
View file @
e7b00592
...
...
@@ -956,7 +956,7 @@ def extract_embeddings(idmap_name,
file_extension
=
file_extension
,
transform_pipeline
=
transform_pipeline
,
frame_rate
=
int
(
1.
/
frame_shift
),
min_duration
=
(
model
.
context_size
()
+
2
)
*
frame_shift
min_duration
=
(
model
.
context_size
()
+
2
)
*
frame_shift
*
2
)
dataloader
=
DataLoader
(
dataset
,
...
...
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