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
f9f9d650
Commit
f9f9d650
authored
Jan 20, 2021
by
Anthony Larcher
Browse files
include format in frontend io
parent
827a0b75
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/io.py
View file @
f9f9d650
...
...
@@ -468,7 +468,9 @@ def read_audio(input_file_name, framerate=None):
def
write_label
(
label
,
output_file_name
,
selected_label
=
'speech'
,
frame_per_second
=
100
):
frame_per_second
=
100
,
show
=
None
,
format
=
"mdtm"
):
"""Save labels in ALIZE format
:param output_file_name: name of the file to write to
...
...
@@ -483,11 +485,29 @@ def write_label(label,
# append 0 at the beginning of the list, append the last index to the list
idx
=
[
0
]
+
(
numpy
.
arange
(
len
(
bits
))[
bits
]
+
1
).
tolist
()
+
[
len
(
label
)]
framerate
=
decimal
.
Decimal
(
1
)
/
decimal
.
Decimal
(
frame_per_second
)
# for each pair of indexes (idx[i] and idx[i+1]), create a segment
with
open
(
output_file_name
,
'w'
)
as
fid
:
if
format
==
"lab"
:
# for each pair of indexes (idx[i] and idx[i+1]), create a segment
with
open
(
output_file_name
,
'w'
)
as
fid
:
for
i
in
range
(
~
label
[
0
],
len
(
idx
)
-
1
,
2
):
fid
.
write
(
'{} {} {}
\n
'
.
format
(
str
(
idx
[
i
]
*
framerate
),
str
(
idx
[
i
+
1
]
*
framerate
),
selected_label
))
else
:
# write in MDTM format
lst
=
[]
for
i
in
range
(
~
label
[
0
],
len
(
idx
)
-
1
,
2
):
fid
.
write
(
'{} {} {}
\n
'
.
format
(
str
(
idx
[
i
]
*
framerate
),
str
(
idx
[
i
+
1
]
*
framerate
),
selected_label
))
gender
=
'U'
env
=
'U'
channel
=
'U'
start
=
idx
[
i
]
*
framerate
stop
=
idx
[
i
+
1
]
*
framerate
lst
.
append
(
'{:s} 1 {:.2f} {:.2f} {:s} {:s} {:s} {:s}
\n
'
.
format
(
show
,
start
,
stop
-
start
,
gender
,
channel
,
env
,
"speech"
))
with
open
(
output_file_name
,
'w'
,
encoding
=
"utf8"
)
as
fid
:
for
line
in
lst
:
fid
.
write
(
line
)
def
read_label
(
input_file_name
,
selected_label
=
'speech'
,
frame_per_second
=
100
):
...
...
nnet/sincnet.py
View file @
f9f9d650
...
...
@@ -337,7 +337,6 @@ class SincNet(torch.nn.Module):
bias
=
True
,
)
else
:
print
(
f
"smaple_rate =
{
self
.
sample_rate
}
"
)
conv1d
=
SincConv1d
(
out_channels
,
kernel_size
,
...
...
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