seorim0 / NUNet-TLS

Nested U-Net with two-level skip connections for speech enhancement
MIT License
30 stars 4 forks source link

about Data Normalization function: minMaxNorm #3

Closed lixinlun closed 2 years ago

lixinlun commented 2 years ago

Hello,同学你好!

In the last few days, I was trying to change the dataloader from loading .npy huge file to load wav files from folders directly on your DCCRN project. (https://github.com/seorim0/DCCRN-with-various-loss-functions)

Fortunately, I saw a same requset from the Issues (https://github.com/seorim0/DCCRN-with-various-loss-functions/issues/4), which helped me a lot. Now, I find a function in NUNet-TLS --> tools.py --> minMaxNorm(wav, eps=1e-8), However, is the function result value correct?

tools.py line72-76: def minMaxNorm(wav, eps=1e-8): max = np.max(abs(wav)) min = np.min(abs(wav)) wav = (wav - min) / (max - min + eps) return wav

the wav data should have negtive values, so... should we change the code to like this?

def minMaxNorm(wav, eps=1e-8): max = np.max(wav) min = np.min(wav) wav = (wav - min) / (max - min + eps) return wav

I mean, should we abandon the abs()? thank you!!!

seorim0 commented 2 years ago

Hi! Thank you for your interest in our project.

Yes, similar issues can be found here. (#8)

The minMaxNorm function was designed to set the input value between -1 and 1. You may abandon abs() depending on your purpose.

And actually, in this project, since inputs = torch.clamp_(inputs, -1, 1) is used in dataloader.py, you do not need to use the function.

I hope this answer was helpful to you!

lixinlun commented 2 years ago

👍👍👍Got it! Your answer is really helpful, thanks and thanks again~