Rafay Zia Mir
Rafay Zia Mir

Reputation: 2116

How to convert hdf5 format to caffemodel format in caffe?

Basically I am using using caffe for deep learning. Now I finetuned a network for my own dataset and saved my model in hdf5 format which is .h5 extension.

Now I want to classify images using matcaffe. matcaffe understands only .caffemodel format for trained model.
So is there any way to convert hdf5 file to caffemodel?

Upvotes: 2

Views: 4654

Answers (1)

Shai
Shai

Reputation: 114786

You can set the preferred format for the caffemodel file in your solver.prototxt. Simply set

snapshot_format: BINARYPROTO

See caffe.proto for more information.


Alternatively, you can use python interface (which is by far better than the matlab interface for caffe, IMHO):

import caffe
net = caffe.Net('/path/to/deploy.prototxt', '/path/to/caffemodel.h5', caffe.TEST)
net.save('/path/to/just.caffemodel')

Upvotes: 3

Related Questions