Corn disease and pest real-time detection method and system based on lightweight YOLOv8
By optimizing the YOLOv8 model and combining techniques such as depthwise separable convolution, channel attention pruning, and adaptive illumination compensation, the real-time and accuracy issues of pest and disease detection on mobile devices were resolved, enabling efficient and stable detection in cornfields.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-03
- Publication Date
- 2026-03-13
AI Technical Summary
Traditional field pest and disease detection methods are difficult to implement efficiently, in real time, and accurately on mobile devices, especially due to limitations in computing resources and environmental interference.
The YOLOv8 model is optimized using techniques such as depthwise separable convolution, channel attention pruning, knowledge distillation, and adaptive illumination compensation to reduce computational load and parameters. An enhanced spatial pyramid pooling module is integrated to adapt to the computational limitations of mobile devices and maintain stable detection under different lighting conditions.
It achieves real-time detection of 35 frames per second on devices with low computing resources, improves the accuracy of pest and disease detection, adapts to strong light and leaf shading conditions, ensures the stability and reliability of detection, and reduces equipment operating costs.
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, specifically to a real-time detection method and system for corn diseases and pests based on lightweight YOLOv8. Background Technology
[0002] With the development of intelligent and precision agricultural production, traditional field pest and disease detection methods are inefficient and limited by equipment performance and environmental interference, making it difficult to guarantee real-time performance and accuracy. YOLO series target detection algorithms are widely used in agriculture due to their high detection accuracy and real-time performance; however, when deployed on mobile devices, they struggle to achieve good performance due to computational resource limitations.
[0003] This invention improves the lightweight effect of the YOLOv8 model by using techniques such as depthwise separable convolution, channel attention pruning, and knowledge distillation, optimizes detection accuracy and speed, and enables it to adapt to the computing limitations of mobile devices. At the same time, it solves problems such as strong light interference and leaf occlusion, providing an innovative method for detecting corn diseases and pests. Summary of the Invention
[0004] To achieve the above objectives, the present invention provides the following technical solution: a real-time detection method for corn diseases and pests based on lightweight YOLOv8, comprising the following steps:
[0005] S1: Based on YOLOv8, depthwise separable convolutional reconstruction of feature extraction layers is used to replace traditional standard convolutional layers, thereby reducing the amount of convolutional computation and parameters, and alleviating the computational burden of the model.
[0006] S2: Design a pruning strategy based on channel attention mechanism. This strategy automatically identifies and removes redundant channels by evaluating the contribution of each channel to feature representation, thereby reducing computation and storage requirements and improving model efficiency.
[0007] S3: Apply the knowledge distillation method to transfer the multi-scale feature extraction capability of the trained teacher model to the lightweight student model, so that the student model can use the knowledge of the teacher model to improve the feature expression capability under limited computing resources.
[0008] S4: Develop an enhanced spatial pyramid pooling module (ASPP), which effectively improves the detection accuracy of dense pest and disease areas under the condition of corn leaf occlusion by fusing features at different scales of the image and recombining local features.
[0009] S5: Integrates an adaptive illumination compensation algorithm and uses the HSV color space conversion method to eliminate strong light interference, enabling the system to maintain stable detection performance under different lighting conditions and avoid image quality problems caused by excessively strong or weak illumination.
[0010] S6: Deploy the optimized model to edge computing devices, ensuring that the model size is compressed to 2.1MB and achieves real-time detection of 35 frames per second on the device, with an inference time of less than 18ms. It is suitable for mobile devices with low computing power, such as the Kirin 980 chip.
[0011] Preferably, the depthwise separable convolution adopts a combination structure of channel-wise convolution and point-wise convolution. By splitting the traditional convolution operation into two stages of computation, the amount of computation and parameters is further reduced, thereby improving the computational efficiency of the model.
[0012] Preferably, the channel attention mechanism employs an SE (Squeeze-and-Excitation) module or a similar structure to calculate the importance of each convolutional channel and prune low-contribution channels based on the calculation results, thereby optimizing model storage and computational efficiency.
[0013] Preferably, the knowledge distillation technique trains the student model by maximizing the similarity between the feature maps output by the student model and the teacher model, thereby effectively transferring the teacher model's knowledge of multi-scale feature extraction to the student model.
[0014] Preferably, the Enhanced Spatial Pyramid Pooling Module (ASPP) processes feature maps of different resolutions of the image in parallel using convolutional kernels of multiple scales, and then fuses these feature maps, enabling the model to effectively extract features at different scales and handle complex situations such as leaf occlusion.
[0015] Preferably, the adaptive illumination compensation algorithm uses HSV color space conversion for image preprocessing, specifically by adjusting hue (H), saturation (S), and brightness (V) to eliminate the effects of excessively strong or weak illumination, ensuring that the detection algorithm can perform stably under different illumination conditions.
[0016] Preferably, the model is compressed to 2.1MB and the inference speed on the edge computing device does not exceed 18ms, making it suitable for deployment on platforms that support mobile computing, such as the Kirin 980 chip and other low-power, high-performance chips.
[0017] A real-time corn pest and disease detection system based on lightweight YOLOv8, characterized by: including:
[0018] A: Camera equipment used to acquire images
[0019] B: Edge computing devices that integrate YOLOv8 models and perform real-time inference.
[0020] C: Deep learning model used for pest and disease classification and localization
[0021] D: Adaptive Illumination Compensation Algorithm Module
[0022] E: Enhanced spatial pyramid pooling module for improving detection accuracy in densely populated pest and disease areas.
[0023] Preferably, the edge computing device is a mobile device that supports YOLOv8 model inference and has an inference time of less than 18ms.
[0024] Compared with existing technologies, this invention provides a method and system for real-time detection of corn diseases and pests based on lightweight YOLOv8, which has the following beneficial effects:
[0025] 1. This real-time detection method and system for maize diseases and pests based on lightweight YOLOv8 significantly reduces the computational load and parameters of the model through depthwise separable convolution and channel attention pruning techniques. This enables real-time detection at 35 frames per second on mobile devices with low computing resources, with an inference time of less than 18ms, fully meeting the real-time requirements of agricultural applications. The enhanced spatial pyramid pooling module (ASPP) can handle image features of different scales, and can still accurately detect disease and pest areas, especially when maize leaves are obscured. Compared with traditional YOLOv8, the improved model significantly improves the accuracy of disease and pest detection.
[0026] 2. This real-time detection method and system for maize diseases and pests based on lightweight YOLOv8 effectively addresses the impact of complex field lighting conditions on detection accuracy through an adaptive light compensation algorithm. The system operates stably under strong light, shade, and variable lighting conditions, ensuring reliable detection results. The model is compressed to 2.1MB, making it suitable for deployment on low-power, low-storage mobile devices. Through quantization and pruning techniques, efficient inference is ensured while further reducing computational resource consumption and lowering operating costs. Detailed Implementation
[0027] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] Example
[0029] Examples of Real-Time Detection Methods and Systems for Corn Diseases and Pests Based on Lightweight YOLOv8
[0030] A real-time detection method and system for corn diseases and pests based on lightweight YOLOv8 includes the following steps:
[0031] S1: Based on YOLOv8, depthwise separable convolutional reconstruction of feature extraction layers is used to replace traditional standard convolutional layers, thereby reducing the amount of convolutional computation and parameters, and alleviating the computational burden of the model.
[0032] S2: Design a pruning strategy based on channel attention mechanism. This strategy automatically identifies and removes redundant channels by evaluating the contribution of each channel to feature representation, thereby reducing computation and storage requirements and improving model efficiency.
[0033] S3: Apply the knowledge distillation method to transfer the multi-scale feature extraction capability of the trained teacher model to the lightweight student model, so that the student model can use the knowledge of the teacher model to improve the feature expression capability under limited computing resources.
[0034] S4: Develop an enhanced spatial pyramid pooling module (ASPP), which effectively improves the detection accuracy of dense pest and disease areas under the condition of corn leaf occlusion by fusing features at different scales of the image and recombining local features.
[0035] S5: Integrates an adaptive illumination compensation algorithm and uses the HSV color space conversion method to eliminate strong light interference, enabling the system to maintain stable detection performance under different lighting conditions and avoid image quality problems caused by excessively strong or weak illumination.
[0036] S6: Deploy the optimized model to edge computing devices, ensuring that the model size is compressed to 2.1MB and achieves real-time detection of 35 frames per second on the device, with an inference time of less than 18ms. It is suitable for mobile devices with low computing power, such as the Kirin 980 chip.
[0037] Specifically, the depthwise separable convolution adopts a combination of channel-wise convolution and pointwise convolution. By splitting the traditional convolution operation into two stages of computation, the amount of computation and parameters is further reduced, thereby improving the computational efficiency of the model.
[0038] Specifically, the channel attention mechanism uses the SE (Squeeze-and-Excitation) module or a similar structure to calculate the importance of each convolutional channel and prune low-contribution channels based on the calculation results, thereby optimizing model storage and computation efficiency.
[0039] Specifically, knowledge distillation technology trains the student model by maximizing the similarity between the feature maps output by the student model and the teacher model, thereby effectively transferring the teacher model's knowledge of multi-scale feature extraction to the student model.
[0040] Specifically, the Enhanced Spatial Pyramid Pooling (ASPP) module processes feature maps of different resolutions of the image in parallel using convolutional kernels of multiple scales, and then fuses these feature maps, enabling the model to effectively extract features at different scales and handle complex situations such as leaf occlusion.
[0041] Specifically, the adaptive illumination compensation algorithm uses HSV color space conversion for image preprocessing, which includes adjusting hue (H), saturation (S), and brightness (V) to eliminate the effects of excessively strong or weak illumination, ensuring that the detection algorithm can perform stably under different illumination conditions.
[0042] Specifically, the model is compressed to 2.1MB and its inference speed on edge computing devices does not exceed 18ms, making it suitable for deployment on platforms that support mobile computing, such as the Kirin 980 chip and other low-power, high-performance chips.
[0043] A real-time corn pest and disease detection system based on lightweight YOLOv8, characterized by: including:
[0044] A: Camera equipment used to acquire images
[0045] B: Edge computing devices that integrate YOLOv8 models and perform real-time inference.
[0046] C: Deep learning model used for pest and disease classification and localization
[0047] D: Adaptive Illumination Compensation Algorithm Module
[0048] E: Enhanced spatial pyramid pooling module for improving detection accuracy in densely populated pest and disease areas.
[0049] Specifically, the edge computing device is a mobile device that supports YOLOv8 model inference with an inference time of less than 18ms.
[0050] Through the above technical solutions, this invention significantly reduces the computational load and parameters of the model by employing depthwise separable convolution and channel attention pruning techniques. This enables real-time detection at 35 frames per second on mobile devices with low computing resources, with an inference time of less than 18ms, fully meeting the real-time requirements of agricultural applications. The enhanced spatial pyramid pooling module (ASPP) can handle image features of different scales, and can still accurately detect pest and disease areas, especially when corn leaves are obscured. Compared with the traditional YOLOv8, the improved model has significantly improved the accuracy of pest and disease detection. The adaptive illumination compensation algorithm effectively solves the impact of complex field lighting conditions on detection accuracy. The system can operate stably under strong light, shadow, or variable lighting conditions, ensuring the reliability of detection results. The model is compressed to 2.1MB, making it suitable for deployment on low-power, low-storage mobile devices. Through quantization and pruning techniques, efficient inference is ensured while further reducing the consumption of computing resources and lowering the operating costs of the equipment.
[0051] Applications of depthwise separable convolution:
[0052] In the feature extraction part of YOLOv8, the original convolution operation is replaced by depthwise separable convolution. The depthwise separable convolution operation is split into two steps: first, channel-wise convolution, which performs independent convolution on each input channel, and then pointwise convolution, which linearly combines all channels through 1x1 convolution. This process greatly reduces the amount of computation and the number of parameters, thus enabling the model to run efficiently on mobile devices.
[0053] Channel attention mechanism pruning strategy:
[0054] A channel attention mechanism (e.g., the Squeeze-and-Excitation module) is employed to analyze the contribution of each channel. Specifically, the features of each channel are first compressed using global average pooling, then weights for each channel are generated using two fully connected layers, and finally, channels with lower task contributions are pruned based on their weight values. This operation significantly reduces redundant computation and improves the model's inference efficiency.
[0055] Applications of knowledge distillation technology:
[0056] The student model is trained by minimizing the difference between its output and the output of a pre-trained teacher model (especially its feature maps). The teacher model typically employs a complex, large-scale network capable of extracting rich, multi-scale features, while the student model learns these features to achieve similar performance with less computational resources.
[0057] Enhanced Spatial Pyramid Pooling Module (ASPP):
[0058] The ASPP module captures image information at different scales by using multiple convolutional kernels of different sizes in parallel. This effectively handles pest and disease areas against complex backgrounds, especially in occluded regions. The module can improve detection accuracy at different scales by reconstructing local features.
[0059] Adaptive illumination compensation:
[0060] In environments with significant lighting variations (such as strong light or shadow in a field), the input image for the model may exhibit excessive or insufficient brightness. Therefore, during the input image preprocessing stage, HSV color space conversion is used to adjust hue, saturation, and brightness separately. In particular, the V channel is modified to eliminate interference from strong light, ensuring that lighting variations do not affect the model's detection performance.
[0061] Edge computing device deployment:
[0062] After model optimization, it was deployed to edge computing-enabled devices such as the Kirin 980. Through model quantization and parameter pruning, the model size was compressed to 2.1MB. With the optimized lightweight model, the device can process 35 frames of real-time images per second, with an inference time of less than 18ms, ensuring real-time detection capabilities for corn pests and diseases in the field.
[0063] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A real-time detection method for maize diseases and pests based on lightweight YOLOv8, characterized by: Includes the following steps: S1: Based on YOLOv8, depthwise separable convolutions are used to reconstruct the feature extraction layer, replacing the traditional standard convolutional layer, thereby reducing the amount of convolutional computation and parameters, and alleviating the computational burden of the model. S2: Design a pruning strategy based on channel attention mechanism. This strategy automatically identifies and removes redundant channels by evaluating the contribution of each channel to feature representation, thereby reducing computation and storage requirements and improving model efficiency. S3: Apply the knowledge distillation method to transfer the multi-scale feature extraction capability of the trained teacher model to the lightweight student model, so that the student model can use the knowledge of the teacher model to improve the feature expression capability under limited computing resources. S4: Develop an enhanced spatial pyramid pooling module (ASPP), which effectively improves the detection accuracy of dense pest and disease areas under the condition of corn leaf occlusion by fusing features at different scales of the image and recombining local features. S5: Integrates an adaptive illumination compensation algorithm and uses the HSV color space conversion method to eliminate strong light interference, enabling the system to maintain stable detection performance under different lighting conditions and avoid image quality problems caused by excessively strong or weak illumination. S6: Deploy the optimized model to edge computing devices, ensuring that the model size is compressed to 2.1MB and achieves real-time detection of 35 frames per second on the device, with an inference time of less than 18ms. It is suitable for mobile devices with low computing power, such as the Kirin 980 chip.
2. The method for real-time detection of maize diseases and pests based on lightweight YOLOv8 according to claim 1, characterized in that: The depthwise separable convolution uses a combination of channel-wise convolution and point-wise convolution. By splitting the traditional convolution operation into two stages of computation, it further reduces the amount of computation and parameters, thereby improving the computational efficiency of the model.
3. The method for real-time detection of maize diseases and pests based on lightweight YOLOv8 according to claim 1, characterized in that: The channel attention mechanism employs the Squeeze-and-Excitation (SE) module or a similar structure to calculate the importance of each convolutional channel and prune low-contribution channels based on the calculation results, thereby optimizing model storage and computational efficiency.
4. The method for real-time detection of maize diseases and pests based on lightweight YOLOv8 according to claim 1, characterized in that: Knowledge distillation technology trains the student model by maximizing the similarity between the feature maps output by the student model and the teacher model, thereby effectively transferring the teacher model's knowledge of multi-scale feature extraction to the student model.
5. The method for real-time detection of maize diseases and pests based on lightweight YOLOv8 according to claim 1, characterized in that: The Enhanced Spatial Pyramid Pooling (ASPP) module processes feature maps of different resolutions in the image in parallel using convolutional kernels of multiple scales, and then fuses these feature maps, enabling the model to effectively extract features at different scales and handle complex situations such as leaf occlusion.
6. The method for real-time detection of maize diseases and pests based on lightweight YOLOv8 according to claim 1, characterized in that: Adaptive The illumination compensation algorithm uses HSV color space conversion for image preprocessing, specifically by adjusting hue (H), saturation (S), and brightness (V) to eliminate the effects of excessively strong or weak illumination, ensuring that the detection algorithm can perform stably under different illumination conditions.
7. The method for real-time detection of maize diseases and pests based on lightweight YOLOv8 according to claim 1, characterized in that: After compression, the model size is reduced to 2.1MB, and the inference speed on edge computing devices does not exceed 18ms, making it suitable for deployment on platforms that support mobile computing, such as the Kirin 980 chip and other low-power, high-performance chips.
8. A real-time detection system for corn diseases and pests based on lightweight YOLOv8, characterized in that: include: A: Camera equipment used to acquire images B: Edge computing devices that integrate YOLOv8 models and perform real-time inference. C: Deep learning model used for pest and disease classification and localization D: Adaptive Illumination Compensation Algorithm Module E: Enhanced spatial pyramid pooling module, used to improve detection accuracy in densely populated pest and disease areas.
9. The real-time detection system for corn diseases and pests based on lightweight YOLOv8 according to claim 8, characterized in that: The edge computing devices are mobile devices that support YOLOv8 model inference, with an inference time of less than 18ms.