Referring Image Matting

Jizhizi Li, Jing Zhang, Dacheng Tao

Introduction

This research introduces Referring Image Matting (RIM), a novel computer vision task designed to extract high-quality alpha mattes of specific objects based on natural language descriptions. To facilitate this, the authors present RefMatte, a large-scale dataset of over 47,000 images, and CLIPMat, a baseline model leveraging the CLIP architecture for precise, language-driven foreground extraction.

The Challenge: Beyond Binary Segmentation

Traditional image matting typically requires manual input, such as "trimaps" or scribbles, or is limited to specific pre-defined classes like humans. While Referring Image Segmentation (RIS) allows for language-based object identification, it only produces coarse binary masks. Matting requires a "soft" alpha matte (values between 0 and 1) to capture intricate details like hair, fur, or semi-transparent edges. RIM bridges the gap between the semantic flexibility of natural language and the technical precision required for high-quality image editing.

Example of referring to specific individuals in a scene for extraction.

CLIPMat: A Language-Aware Matting Architecture

The proposed baseline, CLIPMat, utilizes the pre-trained CLIP model to understand the relationship between text and images. To adapt CLIP for high-precision matting, three key modules were developed:

  1. Context-embedded Prompt (CP): Uses matting-specific templates and learnable "context tokens" to prime the text encoder for the matting task.
  2. Text-driven Semantic Pop-up (TSP): Employs cross-attention to highlight visual features matching the text description, guiding the decoder to the target object.
  3. Multi-level Details Extractor (MDE): Extracts features from multiple layers of the Vision Transformer (ViT) to capture fine-grained textures and edges.

The model employs a dual-decoder architecture: one branch predicts a semantic trimap to locate the object, while the other refines the intricate details of the alpha matte.

Data Innovation: RefMatte and RW100

To support research in RIM, two new datasets were created:

  • RefMatte: A synthetic dataset of 47,500 images and 475,000 expressions across 230 categories. It uses intelligent composition of high-quality foregrounds onto diverse backgrounds with attribute-based descriptions.
  • RefMatte-RW100: A real-world benchmark of 100 high-resolution images with manually annotated complex phrases to test generalization.
Components and language descriptions used in the RefMatte dataset construction.

Results and Insights

CLIPMat establishes a new state-of-the-art for language-driven matting. In quantitative tests on RefMatte, CLIPMat (ViT-L/14) achieved a Sum of Absolute Differences (SAD) of 8.29, significantly outperforming adapted segmentation models like MDETR (32.27) and CLIPSeg (17.75).

Key findings include:

  • Segmentation is not Matting: Simply adding a matting head to segmentation models yields poor results; specialized architectures are necessary for pixel-level alignment.
  • Language as a Control Signal: RIM enables intuitive interaction, allowing users to specify objects (e.g., "extract the giraffe on the left") without manual painting.
  • Fine-Tuning Matters: Fine-tuning the CLIP backbone for matting tasks is more effective than freezing weights, as it bridges the domain gap for foreground extraction.

Conclusion and Future Work

While CLIPMat shows strong performance, challenges remain in handling complex occlusions and ambiguous descriptions. Future work will focus on reducing computational costs for real-time applications and narrowing the gap between synthetic training data and real-world lighting complexities through advanced data augmentation or semi-supervised learning.

Summary updated

BibTeX
@inproceedings{li2022referring,
  author = {Jizhizi Li and Jing Zhang and Dacheng Tao},
  title = {{Referring Image Matting}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure