Skip to content

Can't import ONNX model produced by keras2onnx #20439

@chirag900

Description

@chirag900
System information (version)
  • OpenCV(4.5.3-dev)
  • Operating System / Platform => Ubuntu 20.04
  • Compiler => gcc 9.3.0

Description of the issue:
I am using the caption model which is converted using keras2onnx. I am unable to load the model by using readNet or readNetFromONNX in opencv. And I have installed Opencv from source (OpenCV(4.5.3-dev)).

steps to reproduce :

Code is as below : (C++)

std::string Caption_Model = "Caption_Model.onnx";
cv::dnn::Net net = cv::dnn::readNetFromONNX(Caption_Model);

Error message:

Error : Node [Gather]:(embedding_1/Identity:0) parse error: OpenCV(4.5.3-dev) /opencv_build/opencv/modules/dnn/src/onnx/onnx_importer.cpp:356: error: (-5:Bad argument) Blob casted not found in const blobs in function 'getBlob'
Aborted (core dumped)

You can find the architecture of the caption model in the screenshot.
Caption_Model

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions