Run the OpenVINO Sample Programs¶
About This Task¶
Once your OpenVINO installation is up and running, you can experiment with the sample C and C++ programs included with the OpenVINO Toolkit.
Before You Begin¶
You must have a sourced, running, OpenVINO environment
You must have the resnet-50-pytorch model, yolov8n.pt model, and banana.jpg image file installed
For details on these requirements, see Verify the OpenVINO Toolkit and Runtime Installation.
This procedure assumes you are in the $WORKSPACE (/home/workspace) working directory defined earlier in this tutorial.
The terminal prompt should reflect that you are in the environment, for example:
(ov_venv) :~/workspace$
For clarity, the code examples in this procedure do not include this extra detail.
Run the Python Sample Programs¶
Navigate to the $WORKSPACE directory and run the hello_query_device.py sample program. This program provides information about your supported devices and CPU.
Command for package installs:
$ python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py
Command for source installs:
$ python3 $OPENVINO_REPO/openvino_dist/samples/python/hello_query_device/hello_query_device.py
Run the hello_classification sample program. This program provides classification information for API development.
Command for package installs:
$ python3 /usr/share/openvino/samples/python/hello_classification/hello_classification.py $WORKSPACE/ov_models/public/resnet-50-pytorch/FP32/resnet-50-pytorch.xml $WORKSPACE/banana.jpg CPU
Command for source installs:
$ python3 $OPENVINO_REPO/openvino_dist/samples/python/hello_classification/hello_classification.py $WORKSPACE/ov_models/public/resnet-50-pytorch/FP32/resnet-50-pytorch.xml $WORKSPACE/banana.jpg CPU
Run the C++ Sample Programs¶
Build the sample programs.
Command for package installs:
$ cd $WORKSPACE $ /usr/share/openvino/samples/cpp/build_samples.sh
Command for source installs:
$ cd $WORKSPACE $ $OPENVINO_REPO/openvino_dist/samples/cpp/build_samples.sh
Download the car.bmp image file to use with the sample programs.
$ wget https://storage.openvinotoolkit.org/data/test_data/images/car.bmp -O $WORKSPACE/car.bmp
Run the hello_query_device sample program. Similar to the Python version, this program provides information about your device.
$ ~/openvino_cpp_samples_build/intel64/Release/hello_query_device
Run the hello_classification sample program. Similar to the Python version, this program provides classification information for API development.
$ ~/openvino_cpp_samples_build/intel64/Release/hello_classification $WORKSPACE/ov_models/public/resnet-50-pytorch/FP32/resnet-50-pytorch.xml $WORKSPACE/car.bmp CPU
Run the C Sample Programs¶
This section requires the car.bmp image file from the previous section.
Build the sample programs.
Command for package installs:
$ cd $WORKSPACE $ /usr/share/openvino/samples/c/build_samples.sh
Command for source installs:
$ cd $WORKSPACE $ $OPENVINO_REPO/openvino_dist/samples/c/build_samples.sh
Run the hello_classification sample program. The results will be similar to the version for C++ in the previous section.
$ ~/openvino_c_samples_build/intel64/Release/hello_classification_c $WORKSPACE/ov_models/public/resnet-50-pytorch/FP32/resnet-50-pytorch.xml $WORKSPACE/car.bmp CPU
Results¶
Now that you are able to run the OpenVINO sample programs for a few different development languages, it is time to familiarize yourself with the OpenVINO Toolkit developer documentation. You can find links to the official user documentation, along with additional tutorials at OpenVINO Toolkit: Get Started.