Created
October 23, 2020 08:35
-
-
Save adriacabeza/aa4e2e4791fda322cd159e24518f02a4 to your computer and use it in GitHub Desktop.
Get layers and shape of a Caffe model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import caffe | |
| import numpy as np | |
| mean = np.load('mean.npy').mean(1).mean(1) | |
| image_dims = (224, 244) | |
| model = 'deploy.prototxt' | |
| weights = 'resnet-50.caffemodel' | |
| net = caffe.Classifier(model, weights, image_dims=image_dims, mean=mean, raw_scale=255, channel_swap=[2, 1, 0]) | |
| nb = net.blobs | |
| for ctr, name in enumerate(nb): | |
| print(ctr, name, nb[name].data.shape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment