fangwei123456 / spikingjelly

SpikingJelly is an open-source deep learning framework for Spiking Neural Network (SNN) based on PyTorch.
https://spikingjelly.readthedocs.io
Other
1.35k stars 239 forks source link

speechcommands reproducation #330

Closed Hjwinging closed 1 year ago

Hjwinging commented 1 year ago

Hello, I would like to ask a problem.When I use Spikingjelly to reproduce the code of speechcommands.py, there is a problem, and the audio fails to be read. I have tried many methods and can’t find how to solve the problem.

Traceback (most recent call last): File "D:\OneDrive - ilil\pythonProject\spikingjellyTeamExperiments\Voice_classification.py", line 359, in for audios, labels in tqdm(train_dataloader): File "D:\Anaconda3\envs\pytorch\lib\site-packages\tqdm\std.py", line 1195, in iter for obj in iterable: File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 530, in next data = self._next_data() File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 570, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\OneDrive - ilil\pythonProject\spikingjelly\datasets\speechcommands.py", line 188, in getitem waveform, sample_rate = torchaudio.load(noisepath) File "D:\Anaconda3\envs\pytorch\lib\site-packages\torchaudio\backend\soundfilebackend.py", line 197, in load with soundfile.SoundFile(filepath, "r") as file: File "D:\Anaconda3\envs\pytorch\lib\site-packages\soundfile.py", line 655, in init self._file = self._open(file, mode_int, closefd) File "D:\Anaconda3\envs\pytorch\lib\site-packages\soundfile.py", line 1213, in _open raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name)) soundfile.LibsndfileError: Error opening './SpeechCommands\speech_commands_v0.01\SpeechCommands\speech_commands_v0.01\_backgroundnoise\doing_the_dishes.wav': System error.

Yanqi-Chen commented 1 year ago

It seems to be caused by a corrupted audio file. Have you ever tried re-downloading the dataset?

Hjwinging commented 1 year ago

Thank you for your help, however, I tried re-downloading the dataset. Because the dataset can be downloaded from the code, right?But I think it may be a problem with the path. I see that there are two SpeechCommands\speech_commands_v0.01 in the error message path, but I can’t find where there is a statement path that controls the search for audio.

Yanqi-Chen commented 1 year ago

I have fixed it in the latest commit. Please let me know if you have further questions.

Hjwinging commented 1 year ago

My problem has finally been solved, the program can run, and each epoch has output, such as matrix and correct rate, etc. Thank you very much, Mr. Chen.