How to label data for Florence-2 training

Before you can train a computer vision model, you need labeled data on which to train your model. The more accurate the labels, or annotations, are, the higher the performance the model will achieve.

Overview

Florence-2 is a vision language model. It learns from pairs of text for each image: a prefix, the prompt you give the model, and a suffix, the answer it should return. This guide shows how to label those pairs in a Multimodal project in Roboflow Annotate, then train Florence-2 in Roboflow or export your data to train it yourself.

Roboflow Annotate runs in your browser and is free to start. Roboflow is SOC 2 Type 2 compliant and used by over 2 million developers.

To label data for Florence-2, you will:

  1. Create a multimodal project and upload images
  2. Open an image in Roboflow Annotate
  3. Write prefix and suffix pairs
  4. Train Florence-2 or export your data

Step 1: Create a project and upload images

Create a free Roboflow account, then create a new project. Give it a name and choose Multimodal as the project type:

The Create Project page in Roboflow, with Multimodal selected and a prompt and response example

Next, upload your images. Drag them onto the Upload Data page, or select files or a whole folder. If you already have labels, upload the annotation files with your images to review or fix them in Roboflow Annotate:

The Upload Data page of a Roboflow project, with a drop zone for images, annotations, videos, PDFs and zips

Step 2: Open an image

Click any image in your project to open it in Roboflow Annotate. In a Multimodal project, the editor shows a prefix and a suffix field for each pair:

Roboflow Annotate on a multimodal project: a receipt with a prefix asking for the receipt as JSON and the JSON answer as the suffix

Step 3: Write prefix and suffix pairs

The example above uses a full sentence as the prefix. For Florence-2, write it as a task token in angle brackets instead, such as <TOTAL> for the total on a receipt: that is the prefix format Florence-2 expects. Give each task its own token.

Write the suffix exactly as you want the model to answer. If you want structured output, like the JSON on this receipt, use the same keys and format on every image.

Click "Add New Pair" to teach more than one task on the same image. To reuse prefixes across images, add them under Classes & Tags in the project sidebar. The multimodal labeling guide (opens in a new tab) covers both.

Step 4: Train Florence-2 or export your data

When your images are labeled, generate a dataset version. Then open Train in your project, click "Custom Training", and choose "Florence 2". The Train a Model guide (opens in a new tab) walks through each option.

To train Florence-2 on your own hardware instead, export the version as Florence-2 JSONL.

Start where you are

Speak with an AI expert

Our team will help you start solving business problems on the first call.

  • Solution architecting
  • Live demonstration
  • Pricing and specifications
  • Feasibility assessment

Over 80,000 organizations build with Roboflow.

Rivian
Pella
Chobani
USG Corporation
BNSF Railway
American Woodmark
Outcomes
Patrick Industries
Peer Robotics