All models

Microsoft

Florence-2

About

Florence-2 is a 232M open-weight model from Microsoft. Vision foundation model for captioning, OCR, detection, and region tasks. It accepts text and images. Released June 15, 2024.

  • Parameters

    232M

    Published parameter count.

  • License

    MIT

    License on the weights.

Pricing

Token rates are US dollars per 1M tokens. Image rates are per 1K images. Audio rates are per 1M audio seconds.

RatePrice
Per 1K images$1

Compare

Florence-2 has the lowest published input rate of these OCR models, $1 / 1K images.

ModelWhat it doesPriceParametersContext
Florence-2Vision foundation model for captioning, OCR, detection, and region tasks.$1 / 1K images232M—
PP-OCRv6PaddleOCR PP-OCRv6 medium text detection and recognition, GPU end to end; scene OCR JSONL on image chat; text returns plain text; document_url fan-out via text.$0.02 / 1M input20M—
dots.mocrMultilingual document layout parsing and markdown OCR.$0.20 / 1M input3B24K
GLM-OCRCompact multilingual document OCR and markdown extraction.$0.10 / 1M input0.9B8K

Benchmarks

Published scores for Florence-2, from the Florence-2 model card.

Evals
ReadingExample
QualitativeClear structure, grounded in the input
QuantitativeCOCO caption CIDEr: 140.
Cost and performanceLower listed rate, mid-pack latency

Performance

Latency is the end-to-end round trip. Throughput is completion tokens divided by that time. It is a request rate, not decode speed.

  • Latency

    160 ms

  • Throughput

    —

  • Requests

    729

Examples

  • Analytics dashboard with KPI cards and charts

    Caption a screenshot

    caption
  • Basket of vegetables on a wooden counter

    Object detection

    od

Supported inputs

  • textIgnored

    A text part beside the media is accepted and ignored. A request with no media part is a 400.

  • image_urlYes

    One per request. A second image_url part is a 400.

  • video_urlNo

    Not accepted.

  • document_urlNo

    Not accepted.

  • Default method caption. The caption and ocr methods emit a Markdown string; the region methods emit a region container.
  • Aliases: florence-2-base-ft, microsoft/Florence-2-base-ft. Weights: microsoft/Florence-2-base-ft.

Methods

Methods this model serves. Payload shapes are in the docs.

MethodReturns
caption (default)Short image caption
detailed_captionLonger caption
more_detailed_captionLongest caption
ocrAll text on the image
odRegion items with bbox_xywh and label
dense_region_captionRegion items with bbox_xywh and label
region_proposalRegion items with bbox_xywh, no label
ocr_with_regionRegion items with bbox_xywh and text

Each method maps to one Florence-2 task token. The task token itself (<CAPTION>, <OD>, ...) is an implementation detail and is not part of the reply: a caption is the string, and a region method is the container.

Boxes are normalized 0-1 against the image at precision decimals (default 4), and a region method with no hits returns "items": [].

Estimate cost

$1.00

Quick start

Call this model on the OpenAI-compatible gateway. The model id is already filled in.

from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.vlm.run/openai",
    api_key="<VLMRUN_API_KEY>",
)

response = client.chat.completions.create(
    model="microsoft/florence-2-base-ft",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg"
                    },
                },
            ],
        }
    ],
    extra_body={"method": "caption"},
)

print(response.choices[0].message.content)

Response

The caption string alone, with no wrapper:

A cat sitting on a windowsill.

Get an API key. Ship vision today.