解决caffe训练target_blobs.size ==source_layer.blobs_size incompatible number of blobs for layer conv1_1

问题描述:

caffe训练自己的数据,训练代码为

E:/caffe/build/tools/Release/caffe.exe train --solver=E:/caffe/examples/*****/netModel/*****_solver.prototxt --weights E:\code\*****\*****\*****_model.caffemodel

若不给一个初始化--weights,训练没问题。若给一个初始化--weights路径,训练报错。错误为:

初始以为是***model.prototxt文件和***.caffemodel两个不匹配造成的。后来参考网址http://bubuko.com/infodetail-1855819.html,解决办法为:

1. 将io.cpp文件中的函数ReadProtoFromBinaryFile里面的_open(filename, O_RDONLY );改为_open(filename, O_RDONLY |O_BINARY);

2. 重新编译caffe.lib;

3. 重新编译caffe.bin;

4. 训练成功。

猜你喜欢

转载自blog.csdn.net/xiakejiang/article/details/85613849