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
In the Console UI, confirm the blue ROI box (from
ros/config/config.yaml).Record images for state_0: place the first object in the ROI and capture at least 20–30 images (vary position/orientation slightly).
Record images for state_1 the same way.
Images are stored under
ros/data/datasets/classification_active/raw(host:~/aia_sdk/ros/data/datasets/classification_active/raw).
Step 4 — Train the model
Click Train model in the Console UI.
Wait until the terminal shows
onnx conversion completed.The model is written under
ros/data/models/classification_active.
Step 5 — Test in the Console UI
Click Load model.
Click Classify.
Confirm the terminal prints the class (
state_0orstate_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.
Open
aia_example_classifyon the robot (from~/aia_sdk/polyscope/programs/).Ensure
./scripts/run_example_classification.shis still running and the model is loaded.The program uses waypoints for recognize /
state_0/state_1and branches withark_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).