Skip to content

Instantly share code, notes, and snippets.

@drcege
Forked from shelhamer/load_caffemodel.py
Created May 22, 2017 02:08
Show Gist options
  • Save drcege/5aa1436d72933e2792c951d3c26d7073 to your computer and use it in GitHub Desktop.
Save drcege/5aa1436d72933e2792c951d3c26d7073 to your computer and use it in GitHub Desktop.
Load binary proto .caffemodel to inspect layer names.
import sys
sys.path.insert(0, 'python/')
import caffe
from caffe.proto import caffe_pb2
net_param = caffe_pb2.NetParameter()
net_str = open('lenet_iter_5000.caffemodel', 'r').read()
net_param.ParseFromString(net_str)
print net_param.layer[0].name # first layer
print net_param.layer[-1].name # last layer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment