ORIGINAL RESEARCH article

Front. Plant Sci.

Sec. Sustainable and Intelligent Phytoprotection

Volume 16 - 2025 | doi: 10.3389/fpls.2025.1522510

This article is part of the Research TopicCutting-Edge Technologies Applications in Intelligent Phytoprotection: From Precision Weed and Pest Detection to Variable Fertilization TechnologiesView all 6 articles

Few-Shot Object Detection for Pest Insects via Features Aggregation and Contrastive Learning

Provisionally accepted
Shuqian  HeShuqian He1*Biao  JinBiao Jin1Xuechao  SunXuechao Sun1Wenjuan  JiangWenjuan Jiang1*Fenglin  GuFenglin Gu2Fenglin  GuFenglin Gu3
  • 1海南师范大学, 海南 海口, China
  • 2浙江大学, 杭州,浙江, China
  • 3Chinese Academy of Tropical Agricultural Sciences, 万宁 海南, China

The final, formatted version of the article will be published soon.

Accurate detection of pest insects is crucial for effective agricultural pest control and improved crop yields. However, pest detection faces significant challenges due to the large number of species, considerable individual variations, limited labeled data, and environmental factors, causing traditional methods to perform poorly, especially in small-sample and multi-object detection scenarios. To address these issues, we propose a few-shot pest detection approach based on feature aggregation and supervised contrastive learning (SCL), built upon the Faster R-CNN framework. Our method enhances the feature representation capabilities for small-sample targets by effectively utilizing rich features from a support set. First, multi-scale feature extraction is conducted on both support and query sets using a Feature Pyramid Network (FPN), creating multi-scale feature maps from different backbone levels. Region of Interest (RoI) Align extracts fixed-size feature representations from each RoI. Next, a Feature Aggregation Module (FAM) with an attention mechanism models the relationships between support and query features by projecting them into query, key, and value spaces to calculate attention weights. Aggregated features are obtained through weighted summation, significantly enhancing query set feature expressiveness. To further improve discriminative ability and alleviate misclassification, SCL is employed to increase intra-class similarity and inter-class dissimilarity. Enhanced query features are mapped into a normalized contrastive learning space via a projection head, and positive and negative sample pairs are constructed based on label information. Supervised contrastive loss clusters similar samples while separating dissimilar ones. To mitigate sample imbalance issues common in contrastive learning, class weights are integrated into the loss function, assigning higher importance to minority classes. Additionally, Focal Loss is utilized in classification to emphasize challenging samples. Through multi-task learning, tasks of localization, classification, feature aggregation, and contrastive learning are jointly optimized via a comprehensive loss function design. Experimental evaluations demonstrate excellent performance in pest detection tasks, particularly in multi-object and minority-class detection scenarios. Ablation studies confirm significant contributions from each proposed module. In conclusion, our proposed method effectively tackles critical challenges in few-shot and multi-object pest detection, presenting substantial practical value for improving agricultural pest management and crop productivity.

Keywords: Feature aggregation, Contrastive learning, Few-shot learning, object detection, Pest

Received: 13 Nov 2024; Accepted: 19 May 2025.

Copyright: © 2025 He, Jin, Sun, Jiang, Gu and Gu. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) or licensor are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

* Correspondence:
Shuqian He, 海南师范大学, 海南 海口, China
Wenjuan Jiang, 海南师范大学, 海南 海口, China

Disclaimer: All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.