OpenVINO with QT on Linux

OpenVINO is a toolkit has developed by Intel. It offers to developers “a powerful portfolio of scalable hardware and software solutions”. Summary of short story it’s a bundle of computer vision and deep learning solutions under it’s environment. You can access it’s installation document for Linux distributions via this link.

It was painful for me to use OpenVINO’s Open Model Zoo demos with QT. Honestly, the hardest part of development is getting the environment ready to develop. Here is Open Model Zoo repository’s link.

Open Model Zoo demos are also located under “/opt/intel/openvino/deployment_tools/open_model_zoo/demos” if you build demos with build_demos.sh demos will be installed under your home “~/omz_demos_build”. Building demos are important, after building demos some libraries will be built under “~/omz_demos_build/intel64/Release/lib” and those libraries has to built with pro file and has to be called with run time argument.

I’ve worked with pedestrian tracker demo for QT, and I’ve created a .pri file instead of pro to make it modular to reuse. Here is my .pri file

CONFIG += c++11

INCLUDEPATH += /opt/intel/openvino/deployment_tools/inference_engine/include
INCLUDEPATH += /opt/intel/openvino/opencv/include
INCLUDEPATH += /opt/intel/openvino/deployment_tools/inference_engine/external/mkltiny_lnx/include
INCLUDEPATH += /opt/intel/openvino/deployment_tools/open_model_zoo/demos/common
INCLUDEPATH += ~/omz_demos_build/thirdparty/gflags/include
INCLUDEPATH += $$PWD/gflags/include
INCLUDEPATH += $$PWD


LIBS += -L$$PWD/gflags/lib/ -lgflags_nothreads
DEPENDPATH += $$PWD/gflags/include
PRE_TARGETDEPS += $$PWD/gflags/lib/libgflags_nothreads.a

LIBS += -ldl
LIBS += -L~/omz_demos_build/intel64/Release/lib \
           -lgflags_nothreads

LIBS += -L/opt/intel/openvino/opencv/lib \
          -lopencv_core \
          -lopencv_highgui \
          -lopencv_imgcodecs \
          -lopencv_imgproc \
          -lopencv_videoio \
          -lopencv_video

LIBS += -L/opt/intel/openvino/deployment_tools/inference_engine/external/mkltiny_lnx/lib \
          -lmkl_tiny_tbb

LIBS += -L/opt/intel/openvino/deployment_tools/inference_engine/lib/intel64 \
          -linference_engine \
          -lMKLDNNPlugin

SOURCES += \
        $$PWD/cnn.cpp \
        $$PWD/core.cpp \
        $$PWD/detector.cpp \
        $$PWD/distance.cpp \
        $$PWD/image_reader.cpp \
        $$PWD/kuhn_munkres.cpp \
        $$PWD/tracker.cpp \
        $$PWD/utils.cpp \
        $$PWD/xtracking.cpp

HEADERS += \
    $$PWD/cnn.hpp \
    $$PWD/core.hpp \
    $$PWD/descriptor.hpp \
    $$PWD/detector.hpp \
    $$PWD/distance.hpp \
    $$PWD/image_reader.hpp \
    $$PWD/kuhn_munkres.hpp \
    $$PWD/logging.hpp \
    $$PWD/pedestrian_tracker_demo.hpp \
    $$PWD/tracker.hpp \
    $$PWD/utils.hpp \
    $$PWD/xtracking.h

XTracking is the main.cpp of the demo code, I reshaped it as a class, not a big deal. The most important part is include paths and libraries to link. If you run it with just model arguments it will fail and return [ ERROR ] Unsupported primitive of type: PriorBoxClustered name: mbox1/priorbox. At the end it will be terminated. Reason is executable binary does not link with libcpu_extension.so it was generated under “~/omz_demos_build/intel64/Release/lib” I also copied it to my pedestrian tracker module and calling the sample’s first argument to link binary with the dynamic library like: -l ~/omz_demos_build/intel64/Release/lib/libcpu_extension.so -m_det ~/Templates/person-detection-retail-0013.xml -m_reid ~/Templates/person-reidentification-retail-0031.xml -i ~/Videos/c.mkv 

Woala! OpenVINO toolkit works like a charm for Pedestrian Tracker!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *