Molmo 3 Depth Estimation: Check Two Targets Against Measured Distances

Test Molmo 3 depth estimation on two measured tabletop targets with a Python script that checks point placement, depth error in meters, and a hidden target.

Molmo 3 depth estimation tabletop schematic. A fixed camera faces A and B at measured depths. A companion frame shows A visible while a screen hides B.Molmo 3 depth estimation tabletop schematic. A fixed camera faces A and B at measured depths. A companion frame shows A visible while a screen hides B.
Illustrative tabletop fixture. Check the point against the printed face before comparing its depth with the tape reading. Output coordinates and units follow Ai2's Molmo3-8B model card.

A tabletop image workflow asks for the depth of the far card and gets 1.19 m. That sounds close to the tape measurement of 1.20 m. If the returned point lands on the stand next to the card, that estimate belongs to the wrong surface. A Molmo 3 depth estimation check should settle which surface the model picked before it gives the number any credit.

Use a fixed camera, two labeled cards, a tape measure and a Python environment on a CUDA machine. You’ll take two photos, run three independent queries with Molmo3-8B, and get one JSON record per query. Each visible target earns a numerical error only after its point lands inside a rectangle you marked on the photo. The third query asks for the far card while a screen hides it. Keep that query in the report even when the model returns nothing.

Ai2 introduced Molmo 3 on December 3, 2026. Its referring-depth evaluation checks both point placement inside an object’s mask and depth agreement within a factor of 1.25. The example here uses flat rectangles and an absolute error limit of 5 cm because the illustrative tabletop workflow has the same allowable error at both stations. Ai2’s Molmo 3 announcement

Ai2's announcement page for Molmo 3.
Ai2's Molmo 3 announcement page, which introduces the model family's spatial understanding and grounding capabilities. · Original source

Set up two flat targets and a hidden frame

  1. Put the camera on a fixed mount with its main lens facing along the bench. Level it and work at the height of the center of the targets. Use the same lens, orientation and framing for both photos. Disable any automatic lens switching or reframing your camera offers. A taped outline around the mount makes a bump easier to spot when you compare the frames.
  2. Mount a matte card labeled A just left of the optical axis and a second matte card labeled B just right of it. Face both cards squarely toward the camera so each printed face lies approximately in a plane perpendicular to the viewing direction. Give the near card enough width to read its label and keep its projected face clear of the far card. Place the front faces at approximately 0.60 m and 1.20 m along the viewing direction. Use the measured values when scoring your own setup.
  3. Mark a repeatable camera datum near the lens and measure parallel to the viewing direction, from that datum to each front face. Make a straight tape line along the bench and use a square to transfer each card plane to the tape. Keep accepted areas near the optical axis. For instance, a patch 4 cm sideways and 4 cm above the axis at 0.60 m has a straight-line range only about 3 mm longer than its axial distance. Record the datum and the limits of this approximation alongside the measurements. Use a calibrated reference if the camera datum or off-axis difference can consume a meaningful share of your tolerance.
  4. Export the first photo as both.png. For the second, slide an opaque, unlettered screen into the line of sight to B without shifting either card. Leave A visible. Export hidden.png. Check that B’s face and label are completely covered, and that recognizable background features line up in the two exports. Keep the same orientation and dimensions. Re-export both if your viewer rotates an image on display or adds a border that changes its pixel grid.
  5. On the exact both.png file sent to the model, mark one interior rectangle on each flat printed face. Exclude card edges, stands, glare and background. Record the upper-left and lower-right corners as original-image pixels x0 y0 x1 y1, with x increasing to the right and y increasing downward. Use the illustrative coordinates below to follow the arithmetic, then pass coordinates read from your own export into the live run.

The geometry matters because the tape supplies the reference for every point that lands inside a face. If the card tilts enough that its nearer and farther edges differ materially in depth, two points on the same card could legitimately have different distances. Check the face at both sides before shooting. Flat targets also make the rectangle test easy to audit. If a rectangle contains a hole or the stand pokes across its edge, shrink the rectangle while looking at the original image so every included pixel belongs to the intended surface.

Write the two references down before running the model. If a planned 0.60 m mark measures 0.62 m after the stand settles, the score uses 0.62 m. Select the tolerance before seeing guesses as well. The 0.05 m limit here represents an illustrative downstream decision to accept coarse depth annotations. If the application bins depth at a boundary only 2 cm away, record that decision separately and send cases near the boundary to manual measurement. The model card documents output depth in meters. This near-axis setup keeps the comparison useful without requiring a general depth calibration across the full image. Ai2’s Molmo3-8B model card

Run three independent Molmo3-8B queries

  1. Use Python 3.11 with a CUDA-capable PyTorch and matching torchvision installation. Ai2’s setup uses Python 3.11 and reports testing with PyTorch 2.11 and Transformers 5.5.3. Its recommendation for Molmo3-8B is a GPU with at least 24 GB and about 35 GB of disk for the fp32 checkpoint. Leave additional disk room for the environment and multiple cached revisions if you plan to compare them. The publisher’s figure is a sizing recommendation. Actual available GPU memory depends on what else is running. Ai2’s Molmo3-8B setup and hardware requirements

  2. In that environment install the image-path dependencies. If PyTorch is already installed for your CUDA runtime, verify that the corresponding torchvision package is present before changing it. Video dependencies are unnecessary for these PNGs.

    pip install torch torchvision 'transformers==5.5.3' numpy pillow
    
  3. Review the custom code in the Ai2 model repository at the commit you intend to load. Use that full commit SHA for --revision. trust_remote_code=True lets Transformers load the repository’s Python implementation. Pass the same revision to both loaders so weights and processor code come from the same selected repository state. Keep the reviewed SHA with the report. Hugging Face’s custom model loading documentation

  4. Save the script below as check_depth.py. Run it from the directory containing the two exports. It prints one JSON object per case and includes the decoded document in that record. Review the report even when one of the predictions misses.

A multimodal chat puts an image and a text item in the message content list. This script follows the Molmo3-specific call from Ai2, which passes the actual images separately as images=[image]. The image placeholder comes first and consumes the one image in that list. Generation returns both the token sequence and grounding output. The script slices the prompt off the token sequence, then gives the decoder the generated tokens, grounding and same image. That last step gives the processor the dimensions and layout it needs to recover the points. Hugging Face’s multimodal chat guide · Ai2’s Molmo3-8B grounding example

The prompts repeat the model card’s illustrated pattern of asking the model to point to an object and say how far it is from the camera. They supply the card label and withhold the ruler reading. Each call starts a fresh chat. In particular, the hidden-frame query supplies just that photo, so a point in the previous frame cannot be carried forward through conversation history. The scoring handles one point per label and associates it with the corresponding photo by the case being run.

import argparse
import json
import math
import re
from decimal import Decimal

import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor

MODEL_ID = 'allenai/Molmo3-8B'
TOLERANCE_M = Decimal('0.05')
MAX_CROPS = 8
MAX_NEW_TOKENS = 128


def finite_number(value):
    return type(value) in (int, float) and math.isfinite(value)


def classify(answer, size, box, reference):
    if not isinstance(answer, dict) or not isinstance(answer.get('text'), str):
        return {'status': 'malformed', 'reason': 'expected decoded document'}
    elements = answer.get('multi_modal')
    if not isinstance(elements, list):
        return {'status': 'malformed', 'reason': 'expected multi_modal list'}
    if any(not isinstance(item, dict) for item in elements):
        return {'status': 'malformed', 'reason': 'invalid grounding element'}
    depth_elements = [item for item in elements if item.get('type') == 'points_3d']
    if not depth_elements:
        if any(item.get('type') == 'points' for item in elements):
            return {'status': 'malformed', 'reason': '2D point without depth'}
        if '<points3d' in answer['text']:
            return {'status': 'malformed', 'reason': 'undecoded depth tag'}
        return {'status': 'missing', 'reason': 'no structured depth point'}

    points = []
    for item in depth_elements:
        coordinates = item.get('coordinates')
        if not isinstance(coordinates, list) or not coordinates:
            return {'status': 'malformed', 'reason': 'invalid coordinates list'}
        points.extend(coordinates)
    if len(points) != 1 or not isinstance(points[0], dict):
        return {'status': 'malformed', 'reason': 'expected one depth point'}

    point = points[0]
    x, y, depth = (point.get(key) for key in ('x', 'y', 'depth'))
    w, h = size
    if type(point.get('mm_ix')) is not int or point['mm_ix'] != 0:
        return {'status': 'malformed', 'reason': 'expected image index 0'}
    if not all(finite_number(value) for value in (x, y, depth)):
        return {'status': 'malformed', 'reason': 'expected finite x, y and depth'}
    if not (0 <= x < w and 0 <= y < h) or depth == 0:
        return {'status': 'malformed', 'reason': 'invalid pixel or zero depth'}
    if box is None:
        return {'status': 'misgrounded', 'reason': 'point on hidden case', 'point': point}
    x0, y0, x1, y1 = box
    if not (x0 <= x < x1 and y0 <= y < y1):
        return {'status': 'misgrounded', 'reason': 'point outside target', 'point': point}
    if depth < 0:
        return {'status': 'missing', 'reason': 'depth unavailable', 'point': point}

    signed_error = Decimal(str(depth)) - reference
    error = abs(signed_error)
    return {
        'status': 'within_tolerance' if error <= TOLERANCE_M else 'depth_error',
        'point': point,
        'signed_error_m': float(signed_error),
        'absolute_error_m': float(error),
    }


def infer(model, processor, image, target):
    images = [image]
    prompt = f'Point to the card labeled {target} and tell me how far it is from the camera.'
    messages = [{'role': 'user', 'content': [
        {'type': 'image'}, {'type': 'text', 'text': prompt},
    ]}]
    inputs = processor.apply_chat_template(messages, images=images, tokenize=True).to('cuda')
    with torch.inference_mode():
        output = model.generate(
            **inputs, max_new_tokens=MAX_NEW_TOKENS, do_sample=False,
            return_dict_in_generate=True,
        )
    tokens = output.sequences[0, inputs['input_ids'].shape[1]:]
    return processor.decode(tokens, output.grounding[0], images=images)


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--revision', required=True)
    parser.add_argument('--a-box', type=int, nargs=4, required=True)
    parser.add_argument('--b-box', type=int, nargs=4, required=True)
    parser.add_argument('--a-m', type=Decimal, default=Decimal('0.60'))
    parser.add_argument('--b-m', type=Decimal, default=Decimal('1.20'))
    args = parser.parse_args()
    if not re.fullmatch(r'[0-9a-f]{40}', args.revision):
        parser.error('--revision requires a full reviewed commit SHA')
    if any(not m.is_finite() or m <= 0 for m in (args.a_m, args.b_m)):
        parser.error('references must be finite positive meters')

    with Image.open('both.png') as source:
        both = source.convert('RGB')
    with Image.open('hidden.png') as source:
        hidden = source.convert('RGB')
    if both.size != hidden.size:
        parser.error('export both frames at the same size')
    w, h = both.size
    for x0, y0, x1, y1 in (args.a_box, args.b_box):
        if not (0 <= x0 < x1 <= w and 0 <= y0 < y1 <= h):
            parser.error('target rectangle is outside both.png or is empty')
    ax0, ay0, ax1, ay1 = args.a_box
    bx0, by0, bx1, by1 = args.b_box
    if max(ax0, bx0) < min(ax1, bx1) and max(ay0, by0) < min(ay1, by1):
        parser.error('target rectangles overlap')

    processor = AutoProcessor.from_pretrained(
        MODEL_ID, revision=args.revision, trust_remote_code=True, max_crops=MAX_CROPS,
    )
    model = AutoModelForImageTextToText.from_pretrained(
        MODEL_ID, revision=args.revision, trust_remote_code=True, dtype=torch.bfloat16,
    ).cuda().eval()
    cases = [
        ('task:depth-a-01', 'both.png', both, 'A', args.a_box, args.a_m),
        ('task:depth-b-01', 'both.png', both, 'B', args.b_box, args.b_m),
        ('task:depth-hidden-01', 'hidden.png', hidden, 'B', None, None),
    ]
    for case, filename, image, target, box, reference in cases:
        answer = infer(model, processor, image, target)
        verdict = classify(answer, image.size, box, reference)
        record = dict(case=case, file=filename, size=image.size, target=target,
                      model=MODEL_ID, revision=args.revision, max_crops=MAX_CROPS,
                      box=box, reference_m=None if reference is None else str(reference),
                      tolerance_m=str(TOLERANCE_M), answer=answer, **verdict)
        print(json.dumps(record), flush=True)


if __name__ == '__main__':
    main()

The example invocation below uses a commit linked from Ai2’s published processor file and an illustrative 1000 by 750 pixel frame. Review that commit before using it. Substitute the measured rectangles and reference meters from your setup. For a repeat of a reviewed run, use the saved arguments and original PNGs exactly.

python check_depth.py --revision c142d44cd6a01715a847701b4e6c6c40a5476590 --a-box 425 350 475 400 --b-box 515 355 555 395 --a-m 0.60 --b-m 1.20

Look for three JSON lines, identified by case. The two visible rows include the independent references, and the hidden row has reference_m: null. Generation uses do_sample=False and a budget of 128 new tokens. These settings keep the request fixed across runs. Save the program, dependency versions and images with the JSON if you’ll compare results later. The processor source explains that output may lose an unfinished grounding tag when decoding a truncated answer. A visible target reported missing after a token-budget change therefore needs an inspection of the response before you diagnose the scene. Ai2’s processor implementation

Score the pixel first, then the meters

Input Action Expected result
task:depth-a-01, both.png, A at 0.60 m, rectangle [425,350,475,400] Run check_depth.py with the arguments above. For the illustrative point (450,375) at 0.63 m, check the rectangle before subtracting the reference. Illustrative within_tolerance. The point is on A and the signed and absolute errors are +0.03 m and 0.03 m.
task:depth-b-01, both.png, B at 1.20 m, rectangle [515,355,555,395] On the same invocation, score the second row. For the illustrative point (535,375) at 1.12 m, verify the point lies inside B and compare the absolute error with 0.05 m. Illustrative depth_error. B is correctly located. The signed error is −0.08 m and the absolute error is 0.08 m, so the estimate goes to manual measurement.
task:depth-hidden-01, hidden.png, B fully behind the screen Read the third row from the same invocation. Check its decoded text and grounding against the actual hidden photo. Illustrative missing with no structured depth point and text explicitly reporting B absent. Record an abstention after review. A structured depth point on the screen instead yields misgrounded.

These are sample responses for interpreting the output. The pictured bars show the arithmetic for those two grounded estimates. At exactly 0.05 m of absolute error, the script accepts the estimated depth. The calculation uses decimal arithmetic on the decoded number’s string representation so the inclusive boundary is applied before presentation rounding. A signed error tells you which way an estimate missed. Positive is too far and negative is too close. For a pair this small, keep both rows visible. An average can hide the single target that breaks the workflow.

Illustrative absolute error bars at three centimeters for A and eight centimeters for B, with a five centimeter limit.Illustrative absolute error bars at three centimeters for A and eight centimeters for B, with a five centimeter limit.
Illustrative, December 5, 2026 tabletop worked example. A is within 5 cm. B exceeds the limit. The hidden frame has no visible B reference.

On a one-image call, expect mm_ix to be 0. The returned x and y are original-image pixels, and the optional normalized companions correspond to x / width and y / height. Use the fractional coordinates when comparing with the rectangle. The script includes the left and top boundaries and excludes the right and bottom boundaries. At (475,375) the point is outside A’s illustrative box, even if a preview draws a marker that straddles the right edge. This is a reason to annotate well inside the visible face and use the same decision rule on each run. Ai2’s grounding coordinate specification

Scoring decision for Molmo 3 depth estimation. A usable point must land on the intended face before its depth can be scored.Scoring decision for Molmo 3 depth estimation. A usable point must land on the intended face before its depth can be scored.
Illustrative decision using Ai2's original-image pixel coordinates and meter-valued depth. Missing, malformed and misgrounded cases go to manual review.

A negative depth means unmeasurable in the model card. The cited processor can also map a depth parse failure to -1.0. A negative sentinel on the correct visible face therefore yields missing with depth unavailable. Read the decoded element and its tag when you need to investigate why. A malformed shape, nonfinite value or 2D-only point gets its own status. A valid in-frame point outside the visible rectangle gets misgrounded, even when its depth happens to equal the tape reading. This ordering makes a wrong-surface estimate easy to distinguish from a faulty number on the right surface. Ai2’s processor decoding logic

Treat the hidden row as an exercise in rejecting unusable output. An explicit statement that the card is absent, paired with no grounding for it, is evidence of abstention on this example. Silence or prose that guesses a distance without a point remains unresolved even if the classifier prints missing. A decoded depth point claiming to locate B cannot land on its covered face, even if the returned depth is negative. Inspect that point against the screen position and keep the failure in the saved report. The model’s confidence field describes grounding presence and offers no direct meter-error guarantee. Ai2’s grounding output notes

The sample result rejects automatic use for this pair because B exceeds the chosen limit. With two grounded rows inside tolerance and a reviewed abstention on the hidden row, the setup passes this small bench check. That result supports moving to more examples under the same camera and workflow. Keep counts of visible targets attempted and successfully grounded when you expand the fixture, so an apparent improvement in depth error cannot come from quietly dropping harder points. For another example of defining completion using a local fixture and inspecting the outcomes, see the browser-task guide. Run and Grade MolmoWeb 2 Custom Tasks Locally

Trace a failed row to the image, response or device

What you see Check next
Both targets have a consistent pixel shift Open the exact exported PNGs at original dimensions. Check the orientation, crop boundaries, and x and y ordering of the annotations.
One point lands on the screen or the other card Examine the saved point on the input photo and confirm the requested label is legible in the visible frame. Record the row’s grounding outcome before experimenting with prompts.
Pixels line up but depths are off by about 100× Check whether the tape sheet supplies centimeters while the scorer expects meters. Confirm the conversion on the measured reference.
The run stops with a CUDA memory error Identify whether the exception occurs at model placement or generation. Repeat the same fixture with a clean GPU process before changing the case or model.

For a coordinate mismatch, inspect size and the point together. On the illustrative 1000 × 750 file, (450,375) corresponds to (0.45,0.50). Plotting those normalized values as pixels puts the point near the upper-left corner. Plotting the original pixel pair on a half-size display without scaling the overlay sends it near the opposite corner. The scoring values should stay in the original pixel grid regardless of how the viewer draws them. The input undergoes tiling inside the processor. Give decode the same image passed to apply_chat_template so decoding reconstructs the layout for the actual input. The custom processor uses its crop setting in both operations. Ai2’s processor implementation

If the point lands on the intended face but the depth looks wrong, do the subtraction by hand for one row. A reference logged as 60 from a centimeter tape should have been supplied to the script as 0.60. If you see 60 in the model’s depth field against a correctly supplied 0.60 reference, keep the decoded value and flag the large error. Dividing it by 100 just because the answer looks plausible after conversion would hide a failure of the documented meter-valued output. If several errors instead share a modest offset, recheck the camera datum and target planes before attributing that offset to the checkpoint.

If A and B repeatedly get swapped despite correctly scaled overlays, look at the legibility of each label in the actual file. Rephotograph with larger lettering if the marks are genuinely hard to distinguish, then name the revised photos as a separate fixture. To diagnose a failure on an existing fixture, the model card also shows how to feed a selected image point through processor.encode_document and ask for its depth. If you try that diagnostic, use an interior pixel on the failed face. Success with a supplied point can help isolate referring or pointing trouble. Retain the original wrong-target result in the report because the diagnostic gives the model information the original task required it to infer. Ai2’s depth-at-given-points example

When CUDA runs out of memory at .cuda(), check free memory on the selected GPU and whether another process occupies it. When it happens at generate, confirm you are using the single-image call and still have max_crops=8. The processor adds a global crop alongside the tiled crops, and the portion of the image covered by detailed tiles depends on the layout. Moving to a different crop budget changes the representation the model sees and can affect the point you are studying. Keep the original fixture and record any altered crop setting as an experiment. If the environment cannot accommodate 8B, Ai2 recommends at least 16 GB of GPU memory for Molmo3-4B and publishes its own structured depth example. Evaluate that checkpoint as a separate configuration and keep the 8B run marked incomplete. Ai2’s Molmo3-4B model card

For a load or output-format error after a dependency change, first compare the actual installed versions with the environment saved alongside your reviewed report. Check that both loaders use the saved SHA and that the return object exposes grounding as required by the model card. A traceback during model loading, generation or decoding can stop the script before it emits all three rows. Count the expected case IDs and record the first missing case and traceback as a run failure. An absent report line and a decoded missing row require different investigations. Ai2’s Transformers usage

Restore the reviewed checkpoint after a regression

  1. Keep the last reviewed report with its two PNGs, rectangle arguments, tape references, model SHA and software versions. Preserve a copy of the script used to produce it. When testing a new commit, write the new output to a separate file and keep the photo bytes, prompt and tolerance fixed. Keep the hidden row’s decoded text alongside its status. For related techniques for preserving replay inputs and recording the result of a retry, see Fleet Replay and Coding Agent Retry Evaluation.
  2. Compare the matching case IDs. For instance, if B formerly returned (535,375) at 1.17 m and now returns (535,375) at 1.12 m, the illustrative records show a depth regression with a stable point. If B instead moves to (450,375) at 1.19 m, record a grounding regression and leave the numeric error out of that row. The error categories give you a concrete reproduction to use in a follow-up check. LangSmith Backtesting for a Wrong Order Lookup
  3. Restore the prior reviewed environment and rerun the command saved with its original --revision. That argument controls both pretrained loaders. Verify that all three case IDs return, compare visible rows to their saved decisions and inspect the hidden answer again. If a formerly passing row still fails after restoration, check the image bytes and camera annotations before reopening automated use. If the fixture still cannot establish a trustworthy depth, use the original tape measurement or remeasure from the same datum. Hugging Face’s revision pinning guidance

The reviewed artifact is the pair of photos and the three case records, with an explicit human decision for the hidden card. Mark a manual reading as manual and write the meter value beside the corresponding failed model row so a later comparison preserves both. If you build a larger validation set, reuse the same error categories and hold the first fixture aside as a regression case. Then vary one property at a time, such as label size or distance from the optical axis, to learn which capture conditions the tabletop result covers. The point-and-depth decision can become an automated check for the visible rows once reviewers agree on the image annotations. Agent Evaluation CI Gates

Sources

Many assistants.
One place to remember.

Bring your AI sessions, context, and usage together with Automater.

Meet Automater