本文首发于个人博客https://kezunlin.me/post/5898412/,欢迎阅读最新内容!
load model from file and stream for caffe and pytorch
Guide
caffe
load from file
enum caffe::Phase phase = caffe::Phase::TEST;
std::string proto_filepath = "yolov3.prototxt";
std::string weight_filepath = "yolov3.caffemodel";
caffe::Net<float> net = caffe::Net<float>(proto_filepath, phase));
net.CopyTrainedLayersFrom(weight_filepath);
load from stream
no caffe method to load directly from stream.
we can override
ReadProtoFromTextFile
andReadProtoFromBinaryFile
insrc/caffe/util/io.cpp
to implement this fuction.
Replace