0

I have met a problem that I have a sparse-matrix-stored version neural network which means I have only some parameters and its index like which layer does it belong and which location does it belong? How can I use these information and a prototxt to reconstruct the caffemodel by python.Thanks

Jackie
  • 3
  • 3

1 Answers1

1

The caffemodel binary file is just a binary proto-buffer file, which you can create/edit with the proto python interfrace module (caffe.proto.caffe_pb2). You should use the helper methods of caffe.io to convert numpy arrays to the array format acceptable by the protobuffer interface (or from the protobuffer to numpy). Alternatively, you could use the caffe.Net python class that wraps most these methods for easier access -- you can look at this example from Caffe's homepage for a more detailed tutorial.

For simplicity, I would use the prototxt to train a dummy network to create a baseline caffemodel structure, and then just edit the weights of the layers using your own external weights using one of the above methods.

Community
  • 1
  • 1
Or Sharir
  • 1,607
  • 12
  • 21