-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Using pycaffe backward() #583
Comments
Try adding
p.s. Note that |
@shelhamer Thanks, that solved the issue! I did not consider that computing the bottom_diff is an unnecessary computation in most cases. While looking into classifier.py I might have spotted a bug in the predict() method: Scale to standardize input dimensions.
In the case of the imagenet_deploy.prototxt the self.image_dims are set to 227. Before the oversampling is taking place the image is resized to 227x227 and since self.crop is as well 227 only the mirroring is working as expected. I solved this by passing a separate resize-size var instead of using self.image_dims. |
False alarm. Looking at the code again I see now that image_dims can be passed using the Classifier init. In order to use oversampling, you just need to init the Classifier correctly and everything is fine:
This should probably be added in the imagenet_classification.ipynb. |
Hi @shelhamer @to3i , I have a similar problem while using @to3i 's code. After add the statement force_backward: true in my model file, it says
Then I turn to
I checked the net.blobs['prob'].diff, all its values are 1.
I still get all zeros in bottom_diff['data']. Did I missed anything? Thanks! PS: I use the deploy model file to initialize the net. |
I solved it by replacing the net.blobs['prob'].diff with net.blobs['prob'].data
|
Hi, CODE:caffe.set_mode_cpu() net.blobs['data'].reshape(1,3,227,227) forceback_deploy.prototxtname: "CaffeNet" |
I want to run backward of the model in the /examples/mnist. I add "force_backward: true" in both "lenet.prototxt" and "lenet_train_test.prototxt". |
Set the diff of the target class = 1. To be precise : net.blobs['last-layer'].diff[0]['target_class']=1 This should give you the required weights. :) Regards, On Thu, Feb 4, 2016 at 10:03 PM Saukymo notifications@github.com wrote:
|
@NightFury13 Thank you for your reply. But still zero. In fact, I used similar code.
And these ran well in googlenet but all zeros in the LeNet of the mnist tutorial. Is it possible that I missed some setting in the train phase? One more thing, I used OSX EI 10.11.13. Thank you for your prompt reply again. |
You seem to be setting the data parameters as 1 in the code snippet you've As for the libcaffe.so error, maybe you can expand a bit more as to Regards, On Fri, Feb 5, 2016 at 8:08 AM Saukymo notifications@github.com wrote:
|
@NightFury13 Thank you again. And for the libcaffe.so. I found lots of people had the just exact same problem these days so I just mentioned it without details. And thank you for your advice for the google group. I have not asked problem before since my poor English. And this time I saw the relative issue here so I just add my problem here. :) I will try google group later of course. Really thank you! |
In the case of the imagenet caffenet example I want to use the python wrapper to compute a single forward pass (similar to the predict method in classifer.py) followed by a single backward pass.
Classify
Compute backward pass
My issue is that the backward method returns a bottom_diff['data'] that is all zeros. I would expect to see some more gradient information passed through the network. For debugging I am using the cat example and the classify part of the code is outputting the probabilities as featured in the ipython notebook example. Most likely I missed something important going from forward to backward. Do I have to set a learning rate somehow? It would be great if someone could give me a pointer. Thanks!
The text was updated successfully, but these errors were encountered: