Pycaffe Basic usuage

1,381 views
Skip to first unread message

Yotam Hechtlinger

unread,
Apr 29, 2015, 3:29:32 PM4/29/15
to caffe...@googlegroups.com
Hello Everyone,

I'm a caffe new user, I have some questions on basic Pycaffe usage. Following the MNIST tutorial, I've defined:
solver = caffe.SGDSolver(SOLVER_FILE), and used it to train my network.
Next I would like to save the model created, and use it to classify a different set of images. I tried doing:
solver.net.save('FILENAME')
and then creating a classifier by doing:
TheClassifier = caffe.classifier(model_file = caffe_root + MODEL_FILE,pretrained_file = caffe_root + 'FILENAME')
But this is not working.

So my questions can be summarized as:
1. How do I save the trained model?
2. How do I use it to classify new images? I have already prepared the new images in a LMDB format, so it seems reasonable to import that in as a blob somehow and just apply forward on the network.
3. I am getting really good results on the test set, when I check:
solver.test_nets[0].blobs['ip2'].data.argmax(1)== solver.test_nets[0].blobs['label'].data
To the point where I think I'm teaching the model on the test set also. Does the command solver.test_nets[0].forward() does something in that spirit, or it's just working good? and what's the idea behind solver.step(1)? It's just a single forward backward run?

I'm a really new caffe (and python) user, so specific examples on how to use the commands will be highly helpful!

Thanks a lot,
Yotam.
Reply all
Reply to author
Forward
0 new messages