Spaces:
Running
on
Zero
Running
on
Zero
Update utils/decode.py
Browse files- utils/decode.py +4 -4
utils/decode.py
CHANGED
@@ -63,7 +63,7 @@ def decode_one_audio_mossformer2_ss_16k(model, device, inputs, args):
|
|
63 |
"""
|
64 |
out = [] # Initialize the list to store outputs
|
65 |
decode_do_segment = False # Flag to determine if segmentation is needed
|
66 |
-
window = args.sampling_rate * args.decode_window # Decoding window length
|
67 |
stride = int(window * 0.75) # Decoding stride if segmentation is used
|
68 |
b, t = inputs.shape # Get batch size and input length
|
69 |
|
@@ -147,7 +147,7 @@ def decode_one_audio_frcrn_se_16k(model, device, inputs, args):
|
|
147 |
"""
|
148 |
decode_do_segment = False # Flag to determine if segmentation is needed
|
149 |
|
150 |
-
window = args.sampling_rate * args.decode_window # Decoding window length
|
151 |
stride = int(window * 0.75) # Decoding stride for segmenting the input
|
152 |
b, t = inputs.shape # Get batch size (b) and input length (t)
|
153 |
|
@@ -218,7 +218,7 @@ def decode_one_audio_mossformergan_se_16k(model, device, inputs, args):
|
|
218 |
numpy.ndarray: The decoded audio output, which has been enhanced by the model.
|
219 |
"""
|
220 |
decode_do_segment = False # Flag to determine if segmentation is needed
|
221 |
-
window = args.sampling_rate * args.decode_window # Decoding window length
|
222 |
stride = int(window * 0.75) # Decoding stride for segmenting the input
|
223 |
b, t = inputs.shape # Get batch size (b) and input length (t)
|
224 |
|
@@ -290,7 +290,7 @@ def _decode_one_audio_mossformergan_se_16k(model, device, inputs, args):
|
|
290 |
"""
|
291 |
input_len = inputs.size(-1) # Get the length of the input audio
|
292 |
nframe = int(np.ceil(input_len / args.win_inc)) # Calculate the number of frames based on window increment
|
293 |
-
padded_len = nframe * args.win_inc # Calculate the padded length to fit the model
|
294 |
padding_len = padded_len - input_len # Determine how much padding is needed
|
295 |
|
296 |
# Pad the input audio with the beginning of the input
|
|
|
63 |
"""
|
64 |
out = [] # Initialize the list to store outputs
|
65 |
decode_do_segment = False # Flag to determine if segmentation is needed
|
66 |
+
window = int(args.sampling_rate * args.decode_window) # Decoding window length
|
67 |
stride = int(window * 0.75) # Decoding stride if segmentation is used
|
68 |
b, t = inputs.shape # Get batch size and input length
|
69 |
|
|
|
147 |
"""
|
148 |
decode_do_segment = False # Flag to determine if segmentation is needed
|
149 |
|
150 |
+
window = int(args.sampling_rate * args.decode_window) # Decoding window length
|
151 |
stride = int(window * 0.75) # Decoding stride for segmenting the input
|
152 |
b, t = inputs.shape # Get batch size (b) and input length (t)
|
153 |
|
|
|
218 |
numpy.ndarray: The decoded audio output, which has been enhanced by the model.
|
219 |
"""
|
220 |
decode_do_segment = False # Flag to determine if segmentation is needed
|
221 |
+
window = int(args.sampling_rate * args.decode_window) # Decoding window length
|
222 |
stride = int(window * 0.75) # Decoding stride for segmenting the input
|
223 |
b, t = inputs.shape # Get batch size (b) and input length (t)
|
224 |
|
|
|
290 |
"""
|
291 |
input_len = inputs.size(-1) # Get the length of the input audio
|
292 |
nframe = int(np.ceil(input_len / args.win_inc)) # Calculate the number of frames based on window increment
|
293 |
+
padded_len = int(nframe * args.win_inc) # Calculate the padded length to fit the model
|
294 |
padding_len = padded_len - input_len # Determine how much padding is needed
|
295 |
|
296 |
# Pad the input audio with the beginning of the input
|