Software · Vision

Object Detection Lab

Tune what the robot's camera thinks is a game piece, then watch it play 15 seconds of auto on what you tuned.

Step 1 of 9

What the camera sees

    Go deeper

    What is real here and what is pretend
    • The color detector is real. It runs on the actual pixels of the camera image every frame: HSV threshold, connected blobs, size filter. The lighting really changes those pixels. If it breaks, it broke for the same reason it would on a robot.
    • The YOLO detector is a stand-in. No neural network runs here. It uses the positions of the objects to write out the kind of boxes and confidences a real model gives: closer objects score higher, hidden objects score lower, look-alikes score some, and one object gets several boxes.
    • NMS and the scoring are real. NMS, IoU, precision and recall are the actual algorithms, run on those boxes.
    • The model sizes are illustrative. Their frame rates and scores are made up to show the trade-off. Measure your own model on the Jetson before believing any number.
    In real code

    The color filter you have tuned, in Python with OpenCV:

    
          

    The YOLO settings you have tuned, with Ultralytics. predict() does the confidence filter and NMS for you:

    
          

    Read more on the Object Detection page.

    How a box becomes a place on the field

    This lab's robot uses the bottom edge of a box, which is where the object touches the floor. Knowing the camera's height and lens, it turns that pixel into a distance and a direction. Our Jetson sends the angles to the center of the box instead; the Object Detection page shows how. That is why the fan's shirt sends the robot somewhere silly: its box isn't on the floor at all, so the distance is a guess.

    Within about a meter of the camera, the floor is out of frame, so the robot has to keep driving to the last place it saw the ball.

    This robot uses each detection as if it just happened. Real code should look up where the robot was when the picture was taken, or latency turns into steering error. Run a round on Large and watch how far the boxes trail behind when the robot turns.

    Precision and recall
    • Precision: of all the boxes the detector drew, how many were really balls? Low precision means the robot chases cones.
    • Recall: of all the balls in view, how many got a box? Low recall means the robot drives past game pieces.
    • A box counts as correct when its IoU (overlap divided by combined area) with the real ball is at least 0.25.
    • Raising confidence trades recall for precision. A better model is one that gives you more of both at once.
    Things to try in free play
    1. One range for every light. Try to find a single hue range that finds all the balls under Shop, Arena and Dim gym, with nothing else boxed.
    2. Shape helps color. Under More controls, tick Blob must be round. Do the fans go away? What does it do to a ball half hidden behind something?
    3. Color vs. YOLO. Run a Match with each detector, under each light.
    4. Too cautious. Run a round with confidence at 0.90. The robot makes no mistakes. How many balls does it get?
    5. NMS too loose. Drag the overlap limit up to 0.95 with NMS on. One ball gets several boxes again.