Skip to content

Movenet model of onnx cannot read by opencv dnn #20679

@stereomatchingkiss

Description

@stereomatchingkiss

opencv : opencv4.5.3(5ac5da3)
os : ubuntu20.04
compiler : g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

Process to download and convert the models

wget -q -O movenet_singlepose_lightning_4.tar.gz https://tfhub.dev/google/movenet/singlepose/lightning/4?tf-hub-format=compressed
!mkdir movenet_singlepose_lightning_4
!tar -zxvf movenet_singlepose_lightning_4.tar.gz -C movenet_singlepose_lightning_4/
python -m tf2onnx.convert --opset 11 \
    --saved-model movenet_singlepose_lightning_4 \
    --output movenet_singlepose_lightning_4.onnx

Load model from c++

#include <opencv2/dnn.hpp>

#include <iostream>
#include <stdexcept>

using namespace std;

int main(int argc, char *argv[])try
{    
    auto net = cv::dnn::readNet(std::string(argv[1]) + "/models/onnx/movenet_singlepose_lightning_4.onnx");

}catch(std::exception const &ex){
    cerr<<ex.what()<<endl;
}

Error message:

[ERROR:0] global /home/yyyy/cv_projects/3rdLibs/opencv/modules/dnn/src/onnx/onnx_importer.cpp (627) handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [ArgMax]:(StatefulPartitionedCall/ArgMax:0)
exception = OpenCV(4.5.3-dev) /home/yyyy/cv_projects/3rdLibs/opencv/modules/dnn/src/onnx/onnx_importer.cpp:648: error: (-2:Unspecified error) in function 'handleNode'
> Node [ArgMax]:(StatefulPartitionedCall/ArgMax:0) parse error: OpenCV(4.5.3-dev) /home/yyyy/cv_projects/3rdLibs/opencv/modules/dnn/src/dnn.cpp:615: error: (-2:Unspecified error) Can't create layer "StatefulPartitionedCall/ArgMax:0" of type "ArgMax" in function 'getLayerInstance'
> 

Link of the model

Works well with onnx.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions