Created
February 19, 2017 08:48
-
-
Save soulslicer/3c0afcf5a3e8e401d106e77b453ec0af to your computer and use it in GitHub Desktop.
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
caffe::BlobProto blob_proto; | |
blob_proto.set_num(1); | |
blob_proto.set_channels(3); | |
blob_proto.set_height(224); | |
blob_proto.set_width(224); | |
blob_proto.clear_data(); | |
for (int c = 0; c < 3; ++c) { | |
for (int h = 0; h < 224; ++h) { | |
for (int w = 0; w < 224; ++w) { | |
cv::Vec3f& vec = conv.at<cv::Vec3f>(h,w); | |
blob_proto.add_data(conv.at<cv::Vec3b>(h, w)[c]); | |
} | |
} | |
} | |
input_layer->FromProto(blob_proto); | |
std::vector<boost::shared_ptr<caffe::Blob<float> > >& layer = net_.layer_by_name("data")->blobs(); | |
net_.Forward(); | |
std::vector<std::string> layerNames = net_.layer_names(); | |
for(int i=0; i<layerNames.size(); i++){ | |
cout << layerNames[i] << endl; | |
std::vector<boost::shared_ptr<caffe::Blob<float> > >& layer = net_.layer_by_name(layerNames[i])->blobs(); | |
cout << layer.size() << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment