OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
Installing
Once the project is built you can install OpenVINO™ Runtime into custom location:
cmake --install <BUILDDIR> --prefix <INSTALLDIR>
Build and Run Samples
Build samples.
To build C++ sample applications, run the following commands:
Linux and macOS:
cd <INSTALLDIR>/samples/cpp ./build_samples.shWindows Command Prompt:
cd <INSTALLDIR>\samples\cpp build_samples_msvc.batWindows PowerShell:
& <path-to-build-samples-folder>/build_samples.ps1Download a model.
You can download an image classification model from Hugging Face to run the sample
Convert the model.
Linux and macOS:
ovc <path-to-your-model> --compress_to_fp16=TrueWindows:
ovc <path-to-your-model> --compress_to_fp16=TrueRun inference on the sample.
Set up the OpenVINO environment variables:
Linux and macOS:
source <INSTALLDIR>/setupvars.shWindows Command Prompt:
<INSTALLDIR>\setupvars.batWindows PowerShell:
. <path-to-setupvars-folder>/setupvars.ps1The following commands run the Image Classification Code Sample using the [
dog.bmp](https://storage.openvinotoolkit.org/data/test_data/images/ 224x224/dog.bmp) file as an input image, the model in IR format, and on different hardware devices:Linux and macOS:
cd ~/openvino_cpp_samples_build/<architecture>/Release ./classification_sample_async -i <path-to-input-image>/dog.bmp -m <path-to-your-model>/model.xml -d CPUwhere the is the output of
uname -m, for example,intel64,armhf, oraarch64.Windows:
cd %USERPROFILE%\Documents\Intel\OpenVINO\openvino_cpp_samples_build\<architecture>\Release .\classification_sample_async.exe -i <path-to-input-image>\dog.bmp -m <path-to-your-model>\model.xml -d CPUwhere the is either
intel64oraarch64depending on the platform architecture.
When the sample application is complete, you see the label and confidence data for the top 10 categories on the display:
Below are results of using the googlenet-v1 model.
Top 10 results:
Image dog.bmp
classid probability
------- -----------
156 0.6875963
215 0.0868125
218 0.0784114
212 0.0597296
217 0.0212105
219 0.0194193
247 0.0086272
157 0.0058511
216 0.0057589
154 0.0052615
Adding OpenVINO Runtime to Your Project
For CMake projects, set the OpenVINO_DIR and when you run CMake tool:
cmake -DOpenVINO_DIR=<INSTALLDIR>/runtime/cmake .
Then you can find OpenVINO Runtime by [find_package]:
find_package(OpenVINO REQUIRED)
add_executable(ov_app main.cpp)
target_link_libraries(ov_app PRIVATE openvino::runtime)
add_executable(ov_c_app main.c)
target_link_libraries(ov_c_app PRIVATE openvino::runtime::c)