opencv: Error Loading .pb model file from readNetFromTensorflow
OpenCV => 4.1.0 Operating System / Platform => Windows 64 Bit Compiler => Visual Studio 2015
Detailed description String weights = “model_opt.pb”; String prototxt = “model_opt.pbtxt”;
- dnn::Net net = cv::dnn::readNetFromTensorflow(weights); OpenCV(4.1.0) Error: Unspecified error (More than one input is Const op) in cv::dnn::dnn4_v20190122::`anonymous-namespace’::TFImporter::getConstBlob, file C:\build\master_winpack-build-win64-vc14\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 522
- dnn::Net net = cv::dnn::readNetFromTensorflow(weights,prototxt);
OpenCV(4.1.0) Error: Assertion failed (const_layers.insert(std::make_pair(name, li)).second) in cv::dnn::dnn4_v20190122::`anonymous-namespace’::addConstNodes, file C:\build\master_winpack-build-win64-vc14\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 616
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (16 by maintainers)
Hi, @zy2008cn, @FadyEssam , @dkurt
I was wondering if you have solved this issue since I met some familiar problems. The error info in forward propagation of mine is: Can’t create layer “Pnet_prelu3/Neg” of type “Neg”. But actually in layer “Pnet_prelu1/Neg” & “Pnet_prelu2/Neg” before this layer there are already ops “Neg”.
And this is the error info I got if reading the model without the .pbtxt file. I got the same error info when reading the model with the .pbtxt file.
My model is simply a Keras implementation of P-Net of MTCNN and I have transfered it into an optimized .pb file. If you @FadyEssam @dkurt are available, could you please check it since this is really a basic Conv Net without even fully connected layers.
For R-Net and O-Net, since there is a Permute layer to switch the channels of the intermediate input, the 2 nets are also unable to be read. The error is: Parsing error (Only NHWC <-> NCHW permutations are allowed.).
Hope to hear from you. Thanks.
optimized_Rnet.zip
optimized_Pnet.zip