Contenu principal

moondream

R2026b

Create pretrained Moondream vision-language model (VLM)

Since R2026a

    Description

    Add-On Required: This feature requires the Computer Vision Toolbox Model for Moondream Vision Language Model add-on.

    The moondream object configures a pretrained Moondream™ vision-language model (VLM).

    Moondream is a compact multimodal model that combines visual understanding with natural language processing to perform multiple computer vision tasks. Use the Moondream model to quickly understand image content by generating descriptive captions and detect or localize objects through natural‑language queries, without prior training data. You can also use it to extract printed or handwritten text from images using optical character recognition (OCR) and answer questions about the visual content of an image through visual question answering (VQA). Due to its lightweight design and on-device execution capability, you can use Moondream for low-latency tasks such as alt-text generation, image-text retrieval, scene understanding, object localization, and text extraction.

    Creation

    Description

    mdModel = moondream loads a pretrained Moondream vision-language model with approximately 1.6 billion parameters.

    example

    mdModel = moondream(modelName) loads the specified pretrained Moondream model modelName.

    example

    Input Arguments

    expand all

    Name of the pretrained Moondream vision-language model, specified as one of these values.

    • "moondream-1.6B" — Pretrained Moondream vision-language model with approximately 1.6 billion parameters. This model supports GPU acceleration. In comparison to "moondream-2B", this model offers faster performance and a higher level of accuracy. This is the recommended model starting from R2026b.

    • "moondream-2B" — Pretrained Moondream vision-language model with approximately 2 billion parameters. This model does not support GPU acceleration. Use this model when you have moderate computational resources for example, CPU-based deployments with limited memory and when you need behavior consistent with the model used prior to R2026b.

    This argument sets the ModelName property.

    Data Types: char | string

    Properties

    expand all

    This property is read-only after object creation. To set this property, use the modelName argument during object creation.

    Name of the pretrained Moondream vision-language model, represented as "moondream-1.6B" or "moondream-2B".

    Data Types: char | string

    Object Functions

    captionImageCaption images using Moondream vision-language model (VLM)
    detectObjectsDetect objects in image using Moondream vision-language model (VLM)
    ocrMoondreamRecognize text in image using Moondream vision-language model (VLM)
    queryImageQuery image using Moondream vision-language model (VLM)

    Examples

    collapse all

    Load a pretrained Moondream vision-language model with approximately 1.6 billion parameters into the workspace.

    mdModel = moondream("moondream-1.6B");

    Load an image to caption into the workspace, and display the image.

    I = imread("peppers.png");
    imshow(I)

    Figure contains an axes object. The hidden axes object contains an object of type image.

    Caption the image using the captionImage object function.

    captions = captionImage(mdModel,I);

    Display the generated image caption.

    display(captions)
    captions = 
    " A purple tablecloth holds a vibrant array of red, green, yellow, and white peppers, onions, and garlic, arranged in a visually appealing composition."
    

    Tips

    • The quality of Moondream outputs can vary across different data domains. Validate its predictions using a data set from a domain similar to your intended application.

    • Object detection, OCR, and VQA accuracy can degrade in low-light, heavily occluded, or cluttered scenes. For best results, use high-quality, well-lit images.

    References

    [1] “Moondream.” Accessed September 2, 2025. https://moondream.ai/.

    Version History

    Introduced in R2026a

    expand all