Classification

Warning

The AI Accelerator requires ROS 2 Humble, so PolyScope X 10.12.1 is the latest compatible release. PolyScope X 10.13 and later use ROS 2 Jazzy and are not currently supported.

This demo trains a two-state classifier (state_0 / state_1) from camera images and uses it for a simple quality-style decision on the robot.

What you need

  • SDK installed and running

  • Robot moved to the inspection pose you will use later (wp_detect / recognize waypoint)

  • Example program: ~/aia_sdk/polyscope/programs/aia_example_classify.urpx

Warning

The Region of Interest (ROI) is critical. All images are cropped to this area before inference. Set it correctly in ros/config/config.yaml for the Console UI. The robot program also defines ROI under the script node local roi_query — keep both consistent so GUI and robot inference match. Collect training images with the robot already in the final inspection pose.

Steps

Step 1 — Enter the SDK container

cd ~/aia_sdk/ros
./scripts/run_sdk_setup.sh

Step 2 — Launch classification

./scripts/run_example_classification.sh

Step 3 — Collect training images

  1. In the Console UI, confirm the blue ROI box (from ros/config/config.yaml).

  2. Record images for state_0: place the first object in the ROI and capture at least 20–30 images (vary position/orientation slightly).

  3. Record images for state_1 the same way.

  4. Images are stored under ros/data/datasets/classification_active/raw (host: ~/aia_sdk/ros/data/datasets/classification_active/raw).

Step 4 — Train the model

  1. Click Train model in the Console UI.

  2. Wait until the terminal shows onnx conversion completed.

  3. The model is written under ros/data/models/classification_active.

Step 5 — Test in the Console UI

  1. Click Load model.

  2. Click Classify.

  3. Confirm the terminal prints the class (state_0 or state_1) and probability.

Step 6 — Run the PolyScope program

Warning

This program stores fixed waypoints. Before running, set speed to 10%, use Move Here on each waypoint, and confirm free motion. wp_detect / recognize must match the pose used during training.

  1. Open aia_example_classify on the robot (from ~/aia_sdk/polyscope/programs/).

  2. Ensure ./scripts/run_example_classification.sh is still running and the model is loaded.

  3. The program uses waypoints for recognize / state_0 / state_1 and branches with ark_classification_retrieve().

Improving accuracy

  • Capture more diverse images per state (angles, lighting, distance within the ROI).

  • If results stay poor, consider a different model architecture (requires code changes and rebuild).