Skip to main content

Run in Colab

Step through this example interactively
The caption() helper produces text descriptions from images. Use captioning to create accessibility text, generate metadata, or build visual search features.

Basic usage

Parameters: Returns: PerceiveResult object:
  • text (str): The generated caption.
  • reasoning (str | None): Chain-of-thought when reasoning=True.
  • boxes, points (list | None): Populated based on the expects you requested. boxes_to_pixels / points_to_pixels convert normalized → pixel coordinates.

Example: grounded captions

In this example, we download a suburban street image and generate a concise caption with grounded bounding boxes. The model returns short prose along with boxes that correspond to specific regions mentioned in the caption — each box includes a mention field containing the text snippet that describes that region.
All spatial outputs use a 0-1000 normalized coordinate system. Convert via result.points_to_pixels(width, height) before rendering overlays — see the coordinate system guide for more patterns.

CLI usage

Examples:
The CLI auto-detects video paths (.mp4) and routes them to a video() node.

Best practices

  • Structured outputs: Perceptron can return formatted data when you specify it up front — for example, “Describe the people in the image as JSON with keys hair_color, shirt_color, person_type.”
Run through the full Jupyter notebook here. Reach out to Perceptron support if you have questions.