Skip to main content
Vision models analyze images and video. They describe scenes, answer questions about visual content, compare images, read text, and locate objects. Omni models can also take a spoken question about an image or use a video’s soundtrack. Pick a model family in the tabs below. The choice applies to every example on the page. For tool calls based on an image, see Tool Use.

Setup

Install PyTorch, Transformers, and the image packages used by the examples. torchvision and Pillow are required by the image processor, and opencv-python draws the layout boxes. The examples use the recommended sampling parameters for the model shown. For another model, use the values from its model page.
Load the model with AutoProcessor and AutoModelForImageTextToText:
The LFM3-VL examples use thinking by default. Set enable_thinking=False below for direct answers. The examples pass this setting to the processor. Transformers then parses the response using the checkpoint’s response_template, including the assistant prefix already inserted by the chat template. See Thinking for reasoning controls.

Single-image prompt

Provide one image and a text question in the same user message. This pattern is useful for captioning, visual question answering, and scene understanding. Input image
Output

Multi-image prompt

You can include multiple images in a single prompt. Label each image in the prompt, such as Media-1 and Media-2, to make cross-image references clearer.
Media-1 inputMedia-2 input
Output

OCR

LFM vision models read text in document images and screenshots. OCR works best when text is legible and the image is not blurry, rotated, or heavily compressed. For dense documents, crop to the relevant page or region when possible. Input image
Output (truncated)

Document layout annotations

The structured layout example uses LFM2.5-VL-3B. To run it, select LFM2/LFM2.5 and load that model in Setup. For text extraction with LFM3-VL, see OCR.

Pointing

This example uses LFM3-VL-2B, loaded in Setup.Pointing asks the model to locate visible objects with a single point each. The model returns {"point_2d": [x, y]}, with x and y as integers normalized to [0, 1000]. This example asks for a point on each cat and each remote control, then draws the points.
Output
Points drawn on the cats and remote controls

Object detection and grounding

Grounding asks the model to localize visible objects with bounding boxes. This example uses the cat photo from Single-image prompt, asks for boxes in [xmin, ymin, xmax, ymax] format normalized to [0, 1000], then draws the returned boxes. Convert normalized coordinates back to pixels with x / 1000 * width and y / 1000 * height. Boxes are approximate, so visually inspect the result before using coordinates in downstream workflows.
Output
Then draw the boxes:
Bounding boxes drawn around the cats and remote controls

Ask about an image by voice

Spoken questions about an image require an omni model with image and audio input. Load it as shown in Audio Capabilities.
An omni model can understand images and speech in the same turn, so the question can be a recording instead of text. Recommended system prompts: Describe the provided image. for captions, and Answer questions about the provided image. Base every answer only on what can be seen. for questions. When the answer should be in a different modality from the question, add an output instruction after the task prompt, for example Respond with text. This example first records a spoken question with text-to-speech, then asks it about a photo:
Input photo
Output
To get a spoken answer instead, see Speech Generation.

Video understanding

Video-capable models can answer questions using a clip’s frames. Check the model page for the default frame rate and frame limits. Install torchcodec and FFmpeg for video decoding in addition to the packages in Setup:

Describe a video

Pass a local path with {"type": "video", "video": ...}. This example downloads a short sample clip:
Output

Use the soundtrack

Soundtrack input requires an omni model with video and audio input. Load it as shown in Audio Capabilities.
An omni model can also use a video’s soundtrack. Pass load_audio_from_video=True and processor_kwargs={"use_audio_in_video": True} so the processor interleaves the soundtrack with the frames:
Output

FAQ

Which vision model should I use? Choose a vision model based on the task: a smaller model for fast captioning and visual questions, a model with layout support for documents, or a thinking model for harder questions and spatial tasks. Choose an omni model when the request also involves speech or a video’s soundtrack. See the model library for current options. Can I turn off reasoning? On models that support switching thinking off, pass enable_thinking=False to apply_chat_template() for direct answers with lower latency. See Thinking for support and controls. What image formats are supported? LFM vision models work with common image formats such as JPEG and PNG. In the examples above, images are loaded from Hugging Face URLs with transformers.image_utils.load_image. What video formats are supported? The video examples accept files that torchcodec can decode, such as MP4. How precise are points and boxes? Boxes and points are approximate and can vary with prompt wording, image resolution, and generation settings. For workflows that require precise localization, inspect the returned coordinates and validate them against the original image. Can the models generate or edit images? No. LFM vision models are image and video understanding models. They can analyze images, answer questions, read text, localize objects, parse layouts, and route tool calls, but they do not generate or edit images.
Last modified on November 16, 2026