System information (version)
- OpenCV => 4.0
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2015
Detailed description
I added and registered some layers, and dnn module can excute normally by invoking function
cv::dnn::Net net = cv::dnn::readNetFromCaffe(configPath,modelPath);.
When i invoke
cv::dnn::Net net = cv::dnn::readNetFromCaffe(configBuf,configLen, modelBuf, modelLen); , a crash occurred, such as bellow:
[libprotobuf ERROR C:\build\master_winpack-build-win64-vc14\opencv\3rdparty\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format opencv_caffe.NetParameter: 65:12: Message type "opencv_caffe.LayerParameter" has no field named "xxx_param".
After check out the source code, i found a difference between function ReadProtoFromTextFile and ReadProtoFromTextBuffer.
The former function has an macro implementation like
#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
return google::protobuf::TextFormat::Parser(true).Parse(&input, proto);
#else
return google::protobuf::TextFormat::Parser().Parse(&input, proto);
#endif
, but the latter only call return google::protobuf::TextFormat::Parser().Parse(&input, proto);.
Is something wrong when protobuf library parse network witch has unknow fields?
Or perhaps it can run by editing return google::protobuf::TextFormat::Parser(true).Parse(&input, proto); and recompiling?
System information (version)
Detailed description
I added and registered some layers, and dnn module can excute normally by invoking function
cv::dnn::Net net = cv::dnn::readNetFromCaffe(configPath,modelPath);.When i invoke
cv::dnn::Net net = cv::dnn::readNetFromCaffe(configBuf,configLen, modelBuf, modelLen);, a crash occurred, such as bellow:[libprotobuf ERROR C:\build\master_winpack-build-win64-vc14\opencv\3rdparty\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format opencv_caffe.NetParameter: 65:12: Message type "opencv_caffe.LayerParameter" has no field named "xxx_param".
After check out the source code, i found a difference between function
ReadProtoFromTextFileandReadProtoFromTextBuffer.The former function has an macro implementation like
, but the latter only call
return google::protobuf::TextFormat::Parser().Parse(&input, proto);.Is something wrong when protobuf library parse network witch has unknow fields?
Or perhaps it can run by editing
return google::protobuf::TextFormat::Parser(true).Parse(&input, proto);and recompiling?