The Inference Engine sample applications are simple console applications that show how to utilize specific Inference Engine capabilities within an application, assist developers in executing specific tasks such as loading a model, running inference, querying specific device capabilities and etc.
After installation of Intel® Distribution of OpenVINO™ toolkit, С, C++ and Python* sample applications are available in the following directories, respectively:
<INSTALL_DIR>/inference_engine/samples/c
<INSTALL_DIR>/inference_engine/samples/cpp
<INSTALL_DIR>/inference_engine/samples/python
Inference Engine sample applications include the following:
To run the sample applications, you can use images and videos from the media files collection available at https://github.com/intel-iot-devkit/sample-videos.
You can download the pre-trained models using the OpenVINO Model Downloader or from https://download.01.org/opencv/.
The officially supported Linux* build environment is the following:
To build the C or C++ sample applications for Linux, go to the <INSTALL_DIR>/inference_engine/samples/c
or <INSTALL_DIR>/inference_engine/samples/cpp
directory, respectively, and run the build_samples.sh
script:
Once the build is completed, you can find sample binaries in the following folders:
~/inference_engine_c_samples_build/intel64/Release
~/inference_engine_cpp_samples_build/intel64/Release
You can also build the sample applications manually:
NOTE: If you have installed the product as a root user, switch to root mode before you continue:
sudo -i
build
: NOTE: If you ran the Image Classification verification script during the installation, the C++ samples build directory was already created in your home directory:
~/inference_engine_samples_build/
make
to build the samples: For the release configuration, the sample application binaries are in <path_to_build_directory>/intel64/Release/
; for the debug configuration — in <path_to_build_directory>/intel64/Debug/
.
The recommended Windows* build environment is the following:
NOTE: If you want to use Microsoft Visual Studio 2019, you are required to install CMake 3.14.
To build the C or C++ sample applications on Windows, go to the <INSTALL_DIR>\inference_engine\samples\c
or <INSTALL_DIR>\inference_engine\samples\cpp
directory, respectively, and run the build_samples_msvc.bat
batch file:
By default, the script automatically detects the highest Microsoft Visual Studio version installed on the machine and uses it to create and build a solution for a sample code. Optionally, you can also specify the preferred Microsoft Visual Studio version to be used by the script. Supported versions are VS2017
and VS2019
. For example, to build the C++ samples using the Microsoft Visual Studio 2017, use the following command:
Once the build is completed, you can find sample binaries in the following folders:
C:\Users\<user>\Documents\Intel\OpenVINO\inference_engine_c_samples_build\intel64\Release
C:\Users\<user>\Documents\Intel\OpenVINO\inference_engine_cpp_samples_build\intel64\Release
You can also build a generated solution manually. For example, if you want to build C++ sample binaries in Debug configuration, run the appropriate version of the Microsoft Visual Studio and open the generated solution file from the C:\Users\<user>\Documents\Intel\OpenVINO\inference_engine_cpp_samples_build\Samples.sln
directory.
Before running compiled binary files, make sure your application can find the Inference Engine and OpenCV libraries. Run the setupvars
script to set all necessary environment variables:
**(Optional)**: The OpenVINO environment variables are removed when you close the shell. As an option, you can permanently set the environment variables as follows:
.bashrc
file in <user_home_directory>
: :wq
and press the Enter key.[setupvars.sh] OpenVINO environment initialized
.You are ready to run sample applications. To learn about how to run a particular sample, read the sample documentation by clicking the sample name in the samples list above.
Before running compiled binary files, make sure your application can find the Inference Engine and OpenCV libraries. Use the setupvars
script, which sets all necessary environment variables:
To debug or run the samples on Windows in Microsoft Visual Studio, make sure you have properly configured Debugging environment settings for the Debug and Release configurations. Set correct paths to the OpenCV libraries, and debug and release versions of the Inference Engine libraries. For example, for the Debug configuration, go to the project's Configuration Properties to the Debugging category and set the PATH
variable in the Environment field to the following:
where <INSTALL_DIR>
is the directory in which the OpenVINO toolkit is installed.
You are ready to run sample applications. To learn about how to run a particular sample, read the sample documentation by clicking the sample name in the samples list above.