Abstract:In real-world scenarios where pest data is scarce, existing pest image recognition methods are prone to overfitting, resulting in insufficient model expressiveness. To address this issue, a novel few-shot field pest image classification method that integrated metric learning with transfer learning was proposed. Firstly, the ECA Pyramid ResNet12 model was pretrained on the mini ImageNet dataset. Subsequently, PN was chosen as the classifier, and cosine similarity was selected as the distance metric. The ECA channel attention mechanism was then incorporated into the metric module to enhance pest image feature representation by capturing inter-channel dependencies, with a kernel size of 3. Additionally, a feature pyramid structure was employed to capture the local and multi-scale features of pest images. After evaluating different pooling combinations, the 2 × 2 + 4 × 4 pooling combination was selected. Finally, a meta-dataset comprising 20 self-built categories of Lepidoptera pest images was utilized for meta-training and meta-testing of the model. Experimental results demonstrated that under 3-way 5-shot and 5-way 5-shot conditions, the proposed method achieved accuracy rates of 91.16% and 87.26% , respectively, surpassing the most relevant works of the past two years, SSFormers and DeepBDC, by 4.58 percentage points and 1.35 percentage points. The proposed model effectively enhanced the feature representation of target images in few-shot learning, providing a methodological reference for the automatic identification of field pests in data-scarce scenarios.