Pest detection method based on improved YOLOv8n

By improving the YOLOv8n model and combining automated pest collection devices and data labeling technology, the problems of low pest detection accuracy and difficulty in data collection in complex environments are solved, and efficient and accurate pest detection is achieved, which is suitable for real-time monitoring scenarios in the field.

CN120198935APending Publication Date: 2025-06-24SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510193914.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-21
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The prior art is in complex and changeable environment, especially when facing pests with high similarity, small size, large scale differences and overlapping, with poor detection accuracy and difficulty in collecting pest detection image data, resulting in insufficient application of the model in real-time monitoring scenarios in the field.

Method used

Based on the improved YOLOv8n pest detection method, an automated pest acquisition device composed of insect-attracting lamp equipment, solar panels and webcams is used to collect data. The annotation software is used to label images, build pest data sets, and improve the YOLOv8n model, integrating the iMLCA architecture, CSPPC module and FASFFHead detection head to improve the model's feature extraction and detection capabilities.

Benefits of technology

It realizes efficient detection of pests in complex environments, improves detection accuracy, alleviates the difficulty of collecting pest detection image data, enables the model to better adapt to real-time monitoring scenarios in the field, and improves the practicality and generalization capabilities of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120198935A_ABST
    Figure CN120198935A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of agricultural pest detection, in particular to an improved YOLOv8n-based pest detection method, which comprises the following steps of: performing data acquisition by adopting an automatic pest acquisition device consisting of trap lamp equipment, a solar panel and a network camera; constructing a pest data set; a YOLOv8n model is improved, and an iMLCA framework, a CSPPC module and a FASFFHead detection head are fused in the YOLOv8n model. According to the method, efficient detection of the pests is achieved by providing a detection model based on YOLOv8n improvement, namely a Pest-YOLOv8n algorithm, the algorithm combines an iMLCA architecture, a CSPPC module and a FASFHead detection head, higher feature extraction and detection capacity is shown, and the detection precision of the model on the pests in the complex and changeable environment is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural pest detection, and specifically to a pest detection method based on improved YOLOv8n. Background Art

[0002] Agriculture, as the primary industry in China, plays an important role in the national economy. However, during the growth process of crops, they are inevitably invaded by agricultural pests, resulting in significant economic losses to the global agricultural industry. Traditional crop pest identification relies on experts or farmers' on-site observations, which has problems such as strong subjectivity, poor timeliness, and difficulty in popularization. In recent years, certain progress has been made in crop pest identification based on image processing technology and machine learning (ML) algorithms.

[0003] However, when the existing technology is actually used, under complex and changeable environmental factors, especially when facing pests with high similarity, small size, large scale differences, and overlaps, the detection accuracy is still poor. In addition, it is difficult to collect pest detection image data, resulting in limited pest species and detection targets in the collected data, which restricts the application of the model in the field of real-time monitoring. Summary of the Invention

[0004] The purpose of the present invention is to provide a pest detection method based on improved YOLOv8n to solve the problem of poor detection accuracy when facing pests with high similarity, small size, large scale differences, and overlaps, as well as the problem that it is difficult to collect pest detection image data, resulting in limited pest species and detection targets in the collected data, which restricts the application of the model in the field of real-time monitoring in the wild.

[0005] To achieve the above purpose, the present invention provides the following technical solution: A pest detection method based on improved YOLOv8n, including the following steps:

[0006] S1. Data collection: An automated pest collection device composed of an insect trap light device, a solar panel, and a network camera is used for data collection. The insect trap light device emits light waves of a specific frequency to attract field pests, and the network camera conducts real-time monitoring and transmits the pest image data to the cloud server for storage;

[0007] S2. Dataset annotation: The pest images obtained in step S1 are annotated using annotation software to construct a pest dataset;

[0008] S3. Construct the Pest - YOLOv8n model:

[0009] Improve the YOLOv8n model by integrating the iMLCA architecture, the CSPPC module, and the FASFFHead detection head into the YOLOv8n model, where:

[0010] The iMLCA architecture is formed by integrating the CNN architecture with a lightweight hybrid local channel attention mechanism. It extracts local features through the inverted residual structure iRMB and enhances global feature fusion through the hybrid local channel attention mechanism, improving the model's ability to capture feature information.

[0011] The CSPPC module is redesigned by introducing lightweight PartialConv into the C2f module and replacing the C2f module in the original YOLOv8n model. By stacking multiple PConv convolutions, it reduces redundant calculations and memory access, and more efficiently extracts spatial features.

[0012] The FASFFHead detection head is designed based on the adaptive feature fusion ASFF method, dynamically adjusting the fusion weights of features at different scales, and improving the model's detection performance for pests at different scales.

[0013] S4. Model training and testing: Input the pest dataset obtained in step S2 into the Pest-YOLOv8n feature extraction network in step S3 for feature extraction to obtain feature maps at different scales, classify and regress the feature maps, calculate the loss, complete model training, use the trained model to test the test set, achieve pest detection, and evaluate the detection effect.

[0014] Preferably, the automated pest collection device in step S1 further includes a cloud server for storing the pest image data transmitted by the network camera. The working process of the automated pest collection device includes: the insect attracting lamp device emits light waves within a specific frequency range to attract field pests. After the pests fly into the lamp, they fall into the water and drown. The network camera monitors in real time and transmits the pest image data to the cloud server for storage in JPG format.

[0015] Preferably, the annotation software in step S2 is Labelme.

[0016] Preferably, the evaluation of the detection effect in step S4 includes ablation experiments and comparative experiments to verify the performance improvement of the improved model.

[0017] Compared with the prior art, the beneficial effects of the present invention are:

[0018] 1. The present invention realizes the efficient detection of pests by proposing a detection model improved based on YOLOv8n, namely the Pest-YOLOv8n algorithm. This algorithm combines the iMLCA architecture, the CSPPC module, and the FASFFHead detection head, demonstrating stronger feature extraction and detection capabilities, effectively improving the detection accuracy of the model for pests in complex and variable environments. Specifically, the iMLCA architecture integrates the advantages of CNN and the spatial-channel hybrid attention mechanism, enhancing the model's ability to capture features; the CSPPC module aims to more efficiently extract spatial features with less computational effort, reducing redundant computational amounts and parameter quantities; the FASFFHead detection head solves the consistency problem between different feature scales, improving the detection performance of the model, thereby significantly enhancing the detection accuracy for pests.

[0019] 2. The present invention also alleviates the problem of difficult collection of pest detection image data to a certain extent by forming an automated pest collection device and collecting a pest dataset. It automatically collects pest images using devices such as insect-trapping lights and annotates them through open-source software, constructing an image dataset containing various pests, providing data support for the training and testing of the model. This enables the model to better adapt to field real-time monitoring scenarios, improving the practicality and generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 Schematic diagram of the automated pest collection device in the pest detection method based on improved YOLOv8n of the present invention;

[0021] Figure 2 Image of the dataset in the pest detection method based on improved YOLOv8n of the present invention;

[0022] Figure 3 Overall framework of the Pest-YOLOv8 in the pest detection method based on improved YOLOv8n of the present invention and block diagram of its constituent modules;

[0023] Figure 4 Schematic block diagram of the working principle of MLCA in the pest detection method based on improved YOLOv8n of the present invention;

[0024] Figure 5 Schematic block diagram of the module structures of iMLCA and MLCA in the pest detection method based on improved YOLOv8n of the present invention;

[0025] Figure 6 Schematic block diagram of the working principle of PConv in the pest detection method based on improved YOLOv8n of the present invention;

[0026] Figure 7Schematic block diagram of the CSPPC module structure of the pest detection method based on improved YOLOv8n of the present invention;

[0027] Figure 8 Schematic block diagram of the working principle of ASFF of the pest detection method based on improved YOLOv8n of the present invention;

[0028] Figure 9 Comparison results of ablation experiments of different modules of the pest detection method based on improved YOLOv8n of the present invention

[0029] Figure 10 Schematic diagram of the detection results of pest samples of the pest detection method based on improved YOLOv8n of the present invention. Detailed implementation manners

[0030] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0031] In recent years, certain progress has been made in the identification of crop pests based on image processing technology and machine learning (ML) algorithms. Traditional machine learning frameworks usually consist of two main parts: a feature extractor and a classifier. Manually designed features such as scale-invariant feature transform (SIFT), histogram of oriented gradient (HOG), and bag of features (BOF) are representatives among them. Commonly used classifiers include the K-nearest neighbor classification algorithm and support vector machine (SVM). However, in complex recognition tasks, the performance of manually designed features is often poor, and incorrect features may be extracted, thus affecting the recognition effect.

[0032] In contrast, due to its excellent feature extraction ability, Deep Learning (DL) has shown significant advantages in improving recognition accuracy. Nevertheless, in the complex environment of multi-class pests, the recognition performance of the Convolutional Neural Networks (CNN) model still has deficiencies. At the same time, due to problems such as its complex structure and large computational amount, the CNN model is restricted in its practical applications in edge devices. Therefore, developing a model with stronger recognition ability and lighter weight has become a key research direction to promote the development of pest recognition technology.

[0033] Traditional machine vision methods mainly rely on features such as color, shape, texture, and threshold for analysis. However, in the natural environment, changes in lighting, weather, and shadows pose great challenges to the detection of crop pests. To address these problems, the combination of deep learning technology and Convolutional Neural Networks (CNN) has been introduced to overcome the limitations of manually designed features. Research shows that this technology has high feasibility in pest detection tasks. In 2021, Wang Jin et al. improved the Feature Pyramid Network (FPN) in Faster-RCNN, optimized the feature maps for multi-scale object detection, and achieved a mean average precision (mAP) of 96.69% in the detection of 5 species of stored-grain pests, while realizing a stored-grain pest monitoring system. Xu Degang et al. improved Faster-RCNN by introducing a pyramid pooling module and optimizing the loss function, making the mAP of this model reach 89.42% and 90.12% respectively under the self-made whiteboard background and stored-grain background. Teng et al. proposed the MSR-RCNN model, which designed a multi-scale super-resolution feature enhancement module, effectively improving the detection accuracy of small-sized and highly similar pests, and finally reaching an mAP of 67.4% on the self-built dataset. Zhang et al. proposed an improved YOLOX real-time high-performance detection model, incorporating an efficient channel attention mechanism (ECA), a hard swish activation function, and a focal loss function, thus enhancing the image feature extraction ability, improving the speed and accuracy of detection, and finally making the mean precision (mAP) of cotton pest and disease detection reach 94.60%. Li et al. proposed an improved algorithm for vegetable disease detection based on YOLOv5s, optimized the CSP, FPN, and NMS modules in YOLOv5s, eliminated external environmental interference, enhanced the multi-scale feature extraction ability, and improved the detection range and performance, making the mAP of vegetable disease detection reach 93.1%.

[0034] However, most current methods are based on the two-stage object detection models of the R-CNN series, and these models have significant deficiencies in detection speed. The existing object detection models have poor detection accuracy for pests with high similarity, small size, large scale differences, and overlapping. In addition, it is difficult to collect pest detection image data, resulting in limited pest species and detection targets in the collected data, and insufficient application in real-time monitoring scenarios in the wild.

[0035] Please refer to Figure 1-9 , the present invention provides a technical solution: a pest detection method based on improved YOLOv8n, including the following steps:

[0036] S1. Data collection: Use an automated pest collection device composed of an insect trap light device, a solar panel, and a network camera to collect data. The insect trap light device emits light waves of a specific frequency to attract field pests, and the network camera conducts real-time monitoring and transmits the pest image data to the cloud server for storage. The automated pest collection device also includes a cloud server for storing the pest image data transmitted by the network camera;

[0037] The working process of the automated pest collection device includes: the insect trap light device emits light waves within a specific frequency range to attract field pests. After the pests fly to the light and fall into the water and drown, the network camera conducts real-time monitoring and transmits the pest image data to the cloud server for storage in JPG format;

[0038] S2. Dataset annotation: Use the open-source annotation software Labelme to annotate the pest images obtained in step S1 to construct a pest dataset;

[0039] S3. Construct the Pest-YOLOv8n model:

[0040] Improve the YOLOv8n model by integrating the iMLCA architecture, the CSPPC module, and the FASFFHead detection head into the YOLOv8n model, where:

[0041] The iMLCA architecture is formed by integrating the CNN architecture with a lightweight hybrid local channel attention mechanism. It extracts local features through the inverted residual structure iRMB and enhances global feature fusion through the hybrid local channel attention mechanism, improving the model's ability to capture feature information;

[0042] The CSPPC module is redesigned by introducing the lightweight PartialConv (PConv) into the C2f module and replacing the C2f module in the original YOLOv8n model. By stacking multiple PConv convolutions, redundant calculations and memory access are reduced, and spatial features are extracted more efficiently;

[0043] The FASFF detection head is designed based on the Adaptive Scale Feature Fusion (ASFF) method, which dynamically adjusts the fusion weights of features at different scales to improve the model's detection performance for pests of different scales;

[0044] S4. Model training and testing: Input the pest dataset obtained in step S2 into the Pest-YOLOv8n feature extraction network in step S3 for feature extraction to obtain feature maps of different scales. Classify and regress the feature maps, calculate the loss, complete the model training, and use the trained model to test the test set to achieve pest detection. Through ablation experiments and comparative experiments, evaluate the performance improvement of the improved model on the detection effect.

[0045] The present invention provides a specific implementation method of a pest detection method based on improved YOLOv8n, including the following steps:

[0046] S1. Data collection: To better collect images of field crop pests, the present invention uses an automated pest collection device composed of a pest lamp device, a solar panel, and a network camera for data collection, as Figure 1 shown. The working process of the automated pest collection device is as follows:

[0047] The pest lamp device powered by the solar panel can emit light waves within a specific frequency range to attract field pests. When the pests fly towards the lamp, they will fall into the water and lose their flying ability, and can only drown in the water container. The water in the container needs to be replaced in a timely manner. The network camera powered by the solar panel with a 4G data card can conduct real-time monitoring and transmit the pest image data to the cloud server for storage in JPG format. Users can use terminal devices such as computers to remotely view and screen the pest images. The image data collected in this embodiment was collected by multiple pest lamp image collection devices deployed in Guangzhou and Qingyuan cities, Guangdong Province from May 28, 2023 to September 1, 2023. By screening 2805 images containing crane flies, leaf beetles, Spodoptera frugiperda, tussock moths, crickets, locusts, mole crickets, and stink bugs from the pest monitoring data, a pest detection dataset Pest was constructed. Some pest image samples in this dataset are as Figure 2 shown;

[0048] S2. Dataset annotation: Use the open-source annotation software Labelme to annotate the pest images obtained in step S1 to construct a pest dataset;

[0049] S3. Aiming at the problems that most existing algorithms have slow detection speed on the pest dataset, are difficult to cope with complex and changeable environments, and have poor detection effects on small target pests, a model improved based on YOLOv8n is proposed, namely the Pest-YOLOv8n model;

[0050] The environment for model training is as follows:

[0051] Based on the Ubuntu system and the PyTorch framework. The main configuration of the computer hardware is an i9-9900k CPU and a GeForce RTX 3090 GPU. CUDA 11.0, CUDNN 8.0.1 and Python 3.8 are installed. The training environments for different algorithms are the same, and the training parameters are set as follows: the batch size of the model is set to 32, the maximum number of iterations is set to 300, and if the model performance does not improve within 50 consecutive epochs, the training stops. The image input size is set to 640x640 pixels, the initial learning rate is 0.01, the cyclic learning rate is 0.2, the momentum parameter is 0.937, and the weight decay coefficient is 0.0005. In addition, in the classification of the prediction boxes obtained after non-maximum suppression processing, the prediction boxes with a confidence greater than the 0.5 threshold are defined as positive samples, otherwise they are defined as negative samples;

[0052] The specific improvements based on the YOLOv8n model are as follows:

[0053] The efficient spatial feature extraction ability of the convolutional kernel and the effectiveness of the attention mechanism have been well established in the field of computer vision. In this embodiment, efforts are made to integrate the capabilities of convolution and the attention mechanism, and the iMLCA structure is proposed. The performance improvement of the fused module on the model is more significant than using convolution or the attention mechanism alone. In addition, CSPPC is introduced to replace C2f, aiming to extract spatial features more efficiently with less computational effort, improving the accuracy while reducing redundant computational effort and the number of parameters. Finally, based on the adaptive feature fusion method (ASFF), FASFFHead is designed to replace the original detection head to solve the consistency problem between different feature scales and improve the detection performance of the model, where:

[0054] iMLCA architecture: As one of the most widely used components in computer vision, the attention mechanism can help the neural network pay more attention to important features and reduce the influence of some unnecessary features. The Mixed local channel attention (MLCA) module is a novel lightweight hybrid local channel attention mechanism. The MLCA module integrates channel information and spatial information, as well as local information and global information to improve the expression effect of the network. The working principle of MLCA is as Figure 4As shown, the input feature map (C, H, W) is first processed by local average pooling (LAP) and global average pooling (GAP). Local pooling focuses on the features in local regions, while global pooling captures the statistical information of the entire feature map. The features after local pooling and the features after global pooling both go through a 1D convolution (Conv1d) for feature transformation. The 1D convolution here is used to compress the feature channels while keeping the spatial dimensions unchanged. After the 1D convolution, the features are reshaped to adapt to subsequent operations. For the features after local pooling, after using 1D convolution and reshaping, they are combined with the original input features through a "multiplication" operation (X). For the features after global pooling, after 1D convolution and reshaping, they are combined with the local pooling features through an "addition" operation. This step fuses the global context in the feature map. Finally, the feature map processed by local and global attention goes through an unpooling (UNAP) operation again to restore to the original spatial dimensions.

[0055] Although MLCA enhances the perception of details by adopting local modeling, in small object detection, especially in the pest detection task with a large number of small-sized pests, local features may be masked by high-level semantic information and are easily interfered by complex background information, resulting in insufficient performance for small objects. Therefore, in this embodiment, a module iMLCA based on the combination of a lightweight CNN architecture and MLCA attention is designed. The performance improvement of the fused module is more significant than using convolution or the attention mechanism alone, as Figure 5 shown, where Figure 5 (a) in is the schematic block diagram of the iMLCA module structure, and (b) is the schematic block diagram of the MLCA module structure. By adopting an inverted residual structure iRMB to model local features and the hybrid local spatial channel attention of MLCA to model global features, the defect of MLCA attention in small object detection is effectively solved, realizing the efficient detection of small-sized pests;

[0056] CSPPC module: In the feature map of a convolutional neural network, there is a large amount of similar or repetitive information between different channels, which is also called feature map redundancy. In many cases, some channels of the feature map may contain features highly similar to other channels, which means that when performing the forward propagation of the network, the repeated processing of this part of the information does not provide additional useful information, but instead increases the computational cost and the overhead of memory access. To solve the above problems, a lightweight PartialConv (PConv) is introduced into the C2f module and redesigned as the CSPPC module, which replaces the C2f module in the original YOLOv8n model. That is, the CSPPC module is formed by introducing PartialConv (PConv) on the basis of the C2f module and redesigning it based on the principle of PConv. The basic principle of PConv (partial convolution) is as Figure 6As shown, specifically, PConv dynamically selects channels in the input channels to apply conventional convolution for spatial feature extraction, while keeping the remaining channels unchanged. Compared with conventional convolution and depth convolution, PConv reduces the computational amount and computational complexity by performing calculations on fewer channels. On the other hand, although calculations are only performed on a part of the input channels, the remaining channels are still useful in the subsequent pointwise convolution (PWConv) layer, allowing feature information to flow through all channels, thus achieving fast and efficient operations. Therefore, in this embodiment, the CSPPC module is redesigned based on PConv to replace the C2f module, as Figure 7 shown. By stacking multiple PConv convolutions, redundant calculations and memory access are reduced simultaneously, and spatial features are extracted more efficiently;

[0057] FASFFHead Detection Head: In the pest detection task, pests usually have different scales and distributions, especially on the water surface. The sizes of these targets vary greatly, and it is possible for small insects to large pests to appear in the same scene. In traditional object detection methods, although multi-scale feature maps are used to handle this size variation problem, due to the fixed and inflexible fusion method of different scale features, the model may not be able to fully capture the detailed differences between different scales, especially when facing small targets. To solve this problem, an adaptive spatial feature fusion (ASFF) module is introduced in this embodiment, and its basic principle is as Figure 8 shown. ASFF can dynamically adjust the fusion weights of different scale features according to the content of the feature maps at each scale, thus more effectively fusing multi-scale features. Specifically, ASFF learns an adaptive weighting coefficient for feature maps at different scales, enabling the model to flexibly adjust the fusion degree between feature maps according to information such as the size, position, and morphology of pests in the image. This method enhances the model's detection ability for small targets (such as tiny pests on the water surface) and improves the comprehensive detection performance for targets of different scales, large, medium, and small, in complex backgrounds. In this embodiment, based on the ASFF module, a detection head FASFFHead suitable for the water surface pest detection task in the light trap scenario is designed, and a small target detection layer is added on the basis of the original detection head to further improve the model's detection ability for small target pests;

[0058] S4. Model Training and Testing: Input the pest dataset obtained in step S2 into the Pest-YOLOv8n feature extraction network in step S3 for feature extraction to obtain feature maps of different scales. Classify and regress the obtained feature maps, perform feature reconstruction operations on the regression results to obtain more refined feature maps, and on this basis, perform classification and regression operations again, calculate the loss, complete model training, use the trained model to test the test set, realize the detection of pests, and evaluate the detection effect by verifying the performance improvement of the improved model through ablation experiments and comparative experiments;

[0059] The ablation experiment and comparative experiment are as follows:

[0060] Ablation Experiment: As Figure 9 shown, adding the iMLCA module of this embodiment to the YOLOv8n model increased the mAP by 3.6%, indicating that the addition of the iMLCA module improved the network's ability to capture feature information. Replacing the C2f of the YOLOv8n model with the CSPPC module reduced the floating-point operation amount by 32.1% and increased the mAP by 1.1%, which indicates that the CSPPC module can effectively reduce the complexity of the model. After replacing the detection head with FASFFHead, the mAP increased by 5.3%. The combination of iMLCA, CSPPC, and FASFFPoseHead improved the model's detection performance for small target pests and increased the mAP by 6.6%.

[0061] The actual detection results of the model on some pest samples are as Figure 10 shown, where the circled pests indicate missed detections.

[0062] The experimental results show that the detection accuracy of the improved YOLOv8 for pests has been greatly improved, from 81.6% to 88.2%, while the computational complexity has only increased from 8.4G to 9.6G. Compared with various existing mainstream detection algorithms, the improved YOLOv8n shows great advantages in the detection performance under complex and variable environmental factors.

[0063] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device.

[0064] Although embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A pest detection method based on improved YOLOv8n, characterized by: The following steps are involved: S1. Data collection: Data collection is performed using an automated pest collection device consisting of an insect trap lamp device, a solar panel, and a network camera. The insect trap lamp device releases light waves of a specific frequency to lure field pests, and the network camera performs real-time monitoring and transmits pest image data to a cloud server for storage; S2, data set annotation: annotate the pest images obtained in step S1 using annotation software to construct a pest data set; S3. Build the Pest-YOLOv8n model: The YOLOv8n model is improved by integrating the iMLCA architecture, CSPPC module, and FASFFHead detection head into the YOLOv8n model. The iMLCA architecture is a fusion of the CNN architecture and the lightweight hybrid local channel attention mechanism. It extracts local features through the inverted residual structure iRMB and enhances global feature fusion through the hybrid local channel attention mechanism, thus improving the model's ability to capture feature information. The CSPPC module is a redesign of the C2f module by introducing lightweight PartialConv, and replaces the C2f module in the original YOLOv8n model. By stacking multiple PConv convolutions, it reduces redundant calculations and memory accesses, and extracts spatial features more efficiently. The FASFFHead detection head is designed based on the adaptive feature fusion ASFF method, which dynamically adjusts the fusion weights of features of different scales to improve the model's detection performance for pests of different scales. S4, model training and testing: The pest dataset obtained in step S2 is input into the Pest-YOLOv8n feature extraction network in step S3 for feature extraction, feature maps of different scales are obtained, the feature maps are classified and regressed, the loss is calculated, the model training is completed, the trained model is used to test the test set, the pests are detected, and the detection effect is evaluated.

2. The pest detection method based on improved YOLOv8n according to claim 1, characterized in that: The automated pest collection device in step S1 further includes a cloud server for storing pest image data transmitted by a network camera. The working process of the automated pest collection device includes: an insect attractant lamp device releases light waves within a specific frequency range to attract field pests, and the pests fall into the water and drown after flying into the lamp. The network camera performs real-time monitoring and transmits the pest image data to the cloud server for storage in JPG format.

3. The pest detection method based on improved YOLOv8n according to claim 1, characterized in that: The labeling software in step S2 is Labelme.

4. The pest detection method based on improved YOLOv8n according to claim 1, characterized in that: The evaluation of the detection effect in step S4 includes ablation experiments and comparative experiments to verify the performance improvement of the improved model.

Citation Information

Cited By

  • Pest information acquisition system for smart agriculture

    CN121708470A

  • A pest information acquisition system for smart agriculture

    CN121708470B