[Paper Review] OneFormer: One Transformer to Rule Universal Image Segmentation
OneFormer introduces a unified transformer-based framework that achieves state-of-the-art performance across semantic, instance, and panoptic segmentation with a single model trained once on panoptic annotations. It uses a task-conditioned joint training strategy with a task token and query-text contrastive loss to enable multi-task generalization, outperforming specialized Mask2Former models on ADE20K, Cityscapes, and COCO despite using only one-third of the training resources.
Universal Image Segmentation is not a new concept. Past attempts to unify image segmentation in the last decades include scene parsing, panoptic segmentation, and, more recently, new panoptic architectures. However, such panoptic architectures do not truly unify image segmentation because they need to be trained individually on the semantic, instance, or panoptic segmentation to achieve the best performance. Ideally, a truly universal framework should be trained only once and achieve SOTA performance across all three image segmentation tasks. To that end, we propose OneFormer, a universal image segmentation framework that unifies segmentation with a multi-task train-once design. We first propose a task-conditioned joint training strategy that enables training on ground truths of each domain (semantic, instance, and panoptic segmentation) within a single multi-task training process. Secondly, we introduce a task token to condition our model on the task at hand, making our model task-dynamic to support multi-task training and inference. Thirdly, we propose using a query-text contrastive loss during training to establish better inter-task and inter-class distinctions. Notably, our single OneFormer model outperforms specialized Mask2Former models across all three segmentation tasks on ADE20k, CityScapes, and COCO, despite the latter being trained on each of the three tasks individually with three times the resources. With new ConvNeXt and DiNAT backbones, we observe even more performance improvement. We believe OneFormer is a significant step towards making image segmentation more universal and accessible. To support further research, we open-source our code and models at https://github.com/SHI-Labs/OneFormer
Motivation & Objective
- To unify universal image segmentation across semantic, instance, and panoptic tasks into a single architecture and model.
- To eliminate the need for separate training and model storage per task, reducing resource demands.
- To enable a single model to dynamically adapt to different segmentation tasks during inference.
- To improve inter-task and inter-class distinctions during joint training through task-guided attention and contrastive learning.
- To achieve SOTA performance across all three segmentation tasks with a single, unified training process.
Proposed method
- Introduces a task-conditioned joint training strategy that uniformly samples ground truth from semantic, instance, and panoptic segmentation during training.
- Employs a task input token (e.g., 'the task is panoptic') to condition the model on the current task, enabling task-dynamic inference with a single model.
- Uses query-text contrastive loss between learned queries and text embeddings of ground-truth labels to enhance inter-task and inter-class discrimination.
- Derives semantic and instance labels from panoptic annotations during training, requiring only panoptic datasets.
- Adopts a transformer-based architecture with learnable queries initialized as task tokens, enabling dynamic task-specific feature learning.
- Employs a text prompt template 'a photo with a {CLS}' for class-specific text embeddings, with ablation showing strong baseline performance.
Experimental results
Research questions
- RQ1Why do existing panoptic architectures fail to generalize across semantic, instance, and panoptic segmentation tasks when trained jointly?
- RQ2How can a single model learn meaningful distinctions between inter-task and inter-class segmentation without separate training?
- RQ3Can a task-conditioned input token and contrastive loss improve multi-task generalization in universal image segmentation?
- RQ4Does a unified training process on panoptic data alone yield better or comparable performance than task-specific training with more resources?
- RQ5Can a single model dynamically adapt to different segmentation tasks at inference time without retraining?
Key findings
- OneFormer achieves 49.8 PQ, 35.9 AP, and 57.0 mIoU on ADE20K, outperforming specialized Mask2Former models trained on each task individually.
- With Swin-L backbone, OneFormer improves PQ by +1.1%, AP by +2.2%, and mIoU by +0.8% over the Mask2Former-Joint baseline in joint training.
- When prompted with 'the task is instance', OneFormer achieves PQ of 33.1 and PQ^Th of 48.8, showing strong focus on distinct object instances.
- For the semantic task, PQ^St remains high at 50.2%, while PQ^Th drops to 1.5%, confirming the model's ability to suppress thing predictions in 'stuff' regions.
- Qualitative results show reduced category misclassifications—e.g., fewer errors predicting 'fence' as 'wall'—compared to Mask2Former.
- OneFormer achieves SOTA performance on COCO, Cityscapes, and ADE20K across all three segmentation tasks with a single model and one-third of the training compute.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.