Florence-2: Revolutionizing Computer Vision with Unified AI Models

Allan Kouidri
-
8/22/2024
Illustration Florence-2 region captioning by Microsoft

In the rapidly evolving field of artificial intelligence, Microsoft has made a significant leap forward with the introduction of Florence-2, a novel open-source vision foundation model. This cutting-edge AI system represents a major advancement in computer vision, offering a unified approach to tackle a wide variety of visual tasks with unprecedented efficiency and accuracy. 

Florence-2 excels in zero-shot and fine-tuning tasks such as image captioning, visual object detection, grounding, and segmentation, setting a new standard in the industry.

You can try the model using the notebook we have prepared.

Unified Representation: A New Paradigm in Computer Vision

Florence-2 stands out for its ability to handle diverse visual tasks using a single, unified representation, unlike traditional models that are often specialized for specific tasks.

Florence-2 Unified representation
Illustration depicting the levels of spatial hierarchy and semantic granularity demonstrated for different vision tasks. [1]

Spatial Hierarchy

One of the key strengths of Florence-2 is its ability to understand visual information across different spatial scales. The model can seamlessly transition between:

  • Image-level concepts
  • To fine-grained pixel-specific details

This versatility allows Florence-2 to handle tasks ranging from broad image classification to intricate object detection and segmentation.

Semantic Granularity

Florence-2 excels in processing visual information across various levels of semantic detail. It can generate:

  • High-level image captions
  • Detailed object descriptions
  • Specific attribute recognition

This capability enables the model to provide rich, context-aware interpretations of visual data, making it suitable for a wide range of applications.

The FLD-5B dataset is a cornerstone of Microsoft's Florence-2 vision foundation model, playing a crucial role in the model's exceptional performance. This high-quality dataset provides the extensive and detailed annotations necessary for training a versatile and powerful AI system.

Its creation involved a rigorous process of image collection, initial annotation, data filtering, and iterative refinement, ensuring a comprehensive dataset that supports a wide range of visual understanding tasks with high accuracy and diversity.

This robust dataset is a key factor in making Florence-2 a groundbreaking model in the field of computer vision.

Creation process

The creation process of FLD-5B involved several meticulous steps to ensure the dataset's quality and diversity:

 FLD-5B dataset creation process
Overview of the FLD-5B dataset creation process. [1]

1. Image Collection: The dataset comprises 126 million images sourced from various existing datasets, including ImageNet-22k, Object 365, Open Images, Conceptual Captions, and LAION. These sources were chosen to cover a broad spectrum of visual concepts and scenarios.

2. Initial Annotation: Specialist models were employed to generate initial annotations. These models, trained on diverse public datasets and cloud services, provided synthetic labels for different annotation types. In cases where datasets already had partial annotations, such as Object 365, these were merged with the new synthetic labels to enhance coverage and diversity.

3. Data Filtering and Enhancement: The initial annotations were refined through a multifaceted filtering process to remove noise and improve accuracy. Textual annotations were parsed using tools like SpaCy to extract objects, attributes, and actions, while region annotations were filtered based on confidence scores and non-maximum suppression to reduce redundancy.

4. Iterative Data Refinement: The dataset underwent multiple rounds of refinement. A multitask model was trained on the filtered annotations, and the resulting outputs were used to further enhance the dataset. This iterative process ensured that the final dataset was both comprehensive and high-quality.

Key Characteristics of the final annotations

The FLD-5B dataset is notable for its extensive and detailed annotations, which support a wide range of visual understanding tasks. Here are some of its key characteristics:

1. Annotation Types and Volume:

  1. Text Annotations: The dataset includes around 500 million text annotations, categorized into brief, detailed, and more detailed texts. These annotations vary in length, with detailed texts containing up to 9 times more tokens than brief texts, providing rich information for comprehensive visual understanding.
  2. Region-Text Annotations: There are approximately 1.3 billion region-text annotations, significantly larger than other academic object detection datasets. Each image has an average of 5 regions, annotated with phrases or brief texts, enhancing the dataset's granularity.
  3. Text-Phrase-Region Annotations: The dataset also includes over 3.6 billion text-phrase-region annotations. These annotations link text phrases to specific regions within images, offering detailed semantic relationships and spatial context.

illustrative example of an image and its corresponding annotations in FLD-5B dataset
An illustrative example of an image and its corresponding annotations in FLD-5B dataset. [1]

2. Semantic and Spatial Granularity:

  1. The annotations span multiple levels of semantic and spatial granularity, from high-level image captions to detailed object descriptions and specific attribute recognition. This diversity allows the dataset to support a wide range of visual tasks, from image classification to object detection and segmentation.

3. Comprehensive Coverage:

  1. The dataset's annotations cover a broad spectrum of visual concepts and scenarios, making it suitable for training models that need to perform well across various tasks. The detailed and diverse annotations ensure that models trained on FLD-5B can understand and interpret complex visual information effectively.

Model Architecture

Florence-2 employs a sophisticated sequence-to-sequence (seq2seq) learning paradigm, integrating advanced components to process both visual and textual information effectively. The architecture consists of two main parts:

1. Vision Encoder:

  1. Utilizes the DaViT (Data-efficient Vision Transformer) architecture
  2. Converts input images into visual token embeddings
  3. Chosen for its efficiency in processing visual data with transformer-based models

2. Multi-modal Encoder-Decoders:

  1. Based on the BART (Bidirectional and Auto-Regressive Transformers) architecture
  2. Processes combined visual and textual information
  3. Incorporates BERT-style bidirectional encoding for enhanced language understanding, leveraging the robustness of BERT, which has remained a strong choice since its release in late 2018.
Overview of Florence-2 architecture.
Overview of Florence-2 architecture. [1]

Key components and workflow:

1. Input Processing:

  1. Images are processed by the DaViT-based vision encoder to create visual token embeddings (V)
  2. Text prompts are tokenized using a language tokenizer and word embedding layer

2. Feature Fusion:

  1. Visual token embeddings (V) are projected and normalized to align dimensions
  2. Prompt embeddings are concatenated with visual embeddings to form the multi-modality input

3. Multi-modal Processing:

  1. The combined input is processed by the BART-based encoder-decoder
  2. This allows for intricate interactions between visual and textual features

4. Output Generation:

  1. The model generates text-based outputs for various tasks (e.g., captions, object descriptions)

Model Variants

Florence-2 comes in two sizes:

    1. Florence-2-B: 232 million parameters

    2. Florence-2-L: 771 million parameters

Capabilities

The model is trained using a standard language modeling approach with cross-entropy loss, allowing it to handle diverse tasks within a unified framework. This architecture enables Florence-2 to perform a wide range of vision tasks, from image captioning to object detection, segmentation and visual grounding, all through a single, unified model. 

Florence-2 demonstrates state-of-the-art zero-shot performance on several key tasks. The table below compares Florence-2 with other prominent models in terms of zero-shot performance metrics.

Model

Parameters

COCO Caption (CIDEr)

Flickr30k (Recall@1)

RefCOCO (Accuracy@0.5)

RefCOCO (mIOU)

Flamingo

80B

84.3

-

-

-

Kosmos-2

1.6B

-

78.7

52.3

47.3

Florence 2-B

0.23B

133.0

83.6

53.9

49.7

Florence 2-L

0.77B

135.6

84.4

56.3

51.4

 

Image captioning: 

Young man sitting at a wooden table

The model outputs an impressively detailed description of the image: 

‘The image shows a young man sitting at a wooden table in a room with a large window in the background. He is wearing a white long-sleeved shirt and has a beard and dreadlocks. On the table, there is a laptop, a cup of coffee, and a small plant. A dog is lying on the floor next to the table. The room is decorated with potted plants and there is an air conditioning unit on the wall. The overall atmosphere of the room is cozy and relaxed.’

Object Detection:

First, we tested a simple object detection task:

Visual grounding:

Here we use the following text prompt: ‘A green car parked in front of a yellow building’

Green car Florence-2 grounding

Grounded segmentation: 

Using a semantic description: ‘A green car’

Green car Florence-2 segmentation

Or a box coordinate:

Green car Florence-2 segmentation box

OCR (text detection and recognition):

Florence-2 OCR

Key Takeaways

Florence-2 represents a significant step forward in the development of universal vision models. By combining a comprehensive dataset, innovative architecture, and multi-task learning approach, Microsoft has created a powerful tool that could reshape the landscape of computer vision applications.

1. Versatility: Florence-2 can handle a wide range of vision tasks with a single model and unified architecture.

2. Efficiency: The model achieves state-of-the-art results while maintaining a relatively compact size.

3. Adaptability: Florence-2 shows strong performance in both zero-shot and fine-tuned scenarios.

3. Potential: As a vision foundation model, Florence-2 opens up new possibilities for various applications in computer vision and AI.

References

[1] Florence-2: Advancing a Unified Representation for a Variety of Vision Tasks; https://arxiv.org/abs/2311.06242

Arrow
Arrow
No items found.