Skip to content

Unsupported data type: BOOL in function 'getMatFromTensor' after call readNetFromONNX (TensorFlow -> ONNX) #19366

@JJonahJson

Description

@JJonahJson
System information (version)
  • OpenCV => 4.5.1.48
  • Operating System / Platform => Google Colab
Detailed description

I've got the following error:
OpenCV(4.5.1) /tmp/pip-req-build-1syr35c1/opencv/modules/dnn/src/onnx/onnx_graph_simplifier.cpp:592: error: (-210:Unsupported format or combination of formats) Unsupported data type: BOOL in function 'getMatFromTensor'

because in onnx_graph_simplifier.cpp the TensorProto_DataType_BOOL isn't mentioned, will it be added soon?

The model I converted is Mask R-CNN Inception Resnet V2, you can download it from this link:

http://download.tensorflow.org/models/object_detection/tf2/20200711/mask_rcnn_inception_resnet_v2_1024x1024_coco17_gpu-8.tar.gz

I trained it with TensorFlow 2, I've used the saved_model format and converted it to ONNX doing the following:

Steps to reproduce
pip install tf2onnx
pip install opencv-python==4.5.1.48
python -m tf2onnx.convert --saved-model /path/to/saved_model/dir/ --opset 13 --output /path/to/model.onnx


import cv2
net = cv2.dnn.readNetFromONNX('/path/to/model.onnx')   #This is where the error raises
image = cv2.imread("/path/to/image_example.jpg")
blob = cv2.dnn.blobFromImage(image)
net.setInput(blob)
net.forward()
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 solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions