Getting started with TI Jacinto 7 Edge AI - Demos - C++ Demos - Classification

From RidgeRun Developer Connection
Jump to: navigation, search




Previous: Demos/C++ Demos/Build the Docker container & apps Index Next: Demos/C++ Demos/Detection





Classification demo

Requirements

  • Sample images in the J7's /opt/edge_ai_apps/data/images/ directory.

Run the classification demo example

  • Navigate to the C++ apps directory:
cd /opt/edge_ai_apps/apps_cpp
  • Create a directory to store the output files:
mkdir out
  • Run the demo:
./bin/Release/app_image_classification -m ../models/classification/TFL-CL-000-mobileNetV1-mlperf -i ../data/images/%04d.jpg -o out/classification_%d.jpg
  • The demo will start running. The command line will look something like the following:
Error creating thumbnail: Unable to save thumbnail to destination
Figure 1. Terminal output.

After all frames are done processing, navigate to the out directory:

cd out

There should be several images named classification_<number>.jpg as a result of the classification model.

  • Figure 2 shows an example of how these images should look like:


Classification output cpp
Figure 2. Classification output example.

There are multiple input and output configurations available. In this example demo, image input and an image output were specified.

For more information about configuration arguments please refer to the Configuration arguments section below.

Configuration arguments

  -h, --help            show this help message and exit
  -m MODEL, --model MODEL
                    Path to model directory (Required)
                        ex: ./image_classification.py --model ../models/classification/$(model_dir)
  -i INPUT, --input INPUT
                    Source to gst pipeline camera or file
                        ex:  --input v4l2 - for camera
                             --input ./images/img_%02d.jpg - for images
                                   printf style formating will be used to get file names
                             --input ./video/in.avi - for video input
                             default: v4l2
  -o OUTPUT, --output OUTPUT
                    Set gst pipeline output display or file
                        ex:  --output kmssink - for display
                             --output ./output/out_%02d.jpg - for images
                             --output ./output/out.avi - for video output
                             default: kmssink
  -d DEVICE, --device DEVICE
                    Device name for camera input
                    default: /dev/video2
  -c CONNECTOR, --connector CONNECTOR
                    Connector id to select output display
                    default: 39
  -u INDEX, --index INDEX
                    Start index for multiple file input output
                    default: 0
  -f FPS, --fps FPS     Framerate of gstreamer pipeline for image input
                    default: 1 for display and video output 12 for image output
  -n, --no-curses       Disable curses report
                    default: Disabled


Previous: Demos/C++ Demos/Build the Docker container & apps Index Next: Demos/C++ Demos/Detection