Qazi
Qazi

Reputation: 355

Is it possible to use Caffe Only for classification without any training?

Some users might see this as opinion-based-question but if you look closely, I am trying to explore use of Caffe as a purely testing platform as opposed to currently popular use as training platform.

Background:

  1. I have installed all dependencies using Jetpack 2.0 on Nvidia TK1.
  2. I have installed caffe and its dependencies successfully.
  3. The MNIST example is working fine.

Task:

  1. I have been given a convnet with all standard layers. (Not an opensource model)
  2. The network weights and bias values etc are available after training. The training has not been done via caffe. (Pretrained Network)
  3. The weights and bias are all in the form of MATLAB matrices. (Actually in a .txt file but I can easily write code to get them to be matrices)
  4. I CANNOT do training of this network with caffe and must used the given weights and bias values ONLY for classification.
  5. I have my own dataset in the form of 32x32 pixel images.

Issue: In all tutorials, details are given on how to deploy and train a network, and then use the generated .proto and .caffemodel files to validate and classify. Is it possible to implement this network on caffe and directly use my weights/bias and training set to classify images? What are the available options here? I am a caffe-virgin so be kind. Thank you for the help!

Upvotes: 3

Views: 581

Answers (1)

Shai
Shai

Reputation: 114796

The only issue here is:
How to initialize caffe net from text file weights?

I assume you have a 'deploy.prototxt' describing the net's architecture (layer types, connectivity, filter sizes etc.). The only issue remaining is how to set the internal weights of caffe.Net to pre-defined values saved as text files.

You can get access to caffe.Net internals, see net surgery tutorial on how this can be done in python.

Once you are able to set the weights according to your text file, you can net.save(...) the new weights into a binary caffemodel file to be used from now on. You do not have to train the net if you already have trained weights, and you can use it for generating predictions ("test").

Upvotes: 2

Related Questions