Running Simple demos

This chapter describes how to run Python and C++ demo applications in edge_ai_apps with live camera and display.

Note

Please note that the Python demos are useful for quick prototyping while C++ demos are similar by design but tuned for performance.

Running Python based demo applications

Python based demos are simple executable scripts written for image classification, object detection and semantic segmentation. Demos are configured using a YAML file. Details on configuration file parameters can be found in Demo Configuration file

Sample configuration files for out of the box demos can be found in edge_ai_apps/configs this folder also contains a template config file which has brief info on each configurable parameter edge_ai_apps/configs/app_config_template.yaml

Here is how a Python based image classification demo can be run,

root@j7-evm:/opt/edge_ai_apps/apps_python# ./app_edgeai.py ../configs/image_classification.yaml

The demo captures the input frames from connected USB camera and passes through pre-processing, inference and post-processing before sent to display. Sample output for image classification and object detection demos are as below,

logo1

logo2

To exit the demo press Ctrl+C.

Building and running C++ based demo applications

C++ apps needs to be built directly on target and requires header files of different deep-learning runtime framework and its dependencies which are installed in the setup script. The setup script builds the C++ apps when executed. However one can also follow below steps to clean build C++ apps

root@j7-evm:/opt/edge_ai_apps/apps_cpp# rm -rf build bin lib
root@j7-evm:/opt/edge_ai_apps/apps_cpp# mkdir build
root@j7-evm:/opt/edge_ai_apps/apps_cpp# cd build
root@j7-evm:/opt/edge_ai_apps/apps_cpp/build# cmake ..
root@j7-evm:/opt/edge_ai_apps/apps_cpp/build# make -j2

Run the demo once the application is successfully built

root@j7-evm:/opt/edge_ai_apps/apps_cpp# ./bin/Release/app_edgeai ../configs/image_classification.yaml

To exit the demo press Ctrl+C.

Note

Both Python and C++ applications are similar by construction and can accept the same config file and command line arguments

Note

The C++ apps built on Yocto Linux may not run in Docker as there could be a mismatch in Glib and other related tools. So its highly recommended to rebuild the C++ apps within the Docker environment.