Pages and contents
Pages
- Non-Generative World Model Research
- Literature Review
- Literature Notes
- Attention
- Memory
- Planning
- Reviews
- Reinforcement Learning
- World Model Papers
- Biological
- World Models
- Representation
- Partial Homomorphisms
- DeepMDP
- Temporal Abstraction
- Unsupervised Causal Abstractions
- Approximate Equivariance
- OPAL
- Object Learning
- AdaSlot
- DETR & Object Queries
- DynO
- ICRL
- Hierarchical Variable Learning
- Mask2Former
- NeSy Review
- Neural Module Networks
- C-SWM
- Neuro-Symbolic Concepts
- OCRL
- Relational Bottleneck
- Slot Attention
- SlotFormer
- Latent Particles
- Training
- Template
- Important Concepts
- Models
- Resources
Mask2Former
Field | Value | |
|---|---|---|
| ⋮⋮ | Authors | Cheng, Misra et. al. |
| ⋮⋮ | Year | 2022 |
| ⋮⋮ | Link / arXiv | https://arxiv.org/pdf/2112.01527 |
| ⋮⋮ | Code | https://github.com/facebookresearch/mask2former |
| ⋮⋮ | My relevance (1-5) | 4 |
| ⋮⋮ | Tags | #object #transformer #segmentation |
| ⋮⋮ | Prerequisites | [[Segmentation]] |
1\. Main Idea
Mask2Former is architecture capable of addressing any image segmentation task (panoptic, instance or semantic). Its key components include masked attention, which extracts localized features by constraining cross-attention within predicted mask regions.
2\. Problem
Universal segmentation architectures are ones capable of addressing all segmentation tasks with the same architecture (i.e., universal image segmentation). Although existing universal architectures are flexible enough to tackle any segmentation task, in practice their performance lags behind the best specialized architectures.
3\. Method
Mask classification architectures group pixels into segments by predicting binary masks, along with corresponding category labels. Inspired by DETR & Object Queries, each segment in an image can be represented as a C-dimensional feature vector (“object query”) and can be processed by a Transformer decoder, trained with a set prediction objective.
A simple meta architecture would consist of three components. A backbone that extracts lowresolution features from an image. A pixel decoder that gradually upsamples low-resolution features from the output of the backbone to generate high-resolution per-pixel embeddings. And finally a Transformer decoder that operates on image features to process object queries
Masked Attention
The Masked Attention operator extracts localized features by constraining crossattention to within the foreground region of the predicted mask for each query, instead of attending to the full feature map.
recent studies \[22,46\] suggest that the slow convergence of Transformer-based models is due to global context in the cross-attention layer, as it takes many training epochs for cross-attention to learn to attend to localized object regions \[46\]. We hypothesize that local features are enough to update query features and context information can be gathered through self-attention
Standard cross attention computes
Whereas masked attention modulates the attention matrix via
X^{(l)} = \mathrm{Softmax}(M^{(l-1) }+ Q^{(l)}K^{(l)\top})V^{(l)} + X^{(l-1) } \\ M^{(l-1)} = \begin{cases} 0 \ \ \text{if} \ \ M^{(l-1)}(x,y) = 1, \\ -\infty \ \ \text{otherwise } \end{cases}
Here, is the binarized output (thresholded at 0.5) of the resized mask prediction of the previous Transformer decoder layer. The term can be thought of as a way to enforce spatial elements to receive no attention based on the previous layer’s mask.
Feature Pyramids
Feature pyramids is a method the author’s introduce to maintain dense features while controlling computational cost.
High-resolution features improve model performance, especially for small objects \[5\]. However, this is computationally demanding. Thus, we propose an efficient multi-scale strategy to introduce high-resolution features while controlling the increase in computation. Instead of always using the high-resolution feature map, we utilize a feature pyramid which consists of both low and high-resolution features and feed one resolution of the multi-scale feature to one Transformer decoder layer at a time.
For a feature pyramid, the same image is represented at several scales, i.e.
As the stride (the denominator term) increases, the resolution gets lower and represents larger image patches with global or regional semantics encoded. Mask2Former gives one pyramid scale (say ) at a time to the decoder layer, cycling the scales. This lowers the amount of computation required.