Error running instance-segmentation-security inference via OpenCV's dnn (with IE)
See original GitHub issueHi,
I’m running into an error inferring instance-segmentation-security-1039 using OpenVino via OpenCV’s dnn module: `cv2.error: [ PARAMETER_MISMATCH ] Failed to set output Blob. Dimensions mismatch.
This my basic test:
import cv2 as cv
import numpy as np
model_name = 'instance-segmentation-security-1039'
net = cv.dnn.readNetFromModelOptimizer(model_name+'.xml', model_name+'.bin')
print(net.dump())
cap = cv.VideoCapture("test_video.mp4")
# instance-seg = 480
(n, c, h, w) = (1, 3, 480, 480)
# yolact = 550
# (n, c, h, w) = (1, 3, 550, 550)
while cv.waitKey(1) < 0:
hasFrame, frame = cap.read()
if not hasFrame:
break
blob = cv.dnn.blobFromImage(cv.resize(frame, (w, h)))
net.setInput(blob)
out = net.forward()
cv.imshow('OpenVINO', frame)
This is using OpenCV 4.5.3-openvino (which shipped with openvino_2021.4.689).
I can run the instance_segmentation_demo using the IE directly just fine.
Is it possible to run the same demo via OpenCV ? If so, how ?
Thank you so much for your time, George
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Failed to initialize Inference Engine backend , opencv dnn
Solved: I am trying to use opencv dnn module to perform object detection. I am using movidius neural compute stick with openvino toolkit....
Read more >OpenCV DNN inference with "training=True" for using sample ...
This question is actually focused on OpenCV instead of OpenVINO. ... want the batch statistics, while running the model on the test dataset....
Read more >How to use OpenCV's "dnn" module with NVIDIA GPUs ...
How to use OpenCV's 'dnn' module with NVIDIA GPUs, CUDA, and cuDNN. In the remainder of this tutorial I will show you how...
Read more >[Deep Learning] Using OpenCV as deep learning inference ...
Deep neural networks i.e., dnn module of OpenCV supports models trained using TensorFlow, Caffe and Pytorch frameworks.
Read more >Deep Learning with OpenCV DNN Module: A Definitive Guide
A complete step by step guide to image classification using OpenCV DNN. ... We can get good FPS when running inference on real-time...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
4.5.4-dev should work with OpenVINO 2021.4.689 package (2021.4.1 release)
We have here unaligned declared and used IE versions (OpenCV uses OpenVINO product version). Current value says that we using OpenVINO 2021.2.0 which is not correct. We need to replace: 2021020000 => 2021040100 (
INF_ENGINE_RELEASE
CMake variable) to properly build code (e.g., compile this code at least).Perhaps this value is stored in CMakeCache.txt somewhere from previous old cmake runs. There is general CMake rule that we need to drop its caches if we change/upgrade dependencies. So, to avoid other issues it is better to build from the clean build directory.
relates https://github.com/opencv/opencv/pull/20410
This patch will be released with OpenVINO 2022.1 (2021.4.x LTS updates are out of scope for now)
Also you can build OpenCV from source code with enabled InferenceEngine: https://github.com/opencv/opencv/wiki/Intel's-Deep-Learning-Inference-Engine-backend#build-opencv-from-source