2702 Recipes

Object Detection

Finding game pieces and robots with a camera. When object detection is worth it, how a detection pipeline is organized, color-based and machine learning detectors, and a playground to try both.

AprilTags tell a robot where it is. Object detection tells it where things are: a game piece on the carpet, a pile of balls, another robot. Nothing on those things is marked, so the camera has to recognize them by what they look like.

This section explains when object detection helps and when it doesn't, how every detection pipeline is organized, and the two ways to build the detector itself: by color, with a few image processing steps, or with machine learning, using a trained neural network and usually a coprocessor with an accelerator. It ends with a playground that runs both pipelines on a simulated camera image, one stage at a time. How our own vision pipeline puts these ideas into practice is covered separately.

What you need

High-school algebra and trigonometry. The Vision section helps, especially the pinhole camera on the Pose Estimation page, but each idea is explained again where it is used. No machine learning background is needed.

Where to start

Read the pages in order. Each one builds on the one before.

Key ideas at a glance

IdeaOne-line summaryPage
Not always neededPieces at known spots, a forgiving intake, or an AprilTag on the target make detection unnecessary.Do You Need Object Detection?
Same outline every timeCapture, preprocess, detect, pick a target, locate, publish. Only the detect stage changes.The Detection Pipeline
Angle is easy, distance is hardThe angle comes straight from the box. The distance depends on the camera's height and tilt, and 1° of tilt error is about 30 cm at 3 m.The Detection Pipeline
Results are oldUse the capture time, and the robot's pose at that time, not now.The Detection Pipeline
Color is fast but fragileA bright, unique color on a matte piece works well. Lighting, look-alikes, white pieces, and piles break it.Color Detection
Lock the cameraFixed exposure and fixed white balance, or the colors change under you.Color Detection
Networks learn from examplesA trained network recognizes shape and texture, not just color. It is only as good as its training images.Machine Learning Detection
Small things vanishThe image is shrunk to the model input. A ball smaller than about 10 input pixels is easily missed.Machine Learning Detection
Accelerators make ML practicalA neural accelerator runs a small detector about ten times faster than a CPU.Machine Learning Detection

On this page