xiph / rnnoise

Recurrent neural network for audio noise reduction
BSD 3-Clause "New" or "Revised" License
3.97k stars 890 forks source link

UnboundLocalError: local variable 'batch_index' referenced before assignment #179

Open ifishtoo opened 3 years ago

ifishtoo commented 3 years ago

I ran python3 ./bin2hdf5.py ../src/trainning.f32 0 87 training.h5 at the suggestion of the numpy git maintainer. It seemed to work. I followed that with $ python3 ./rnn_train.py py Using Theano backend. Build model... Loading data... done. 0 sequences 0 train sequences. x shape = (0, 2000, 42) y shape = (0, 2000, 22) Train... Train on 0 samples, validate on 0 samples Epoch 1/120 Traceback (most recent call last): File "/home/victor/Downloads/git-rnnoise/rnnoise/training/./rnn_train.py", line 112, in model.fit(x_train, [y_train, vad_train], File "/usr/lib/python3/dist-packages/keras/engine/training.py", line 1227, in fit return training_arrays.fit_loop(self, fit_function, fit_inputs, File "/usr/lib/python3/dist-packages/keras/engine/training_arrays.py", line 205, in fit_loop if batch_index == len(batches) - 1: # Last batch. UnboundLocalError: local variable 'batch_index' referenced before assignment

I installed python3 in ubuntu 21.04 via apt and added the proper modules as the error messages indicated. Is there another module I can add to compensate for this error? FYI: My original .raw files are exported from audacity. They are only about 1 minute each of speech (with noise) and 1 minute of noise. Do I need larger samples? I am just trying to filter out the hum from my sound card. Later I will offload the processing to via opencl.