madebyollin / acapellabot

Acapella Extraction with a ConvNet
http://madebyoll.in/posts/cnn_acapella_extraction/
205 stars 44 forks source link

TypeError: 'float' object cannot be interpreted as an index #8

Open ManojDatt opened 6 years ago

ManojDatt commented 6 years ago

('\x1b[33m', 'Retrieved spectrogram; processing...', '\x1b[0m') Traceback (most recent call last): File "acapellabot.py", line 147, in acapellabot.isolateVocals(f, args.fft, args.phase) File "acapellabot.py", line 96, in isolateVocals expandedSpectrogram = conversion.expandToGrid(spectrogram, self.peakDownscaleFactor) File "/home/arka/Python/Working/VocalSeparation/vocal_separator/acapellabot-master/conversion.py", line 23, in expandToGrid newSpectrogram = np.zeros((newX, newY)) TypeError: 'float' object cannot be interpreted as an index

ManojDatt commented 6 years ago

Can any one please help me to fix this issue ?

madebyollin commented 6 years ago

Ah, that might be numpy being more strict than the version I was using. Can you try adding int() around the two float() calls? Like:

newY = int(ceil(spectrogram.shape[1] / gridSize) * gridSize)
newX = int(ceil(spectrogram.shape[0] / gridSize) * gridSize)

for lines 21/22?

If that works I can change it in the repo.

ManojDatt commented 6 years ago

I have to change it to. ceil(spectrogram.shape[1] / gridSize) * gridSize ==> spectrogram.shape[1]