Clustered-patch Element Connection for Few-shot Learning

Jinxiang Lai, Siqian Yang, Junhong Zhou, Wenlong Wu, Xiaochen Chen, Jun Liu, Bin-Bin Gao, Chengjie Wang

TL;DR

This paper introduces the Clustered-patch Element Connection (CEC) layer to solve the "semantic mismatch" problem in few-shot learning, where objects in query and support images appear at different locations and scales. By replacing noisy, dense local-to-local connections with a reliable "global-to-local" clustering mechanism, the proposed CECNet achieves state-of-the-art results in few-shot classification and provides significant boosts to segmentation and detection tasks.

What Problem Does This Paper Address?

Few-Shot Learning (FSL) aims to recognize new categories using only a handful of labeled examples. A popular strategy is to divide images into local patches and use Cross Attention to find similarities between a "support" image (the example) and a "query" image (the one to be classified).

However, the authors identify a major flaw in traditional Cross Attention: semantic mismatch. Because objects can be located anywhere and vary in size, a patch containing a "dog's ear" in the query image might be compared to a "background grass" patch in the support image. Standard methods use dense, local-to-local connections that treat all patch pairs equally, leading to unreliable similarity scores and redundant, noisy feature representations.

Comparison between traditional Cross Attention and the proposed CEC approach.

Methods

The core innovation is the Clustered-patch Element Connection (CEC) layer, which operates in two distinct stages:

  1. Patch Cluster: Instead of a simple 1-to-1 patch comparison, this operation collects all patches in the support feature map ($P$) that are semantically similar to a specific reference patch in the query ($Q$). This creates a "global" clustered-patch feature ($C^P$) that is adaptively aligned to the query's content. The authors explore four ways to implement this: MatMul, Cosine similarity, a dynamic "meta-GCN," and a Transformer-based approach.
  2. Element Connection: Once the global clustered feature $C^P$ is obtained, the model performs a concise 1-to-1 connection with the query patch. This ensures the connection is "reliable and concise" rather than "unreliable and redundant."
Figure 2: Patch Cluster and Element Connection.

Building on this layer, the authors propose CECNet, which incorporates:

  • CECM (CEC Module): An attention module to highlight mutually similar regions.
  • Self-CECM: A self-attention variant to enhance the target object's features within a single image.
  • CECD (CEC Distance): A new metric to measure similarity based on the rectified relation maps.
  • Multi-task Learning: The network is trained with auxiliary tasks like rotation prediction and global classification to learn more robust embeddings.
Figure 3: The proposed CECNet framework. The CECM is able to highlight the mutually similar regions, the CECD is utilized to measure similarity of pair-features. And Self-CECM enhances the semantic feature of target object via self-connection.

Datasets

The authors evaluated their approach across several standard benchmarks:

  • Classification: miniImageNet, tieredImageNet, and CIFAR-FS.
  • Semantic Segmentation: PASCAL-$5^i$ and COCO-$20^i$.
  • Object Detection: PASCAL VOC and MS-COCO.

Key Insights and Ideas

  • Global-to-Local is King: The shift from comparing local patches to comparing a local query patch against an aggregated global support representation is the key to overcoming spatial variance.
  • Versatility of the CEC Layer: The CEC layer isn't just for classification; it's a general-purpose feature enhancer. When plugged into existing segmentation (RePRI) and detection (MFDC) frameworks, it consistently improved performance.
  • Fixed vs. Learnable Clustering: A fascinating finding was that learnable clustering (Transformer/GCN) works best for feature enhancement (making representations more discriminative), while fixed clustering (Cosine) is more reliable as a distance metric for final classification.
  • Visual Confirmation: Class activation maps show that CECNet focuses much more accurately on the actual object compared to traditional Cross Attention (CAN), which often gets distracted by background noise.
Visualizations showing CECNet's superior ability to localize target objects.

Key Results

  • Classification: On miniImageNet (1-shot), CECNet achieved 69.32% accuracy with a ResNet-12 backbone, outperforming the previous SOTA (Meta-DeepBDC) by nearly 2%.
  • Segmentation: Adding the CEC embedding module (CECE) to the RePRI baseline resulted in a 1.1% to 1.7% mIoU improvement on PASCAL-$5^i$ and COCO-$20^i$.
  • Detection: When integrated with the MFDC detector, it achieved a 1% to 3% nAP50 boost across various splits of the PASCAL VOC dataset.

Limitations and Future Work

While the paper demonstrates strong results, a few areas remain for exploration:

  • Computational Overhead: The use of Transformers or GCNs for patch clustering adds complexity and parameters compared to simple cosine similarity.
  • Backbone Sensitivity: While tested on ResNet and WRN, the performance impact on extremely lightweight backbones (common in mobile FSL) isn't detailed.
  • Future Directions: The authors suggest that the "Patch Cluster" concept is generic and could potentially be integrated with other reconstruction-based FSL methods like FRN or CTX.

Summary updated

BibTeX
@inproceedings{lai2023clustered,
  author = {Jinxiang Lai and Siqian Yang and Junhong Zhou and Wenlong Wu and Xiaochen Chen and Jun Liu and Bin-Bin Gao and Chengjie Wang},
  title = {{Clustered-patch Element Connection for Few-shot Learning}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/110},
}
Figure