CNN-for-single-channel-speech-enhancement icon indicating copy to clipboard operation
CNN-for-single-channel-speech-enhancement copied to clipboard

'numpy.float64' object cannot be interpreted as an index

Open raikar008 opened this issue 6 years ago • 6 comments

Exception in thread Thread-2: Traceback (most recent call last): File "/home/raikar/anaconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/raikar/anaconda2/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "audio_reader.py", line 150, in thread_main data.strides[1])) File "/home/raikar/anaconda2/lib/python2.7/site-packages/numpy/lib/stride_tricks.py", line 102, in as_strided array = np.asarray(DummyArray(interface, base=x)) File "/home/raikar/anaconda2/lib/python2.7/site-packages/numpy/core/numeric.py", line 492, in asarray return array(a, dtype, copy=False, order=order) TypeError: 'numpy.float64' object cannot be interpreted as an index

Exception in thread Thread-1: Traceback (most recent call last): File "/home/raikar/anaconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/raikar/anaconda2/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "audio_reader.py", line 150, in thread_main data.strides[1])) File "/home/raikar/anaconda2/lib/python2.7/site-packages/numpy/lib/stride_tricks.py", line 102, in as_strided array = np.asarray(DummyArray(interface, base=x)) File "/home/raikar/anaconda2/lib/python2.7/site-packages/numpy/core/numeric.py", line 492, in asarray return array(a, dtype, copy=False, order=order) TypeError: 'numpy.float64' object cannot be interpreted as an index

raikar008 avatar Feb 27 '18 08:02 raikar008

Hi @raikar008 i am also having the same issues and i have been on it for 2 days now, want to ask if you solved it. i have tried different approaches but all to no avail.

imchukwu avatar Mar 15 '18 16:03 imchukwu

This error is probably due to the versions of the dependencies, and I guess rounding the float number to an integer will get things to work.

zhr1201 avatar Mar 16 '18 02:03 zhr1201

Yes i did some research and discovered that floating point indices was finally removed from numpy 1.12. so the walk around was the cast all indices to int.

data_frames = stride_tricks.as_strided( data, shape=(int(num_iter), int(self.N_IN), 2, int(self.frame_length)), strides=( int(data.strides[1] * self.frame_move), int(data.strides[1] * self.frame_move), int(data.strides[0]), int(data.strides[1])))

This works fine.

imchukwu avatar Mar 16 '18 09:03 imchukwu

@zhr1201 thanks alot i just test now with 5 noise for both training and testing and 3 clean speech for training while 2 for testing. am actually trying to know how long the training process will take, i dont have a GPU, but uses 2 CPU cores. please can you give me a rough estimated time. You did a very good job here, thanks once more.

Also if you have a documentation of the entire process, i would really appreciate, i want to have a detailed understanding of the entire process and not just to run the code.

imchukwu avatar Mar 16 '18 09:03 imchukwu

@imchukwu Thanks for finding out the reason. The training time depends on the types of dataset you use. I used TIMIT and 100 types of noise generating a dataset more than 100 h of training set, and it took about a day to make the output sound reasonable. So two CPUs probably won't get things to work using such a big dataset.

I don't know how long the training will take given your training set, but with such limited amount of data, the performance using different speech for training and testing won't be good. You can just test you model using the training data.

And I am really sorry but I don't update the project anymore because I have two much projects to work on.

zhr1201 avatar Mar 16 '18 09:03 zhr1201

it occurs when i use your code .it likes below Exception in thread Thread-7: Traceback (most recent call last): File "E:\anaconda\lib\threading.py", line 916, in _bootstrap_inner self.run() File "E:\anaconda\lib\threading.py", line 864, in run self._target(*self._args, **self.kwargs) File "D:\deeplearning\CNN-for-single-channel-speech-enhancement-master\audio_reader.py", line 108, in thread_main noise_org, _ = librosa.load(self.noisefiles[noise_id], sr=None) File "E:\anaconda\lib\site-packages\librosa\core\audio.py", line 112, in load with audioread.audio_open(os.path.realpath(path)) as input_file: File "E:\anaconda\lib\site-packages\audioread_init.py", line 116, in audio_open raise NoBackendError() audioread.NoBackendError

but i test the code l'ibrosa; it does not have problem。can you give me some advice

bailiangze avatar Nov 28 '18 07:11 bailiangze