Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raikar008 opened this issue Feb 27, 2018 · 6 comments
Open

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

raikar008 opened this issue Feb 27, 2018 · 6 comments

Comments

@raikar008
Copy link

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

@imchukwu
Copy link

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.

@zhr1201
Copy link
Owner

zhr1201 commented Mar 16, 2018

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.

@imchukwu
Copy link

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
Copy link

imchukwu commented Mar 16, 2018

@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.

@zhr1201
Copy link
Owner

zhr1201 commented Mar 16, 2018

@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.

@bailiangze
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants