Solution for SnakeCLEF 2022 by Tackling Long-tailed Categorization

Lingfeng Yang, Xiang Li, Renjie Song, Kexin Zhu, Gang LiCLEF (Working Notes) 2022 · OpenReview

Introduction

Identifying snake species from photographs is a challenging fine-grained classification task. In the SnakeCLEF 2022 competition, this challenge was compounded by a severe long-tail distribution and the need to integrate geographic metadata. The dataset contains over 300,000 images across 1,572 species, but the distribution is highly skewed: while common species have thousands of images, many rare species have fewer than ten.

The long-tailed distribution of the SnakeCLEF 2022 dataset, where a few 'head' classes dominate the sample count while many 'tail' classes have very few examples.

Methodology

The proposed solution utilizes a high-capacity Vision Transformer (ViT) backbone, specifically ViT-Large and ViT-Huge, pretrained using Masked Autoencoders (MAE). To address the specific hurdles of the competition, two primary innovations were introduced: Effective Logit Adjustment Loss (ELAL) and Statistic-aware Post-processing.

Effective Logit Adjustment Loss (ELAL)

Standard cross-entropy loss often fails on imbalanced datasets as models tend to over-fit to majority classes. The authors implemented ELAL, which builds upon Logit Adjustment by incorporating the "Effective Number" of samples. This approach provides a mathematical "nudge" during training, preventing the model from being overly biased toward common classes without sacrificing performance on rare ones.

Statistic-aware Post-processing

Rather than attempting complex multi-modal feature fusion, the researchers employed a parameter-free geographic filter. By constructing a prior matrix from training metadata (mapping species to countries), they applied a hard filter during inference.

The inference pipeline: a ViT model generates a softmax probability vector, which is then refined via a Hadamard product with a one-hot geographic prior vector.

As shown in the diagram, the model's visual prediction is multiplied element-wise by a one-hot vector representing species known to exist in the target location. This effectively zeroes out impossible predictions based on geography, avoiding the complexities of training a multi-modal network.

Results and Discussion

This approach secured second place in the SnakeCLEF 2022 challenge with a private leaderboard F1 score of 0.84565. Ablation studies highlighted the critical role of the metadata filter, which improved the validation F1 score from 0.758 to 0.873. Furthermore, the ELAL loss significantly outperformed standard cross-entropy, particularly for the rarest "tail" classes, where accuracy improved from 0.79 to 0.93 in the top-500 tail categories.

The study also confirmed that increasing input resolution (up to 448x448) and using larger model backbones consistently improved performance in fine-grained tasks, as higher resolution allows the model to capture the subtle visual differences necessary for species identification.

Conclusion

The success of this solution demonstrates that for complex, long-tailed classification tasks, combining state-of-the-art transformer architectures with robust loss functions and simple, domain-specific post-processing filters can be more effective than complex multi-modal training schemes. Future work may address the distribution gap between training and test metadata to make geographic filters more resilient to noise.

Summary updated

BibTeX
@inproceedings{yang2022solution,
  author = {Lingfeng Yang and Xiang Li and Renjie Song and Kexin Zhu and Gang Li},
  title = {{Solution for SnakeCLEF 2022 by Tackling Long-tailed Categorization}},
  booktitle = {CLEF (Working Notes)},
  year = {2022},
  url = {https://openreview.net/forum?id=czWuARN5dy},
}
Figure