nttcslab / byol-a

BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation
https://arxiv.org/abs/2103.06695
Other
204 stars 35 forks source link

Random crop is not working. #9

Closed JUiscoming closed 2 years ago

JUiscoming commented 2 years ago

https://github.com/nttcslab/byol-a/blob/60cebdc514951e6b42e18e40a2537a01a39ad47b/byol_a/dataset.py#L80-L82

If len(wav) > self.unit_length, length_adj will be a negative value. So start will be 0. If wav (before pad) is shorter than unit length, length_adj == 0 after padding. So start is always 0. So It will only perform a certain area of crop from 0 to self.unit_length (cropped_wav == wav[0: self.unit_length]), not random crop.

So I think line 80 should be changed to length_adj = len(wav) - self.unit_length .

daisukelab commented 2 years ago

Hi @JUiscoming I am sorry about this bug. And thank you for spotting, you are totally correct. I fixed it and will commit then. I also checked if any results on the paper have to be fixed or not, and confirmed no change needed. This bug was found implemented when I brought development codes to this repository.

daisukelab commented 2 years ago

Fixed by a0f4d8445664af37d6aa112779f62d07adfb0740