Spaces:
Runtime error
Runtime error
Update helper.py
Browse files
helper.py
CHANGED
@@ -77,6 +77,10 @@ def evaluate(estimate, reference):
|
|
77 |
print(f"STOI score: {stoi_mix}")
|
78 |
|
79 |
def get_irms(stft_clean, stft_noise):
|
|
|
|
|
|
|
|
|
80 |
mag_clean = stft_clean.abs() ** 2
|
81 |
mag_noise = stft_noise.abs() ** 2
|
82 |
irm_speech = mag_clean / (mag_clean + mag_noise)
|
|
|
77 |
print(f"STOI score: {stoi_mix}")
|
78 |
|
79 |
def get_irms(stft_clean, stft_noise):
|
80 |
+
if stft_clean.size(1) > stft_noise.size(1):
|
81 |
+
stft_noise = F.pad(stft_noise, (0, stft_clean.size(1) - stft_noise.size(1)))
|
82 |
+
elif stft_noise.size(1) > stft_clean.size(1):
|
83 |
+
stft_clean = F.pad(stft_clean, (0, stft_noise.size(1) - stft_clean.size(1)))
|
84 |
mag_clean = stft_clean.abs() ** 2
|
85 |
mag_noise = stft_noise.abs() ** 2
|
86 |
irm_speech = mag_clean / (mag_clean + mag_noise)
|