artvandelay / Deep_Inside_Convolutional_Networks

This is a caffe implementation to visualize the learnt model
MIT License
61 stars 32 forks source link

could not broadcast input array from shape (1000,1,1) into shape (1,1000) #1

Closed gauticse2015 closed 8 years ago

gauticse2015 commented 8 years ago

When i run the visualize.py code, i got the above error as follows:-

Traceback (most recent call last): File "visualize.py", line 69, in bw = net.backward(**{net.outputs[0]: caffeLabel}) File "../python/caffe/pycaffe.py", line 167, in _Net_backward self.blobs[top].diff[...] = diff ValueError: could not broadcast input array from shape (1000,1,1) into shape (1,1000)

and when i change the net.backward line as: bw = net.backward(), it runs perfectly. please tell me what is the problem??

artvandelay commented 8 years ago

It might have to do with the caffe version. Which version are you using?

On 05-Aug-2016 4:28 PM, "gauticse2015" notifications@github.com wrote:

When i run the visualize.py code, i got the above error as follows:-

Traceback (most recent call last): File "visualize.py", line 69, in bw = net.backward(**{net.outputs[0]: caffeLabel}) File "../python/caffe/pycaffe.py", line 167, in _Net_backward self.blobs[top].diff[...] = diff ValueError: could not broadcast input array from shape (1000,1,1) into shape (1,1000)

and when i change the net.backward line as: bw = net.backward(), it runs perfectly. please tell me what is the problem??

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/artvandelay/Deep_Inside_Convolutional_Networks/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMc5O0qsbI891B0qRTqMzRLZwthSnzJks5qcxc7gaJpZM4Jdk7O .

gauticse2015 commented 8 years ago

My current version of caffe is "1.0.0-rc3".

gauticse2015 commented 8 years ago

i have modified two lines of code in visualize.py as:

caffeLabel = np.zeros((1,1000)) caffeLabel[0,label_index] = 1;

now its gives desired result.

Thanks...

artvandelay commented 8 years ago

I'll make the changes to the code. I wonder if only the rc version has this issue.

artvandelay commented 8 years ago

Closing it

bgth commented 7 years ago

Hi @artvandelay .. Is it possible to update the code with this change? This works for latest caffe. Thanks.