Shikhargupta / Spiking-Neural-Network

Pure python implementation of SNN
Apache License 2.0
1.02k stars 284 forks source link

IndexError: index 16 is out of bounds for axis 0 with size 16 #4

Closed assadRasheed closed 3 years ago

assadRasheed commented 6 years ago

IndexError Traceback (most recent call last)

in () 52 53 #Convolving image with receptive field ---> 54 pot = rf(img) 55 56 #Generating spike train **# C:\Users\pc\AnacondaProjects\Spiking-Neural-Network-master\training\recep_field.py** in rf(inp) 35 for n in ran: 36 if (i+m)>=0 and (i+m)<=par.pixel_x-1 and (j+n)>=0 and (j+n)<=par.pixel_x-1: ---> 37 summ = summ + w[ox+m][oy+n]*inp[i+m][j+n]/255 38 pot[i][j] = summ 39 return pot IndexError: index 16 is out of bounds for axis 0 with size 16 this happens when i change the image from 1.png to 100.png or 101.png given below to for k in range(par.epoch): for i in range(322,323): print (i," ",k) img = cv2.imread("images/100.png", 0)
henokhope1 commented 6 years ago

If we use proper image the issue will not happen

Amri95 commented 5 years ago

Please recommend the solution for this issue. github

iormaoro commented 5 years ago

That can happen when img loaded is not the same type used by his examples. Do some prints when he does the loads and see the differences with yours ones (Grayscale,...). That happened to me.

liuYing77 commented 5 years ago

Exactly,you can change your the size of image, we usualy load image that is 28*28