Ask Your Question

Revision history [back]

Loading Tensorflow model. Error: Unspecified error (More than one input is Const op) in cv::dnn::dnn4_v20200310

System information (version)

  • OpenCV => 4.3
  • Operating System / Platform => Windows 10 64 Bit
  • Compiler => Visual Studio 2017
  • GPU NVIDIA GTX 1660 TI (6 GB)
  • Processor Intel Core i7-9700F (8 x 3.00 Hz)

Detailed description

I need to run model DenseDepth, with nyu.pth weights (stored at repo). I successfully converted weights to Tensorflow format (pb-file). Link on Tensorflow weights file.

For model loading, I use dnn-samples.sln that could be find at OpenCV_DIR\build\samples\dnn. Mode - Debug/x64. As test project I use (sample) object_detection.

After code execution, I get the following result: cmd OpenCV(4.3.0-dev) Error: Unspecified error (More than one input is Const op) in cv::dnn::dnn4_v20200310::`anonymous-namespace'::TFImporter::getConstBlob, file E:\Windows\Git\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 570

Steps to reproduce

  1. Open OpenCV_DIR\build\samples\dnn directory.
  2. Launch dnn-samples.sln
  3. Change mode to Debug/x64
  4. Open solution properties
  5. In tab Common Properties->Startup Project choose Multiple startup projects and change (sample) object_detection action to Start image
  6. Change source code of object_detection.cpp to attached file object_detection.txt
  7. Change line 132 to your model path cpp std::string modelPath = "YOUR_MODEL_PATH\\nyu.pb";
  8. Press 'Start'