loading tensorflow model with dropout layers by opencv

asked 2020-07-22 05:32:14 -0600

xjf gravatar image

hi everyone, recently i tried to use opencv to load tensorflow .pb file, but i got following problems:

i trained my network with dropout layers and saved it as a .pb file, but when i use function readNetFromTensorflow to load this model, i got the error messages: 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-vc15\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 522 OpenCV: terminate handler is called! The last OpenCV error is: 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-vc15\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 522

but when i removed the dropout layers and retrained the network, opencv can load the generated .pb file successfully. I guess the problem is in the dropout layers but i don't know how to fix it, is there any way to deal with this? Thanks for any help in advance!

edit retag flag offensive close merge delete