Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Use OpenVINO OpenCV DNN module on Windows



  • My settings:

    OS: Windows 10

    Qt: 5.15.2

    OpenVINO: 2021.3.394

    IDE: QtCreator

    Python: 3.7

    I would like to use the OpenVINO InferenceEngine in the OpenCV DNN module.

    .pro-file:

    INCLUDEPATH += "C:/Program Files (x86)/Intel/openvino_2021.3.394/opencv/include"

    INCLUDEPATH += "C:/Program Files (x86)/Intel/openvino_2021.3.394/inference_engine/include"

    INCLUDEPATH += "C:/Program Files (x86)/Intel/openvino_2021.3.394/inference_engine/external/tbb/include"

    LIBS += -L"C:/Program Files (x86)/Intel/openvino_2021.3.394/opencv/lib"

    LIBS += -lopencv_core452d

    LIBS += -lopencv_dnn452d

    LIBS += -lopencv_highgui452d

    LIBS += -lopencv_imgcodecs452d

    LIBS += -lopencv_imgproc452d

    LIBS += -lopencv_video452d

    LIBS += -lopencv_videoio452d

    LIBS += -L"C:/Program Files (x86)/Intel/openvino_2021.3.394/inference_engine/lib/intel64/Debug"

    LIBS += -linference_engined

    LIBS += -linference_engine_transformationsd

    LIBS += -L"C:/Program Files (x86)/Intel/openvino_2021.3.394/inference_engine/external/tbb/lib"

    LIBS += -ltbb

    LIBS += -ltbbmalloc

    myProject.cpp-file:

    cv::dnn::Net() model = cv::dnn::readNetFromTensorflow("path/to/model.pb");

    model.setPreferableBackend(cv::dnn::DNN_BACKEND_INFERENCE_ENGINE);

    model.setPreferableTarget(cv::dnn::DNN_TARGET_MYRIAD);

    Mat inputBlob = cv::dnn::blobFromImage("path/to/image");

    model.setInput(inputBlob);

    Mat pred = model.forward();

    The code work but the runtime is similiar as I used cv::dnn::DNN_BACKEND_OPENCV with cv::dnn::DNN_TARGET_CPU.

    Using Intel Myriad Stick should accelerate the computation?

    Also I got the following outputs:

    [ INFO:0] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\dnn\src\tensorflow\tf_importer.cpp (781) cv::dnn::dnn4_v20210301::anonymous-namespace'::TFImporter::populateNet DNN/TF: parsing model (N/A version info). Number of nodes = 876 [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\videoio_registry.cpp (217) cv::anonymous-namespace'::VideoBackendRegistry::VideoBackendRegistry VIDEOIO: Enabled backends(8, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL_MFX(980); MSMF(970); DSHOW(960); CV_IMAGES(950); CV_MJPEG(940); UEYE(930)
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (335) cv::impl::getPluginCandidates Found 3 plugin(s) for FFMPEG
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_videoio_ffmpeg452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_ffmpeg452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_ffmpeg452_64.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (335) cv::impl::getPluginCandidates Found 2 plugin(s) for GSTREAMER
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_videoio_gstreamer452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_gstreamer452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (335) cv::impl::getPluginCandidates Found 2 plugin(s) for INTEL_MFX
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_videoio_intel_mfx452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_intel_mfx452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (335) cv::impl::getPluginCandidates Found 2 plugin(s) for MSMF
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_videoio_msmf452_64d.dll => OK
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (50) cv::impl::PluginBackend::initCaptureAPI Found entry: 'opencv_videoio_capture_plugin_init_v1'
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (169) cv::impl::PluginBackend::checkCompatibility Video I/O: initialized 'Microsoft Media Foundation OpenCV Video I/O plugin': built with OpenCV 4.5 (ABI/API = 1/1), current OpenCV version is '4.5.2-openvino' (ABI/API = 1/1)
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\20Tot. Runtime: 8719.01

    21.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (69) cv::impl::PluginBackend::initCaptureAPI Video I/O: plugin is ready to use 'Microsoft Media Foundation OpenCV Video I/O plugin'
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (84) cv::impl::PluginBackend::initWriterAPI Found entry: 'opencv_videoio_writer_plugin_init_v1'
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (169) cv::impl::PluginBackend::checkCompatibility Video I/O: initialized 'Microsoft Media Foundation OpenCV Video I/O plugin': built with OpenCV 4.5 (ABI/API = 1/1), current OpenCV version is '4.5.2-openvino' (ABI/API = 1/1)
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\backend_plugin.cpp (103) cv::impl::PluginBackend::initWriterAPI Video I/O: plugin is ready to use 'Microsoft Media Foundation OpenCV Video I/O plugin'
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\videoio\src\cap_msmf.cpp (787) CvCapture_MSMF::configureHW MSMF: Using D3D11 video acceleration on GPU device: NVIDIA TITAN RTX
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\parallel\registry_parallel.impl.hpp (90) cv::parallel::ParallelBackendRegistry::ParallelBackendRegistry core(parallel): Enabled backends(3, sorted by priority): ONETBB(1000); TBB(990); OPENMP(980)
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_core_parallel_onetbb452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_onetbb452_64d.dll => FAILED
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_core_parallel_tbb452_64d.dll => OK
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\parallel\plugin_parallel_wrapper.impl.hpp (48) cv::impl::PluginParallelBackend::initPluginAPI core(parallel): plugin is ready to use 'TBB (interface 9107) OpenCV parallel plugin'
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\include\opencv2/core/parallel/backend/parallel_for.tbb.hpp (54) cv::parallel::tbb::ParallelForBackend::ParallelForBackend Initializing TBB parallel backend: TBB_INTERFACE_VERSION=9107
    [ INFO:1] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\parallel\parallel.cpp (73) cv::parallel::createParallelForAPI core(parallel): using backend: TBB (priority=990)
    [ INFO:8] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (74) cv::plugin::impl::DynamicLib::libraryRelease unload C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_videoio_msmf452_64d.dll
    [ INFO:8] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.3\build\windows\opencv\modules\core\src\utils\plugin_loader.impl.hpp (74) cv::plugin::impl::DynamicLib::libraryRelease unload C:\Optimum\projects\build-_myProject_all-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\bin\opencv_core_parallel_tbb452_64d.dll
    [E:] [BSL] found 0 ioexpander device
    [E:] [BSL] found 0 ioexpander device
    [E:] [BSL] found 0 ioexpander device

    What does this error mean? What is missing in my code/libraries? How could I accelerate my computations with Intel MyriadX?


  • Lifetime Qt Champion

    Hi,

    That's a question you should rather bring to the OpenCV/OpenVINO folks.


Log in to reply