What is Florence-2?

Florence-2 is a general-purpose VLM (Visual Language Model) that looks at an image and handles many tasks with a single model: captioning, object detection, segmentation, OCR, and more.

This page sticks to the four tasks that come up most in ComfyUI: "captioning," "object detection (getting coordinates)," "OCR," and "Q&A about an image."


Custom Node


Florence2Run Node

Florence2Run is the main node for having Florence-2 run a task on the input image. Switch task to choose between captioning, object detection, OCR, and so on.

caption, detailed caption

Generates a natural language caption from the image.

florence2_detailed_caption.json
  • caption
    • Gives a simple overview of the image.
  • detailed caption
    • Describes the composition and look in a bit more detail.

That said, if all you want is "captions to use as prompts," a dedicated captioning model like JoyCaption gives you far more flexible, higher-quality results.

caption_to_phrase_grounding

For each phrase in the caption you give it, this outputs where the object is as a rectangle (bounding box).

florence2_caption_to_phrase_grounding.json
  • Its strength is that it can find positions even from slightly more complex phrases like "left tree" or "red car."
  • Pull out the coordinates with the 🟨 Florence2 Coordinates node and combine them with a segmentation model such as SAM2, and you can mask just a specific object.

ocr

Reads the text in an image and outputs it as text.

florence2_ocr.json

docvqa

Answers questions about the image.

florence2_docvqa.json
  • You can ask things like "Where is XX in this image?" or "What's the value in this table?" and get the answer back as text.
  • Think of it like sending an image to ChatGPT and asking about it.