本文共 1145 字,大约阅读时间需要 3 分钟。
将linux下训练的caffemodel移植到windows上使用但是出现以下错误提示:Can't parse message of type "caffe.NetParameter" because it is missing required fields: layer[502].box_annotator_ohem_param.roi_per_img
实际上,我也知道原因,是因为二者的caffe的版本不一致。这是个遗留问题,是由最初的开发人员遗留下来的。windows上的caffe(生产环境)和linux上的caffe(开发环境)上的版本不一致。具体细节我不是很清楚,大概意思是linux上的caffe是官方的caffe,但是windows上的caffe是个私人的caffe(好像是那个经典的faster-cnn的caffe)
修改src/proto/caffe.proto
, 将required变为optional,并重新编译。关于caffe的proto,可以看这篇。具体步骤如下:
box_annotator_ohem_param.roi_per_img
,因此把这个字段的required 改为 optional,下图显示的是更改过后的情况。 . /caffe-master/src/caffe/protoc
下执行自己新建的extract_proto.bat文件,文件内容如下面的代码所示:src/caffe/proto
下,caffe.pb.h移动至include/caffe/proto
下。protoc caffe.proto --cpp_out=./pause
参考:
https://blog.csdn.net/sinat_26269257/article/details/84788469 https://blog.csdn.net/lily1234567/article/details/87971187