Skip to content

OpenCV cannot import frozen TensorFlow graph: Input layer not found: Shape_4 in function 'cv::dnn::dnn4_v20220524::`anonymous-namespace'::TFImporter::connect' #22597

@ukoehler

Description

@ukoehler

System Information

OpenCV => Python opencv-python-rolling 4.6.0.20220924
Operating System / Platform Windows 10 64 bit
Python =>3.10.4

Detailed description

I tried to load a frozen Tensorflow graph for DeepLab V3 from here:
https://docs.openvino.ai/latest/omz_models_model_deeplabv3.html#doxid-omz-models-model-deeplabv3

Find the frozen graph here: https://drive.google.com/file/d/15PoedGyEORvzZUuOS5ZsP07fyVjfPRI0/view?usp=sharing

Steps to reproduce

model = cv2.dnn.readNetFromTensorflow(model_path) leads to to

```[ERROR:0@0.164] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp (3169) cv::dnn::dnn4_v20220524::anonymous-namespace'::TFImporter::parseNode DNN/TF: Can't parse layer for node='strided_slice_7' of type='StridedSlice'. Exception: OpenCV(4.6.0-dev) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:2809: error: (-2:Unspecified error) Input layer not found: Shape_4 in function 'cv::dnn::dnn4_v20220524::anonymous-namespace'::TFImporter::connect'

Traceback (most recent call last):
File "d:\Local\devel\Python\OpenCV\dnn_segmentation_deeplabv3\inference.py", line 95, in
model = cv2.dnn.readNetFromTensorflow(model_path)
cv2.error: OpenCV(4.6.0-dev) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:2809: error: (-2:Unspecified error) Input layer not found: Shape_4 in function 'cv::dnn::dnn4_v20220524::`anonymous-namespace'::TFImporter::connect' ```

I than tried to follow the instructions here: https://docs.opencv.org/4.x/dc/db4/tf_segm_tutorial_dnn_conversion.html

However, I cannot find the mentioned code in the GitHub repository. https://github.com/opencv/opencv/tree/4.x/samples/dnn/dnn_model_runner/dnn_conversion/tf/ does not contain a folder called segmentation

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions