Next Article in Journal
A Video Dual-Domain Blind Watermarking Algorithm Based on Hadamard Transform
Previous Article in Journal
Novel Accelerated Cyclic Iterative Approximation for Hierarchical Variational Inequalities Constrained by Multiple-Set Split Common Fixed-Point Problems
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Global–Local Query-Support Cross-Attention for Few-Shot Semantic Segmentation

by
Fengxi Xie
1,†,
Guozhen Liang
1,† and
Ying-Ren Chien
2,*
1
Department of Electrical Engineering and Computer Science, Technische Universität Berlin, 10623 Berlin, Germany
2
Department of Electrical Engineering, National Ilan University, Yilan 260007, Taiwan
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Mathematics 2024, 12(18), 2936; https://doi.org/10.3390/math12182936
Submission received: 31 July 2024 / Revised: 10 September 2024 / Accepted: 19 September 2024 / Published: 21 September 2024

Abstract

:
Few-shot semantic segmentation (FSS) models aim to segment unseen target objects in a query image with scarce annotated support samples. This challenging task requires an effective utilization of support information contained in the limited support set. However, the majority of existing FSS methods either compressed support features into several prototype vectors or constructed pixel-wise support-query correlations to guide the segmentation, which failed in effectively utilizing the support information from the global–local perspective. In this paper, we propose Global–Local Query-Support Cross-Attention (GLQSCA), where both global semantics and local details are exploited. Implemented with multi-head attention in a transformer architecture, GLQSCA treats every query pixel as a token, aggregates the segmentation label from the support mask values (weighted by the similarities with all foreground prototypes (global information)), and supports pixels (local information). Experiments show that our GLQSCA significantly surpasses state-of-the-art methods on the standard FSS benchmarks PASCAL-5i and COCO-20i.

1. Introduction

In recent years, Deep Neural Networks (DNNs) have played a pivotal role in achieving substantial performance enhancements in semantic segmentation [1,2]. However, DNN-based methods require a substantial number of annotated examples extracted from extremely large-scale datasets. In low-data scenarios, DNNs face challenges in predicting unseen categories, primarily attributed to poor generalization. Humans, in contrast, exhibit the remarkable ability to rapidly master new skills or tasks based on prior knowledge and sparse examples. Motivated by this human cognitive pattern, few-shot learning (FSL) [3,4] was developed. The objective of FSL is to understand unseen classes with scarce annotated exemplars. FSL has found widespread application in computer vision tasks, such as image classification [5], object detection [6], image retrieval [7] and semantic segmentation [8,9,10,11,12,13,14,15,16,17,18,19,20,21]. In this work, we focus on few-shot semantic segmentation (FSS), where the model leverages only a small number of support images to segment novel targets in a query image.
The crux of FSS lies in effectively leveraging the information within the limited support set. Existing FSS methods utilize support information from two perspectives. On one hand, many prior works adopted the notion of metric-based prototyping [22], where support features were extracted into a limited number of class-wise prototypes, against which the query features were compared for fine-grained mask predictions. For instance, PANet [9] extracts class-wise prototypes from support features via average pooling, and then segments query objects by matching the query pixels with these prototypes in an embedding space. CANet [10] also adopts the class-wise average pooling strategy and proposes using an iterative optimization algorithm to refine the predictions. In enhancing the prototype-based semantic representation, PPNet [12] generates multiple prototypes to represent a single class. CECNet [13] proposes using a clustered-patch attention mechanism to extract discriminative features, and a new distance metric was designed to measure the similarity between support-query pair features. SiGCN [14] introduced a support-induced GCN to locate query targets of different feature levels and proposed an instance association module to exploit high-level semantics from a support and query set. QPENet [15] proposed a dual prototype enhancement branch to generate a prototype bank, which significantly enhances the prototype representation ability.
However, prototypical approaches are faced with non-negligible information loss resulting from the compression of support information. This problem, on the other hand, has encouraged researchers to explore pixel-wise support-query correlations. Noteworthy contributions in this direction include PGNet [11] and DAN [16], both of which employ graph attention mechanisms to establish pixel-to-pixel dense support-query correspondences. Moreover, HSNet [17] proposed 4D convolution operations to refine the dense support-query connections. Recently, researchers have started to explore applications of the transformer architecture [23] in aggregating pixel-wise support information into query predictions. For instance, CyCTR [24] calculates a support-query affinity map via multi-head attention to guide the query segmentation. DCAMA [20] also adopts scaled dot-product attention to aggregate the pixel-wise support-query correlations, where background cues in the support set are fully utilized.
Although pixel-wise approaches have pushed the FSS performance to a new level, there still exist two big drawbacks in effectively matching the support-query pairs. Firstly, many existing approaches mask out support foregrounds with support ground truths, thereby removing important cues for query predictions. Secondly, certain ambiguous query tokens lack clear similarities to all support pixels due to intra-class discrepancies, resulting in incomplete query segmentation.
To address the aforementioned issues, we propose Global–Local Query-Support Cross-Attention (GLQSCA) for FSS, aiming to fully exploit both local support-query similarities and global prototype-query correlations. As shown in Figure 1, GLQSCA additively aggregates the segmentation label of a query pixel from the support mask values, and then proportionally weights the predicted mask value by its similarities to the corresponding foreground masked prototypes and all the support image pixels. The underlying principle of GLQSCA can be likened to a voting process: a query pixel will be voted for as foreground for the mask value if it is semantically similar to foreground prototypes and foreground support pixels, and vice versa. Incorporating foreground prototypes plays a crucial role in determining ambiguous target pixels, as they encapsulate more general characteristics of the novel classes. In addition, it is noteworthy that the GLQSCA query mask generation pipeline can be readily implemented with the multi-head attention architecture [23], where each query pixel serves as an input token, a matrix Q comprises the flattened query features, a matrix V consists of the flattened support mask values, and a matrix K is composed of the flattened support features added with the flattened foreground masked prototype features. Subsequently, coarse query masks are obtained through softmax( Q K T )V, which are mingled with the multi-level support and query features in the mixer to yield refined predictions.
Furthermore, the majority of previous methods [9,10,25,26] have relied on averaged or weighted prototypes under a few-shot setting, leading to further information loss. In contrast to these approaches, our proposed GLQSCA maximizes the utilization of support information under different n settings. Specifically, each query token is simply aggregated from all the n support masks and weighted by its similarities to all the n corresponding prototypes and all the pixels of the n support images. Meanwhile, the core of our mask aggregation pipeline is scaled dot-product attention and is thus non-parametric. Consequently, the same one-shot trained model can be reused for n-shot segmentation.
The primary contributions of our work can be summarized as follows:
  • We propose a novel Global–Local Query-Support Cross-Attention (GLQSCA) mechanism for FSS, which is designed to effectively leverage both global prototype-query connections and local pixel-wise support-query similarities from the support images. The performance exhibits significant improvement in terms of the mean intersection over union (MIoU) and the foreground–background IoU (FB-IoU).
  • The proposed GLQSCA can be easily and efficiently extended from one-shot to few-shot semantic segmentation with the full utilization of support information and without additional training.
  • The proposed GLQSCA was evaluated on the FSS benchmarks PASCAL-5i and COCO-20i. The results show that our GLQSCA surpasses current prevalent FSS algorithms under both one-shot and five-shot settings. Comprehensive ablation studies prove the effectiveness and accuracy of the proposed framework.

2. Problem Definition

In the context of FSS, we define a support set, denoted as S = I s i , M s i ( l ) i = 1 n , with I s i being the supported image of the shot i and M s i being the corresponding segmentation mask for a specific semantic class l. Similarly, we denote the query set as Q = I q , M q ( l ) } . The objective of FSS is to train a model, denoted as f I q , S , capable of taking both the support set S and a query image I q as input and predicting a binary mask M ^ q for a novel category l.
The network is trained based on episodic learning [5]. We denote two image sets D t r a i n and D t e s t that do not contain overlapped object categories. Both image sets include multiple episodes, each containing a randomly sampled support set S and a query set Q . In the training stage, the model is optimized on D t r a i n and given extensive annotated samples, learning the mapping from S , I q to query prediction. During testing, the trained model is assessed on D t e s t (novel classes) with scarce annotated samples.

3. Methodology

3.1. Overall Framework

The overall architecture of the proposed GLQSCA is depicted in Figure 2. To simplify, we first outline the overall framework under the 1-shot setting. In each episode, multi-level support features F s i R B × C × H 2 i + 1 × W 2 i + 1 and query features F q i R B × C × H 2 i + 1 × W 2 i + 1 are generated from the input images by a pre-trained feature extractor, where B is the batch size, C is the channel number, and H and W represent the height and width of the input images, respectively. The index i 1 , 2 , 3 , 4 corresponds to the feature level. Similar to Min et al. [17], we utilize all the intermediate-level features. Meanwhile, we downsample the support masks to align with the dimensions of the multi-level image features. Then, we separately perform the cross-attention at feature levels i { 2 , 3 , 4 } . At each selected feature level, the support and query features, concatenated with the support mask(s), are inputted to the GLQSCA block to generate the coarse query mask. Afterward, the multi-level coarse masks are processed by a 3 × 3 convolution and subsequently resampled to the same dimensions H 8 × W 8 . Finally, these intermediate query masks along with the skip-connected image features at levels { 1 , 2 } are passed through the mixer block to generate the refined query predictions.

3.2. Global–Local Query-Support Cross-Attention Block

In this subsection, we introduce our global–local context-aware cross-attention block, which is the core of our work. To incorporate global semantic information, we first generate the foreground prototype features as follows:
F c = F s M s
P = M A P F c
F p = P . R e p e a t ( 1 , 1 , H W )
where F c R B × 1 × H 2 i + 1 × W 2 i + 1 refers to the class-aware features, M A P · is the mean average pooling operation, P R B × C denotes the class-aware prototypes, and F p R B × 1 × ( H 2 i + 1 × W 2 i + 1 ) represents the class-aware prototype features. ⊗ is the element-wise addition.
We adopt the multi-head attention in the transformer architecture and employ sine and cosine functions to create a positional encoding [23]. We apply the positional encoding and linear projection Linear(·) to generate Q, V, and K matrices from the flattened F q , the flattened M s , and the summation between the flattened F s and the flattened F p (weighted by the learnable parameter α , which is set to 1 initially), respectively:
Q = L i n e a r F q . r e s h a p e B , C H e a d s , H e a d s , H W
V = M s . R e p e a t ( 1 , H e a d s , 1 , 1 )
V = V . r e s h a p e ( B , H e a d s , H W , 1 )
K s = F s . R e s h a p e B , C H e a d s , H e a d s , H W
K p = F p . R e s h a p e B , C H e a d s , H e a d s , H W
K = L i n e a r K s α K p
Here, H e a d s denotes the total number of the scaled dot-product attention, and ⊕ represents element-wise addition.
For each query token, the correlation feature F c o r r is calculated, which measures its similarities to its correlations to the class-wise prototypes (global information) and all the support pixels (local information):
F c o r r = S o f t m a x Q K T C H e a d s , d i m = 1
Finally, we obtain the coarse query mask M c o a r s e R B × 1 × H 2 i + 1 × W 2 i + 1 through the multiplication of F c o r r and V:
M c o a r s e = F c o r r V
Intuitively, if a query token is more similar to foreground prototypes and pixels, it would be voted for the foreground, and vice versa.

3.3. Mask–Feature Mixer

After obtaining the collection of intermediate query masks M c o a r s e i with i 2 , 3 , 4 , we skip connectting them with the query and support features of levels { 1 , 2 } . These concatenated features are proceeded through the mask–feature mixer to generate the final predictions. As shown in Figure 3, the mixer comprises three mixer blocks, each consisting of two consecutive convolution layers followed by ReLU activation. Two interleaved upsampling operations are adopted to restore the resolution of predicted query masks to that of input images.

3.4. n-Shot Segmentation

In an n-shot setting (n > 1), n annotated support images are input to the network. Previous methods either separately perform n forward passes to obtain the predicted masks by ensemble [17], or take the average of support prototypes and retrain a specific model for n-shot inference [22,25,26]. However, these approaches inevitably lose support information and introduce computational burden to some extent. In contrast, we reuse the 1-shot trained model under different n-shot settings while effectively utilizing support information from both global and local perspectives. Concretely, the additional support features, prototype features, and support masks are treated as extra tokens in K s , K p , and V, which can be readily implemented by an appropriate tensor reshaping (as shown in Figure 4). The mask generation pipeline remains unchanged since each query token is simply voted by all prototype vectors and support pixels at once. Benefiting from the parameter-free scaled dot-product attention, the proposed GLQSCA can be switched from 1-shot to n-shot inference without retraining.

4. Experiments

4.1. Experimental Setup

4.1.1. Dataset and Evaluation Metrics

In this study, we implemented the experiments on PASCAL-5i and COCO-20i. The PASCAL-5i dataset, originally introduced in the OSLSM [8] framework, is a compilation of additional annotations from PASCAL VOC 2012 [27,28], with 20 distinct categories separated uniformly in 4 folds. We conducted the evaluation based on cross-validation. Specifically, three folds of the PASCAL-5i are randomly sampled for model training, and the remaining fold is used as a target fold for testing. COCO-20i is generated from the MS-COCO [29], which is split into 4 folds with 60 base categories and 20 novel categories in each fold. Following the previous works [11,17,26], the mean intersection over union (MIoU) is employed for evaluation. For a fair comparison, the foreground–background IoU (FB-IoU) is also reported.

4.1.2. Implementation Details

The experiments were implemented using PyTorch version 1.10.0 [30]. ResNet-50, ResNet-101, and base Swin transformer (Swin-B) models pre-trained on ImageNet [31] were selected as our backbone feature extractors. For the supervision of model training, the binary cross entropy (BCE) loss was adopted. The dimensions of input images and support masks were resized to 384 × 384. For the hyperparameters, we configured the learning rate, momentum, and weight decay to 0.001, 0.9, and 0.0001, respectively. In addition, a stochastic gradient descent-optimized SGD optimizer was used to update the network parameters (except those in the frozen backbone layers). We trained the network for 200 epochs, with the batch size set to 48 for both datasets. Moreover, we trained the network on four NVIDIA Tesla A40s and tested it on an NVIDIA Tesla T4.

4.2. Comparison with State-of-the-Art Methods

The performance of our GLQSCA against the prevalent FSS approaches is reported in Table 1 in terms of mIoU and FB-IoU. We ran the source code of these models to evaluate the performance for a fair comparison. Our method with the ResNet-50 backbone consistently outperformed all the state-of-the-art (SOTA) methods under all few-shot settings, achieving performance improvements of a 0.3%mIoU (one-shot) and 0.6%mIoU (five-shot) against the second-best method SiGCN [14] (one-shot) and QPENet [15] (five-shot) on PASCAL-5i, respectively. For ResNet-101, HSNet [17] and our method rank in the top two among all the benchmarks with outstanding performances. Remarkably, our proposed method achieves state-of-the-art performances among all data folds with the Swin-B backbone, surpassing the second-best method by 1.2%mIoU (one-shot) and 1.3%mIoU (five-shot), respectively. For COCO-20i, our GLQSA achieves the best performances among all the combinations of different backbones and n-shot settings. The proposed method outperforms the second-best approach DCAMA [20] by 1.2%mIoU (one-shot) and 1.5%mIoU (five-shot), respectively. Additionally, it can be observed that the proposed method significantly surpasses both the prototyping methods and pixel-wise methods, indicating the effectiveness of combining the local and global information in the current FSS paradigm.
In Figure 5 and Figure 6, we visualize some representative examples of the segmentation under one-shot and five-shot settings, respectively. It can be seen that our predictions are almost identical to the ground truths, and the proposed method under a five-shot setting significantly outperforms that of a one-shot.

4.3. n-Shot Inference Analysis

As shown in Table 2, we also investigated the computational efficiency of the proposed method. It can be seen that the memory cost and inference time increased linearly from one-shot to five-shot, which is in line with the proposed mask aggregation mechanism.

4.4. Limitation Analysis

In Table 1, we observe that the proposed method underperforms in some data folds, especially with the ResNet-101 backbone. We assume that this is because the proposed method relies on the pixel-wise information provided by the extracted features. However, this local information is progressively diluted, with the backbone layers being deeper. This is why the proposed method achieves better performance with ResNet50 than with ResNet101, which is counter-intuitive.
In addition, our GLQSA achieves the best performance in all data folds with the Swin-B backbone, indicating that the proposed method relies on a strong backbone. The proposed method also shows better performance in the larger dataset COCO-20i. These two factors inevitably lead to higher computational costs in training.
Besides, we list some representative failure cases of the proposed method in Figure 7. Failure cases happen when the query objects are too small (row 1), with intra-class discrepancy (row 2), and with inter-class similarity (row 3). The proposed method tends to yield incomplete query predictions if the target objects are too small. Intra-class discrepancy and inter-class similarity may lead to false activation, which reduces the model’s performance to some extent. These problems are also the major challenges faced by the current few-shot semantic segmentation paradigm.

4.5. Ablation Studies

Ablative experiments were conducted by removing certain components to investigate the contribution of the components and parameters to the overall framework. We conducted a series of ablative experiments on PASCAL-5i under the one-shot setting. We used ResNet-50 as the backbone network for all the ablation experiments. Other experiment settings were the same as those mentioned in Section 4.1. Table 3 provides a detailed analysis of the contribution of each component and parameter within the framework of our segmentation approach, with MIoU and FB-IoU listed as the performance indicators.

4.5.1. Effectiveness of Incorporating Foreground Prototypes in Matrix K

We first conducted an ablative experiment to validate the effectiveness of utilizing global (prototype) information in the proposed framework. The second row shows the experimental result of considering global information in the overall framework by adding the foreground prototypes in matrix K based on the baseline. Compared with the baseline, incorporating foreground prototypes in matrix K results in performance enhancements of 4.6%mIoU and 2.9%FB-IoU. This result demonstrates that utilizing both local details and global semantics in the proposed mask aggregation pipeline can further exploit the information from the given data, giving it a significant advantage over previous pixel-wise approaches.

4.5.2. Effectiveness of Learnable Parameter α

To evaluate the effectiveness of weighting the masked foreground prototypes with the learnable parameter α , we conducted an ablative experiment where we set the parameter α to 1 (constant value) when calculating the matrix K. From the comparison of the results of the second and third row in Table 3, it can be observed that incorporating α brings improvements of 2.2% and 0.9% in terms of the mIoU and FB-IoU, indicating that the parameter α can effectively balance the proportion of the pixel-wise similarities and the semantic correlations in the mask aggregation process. We also note the influences of different initial α values in Table 4. In this ablative experiment, we set the framework with the setting of the second row in Table 3 as the baseline, and increased the initial α value by 0.2 for each sub-experiment. It can be seen that the accuracy is progressively enhanced with the increase in the initial α value, although the performance slightly decreases when the initial α value is increased from 0 to 0.2.

5. Conclusions

In this paper, we proposed the Global–Local Query-Support Cross-Attention (GLQSCA) mechanism for FSS, which can be simply and effectively implemented through scaled dot-product attention in the transformer architecture. Our proposed method demonstrates two distinct advantages over previous approaches: (i) it fully exploits both global prototype-query correlations and local pixel-wise support-query similarities; (ii) the one-shot trained model can be readily switched to n-shot inference without retraining. On PASCAL-5i and COCO-20i, GLQSCA outperforms current cutting-edge few-shot semantic segmentation algorithms by a significant margin. These results confirm the efficacy and precision of this innovative framework.
The major challenges of the proposed method lie in the small targets, intra-class discrepancy, inter-class similarity, and high computational cost. In the future, we will explore the possibilities of improving the mask aggregation mechanism to further exploit novel class information and enhance computational efficiency by designing a lightweight transformer architecture to enhance the computational efficiency. We will also attempt to adapt the proposed method to other few-shot learning tasks, such as object detection.

Author Contributions

Conceptualization, F.X., G.L. and Y.-R.C.; methodology, F.X. and G.L.; software, F.X. and G.L.; validation, F.X. and G.L.; formal analysis, F.X. and Y.-R.C.; resources, Y.-R.C.; data curation, F.X. and Y.-R.C.; writing—original draft, F.X., G.L. and Y.-R.C.; writing—review and editing, F.X., G.L. and Y.-R.C.; project administration, Y.-R.C. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the National Science and Technology Council, Taiwan (NSTC) under Grant 112-2221-E-197-022.

Data Availability Statement

No new data were created or analyzed in this study.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
FSSFew-shot semantic segmentation;
FSLFew-shot learning;
DNNDeep Neural Network;
MIoUMean intersection over union;
FB-IoUForeground–background intersection over union.

References

  1. Chen, L.-C.; Papandreou, G.; Kokkinos, I.; Murphy, K.; Yuille, A.L. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 40, 834–848. [Google Scholar] [CrossRef]
  2. Zhao, H.; Shi, J.; Qi, X.; Wang, X.; Jia, J. Pyramid scene parsing network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 2881–2890. [Google Scholar]
  3. Fink, M. Object classification from a single example utilizing class relevance metrics. Adv. Neural Inf. Process. Syst. 2004, 17, 1–8. [Google Scholar]
  4. Li, F.-F.; Fergus, R.; Perona, P. One-shot learning of object categories. IEEE Trans. Pattern Anal. Mach. Intell. 2006, 28, 594–611. [Google Scholar]
  5. Vinyals, O.; Blundell, C.; Lillicrap, T.; Wierstra, D. Matching networks for one shot learning. Adv. Neural Inf. Process. Syst. 2016, 29, 1804. [Google Scholar]
  6. Chen, H.; Wang, Y.; Wang, G.; Qiao, Y. Lstd: A low-shot transfer detector for object detection. In Proceedings of the AAAI Conference on Artificial Intelligence, New Orleans, LA, USA, 2–7 February 2018; Volume 32. [Google Scholar]
  7. Triantafillou, E.; Zemel, R.; Urtasun, R. Few-shot learning through an information retrieval lens. Adv. Neural Inf. Process. Syst. 2017, 30, 1329. [Google Scholar]
  8. Shaban, A.; Bansal, S.; Liu, Z.; Essa, I.; Boots, B. One-shot learning for semantic segmentation. arXiv 2017, arXiv:1709.03410. [Google Scholar]
  9. Wang, K.; Liew, J.H.; Zou, Y.; Zhou, D.; Feng, J. Panet: Few-shot image semantic segmentation with prototype alignment. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 9197–9206. [Google Scholar]
  10. Zhang, C.; Lin, G.; Liu, F.; Yao, R.; Shen, C. Canet: Class-agnostic segmentation networks with iterative refinement and attentive few-shot learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 5217–5226. [Google Scholar]
  11. Zhang, C.; Lin, G.; Liu, F.; Guo, J.; Wu, Q.; Yao, R. Pyramid graph networks with connection attentions for region-based one-shot semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 9587–9595. [Google Scholar]
  12. Liu, Y.; Zhang, X.; Zhang, S.; He, X. Part-aware prototype network for few-shot semantic segmentation. In Proceedings of the Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020, Proceedings, Part IX 16; Springer: Berlin/Heidelberg, Germany, 2020; pp. 142–158. [Google Scholar]
  13. Lai, J.; Yang, S.; Zhou, J.; Wu, W.; Chen, X.; Liu, J.; Gao, B.; Wang, C. Clustered-patch element connection for few-shot learning. arXiv 2023, arXiv:2304.10093. [Google Scholar]
  14. Liu, J.; Bao, Y.; Yin, W.; Wang, H.; Gao, Y.; Sonke, J.; Gavves, E. Few-shot semantic segmentation with support-induced graph convolutional network. arXiv 2023, arXiv:2301.03194. [Google Scholar]
  15. Cong, R.; Xiong, H.; Chen, J.; Zhang, W.; Huang, Q.; Zhao, Y. Query-guided Prototype Evolution Network for Few-Shot Segmentation. IEEE Trans. Multimed. 2024, 26, 6501–6512. [Google Scholar] [CrossRef]
  16. Wang, H.; Zhang, X.; Hu, Y.; Yang, Y.; Cao, X.; Zhen, X. Few-shot semantic segmentation with democratic attention networks. In Proceedings of the Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020, Proceedings, Part XIII 16; Springer: Berlin/Heidelberg, Germany, 2020; pp. 730–746. [Google Scholar]
  17. Min, J.; Kang, D.; Cho, M. Hypercorrelation squeeze for few-shot segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Virtual, 11–17 October 2021; pp. 6941–6952. [Google Scholar]
  18. Lu, Z.; He, S.; Zhu, X.; Zhang, L.; Song, Y.; Xiang, T. Simpler is better: Few-shot semantic segmentation with classifier weight Transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Virtual, 11–17 October 2021; pp. 8741–8750. [Google Scholar]
  19. Azad, R.; Fayjie, A.R.; Kauffmann, C.; Ayed, I.B.; Pedersoli, M.; Dolz, J. On the texture bias for few-shot CNN segmentation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Waikoloa, HI, USA, 3–8 January 2021; pp. 2674–2683. [Google Scholar]
  20. Shi, X.; Wei, D.; Zhang, Y.; Lu, D.; Ning, M.; Chen, J.; Ma, K.; Zheng, Y. Dense cross-query-and-support attention weighted mask aggregation for few-shot segmentation. In European Conference on Computer Vision; Springer: Berlin/Heidelberg, Germany, 2022; pp. 151–168. [Google Scholar]
  21. Chen, H.; Yu, Y.; Dong, Y.; Lu, Z.; Li, Y.; Zhang, Z. Multi-context interaction network for few-shot segmentation. arXiv 2023, arXiv:2303.06304. [Google Scholar]
  22. Snell, J.; Swersky, K.; Zemel, R. Prototypical networks for few-shot learning. Adv. Neural Inf. Process. Syst. 2017, 30, 2153. [Google Scholar]
  23. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention is all you need. Adv. Neural Inf. Process. Syst. 2017, 30, 1–11. [Google Scholar]
  24. Zhang, G.; Kang, G.; Wei, Y.; Yang, Y. Few-shot segmentation via cycle-consistent Transformer. arXiv 2021, arXiv:2106.02320. [Google Scholar]
  25. Tian, Z.; Zhao, H.; Shu, M.; Yang, Z.; Li, R.; Jia, J. Prior guided feature enrichment network for few-shot segmentation. IEEE Trans. Pattern Anal. Mach. Intell. 2020, 44, 1050–1065. [Google Scholar] [CrossRef] [PubMed]
  26. Lang, C.; Cheng, G.; Tu, B.; Han, J. Learning what not to segment: A new perspective on few-shot segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 8057–8067. [Google Scholar]
  27. Everingham, M.; Eslami, S.M.A.; Gool, L.V.; Williams, C.K.I.; Winn, J.; Zisserman, A. The pascal visual object classes challenge: A retrospective. Int. J. Comput. Vis. 2015, 111, 98–136. [Google Scholar] [CrossRef]
  28. Hariharan, B.; Arbeláez, P.; Girshick, R.; Malik, J. Simultaneous detection and segmentation. In Proceedings of the Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, 6–12 September 2014, Proceedings, Part VII 13; Springer: Berlin/Heidelberg, Germany, 2014; pp. 297–312. [Google Scholar]
  29. Lin, T.; Maire, M.; Belongie, S.; Hays, J.; Perona, P.; Ramanan, D.; Dollár, P.; Zitnick, C. Microsoft coco: Common objects in context. In Proceedings of the Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, 6–12 September 2014, Proceedings, Part V 13; Springer: Berlin/Heidelberg, Germany, 2014; pp. 740–755. [Google Scholar]
  30. Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.P.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. An imperative style, high-performance deep learning library. Adv. Neural Inf. Process. Syst. 1912, 32, 8026. [Google Scholar]
  31. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
  32. Yang, B.; Liu, C.; Li, B.; Jiao, J.; Ye, Q. Prototype mixture models for few-shot semantic segmentation. In Proceedings of the Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020, Proceedings, Part VIII 16; Springer: Berlin/Heidelberg, Germany, 2020; pp. 763–778. [Google Scholar]
  33. Boudiaf, M.; Kervadec, H.; Masud, Z.I.; Piantanida, P.; Ayed, I.B.; Dolz, J. Few-shot segmentation without meta-learning: A good transductive inference is all you need? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 13979–13988. [Google Scholar]
  34. Zhang, B.; Xiao, J.; Qin, T. Self-guided and cross-guided learning for few-shot segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 8312–8321. [Google Scholar]
  35. Sun, G.; Liu, Y.; Liang, J.; Gool, L.V. Boosting few-shot semantic segmentation with Transformers. arXiv 2021, arXiv:2108.02266. [Google Scholar]
Figure 1. Visualization of the mask generation pipeline.
Figure 1. Visualization of the mask generation pipeline.
Mathematics 12 02936 g001
Figure 2. Illustration of our proposed Global–Local Query-Support Cross-Attention (GLQSCA).
Figure 2. Illustration of our proposed Global–Local Query-Support Cross-Attention (GLQSCA).
Mathematics 12 02936 g002
Figure 3. The structure of the mask–feature mixer.
Figure 3. The structure of the mask–feature mixer.
Mathematics 12 02936 g003
Figure 4. Global–Local Query-Support Cross-Attention in n-shot (n > 1) setting.
Figure 4. Global–Local Query-Support Cross-Attention in n-shot (n > 1) setting.
Mathematics 12 02936 g004
Figure 5. Qualitative results of the designed GLQSCA on the PASCAL-5i under one-shot setting.
Figure 5. Qualitative results of the designed GLQSCA on the PASCAL-5i under one-shot setting.
Mathematics 12 02936 g005
Figure 6. Qualitative results of the designed GLQSCA on the PASCAL-5i under five-shot setting.
Figure 6. Qualitative results of the designed GLQSCA on the PASCAL-5i under five-shot setting.
Mathematics 12 02936 g006
Figure 7. Visualization of the failure cases of the proposed GLQSCA on PASCAL-5i with the Resnet50 backbone.
Figure 7. Visualization of the failure cases of the proposed GLQSCA on PASCAL-5i with the Resnet50 backbone.
Mathematics 12 02936 g007
Table 1. Quantitative results on PASCAL-5i and COCO-20i under one-shot and five-shot settings. The underlined results denote the second-best performance, while the best results are highlighted in bold.
Table 1. Quantitative results on PASCAL-5i and COCO-20i under one-shot and five-shot settings. The underlined results denote the second-best performance, while the best results are highlighted in bold.
PASCAL-5i [8]
BackboneModelsTypeOne-ShotFive-Shot
Fold-0Fold-1Fold-2Fold-3MIoUFB-IoUFold-0Fold-1Fold-2Fold-3MIoUFB-IoU
ResNet-50PPNet [12]Prototype52.762.857.447.755.2-60.370.069.460.765.1-
PMM [32]52.067.551.549.855.2-55.068.252.951.156.8-
RPMM [32]55.266.952.650.756.3-56.367.354.551.057.3-
RePRI [33]59.868.362.148.559.7-64.671.471.159.366.6-
CECNet [13]61.568.762.249.560.5-66.770.968.159.166.2-
PEFNet [25]61.769.555.456.360.873.363.170.755.857.961.973.9
SCL [34]63.070.056.557.761.871.964.570.957.358.762.972.8
TRFS [35]62.970.756.557.561.9-65.071.255.560.963.2-
QPENet [15]64.570.863.257.964.175.468.273.967.264.768.579.5
SiGCN [14]64.669.264.658.864.375.568.572.166.565.768.278.3
DCAMA [20]Pixel-wise66.071.359.357.363.574.970.373.563.565.667.578.8
GLQSCA (Ours)Pixel-wise+Prototype67.572.359.659.064.675.771.075.564.265.969.179.7
ResNet-101CWT [18]Prototype56.965.261.248.858.0-62.670.268.857.264.7-
DoG-LSTM [19]57.067.256.154.358.7-57.368.561.556.360.9-
QPENet [15]67.073.263.760.166.077.169.875.566.866.369.681.1
DAN [16]Pixel-wise54.768.657.851.658.271.957.969.060.154.960.572.3
CyCTR [24]69.372.756.558.664.3-73.574.058.660.266.6-
HSNet [17]67.372.362.063.166.277.671.874.467.068.370.480.6
DCAMA [20]65.371.363.258.364.477.670.773.666.761.868.080.7
GLQSCA (Ours)Pixel-wise+Prototype66.269.764.459.264.978.272.071.267.564.068.781.0
Swin-BHSNet [17]Pixel-wise67.974.060.367.067.377.972.277.564.072.671.681.2
DCAMA [20]72.273.864.367.169.378.575.777.172.074.874.982.9
GLQSCA (Ours)Pixel-wise+Prototype73.575.265.567.870.579.277.078.273.376.376.283.5
COCO-20i [29]
ResNet-50PPNet [12]Prototype36.526.526.019.727.2-48.931.436.030.636.7-
PMM [32]29.334.827.127.329.6-33.040.630.333.334.3-
RPMM [32]29.536.828.927.030.6-33.842.033.033.335.5-
TRFS [35]31.834.936.431.433.6-35.441.742.336.138.9-
RePRI [33]31.238.133.333.034.0-38.546.240.043.642.1-
CECNet [13]37.941.335.237.938.1-44.351.245.246.146.7-
SiGCN [14]38.746.341.337.541.462.744.954.546.545.948.066.2
QPENet [15]41.547.340.939.442.367.447.352.444.344.947.269.5
CyCTR  [24]Pixel-wise38.943.039.639.840.3-41.148.945.247.045.6-
DCAMA [20]41.945.144.441.743.369.545.950.550.746.048.371.7
GLQSCA (Ours)Pixel-wise+Prototype42.346.345.142.944.270.147.552.251.749.050.173.0
ResNet-101CWT  [18]Prototype30.336.630.532.232.4-38.546.739.443.242.0-
SCL [34]36.438.637.535.437.0-38.940.541.538.739.9-
PEFNet [25]36.841.838.736.738.563.040.446.843.240.542.765.8
QPENet [15]39.845.440.540.041.467.847.254.943.445.447.770.6
DAN [16]Pixel-wise----24.462.3----29.663.9
HSNet [17]37.244.142.441.341.269.145.953.051.847.149.572.4
DCAMA [20]41.546.245.241.343.569.948.058.054.347.151.973.3
GLQSCA (Ours)Pixel-wise+Prototype42.047.146.142.844.570.849.159.654.948.453.074.2
Swin-BHSNet [17]Pixel-wise43.649.949.446.447.372.550.158.656.755.155.176.1
DCAMA [20]49.552.752.848.750.973.255.460.359.957.558.376.9
GLQSCA (Ours)Pixel-wise+Prototype50.253.553.751.052.173.856.861.560.460.559.877.5
Table 2. Efficiency analysis of n-shot inference.
Table 2. Efficiency analysis of n-shot inference.
1-Shot2-Shot3-Shot4-Shot5-Shot
Memory (MiB)32413860475253186106
Inference Time (s)0.160.260.350.560.65
Table 3. Ablation study on the effectiveness of different modules and parameters. The network with the settings of the first row was set as the baseline.
Table 3. Ablation study on the effectiveness of different modules and parameters. The network with the settings of the first row was set as the baseline.
Pixel-WisePrototypeAlphaMIoU (%)FB-IoU (%)
--57.871.9
-62.474.8
64.675.7
Table 4. Ablation study on different initial values of α .
Table 4. Ablation study on different initial values of α .
α0.00.20.40.60.81.0
MIoU(%)62.461.962.763.564.364.6
FB-IoU(%)74.874.274.674.975.275.7
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Xie, F.; Liang, G.; Chien, Y.-R. Global–Local Query-Support Cross-Attention for Few-Shot Semantic Segmentation. Mathematics 2024, 12, 2936. https://doi.org/10.3390/math12182936

AMA Style

Xie F, Liang G, Chien Y-R. Global–Local Query-Support Cross-Attention for Few-Shot Semantic Segmentation. Mathematics. 2024; 12(18):2936. https://doi.org/10.3390/math12182936

Chicago/Turabian Style

Xie, Fengxi, Guozhen Liang, and Ying-Ren Chien. 2024. "Global–Local Query-Support Cross-Attention for Few-Shot Semantic Segmentation" Mathematics 12, no. 18: 2936. https://doi.org/10.3390/math12182936

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop