Locate a detected object in the twin

Connect a detection to a plausible surface and retain uncertainty.

Exercise brief·Intermediate·3 min read

Opening the Python editor…

Requirements and learning goals

Before you start

  • A detector with original-image boxes
  • Pixel-to-world ray exercise

You will be able to

  • Choose a localization point
  • Reject implausible surface hits
  • Score position error independently

The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?

Object detection answers what is visible and where it appears in an image. estimates where that object is in the room. Connecting the two lets a robot approach something it sees. Here you will choose a pixel that can plausibly touch a known surface, then measure how far the estimated position is from an independent survey.

Use the twin-to-real checklist to compare estimated positions with measured targets before treating them as navigation goals.

Choose the point deliberately

A center often points into an object's visible body. For a floor-standing object, the bottom-center can approximate contact with the floor. Neither is guaranteed, especially with occlusion or a loose box.

The warehouse search demo uses the box bottom-center, casts through calibrated geometry, and rejects non-floor hits. Its simulated validation does not establish performance on real objects.

Rendering diagram…
From a detection to a place. A hit that is not on the floor is rejected, and rejections are counted.

Try an independent position check

Place targets at surveyed positions. Keep those positions in the scoring program only. Feed the detector's selected pixels through your ray function, then compare estimates:

from math import hypot
 
# Independent survey, followed by perception estimates, in meters.
truth = [(1.0, 2.0), (3.0, 1.0), (2.0, 4.0)]
estimates = [(1.1, 2.1), (3.3, 1.0), (2.0, 4.2)]
errors = [hypot(x-a, y-b)
          for (x, y), (a, b) in zip(truth, estimates)]
print("maximum error", max(errors))  # approximately 0.3 m

Also count rejected localizations. Reporting error only for accepted detections hides how often the system cannot answer.

Checkpoint 1 of 2

You add a fourth target, surveyed at (4.0, 0.0) and estimated at (4.3, 0.4). What maximum error does the script print now?

Commit to an answer. Every choice explains itself.

Check before making a goal

Attach frame ID, capture time, calibration ID, estimated position, and uncertainty to each result. Reject expired observations, incompatible calibration, rays without intersections, and surfaces outside the task's assumptions.

A robot should approach a reachable stand-off point, not occupy the object's estimated location. Select that point against the robot footprint and current obstacle observations.

Checkpoint 2 of 2

A fresh detection with matching calibration places a crate at (3.0, 1.0) meters. Which navigation goal fits this lesson's rule?

Commit to an answer. Every choice explains itself.

Common snag: excellent class accuracy with bad geometry. Test shelf objects, partially hidden objects, and image-edge boxes separately. Optional extension: compare estimates from two cameras. Disagreement can reveal calibration drift or an incorrect support-surface assumption; averaging incompatible estimates only hides the problem.

Can you do each of these?

  • Choose a localization point
  • Reject implausible surface hits
  • Score position error independently

0 of 2 checkpoints solved. Try checkpoint 1

Previous: Turn a camera pixel into a world ray
All lessons in this topic
  1. 1. Build a twin with a measurement contract
  2. 2. Understand calibration and check a camera projection
  3. 3. Turn a camera pixel into a world ray
  4. 4. Locate a detected object in the twin
  5. 5. Validate a robot goal with a dry-run adapter

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.