2.1. Dataset
All 4,547 field images of corn pests used in this study were collected from 2023 to 2024, and all model training, comparison and generalization verification experiments were conducted from 2025 to 2026.The corn pest dataset adopted in this study contains 4,547 field-shot images covering nine typical corn pest species. All raw images were captured under complex natural field environments with variable illumination, leaf occlusion, dense tiny pest clusters and mixed pest coexistence scenarios. All samples were randomly split into training, validation and test subsets following a fixed 7:2:1 ratio. This article supplements
Table 1, quantifying the names of each type of pest and the exact total number of labelled boxes for that category. Significant unbalanced distribution of annotated objects across classes exists, which is naturally caused by inconsistent pest population density in actual corn fields. During the training phase, online data augmentation strategies including random scaling and rotation are applied to alleviate the negative impact of class imbalance on model training.
Figure 1a displays category name and sample graph of nine pests while
Figure 1b describes sample quantity distribution for each pest type.
Most images in the dataset contain multi-target scenes: a single image may simultaneously contain multiple individuals of the same pest species or mixed individuals of different pest taxa. No multi-target samples are discarded during dataset construction, so the dataset can fully restore the complex overlapping and occlusion conditions of real farmland, which helps improve the multi-target detection robustness of the model.
Complete Dataset Annotation Workflow:
(1)Image pre-filtering: Excessively blurred, overexposed and distorted images were manually eliminated, retaining 4,547 valid field images for subsequent annotation. All reserved images were unified to a consistent resolution standard, and invalid low-quality samples were excluded.
(2)Initial manual labeling: The whole labeling work was undertaken by three postgraduate students with basic digital image processing capabilities. All annotators received systematic pre-training on morphological discrimination of nine corn pests, mastering the differentiation standards between target pests and background interference such as crop leaves, soil and weeds. The LabelImg annotation tool was used to draw bounding boxes for all visible pest individuals and export YOLO-format TXT label files.
(3)Inter-annotator cross verification: To evaluate labeling consistency, 20% of all images were randomly selected as a verification subset, and re-labeled independently by all three annotators. Two core consistency metrics were calculated: average bounding box IoU between different annotators reached 0.92, and the category label agreement rate was 96.4%. All samples with large box position deviation or conflicting category judgments were marked for subsequent expert review to eliminate subjective labeling bias.
(4)Full expert secondary validation: Two professional plant protection experts from the College of Agriculture conducted full-image inspection on all annotated samples. With reference to standard pest specimen atlases, the experts corrected misclassified pest labels, missing pest bounding boxes and false annotations on background impurities. Confusing juvenile larvae and morphologically similar pest individuals were uniformly re-calibrated to guarantee taxonomic accuracy of all labels.
(5)Final format quality inspection: The authors conducted a full check of matching relations between images and annotation files. Empty label files without any targets were deleted, and formatting errors including out-of-bounds coordinate values and duplicate overlapping bounding boxes were fixed, generating the final standardized dataset for model training and testing.
2.2. RMS-YOLO
YOLO algorithm is recognized as classic single-stage detection architecture for real-time target identification, and updated YOLOv11 further optimizes network structure with better lightweight property and multi-scene adaptability, hence this paper selects YOLOv11 as baseline network. The original YOLOv11 has obvious defects in practical application: insufficient feature extraction capacity for small-size pest targets, excessive computational complexity, bulky model volume and unsatisfactory detection accuracy. Aiming at these drawbacks, this research completes targeted network optimization to build RMS-YOLOv11, and
Figure 2 and
Figure 3 separately present structural layout of primitive YOLOv11 and improved RMS-YOLOv11:
(1) Embed RFB module into the tail of YOLOv11 backbone feature extraction branch. Multi-branch convolution plus dilated convolution inside RFB expands network receptive field under the premise of controlling parameter quantity and enhances feature extraction ability for tiny pest objects;
(2) Introduce MobileNetV2 containing inverted residual and linear bottleneck structure alongside global average pooling design. Such lightweight design cuts total parameters and calculation cost effectively, and helps reduce computational burden for edge terminal deployment;
(3) Replace native standard Conv layer with self-developed Conv-SWS module. Featured slicing and adaptive enhancement operations help the network capture feature information of both large and small targets to realize balanced multi-scale identification performance.
2.2.1. RFB
Even though YOLO series gains wide usage in object detection tasks, its native feature extraction structure still needs further optimization for practical application. Plenty of existing researches proposed various feature enhancement modules to fix such defects: Liu teams built joint feature extraction unit for infrared ship inspection [
21], another research introduced global feature fusion block to lift overall feature extraction performance [
22], Mamba-based dual-branch structure and dense connection plus attention hybrid modules are also verified effective for feature optimization [
23,
24]. This work embeds RFB component at backbone output end to boost small-target feature learning capacity, and
Figure 4 displays internal construction of RFB module.
RFB is composed of multi-branch ordinary convolution and dilated convolution two parts. For multi-branch part, 1 × 1 convolution firstly compresses channel dimension and aggregates shallow-layer feature information, followed by multi-size convolution to collect local detail features; another round of 1 × 1 convolution without activation unifies output channel dimension of each branch. Dilated convolution expands receptive field range without increasing parameter number and retains high-resolution feature data. The subsequent feature fusion operation combines two-branch output to acquire final RFB feature mAP.
Given an input feature tensor
where
C denotes the number of channels,
and
represent the height and width of the feature mAP, respectively. First, 1 × 1 convolution is used for channel compression and feature integration:
where
and
are the weight and bias of the 1 × 1 convolution kernel, σ is the activation function, and ∗ denotes the standard convolution operation. Multi-branch multi-scale convolution is then performed to capture local details at different scales:
The multi-branch features are concatenated and dimensionally aligned using 1 × 1 convolution without activation:
where
denotes channel-wise concatenation.Dilated convolution with dilation rate r is defined as:
which expands the receptive field to k + (k − 1) (r − 1) for kernel size k without increasing parameters. Finally, the multi-branch features and dilated convolution features are fused to obtain the RFB output:
The model proposed in this paper significantly enhances the network’s feature extraction and perception capabilities for small targets by integrating the multi-branch structure and dilated convolution characteristics of RFB.
2.2.2. MobileNetV2
Classical convolution networks like ResNet and VGG own excellent identification capability but suffer from parameter redundancy and huge computational overhead, limiting their deployment on resource-limited mobile embedded devices. MobileNet family is proposed to construct low-latency lightweight network, MobileNetV1 relies on depthwise separable convolution to shrink model size yet brings partial precision loss after lightweight processing [
25]; MobileNetV3 upgrades feature dimension transformation mode and introduces SE attention to improve detection performance [
26]. Different from above variants, this paper chooses MobileNetV2 as lightweight backbone, which adopts depth separable convolution, inverse residual unit and linear bottleneck design: it expands feature channel to obtain abundant high-dimensional semantic information first and reduces dimension with linear activation to avoid low-dimensional feature loss, finally outputs results after global average pooling. Such design drastically cuts calculation load and realizes lightweight deployment without severe precision drop, and
Figure 5 shows MobileNetV2 internal structure.
2.2.3. Conv-SWS
Convolution unit is the core feature extraction component of YOLO network, but built-in standard Conv exists fixed receptive field and uniform feature weight distribution defects, making it hard to adapt multi-scale pest detection under complex farmland background and causing low feature utilization efficiency. Many scholars optimized convolution structure for detection promotion: SPDConv, SD-Conv and improved Swin-based convolution all prove effective for feature loss reduction [
27,
28,
29]. Combined with SimAM attention mechanism, this research constructs Conv-SWS convolution module via feature slicing optimization.
The original global SimAM calculates pixel difference relying on full feature mAP statistics, leading small targets with similar feature value to global average to be ignored as background information. The slicing operation in Conv-SWS divides feature mAP into multiple local blocks and calculates attention weight based on block-level pixel statistics: small pest targets own larger difference against block mean value to obtain higher enhancement weight, while large-size targets keep stable feature response after feature fusion. The specific segmentation process is shown in
Figure 6.
Given an input feature mAP
the feature mAP is uniformly sliced into N × N local blocks:
where each block is
For each block
, the energy function of each pixel (x,y) is calculated as:
where
and
are the channel-wise mean and standard deviation of the block (i,j), and λ is a small constant to avoid division by zero.
The attention weight is obtained by:
Small targets have larger energy values and obtain higher weights, while large targets maintain stable recognition.
First, standard convolution extracts basic features:
Then, element-wise weighting is performed with sliced attention:
where
denotes element-wise multiplication.
Finally, batch normalization is applied to obtain the output of Conv-SWS:
This mechanism balances the feature enhancement of large and small targets and improves multi-scale detection performance.