question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

using the onnx model with opencv

See original GitHub issue

hi 😉 i’m trying to use the lightweight-human-pose model on colab:

!wget 'https://drive.google.com/uc?export=dowload&id=1T2Kq01WXzPMrQdnEOUEiVBhwouW8Pka5' -O pose.onnx

net = cv2.dnn.readNet("pose.onnx")
# load 256x256 image and sent through net
net.dumpToFile("pose_dot.txt")
!dot pose_dot.txt -Tpng -opose_dot.png

and the last layer : Clipboard01

that looks weird. 38 heatmaps ? shouldn’t it have 19 heat and 2x19 paf maps (=57) ? or, if it’s meant to be used for single persons , 19 heatmaps only ?

i look at the model: https://github.com/Daniil-Osokin/lightweight-human-pose-estimation.pytorch/blob/55093417d383c25a0f2454eba352198c944290d1/models/with_mobilenet.py#L90

and it should have returned [heatmaps, pafs] here: https://github.com/Daniil-Osokin/lightweight-human-pose-estimation.pytorch/blob/55093417d383c25a0f2454eba352198c944290d1/models/with_mobilenet.py#L86

but it looks to me, like we only have the pafs returned from the forward pass in opencv

the newly added opencv Keypoints model tries to loop over all of them, and results look quite bad 😭

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
berakcommented, Dec 19, 2019

the current model (exported from your script) luckily has heatmaps and pafs in seperate outputs, so it can be used as is (dnn user can choose).

thanks for all your support, the issue moved on to opencv, so i’ll close this one.

0reactions
Daniil-Osokincommented, Dec 18, 2019

I believe the commit author should check, then reconvert the model with right output (heatmaps, not pafs) and upload proper model. If you want, you can do it by yourself, just remove last pafs output in the model: return stages_output[:-1] and remove last output name from conversion script correspondingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conversion of PyTorch Classification Models and ... - OpenCV
The initial step in conversion of PyTorch models into cv.dnn.Net is model transferring into ONNX format. ONNX aims at the interchangeability of the...
Read more >
Load onnx model in opencv dnn - c++ - Stack Overflow
The model you are using has dynamic input shape. OpenCV DNN does not support ONNX models with dynamic input shape [ ...
Read more >
ONNX | LearnOpenCV
In this post, we will learn how to convert a PyTorch model to TensorFlow. If you are new to Deep Learning you may...
Read more >
How to use the onnx (converted from .pt) in opencv C++ #5378
I am using OpenCV 4.5.4, which supports the use of converted yolov5 from pythorch (*.pt) to onnx. I got a pre-trained yolov5 model....
Read more >
Deep Learning with OpenCV
OpenCV DNN Module : Inference Engine. Train using. 1. Caffe. 2. Tensorflow. 3. Torch. 4. Darknet. 5. ONNX model. Use OpenCV for. Inference ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found