Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
6066 Discussions

How to run Object Detection C++ Demo on Windows?

RGVGreatCoder
Novice
397 Views

I successfully ran the "Object Detection Python Demo", on a video I took running an IR model I also created (based on YoloV4-tiny model) on Windows 11, through Visual Studio 2022 Community, after:

  1. Installing Python 3.9.x
  2. Installing OpenVINO Developer toolkit through PIP
  3. Git clone https://github.com/openvinotoolkit/open_model_zoo.git
  4. Created a Python project and imported the libraries in "\open_model_zoo\demos\common\python"

However, I don't know how to run the "Object Detection C++ Demo". This is the link I am referring to: Object Detection C++ Demo — OpenVINO™ documentation — Version(2021.4)

 

I setup OpenCV in my Windows 11 machine, edited the windows "path" variable in "Environment Variables" and, setup the project properties, under "Configuration Properties\C/C++\General" and "Configuration Properties\Linker\General" and "Configuration Properties\Linker\Input. I notice Visual Studio 2022 no longer flags the lines of code (in the "main.cpp" file) that refer to the object variable named "cv::". But I notice I still need to resolve the following issues:

  1. #include <gflags/gflags.h>
    Issue: Cannot open source file "gflags/gflags.h"
  2. DEFINE_INPUT_FLAGS
    DEFINE_OUTPUT_FLAGS
  3. DEFINE_bool(..., DEFINE_string(..., DEFINE_double(...
  4. conf << ...
    Issue: this declaration has no storage class or type specifier
  5. cv::putText(outputImg...
    Issue: Input image is stored inside metadata...
    Issue: Identifier "outputImg" is undefined
  6. std::unique_ptr<ModelBase>
  7. ... and so on ...

Are there some setup steps I need to run before running the "Object Detection C++ Demo" main.cpp program? What am I missing?

 

Thank you and will be waiting for your reply,

0 Kudos
4 Replies
Zulkifli_Intel
Moderator
353 Views

Hello RGVGreatCoder,

 

Thank you for reaching out to us.

 

Before running the Object Detection C++ demo in the Intel® Distribution of OpenVINO™ toolkit, the demo needs to be compiled. There is an automated script to compile all the demos.

 

If you are using OpenVINO 2022.1 version, here are the steps to compile the demos:

 

1. Clone the Open Model Zoo GitHub repository.

 

2. To build the demo applications for Windows, go to the directory with the build_demos_msvc.bat batch file and run it:

  • cd \<download_directory>\open_model_zoo\demos
  • build_demos_msvc.bat

 

If you are using OpenVINO 2021.4 version, here are the steps to compile the demos:

1. Clone the Open Model Zoo GitHub repository.

 

2. To build the demo applications for Windows, go to the directory with the build_demos_msvc.bat batch file and run it:

  • cd \<download_directory>\open_model_zoo\demos
  •  build_demos_msvc.bat

 

The demo applications binaries are in the C:\Users\<username>\Documents\Intel\OpenVINO\omz_demos_build\intel64\Release directory.

 

You can visit Build the Demos Applications on Microsoft Windows OS for more information on Open Model Zoo demos.

 

Sincerely,

Zulkifli 

 

RGVGreatCoder
Novice
329 Views

I ran the steps for OpenVINO 2022.1 (that is the version I have) encountering an error, as follows:

C:\Users\manue\source\repos\AI-Machine-Learning>cd open_model_zoo

C:\Users\manue\source\repos\AI-Machine-Learning\open_model_zoo>git submodule update --init --recursive

C:\Users\manue\source\repos\AI-Machine-Learning\open_model_zoo>cd demos

C:\Users\manue\source\repos\AI-Machine-Learning\open_model_zoo\demos>build_demos_msvc.bat
Failed to set the environment variables automatically
To fix, run the following command: <INSTALL_DIR>\bin\setupvars.bat
where INSTALL_DIR is the OpenVINO installation directory.
Error

 I don't know where the <INSTALL_DIR> (installed directory) of OpenVINO is located since I installed it using PIP.

Please let me know what to do next.

Thank you and will be waiting for your reply

 

Zulkifli_Intel
Moderator
295 Views

Hello RGVGreatCoder,

 

Installing Openvino via pip is targeted at Python developers. The build_demos_msvc.bat file compiles the CPP demos and it requires installation using the offline/online runtime installer.

 

To build the demos, you need to source OpenVINO™ and OpenCV environment. You can install the OpenVINO™ toolkit using the installation package for Intel® Distribution of OpenVINO™ toolkit or build the open-source version available in the OpenVINO GitHub repository using the build instructions. For the Intel® Distribution of OpenVINO™ toolkit installed to the <INSTALL_DIR> directory on your machine, run the following commands to download prebuilt OpenCV and set environment variables before building the demos.

 

For more info, please refer to Build the Demo Applications.

 

Sincerely,

Zulkifli 


Zulkifli_Intel
Moderator
270 Views

Hello RGVGreatCoder,


Thank you for your question. If you need any additional information from Intel, please submit a new question as this thread is no longer being monitored.


Sincerely,

Zulkifli


Reply