Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV - Tensorflow model import error

I use ssd_mobilenet_v1_coco model with OpenCV for object detection.

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'graph.pbtxt')

When using original graph.pbtxt it is OK. But when i create pbtxt file using tf_text_graph_ssd

python --input frozen_inference_graph.pb --output pbtxt/frozen_inference_graph.pbtxt

and then:

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'pbtxt/frozen_inference_graph.pbtxt')

it gives error:

OpenCV Error: Unspecified error (Input layer not found: 

FeatureExtractor/MobilenetV1/zeros) in 
namespace'::TFImporter::populateNet, file C:
line 1061
Traceback (most recent call last):
File "", line 3, in <module>
cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 
cv2.error: C:\projects\opencv-
python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:1061: error: (-2) 
Input layer not found: FeatureExtractor/MobilenetV1/zeros in function cv::d

What is the problem when converting pb to pbtxt?

Here my aim is create custom model using image retraining and use it on OpenCV.

So I have a custom model but not pbtxt file.

First i try to create pbtxt for an example ssd_mobilenet_v1_coco model.