{
  "File Number": "1048",
  "Title": "Mask Matching Transformer for Few-Shot Segmentation",
  "Limitation": "Limitations and societal impact. Our MM-Former introduces the paradigm of decompose first and then blend to the research of few-shot segmentation, which is a totally new perspective and may inspire future researchers to develop more advanced versions. However, there is still a large gap between the current results and the oracle (≈ 20% mIoU). How to further narrow this gap is our future research focus. Acknowledgment. This work was supported in part by the National Key R & D Program of China (No.2021ZD0112100), the National NSF of China (No.U1936212, No.62120106009), the Fundamental Research Funds for the Central Universities (No. K22RC00010). Yao Zhao and Yunchao Wei are the corresponding authors.",
  "Reviewer Comment": "Reviewer_4: Strengths\nThis paper is well-organized and can be easily understood by readers. The technical details are introduced clearly.\nThe authors conducted extensive experiments on multiple benchmarks to investigate the effectiveness of different modules and designs in this paper.\nWeakness\nIn the potential objects segmenter section, the authors just borrow the ideas from Mask2Former to generate object proposals. But in few-shot learning, the number of meaningful object parts is unknown both in the base training set and the novel test set. How does the network learn these object segmenter without any guidance? If the object segmenter is inaccurate, will it affect the subsequent query-related part merge?\nThe proposed MM-Former exploits transformers as decoders for few-shot semantic segmentation. As is known a transformer may need a lot of learnable parameters. It will be better to list the parameters of different modules in MM-Former to see how the number of learnable parameters of transformers affects the final performance.\nIn Table 2, we can find that the performance of MM-Former on PASCAL is not good as other state-of-the-art algorithms. I want to see a thorough analysis of such a phenomenon. Maybe we can know more about the characteristics of MM-Former.\nQuestions:\nI am curious about whether the number of meaningful object proposals affects the final performance. There are also many other issues discussed in the weakness section.\nLimitations:\nI didn't see any obvious negative societal limitations of this work.\nEthics Flag: No\nEthics Review Area: I don’t know\nSoundness: 3 good\nPresentation: 3 good\nContribution: 2 fair\n\nReviewer_5: The writing of this paper is redundant and ambiguous, and the logic is not clear.\nThere are lots of grammatical errors which need to be corrected.\nLack of innovation and low novelty.\nPoor performance on the Pascal dataset even compared with the methods proposed years ago.\nProposed two-stage strategy introduces a new perspective focusing on mask-level segmentation.\nQuestions:\nIn #40, \" Concretely, pixel-level relationships are modeled between the support and query feature maps either by attention mechanism or 4D convolutions.\" Using \"either...or...\" is too arbitrary. There are also other methods to deal with the relationship between the query and support sets, like HSNet and PGNet.\nPoor performance on the Pascal dataset even compared with the methods in the community proposed years ago. In #85, the author attributed the reason to the limited scale of the dataset, which does not convince the reviewer.\nAdding more visual illustrations will make it clearer while introducing the network structure in subsection 2.2.\nIn the Introduction and Abstract sections, the author emphasizes the advantages of the algorithm in complexity. Relevant comparative experiments and explanations need to be supplemented to support the claims.\nIn #115, \" We use the outputs from the last three layers in the following modules\", \"the last three layers\" is ambiguous. Please further elaborate on the details.\nThe novelty is marginal since the core idea is borrowed from MaskFormer.\nThe impacts of different components brought to the model efficiency should be discussed, including the overall final model efficiency in terms of fps and model size.\nThere are quite a lot of grammatical errors and ambiguous expressions. The reviewer did not try to point them all out together. Please check your manuscript carefully and correct all mistakes before submission. Typos include but are not limited to:\na. In #22, \"one of a fundamental tasks\" -> \"one of the fundamental tasks\"\nb. In #22, “ has achieved grand success” -> \" has achieved a grand success\"\nc. In #29, \" segment any objects\" remove \"any\"\nd. A large number of articles are missing or used incorrectly. For example, \"We refer this kind of method as 'few-to-many' matching approach.\" -> \"We refer this kind of method as a 'few-to-many' matching approach.\" I won't list all since there are too many.\ne. In #37, \"While acceptable results obtained\" -> \"While acceptable results were obtained\". Lack of the predicate.\nf. In #51, \"Rather than matching\" -> \"Rather than being matched\"\ng. In #300, \", it is not suitable for the matching problem and impair the matching performance.\" -> \"impairs\"\nLimitations:\nThe stated limitation, i.e., a large gap between the oracle case, indicates room for future improvements, the reviewer still believes that broader negative impacts and limitations should be discussed.\nEthics Flag: No\nSoundness: 2 fair\nPresentation: 2 fair\nContribution: 2 fair\n\nReviewer_6: Strengths\nThe structure of this paper is well-organized and easy to follow the ideas of the authors.\nThe proposed method achieves significant improvements on the two datasets compared with other recent methods.\nWeaknesses\nThe only novel contribution of this paper is the Feature Alignment Block (FAB) in Mask Matching Module and it significantly improves the results, the other blocks are incremental. The authors simply adapt it to Mask2Former architecture. It would be better to investigate more about the FAB in different methods (CyCTR, HSNet) to prove its effectiveness is generalizable enough.\nThe “few-to-few” matching (L53) is not new. Previous approaches ([2], [3]) have applied it to the few-shot instance segmentation task. The proposed method (the mask2former architecture) tends to overfit small datasets (L225), then it is not suitable for the few-shot setting.\nRelated work is not well presented. They do not provide any analysis or comparison of previous work.\nQuestions:\nCan the author add the running time, training time, and the memory consumed by the model? As the Mask Matching Module is implemented by standard transformer decoder layers, does it requires large memory and time?\nWhat is the detailed implementation of the Mask Matching Module? In Fig. 2, the final mask has the same resolution as the F2 feature map, how to upsample the mask to the original resolution of the input image?\nExplain the self-alignment module and intuition of this. Can we replace it with the self-attention module (compare the performance and runtime)\nExplain the use of the MLP in Eq.(4): describe the input, and output range, and how it can correct the cosine similarity vector of N potential masks. Visualize the M and M^ before and after. It helps the reader what is happening inside the block. Why do not use dice loss in L_m (L173)\nL180: “Meanwhile, only constrain on Sˆ pos may lead all outputs of Cross Alignment block to tend to be same”: why? explain in more detail?\nL182: how to find the lowest IoU (ex: 2 potential masks with no overlap with GT)\nCan the authors add more visualization of the failure cases?\nIn Eq. (4), redundant closing parenthesis ')'.\nI will increase my score if the authors address all of my concerns.\nLimitations:\nNo\nEthics Flag: No\nSoundness: 2 fair\nPresentation: 3 good\nContribution: 2 fair",
  "abstractText": "In this paper, we aim to tackle the challenging few-shot segmentation task from a new perspective. Typical methods follow the paradigm to firstly learn prototypical features from support images and then match query features in pixel-level to obtain segmentation results. However, to obtain satisfactory segments, such a paradigm needs to couple the learning of the matching operations with heavy segmentation modules, limiting the flexibility of design and increasing the learning complexity. To alleviate this issue, we propose Mask Matching Transformer (MM-Former), a new paradigm for the few-shot segmentation task. Specifically, MM-Former first uses a class-agnostic segmenter to decompose the query image into multiple segment proposals. Then, a simple matching mechanism is applied to merge the related segment proposals into the final mask guided by the support images. The advantages of our MM-Former are two-fold. First, the MM-Former follows the paradigm of decompose first and then blend, allowing our method to benefit from the advanced potential objects segmenter to produce high-quality mask proposals for query images. Second, the mission of prototypical features is relaxed to learn coefficients to fuse correct ones within a proposal pool, making the MM-Former be well generalized to complex scenarios or cases. We conduct extensive experiments on the popular COCO-20 and Pascal-5 benchmarks. Competitive results well demonstrate the effectiveness and the generalization ability of our MM-Former. Code is available at github.com/Picsart-AI-Research/Mask-Matching-Transformer.",
  "1 Introduction": "Semantic segmentation, one of the fundamental tasks in computer vision, has achieved a grand success [3, 5, 37, 12] in recent years with the advantages of deep learning techniques [11] and large-scale annotated datasets [14, 6]. However, the presence of data samples naturally abides by a long-tailed distribution where the overwhelming majority of categories have very few samples. Therefore, few-shot segmentation [21, 27, 35] is introduced to segment objects of the tail categories only according to a minimal number of labels.\nMainstream few-shot segmentation approaches typically follow the learning-to-learning fashion, where a network is trained with episodic training to segment objects conditioned on a handful of labeled samples. The fundamental idea behind it is how to effectively use the information provided by the labeled samples (called support) to segment the test (referred to as the query) image. Early\n∗Work done during an internship at Picsart AI Research (PAIR).\n36th Conference on Neural Information Processing Systems (NeurIPS 2022).\nworks [27, 36, 33, 24, 30] achieve this by first extracting one or few semantic-level prototypes from features of support images, and then pixels in the query feature map are matched (activated) by the support prototypes to obtain the segmentation results. We refer to this kind of method as “few-to-many” matching paradigm since the number of support prototypes is typically much less (e.g., two to three orders of magnitude less) than the number of pixels in the query feature map. While acceptable results were obtained, this few-to-many matching paradigm turns out to be restricted in segmentation performance due to the information loss in extracting prototypes. Therefore recent advances [34, 26, 19] proceed to a “many-to-many” matching fashion. Concretely, pixellevel relationships are modeled between the support and query feature maps either by attention machanism [34, 26] or 4D convolutions [19]. Benefiting from these advanced techniques, the many-to-many matching approaches exhibit excellent performance over the few-to-many matching counterparts. Overall, the aforementioned approaches construct modules combining the matching operation with segmentation modules and optimizing them jointly. For the sake of improving the segmentation quality, techniques of context modeling module such as atrous spatial pooling pyramid [3], self-attention [39] or multi-scale feature fusion [24] are integrated with the matching operations [33] and then are simultaneously learned via the episodic training [30, 34, 24]. However, this joint learning fashion not only vastly increases the learning complexity, but also makes it hard to distinguish the effect of matching modules in few-shot segmentation.\nTherefore, in this work, we steer toward a different perspective for few-shot segmentation: decoupling the learning of segmentation and matching modules as illustrated in Fig. 1. Rather than being matched with the pixel-level query features, the support samples are directly matched with a few class-agnostic query mask proposals, forming a “few-to-few” matching paradigm. By performing matching in the mask level, several advantages are provided: 1) Such a few-to-few matching paradigm releases matching from the segmentation module and focuses on the matching problem itself. 2) It reduces the training complexity, thus a simple few-to-few matching is enough for solving the few-shot segmentation problem. 3) While previous works turned out to be overfitting when using high-level features for matching and predicting the segmentation mask [24, 27, 34], the learning of our matching and segmentation module would not affect each other and hence avoids this daunting problem.\nTo achieve this few-to-few matching paradigm, we introduce a two-stage framework, named Mask Matching Transformer (dubbed as MM-Former), that generates mask proposals for the query image in the first stage and then matches the support samples with the mask proposals in the second stage. Recently, MaskFormer [4, 5] formulates semantic segmentation as a mask classification problem, which obtains semantic segmentation results by combining the predictions of binary masks and the corresponding classification scores, where the masks and the scores are both obtained by using a transformer decoder. It provides the flexibility for segmenting an image of high quality without knowing the categories of the objects in advance. Inspired by this, we also use the same transformer decoder as in [4] to predict a set of class-agnostic masks based on the query image only. To further determine the target objects indicated by the support annotation, a simple Mask Matching Module is constructed. Given the features extracted from both support and query samples, the Mask Matching Module obtains prototypes from both support and query features through masked global average pooling [27]. Further, a matching operation is applied to match the supports with all query proposals and produces a set of coefficients for each query candidate. The final segmentation result for a given\nsupport(s)-query pair is acquired by combining the mask proposals according to the coefficients. In addition, to resolve the problem of representation misalignment caused by the differences between query and support images, a Feature Alignment Block is integrated into the Mask-Matching Module. Concretely, since the features for all images are extracted with a fixed network, they may not be aligned well in the feature space, especially for testing images with novel classes. A Self Alignment block and a Cross Alignment block are introduced to consist of the Feature Alignment Block to align the query and support samples in the feature space so that the matching operation can be safely applied to the extracted features.\nWe evaluate our MM-Former on two commonly used few-shot segmentation benchmarks: COCO-20i and Pascal-5i. Our model stands out from previous works on the challenging COCO-20i dataset. While our MM-Former only performs comparably with previous state-of-the-art methods due to the limited scale of the Pascal dataset, our MM-Former exhibits a strong transferable ability across different datasets (i.e., COCO-20i → Pascal-5i), owing to our superior mask-matching design. In a nutshell, our contributions can be summarized as follows: (1) We put forward a new perspective for few-shot segmentation, which decouples the learning of matching and segmentation modules, allowing more flexibility and lower training complexity. (2) We introduce a simple two-stage framework named MM-Former that efficiently matches the support samples with a set of query mask proposals to obtain segmentation results. (3) Extensive evaluations on COCO-20i and Pascal-5i demonstrate the potential of the method to be a robust baseline in the few-to-few matching paradigm.",
  "2 Methodology": "Problem Setting: Few-shot segmentation aims at training a segmentation model that can segment novel objects with very few labeled samples. Specifically, given two image sets Dtrain and Dtest with category set Ctrain and Ctest respectively, where Ctrain and Ctest are disjoint in terms of object categories (Ctrain∩Ctest = ∅). The model trained on Dtrain is directly applied to test on Dtest. The episodic paradigm was adopted in [24, 38] to train and evaluate few-shot models. A k-shot episode {{Is}k, Iq} is composed of k support images Is and a query image Iq, all {Is}k and Iq contain objects from the same category. We estimate the number of episodes for training and testing set are Ntrain and Ntest, the training set and test set can be represented by Dtrain = {{Is}k, Iq}Ntrain and Dtest = {{Is}k, Iq}Ntest . Note that both support masks Ms and query masks Mq are available for training, and only support masks Ms are accessible during testing.\nOverview: The proposed architecture can be divided into three parts, i.e., Backbone Network, Potential Objects Segmenter and Mask Matching Module. Specifically, the Backbone Network is used to extract features only, whose parameters are fixed during the training. The Potential Objects Segmenter (dubbed as POS) is applied to produce multiple mask proposals that may contain potential object regions within the given image. The Mask Matching Module (dubbed as MM module) takes support cues as guidance to choose the most likely ones from the mask proposals. The selected masks are finally merged into the target output. The complete diagram of the architecture is shown in Fig. 2. Each of the modules will be explained in detail in the following subsections.",
  "2.1 Feature Extraction Module": "We adopt a ResNet [11] to extract features for input images. Unlike previous few shot segmentation methods [24, 38, 31] using Atrous Convolution to replace strides in convolutions for keeping larger resolutions, we keep the original structure of ResNet following [5]. We use the outputs from the last three layers in the following modules and named them as FS and FQ for IS and IQ, where F = { F i } , i ∈ [3, 4, 5] and F is the features of IS or IQ, i is the layer index of backbone. We further extract the output of query layer2 to obtain the segmentation mask (named as F 2Q). F 2, F 3, F 4 and F 5 have strides of {4, 8, 16, 32} with respect to the input image.",
  "2.2 Potential Objects Segmenter": "The POS aims to segment all the objects in one image. Follow Mask2Former [4], a standard transformer decoder [25] is used to compute cross attention between FQ and N learnable embeddings. The transformer decoder consists of 3 consecutive transformer layers, each of which takes the corresponding F i as an input. Each layer in the transformer decoder can be formulated as\nEl+1 = TLayerl(El, F i), (1) where El and El+1 represent the N learnable embeddings before and after applying the transformer layer respectively. TLayer denote a transformer decoder layer. We simplify the representation of transformer decoder, whereas we conduct the same pipeline proposed by Mask2Former. The output of the transformer decoder is multiplied with F 2Q to get N mask proposals M ∈ RN×H/4×W/4. Note that Sigmoid is applied to normalize all mask proposals to [0, 1]. Besides, our POS abandons the classifier of Mask2Former since we don’t need to classify the mask proposals.",
  "2.3 Mask Matching (MM) Module": "In MM, our goal is to use support cues as guidance to match the relevant masks. The building blocks of MM are a Feature Alignment block and a Learnable Matching block. We first apply Feature Alignment block to align FQ and FS from the pixel level. Then, the Learnable Matching block matches appropriate query masks correspondence to the support images.\nFeature Alignment Block: We achieve the alignment using two types of building blocks: a SelfAlignment block and a Cross-Alignment block. The complete architecture is shown in Fig. 3.\nWe adopt the Self-Alignment block to align features in each channel. Inspired from Polarized Self-Attention [16], we design a non-parametric block to normalize representations. Specifically, the input feature map F ∈ Rc×hw is first averaged at the channel dimension to obtain Favg ∈ R1×hw. Favg is regarded as an anchor to obtain the attention weight A ∈ Rc×1 by matrix multiplication: A = FFTavg, which represents the weights of different channels. A is used to activate the\nfeature by position-wise-multiplication (i.e., expand at the spatial dimension and perform point-wise multiplication with the feature). In this way, the input feature is adjusted across the channel dimension, and the outliers are expected to be smoothed. Note that the Self Alignment block processes FS and FQ individually and does not involve interactions across images.\nThe Cross-Alignment block is introduced to mitigate divergence across different images. FS and FQ are fed into two weight-shared transformer decoders in parallel. We take ith layer as an example in Fig. 3, which can be formulated as\nF̂ iQ = MLP(MHAtten(F i Q, F i S , F i S)),\nF̂ iS = MLP(MHAtten(F i S , F i Q, F i Q)),\n(2)\nwhere F iQ and F i S represent the i th layer feature in FQ and FS . F̂ i represents the alignment features. (F̂ = { F̂ i }L i , i ∈ [3, 4, 5]). MLP denote MultiLayer Perceptron and MHAtten represents multi-\nhead attention [25]\nMHAtten(q, k, v) = softmax( qkT√ dk )v, (3)\nwhere q, k, v mean three matrices, and dk is the dimension of q and k elements. k, v are downsampled to 132 of the original resolution to save computation. To distinguish from the phrase “Query Image” in few-shot segmentation and “matrix Q” in Transformer, we name “Query Image” as Q and “matrix Q” as q. We simplify the representation of MHAtten and omit some Shortcut-Connections and Layer Normalizations in transformer decoder, whereas we conduct the same pipeline with the standard transformer.\nLearnable Matching Block: After acquiring F̂S and F̂Q, we first apply masked global average pooling (GAP) [38, 27, 24, 31] on each F̂ i and concat them together to generate prototypes for support ground-truth and N query mask proposals. Named as { P gtS } , { P iQ } , P gtS , P n Q ∈ R3d and\nn ∈ [1, 2...N ]. Here d represents the dimension of F̂ i, 3d is achieved by concatenating { F̂ 3, F̂ 4, F̂ 5 } together. We use cosine distance to measure the similarity between the prototypes of P gtS and P n Q.\nIn some cases, the mask corresponding to the prototype with the highest similarity may not be complete (e.g., the support image has only parts of the object). So, we further use an MLP layer to merge corresponding masks. The detailed diagram can be formulated as\nS = cos(P gtS , P n Q), n ∈ [1, 2...N ],\nM̂ = M ×MLP(S), S ∈ R1×N , (4)\nwhere M̂ is our final result, MLP and cos indicate the fully connected operation and the cosine similarity. We take N similarities (S) as the input of MLP, and use the output to perform a weighted average of N mask proposals. Note that we do not select the mask with the highest similarity directly, our ablation studies prove that using this block can help improve the performance.",
  "2.4 Objective": "In POS, we adopt segmentation loss functions proposed by Mask2Former (denote as LP ). We apply Hungarian algorithm to match mask proposals with groud-truth and only conduct Dice Loss to supervise on masks with the best matching.\nIn MM module, we conduct Dice Loss on M̂ (denote as LM ) and design a contrastive loss to constrain the cross-alignment module. Our goal is to make prototypes for the same class more similar while different classes less similar by constraining S. We first normalize S to [0, 1] by min-max normalization Ŝ = S−min(S)max(S)−min(S)+ε . Then we calculate IoU between N mask proposals and Query ground-truth. We assume that mask proposals contain various objects in query images. It is unrealistic to constrain the corresponding prototypes across different categories since it is hard to acquire the proper similarity among them. Therefore, we apply a criterion at the location of max(IoU) and denote the point as positive point Ŝpos. Only constrain on Ŝpos may lead all outputs of Cross Alignment block tend to be same. Thus, we add a constraint on the point in Ŝ corresponding to the lowest IoU, and denote it as negative point Ŝneg . We assign ypos = 1 and yneg = 0 to Ŝpos and Ŝneg during the optimization, respectively. Therefore, the cross-alignment loss Lco can be defined as\nLco = − 1\n2 (ypos log Ŝpos + (1− yneg) log (1− Ŝneg)) (5)\nThus, the final loss function can be formulated as L = LP + λ1LM + λ2Lco, where λ1 and λ2 are constants and are set to 10 and 6 in our experiments.",
  "2.5 Training Strategy": "In order to avoid the mutual influence of POS and MM module during training, we propose a two-stage training strategy of first training POS and then training MM. In addition, by decoupling POS and MM, the network can share the same POS under 1-shot and K-shot settings, which greatly improves the training efficiency.\nK-shot Setting: Based on the two stages training strategy, MM-Former can easily extend to the K-shot setting by averaging knowledge from K samples, i.e., P gtS . Note that after pre-trained the POS, MM-Former can be applied to 1-shot/ K-shot tasks with only a very small amount of training.",
  "3.1 Dataset and Evaluation Metric": "We conduct experiments on two popular few-shot segmentation benchmarks, Pascal-5i [9] and COCO-20i [14], to evaluate our method. Pascal-5i with extra mask annotations SBD [10] consisting of 20 classes are separated into 4 splits. For each split, 15 classes are used for training and 5 classes for testing. COCO-20i consists of annotated images from 80 classes.We follow the common data split settings in [20, 38, 19] to divide 80 classes evenly into 4 splits, 60 classes for training and test on 20 classes. 1,000 episodes from the testing split are randomly sampled for evaluation. To quantitatively evaluate the performance, we follow common practice [24, 27, 36, 19, 38], and adopt mean intersection-over-union (mIoU) as the evaluation metrics for experiments.",
  "3.2 Implementation details": "The training process of our MM-Former is divided into two stages. For the first stage, we freeze the ImageNet [6] pre-trained backbone. The POS is trained on Pascal-5i for 20,000 iterations and 60,000 iterations on COCO-20i, respectively. Learning rate is set to 1e−4, batch size is set to 8. For the second stage, we freeze the parameters of the backbone and the POS, and only train the MM module for 10,000/20,000 iterations on Pascal-5i / COCO-20i, respectively. Learning rate is set to 1e−4, batch size is set to 4. For both stages, we use AdamW [17] optimizer with a weight decay of 5e−2. The learning rate is decreased using the poly schedule with a factor of 0.9. All images are resized and cropped into 480× 480 for training. We also employ random horizontal flipping and random crop techniques for data augmentation. All the experiments are conducted on a single RTX A6000 GPU. The standard ResNet-50 [11] is adopted as the backbone network.",
  "3.3 Comparison with State-of-the-art Methods": "We compare the proposed approach with state-of-the-art methods [24, 31, 13, 28, 19, 18, 1, 15, 38] on Pascal-5i and COCO-20i datasets. The results are shown in Tab. 1 and Tab. 2.\nResults on COCO-20i. In Tab. 1, our MM-Former performs remarkably well in COCO for both 1-shot and 5-shot setting. Specifically, we achieve 3.9% improvement on 1-shot compared with CyCTR [34] and outperform HSNet [19] by 1.5% mIoU .\nResults on Pascal-5i. Due to the limited number of training samples in the Pascal dataset, the POS may easily overfit during the first training stage. Therefore, following recent works [24, 1, 19], we include the transferring results that transfer the COCO-trained model to be tested on Pascal. Note that when training on the COCO dataset, the testing classes shared with the Pascal dataset are removed, so as to avoid the category information leakage.\nAccording to Tab. 2, although our MM-Former is slightly inferior to some competitive results when training on Pascal dataset, we find MM-Former exhibits remarkable transferability when training on COCO and testing on Pascal. Specifically, the previous state-of-the-art method HSNet shows powerful results on Pascal→Pascal but degrades when transferring from COCO to Pascal. Instead, our MM-Former further enhances the performance of 1-shot and 5-shot by 4.4% and 5.5%, outperforming HSNet by 6.1% and 1.7%, respectively.\nOracle Analysis. We also explore the room for further improvement of this new few-shot segmentation paradigm by using query ground truth (GT) during inference. The results refer to the last rows in Tab. 1, 2. In detail, after the POS generates N mask proposals, we use the GT mask to select one proposal mask with the highest IoU, and regard this result as the segmentation result. Note that this natural selection is not the optimal solution because there may be other masks complementary to the selected one, but it is still a good oracle to show the potential of the new learning paradigm. According to the results, there is still a large gap between current performance and the oracle (≈ 20% mIoU), which suggests that our model has enormous potential for improvement whereas we have achieved state-of-the-art performance.",
  "3.4 Ablation Studies": "We conduct ablation studies on various choices of designs of our MM-Former to show their contribution to the final results. Component-wise ablations, including the MM Module and the POS, are shown in Sec. 3.4.1. The experiments are performed with the 1-shot setting on Pascal-5i and COCO-20i. We further experimentally demonstrate the benefits of the two-stage training strategy in Sec. 3.4.2.",
  "3.4.1 Component-wise Ablations": "To understand the effect of each component in the MM module, we start the ablations with a heuristic matching baseline and progressively add each building block.\nBaseline. The result of the heuristic matching baseline is shown in the first row of Tab. 3a, which directly selects the mask corresponding to the highest cosine similarity with the support prototype. Note that when not using the learnable matching block, the results in Tab. 3a are all obtained in the same way as the heuristic matching baseline. We observe that the heuristic matching strategy does not provide strong performance, which is caused by the feature misalignment problem and fails to fuse multiple mask proposals.\nSelf-Alignment Block. With the self-alignment block, the performance is improved by 4.3% on Pascal and 1.2% on COCO, as shown by the 2nd result in Tab. 3a, demonstrating that channel-wise attention does help normalize the features for comparison. However, the performance is still inferior, encouraging us to further align the support and query features with the cross-alignment block.\nCross-Alignment Block. In the third result of Tab. 3a, we experiment with a non-parametric variant of the cross-alignment block that removes all learnable parameters in the cross-alignment block. A significant performance drop is observed. This is not surprising because the attention in the cross-alignment block cannot attend to proper areas due to the feature misalignment. When learning the cross-alignment block, indicated by the 4th result of Tab. 3a, the performance is remarkably improved by 14% on Pascal and 12.9% on COCO, manifesting the necessity of learning the feature alignment for further matching.\nLearnable Matching Block. Surprisingly, simply using our learnable matching block can already achieve decent performance (the 5th result in Tab. 3a) compared with the baseline, thanks to its capability to adaptively match and merge multiple mask proposals.\nMask Matching Module. By applying all components, our MM-Former pushes the state-of-theart performance on COCO to 43.2% (the 7th result in Tab. 3a). In addition, to encourage the alignment of query and support in the feature space, we add the auxiliary loss Lco to the output of the cross-alignment block, which additionally enhances the performance by more than 1%.\nPotential Objects Segmenter Although we follow Mask2former to build our POS, several differences are made and we evaluate the choice of design as follows. Mask Classification. In Mask2Former [4], a linear classifier is trained with cross-entropy loss for categorizing each mask proposal, while in our MM-Former for few-shot segmentation, we remove it to avoid learning class-specific representations in the first training stage. The result in Tab. 4a shows that the classifier harms the performance due to that the linear classifier would make the network fit the “seen” classes in the training set. Since this change only affects the first stage, we use the oracle results to demonstrate the effect. Numbers of Proposals. In Tab. 4b, we try to vary the numbers of the mask proposals N . Increasing the number of N will significantly improve the oracle result and our result. Thus we chose 100 as the default value in all other experiments. It is worth noting that, when varying the number from 10 to 100, our result is improved by 5.4%, but the oracle result is improved by 12.1%, indicating the large room for improvement with our new mask matching paradigm.\nEffect of Different Feature Extraction. Previous few-shot segmentation works [34, 24, 30] typically integrate matching operations with segmentation-specific techniques [39, 24, 3]. Following Mask2Former, our POS also includes a multi-scale deformable attention (MSDeformAttn) [39]. In\nTab. 3b, we investigate using the features from the MSDeformAttn instead of the backbone feature for the MM module. Interestingly, although the feature after the context modeling is essential for segmentation, it is not suitable for the matching problem and impairs the matching performance.",
  "3.4.2 Analysis of Training Strategy": "Effect of Two-stage Training. One may wonder what if we couple the training of POS and MM modules. Tab. 3c experiments on this point, the joint optimization is inferior to the two-stage training strategy, since POS and MM have different convergence rates.\nEfficiency of Two-stage Training.We analyze the efficiency of our method and provide comparisons of training time, and training memory consumption (Tab. 5). All models are based on the ResNet-50 backbone and tested on the COCO benchmark. All models are tested with RTX A6000 GPU(s) for a fair comparison. Training times for CyCTR and HSNet are reported according to the official implementation. We report the training time for the first and second stages separately. It is worth noting that for the same test split, our method can share the same stage-1 model across 1-shot and 5-shot. The training time of stage-1 for 5-shot can be ignored if 1-shot models already exist.",
  "3.5 Analysis of model transferability": "Our MM-Former shows a better transfer performance when trained on COCO but a relatively lower performance when trained on Pascal. We make an in-depth study of this phenomenon.\nEffect of the number of training samples: We use all training samples belonging to 15 Pascal training classes from COCO to train MMFormer. In this case, training samples are 9 times larger than the number in Pascal but the categories are the same, dubbed COCO-15 in Tab. 6. When the number of classes is limited, more training data would worsen the matching\nperformance (60.7% vs. 63.3% for 1-shot and 64.8% vs. 64.9% for 5-shot), though a better POS could be obtained, as indicated by the oracle result (86.3% vs. 82.5%).\nEffect of the number of training classes: We randomly sample an equal number of training images ( 6000 images averaged across 4 splits) as in Pascal training set from 75 classes (excluding test classes) in COCO to train our MM-Former, dubbed COCO-75-sub in Tab. 6. When training with the same amount of data, more classes lead to better matching performance (66.8% vs. 63.3% for 1-shot and 68.9% vs. 64.9% for 5-shot).\nIn a word, the number of classes determines the quality of the matching module. This finding is reasonable and inline with the motivation of few-shot segmentation and meta-learning: learning to learn by observing a wide range of tasks and fast adapting to new tasks. When the number of classes is limited, the variety of tasks and meta-knowledge are restricted, therefore influencing the learning of the matching module.",
  "3.6 Qualitative Analysis": "Visual examples: We show some visual examples in Fig. 4. Without loss of generality, some support images may only contain part of the object (e.g., the 2nd row). Directly selecting the mask with the highest cosine similarity can not obtain the anticipated result. Using a learnable mask matching block to fuse multiple masks can solve the problem to a large extent, the proposed feature alignment block can further improve our model by alleviating the misalignment problem, e.g. the results in the last row.\nRobustness analysis: We also provide robustness analysis in Fig. 6, which uses an anomaly support sample for segmenting the query image. Compared with the previous state-of-theart method, HSNet, which tends to segment the salient object in the image, our model is more robust to the anomaly inputs.\nExplanation of SA: SA is proposed to align the\nfeatures at the channel dimension so that outliers at the channel dimension could be smoothed and features would be more robust by aligning with the attended global (specifically, channel-wise weighed average) features. Fig. 5 proves this point. It can be seen that Favg (row 2th) has response to general foreground regions. Important channels (row 3th) are emphasized, and outliers are suppressed (row 4th).",
  "4 Related Work": "Few-Shot Segmentation [21] is established to perform segmentation with very few labeled images. Many recent approaches formulate few-shot segmentation from the view of metric learning [23, 7, 27]. PrototypicalNet [22] is the first to perform metric learning on few-shot segmentation. PFENet [24] further designs an feature pyramid module to extract features from multi-levels. Many recent methods point out that only a single support prototype is insufficient to represent a given category. To address this problem, [32] attempt to obtain multiple prototypes via EM algorithm. [15] utilized super-pixel segmentation technique to generate multiple prototypes. Another way to solve the above problem is to apply pixel-level attention mechanism. [32, 26] attempt to use graph attention networks to utilize all foreground support pixel features. HSNet [19] propose to learn dense matching through 4D Convolution. CyCTR [38] points out that not all foreground pixels are conducive to segmentation and adopt cycle-consistency technology to filter out proper pixels to guide segmentation.\nTransformers originally proposed for NLP [25] are being rapidly adapted in computer vision task [8, 2, 29, 5, 4]. The major benefit of transformers is the ability to capture global information using self-attention module. DETR [2] is the first work applying Transformers on object detection task. Mask2Former [4] using Transformers to unify semantic segmentation and instance segmentation. Motivated by the design of MaskFormer, we apply transformers to segment all potential objects in one image, align support features and query features in pixel-level within our MM-Former.",
  "5 Conclusion": "In the paper, we present Mask Matching Transformer (MM-Former), a new perspective to tackle the challenging few-shot segmentation task. Different from the previous practice, MM-Former is a two-stage framework, which adopts a Potential Objects Segmentor and Mask Matching Module to first produce high-quality mask proposals and then blend them into the final segmentation result. Extensive experiments on COCO-20i and Pascal-5i well demonstrate the effectiveness and the generalization advantage of the proposed MM-Former. We hope our MM-Former can serve as a solid baseline and help advance the future research of few-shot segmentation.\nLimitations and societal impact. Our MM-Former introduces the paradigm of decompose first and then blend to the research of few-shot segmentation, which is a totally new perspective and may inspire future researchers to develop more advanced versions. However, there is still a large gap between the current results and the oracle (≈ 20% mIoU). How to further narrow this gap is our future research focus.\nAcknowledgment. This work was supported in part by the National Key R & D Program of China (No.2021ZD0112100), the National NSF of China (No.U1936212, No.62120106009), the Fundamental Research Funds for the Central Universities (No. K22RC00010). Yao Zhao and Yunchao Wei are the corresponding authors.",
  "Reviewer Summary": "Reviewer_4: This paper tackles the few-shot segmentation task through a proposed mask matching transformer (MM-Former). The MM-Former contains two parts. The first part decomposes query images into multiple segmentation proposals with a class-agnostic segmenter. The second part merges related segment proposals into final masks guided by support images. With the ResNet-50 backbone, the proposed method get competitive results on the popular COCO and PASCAL benchmarks.\n\nReviewer_5: This paper proposes a new two-stage framework that decouples the matching and segmentation modules for few-shot segmentation. Extensive experiments and ablation studies on COCO and Pascal datasets also verify the algorithm's effectiveness.\n\nReviewer_6: This paper proposes a few-shot semantic segmentation (FSSS) network based on Mask2Former [1]. By formulating the semantic segmentation as a mask classification problem like [1], the authors introduced a new matching mechanism in mask-level instead of pixel-level matching in previous FSSS methods. Additionally, they propose a feature-alignment block based on the attention mechanism to align both support and query features individually and cross-align between them. They conducted experiments on two FSSS datasets (COCO-20i and PASCAL-5i) and achieve the SOTA results."
}