Bacillus disease identification method based on improved YOLOv8
By improving the image preprocessing and network structure of the YOLOv8 model, the problems of small target detection and complex background interference in bacterial disease identification were solved, efficient real-time detection of agricultural edge terminals was achieved, and the recognition accuracy and generalization ability were improved.
Patent Information
- Application Number
- CN202510859550.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-17
AI Technical Summary
Existing technologies for identifying bacterial diseases have limited small target detection capabilities, severe interference from complex farmland backgrounds, and insufficient processing capabilities for blurred lesion edge processing, resulting in a high missed detection rate and widespread false detection, and making it difficult to achieve real-time detection at agricultural edge terminals.
An improved YOLOv8 model is used to enhance the lesion features through image preprocessing (CLAHE and adaptive median filtering). The CBAM attention mechanism is combined with the multi-scale fusion network structure of the GSConv module. The loss function optimization of Focal Loss and EIOU Loss is used to realize an end-to-end disease recognition system.
It significantly improves the detection performance of tiny lesions, reduces the computing power requirements of equipment, adapts to the real-time detection needs of agricultural edge terminals, improves recognition accuracy and generalization capabilities, and meets the actual needs of real-time identification in the field.
Smart Images

Figure CN120808209A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and particularly relates to a bacillosis disease recognition method based on improved YOLOv8. BACKGROUND
[0002] Bacillosis disease is an important disease type that seriously threatens the safety of food crops at present, and widely exists in the growth cycle of high-yield crops such as rice and wheat.
[0003] YOLO and Faster R-CNN target detection algorithms have achieved remarkable results in general target recognition tasks and have been preliminarily introduced into the field of agricultural disease recognition. However, for this specific task of bacillosis disease, the existing technology still faces many challenges, which are specifically as follows:
[0004] 1. Limited small target detection capability: The early disease spots of bacillosis disease usually only account for 0.1% to 1% of the image area, with weak features and low contrast. Conventional deep convolutional networks easily lose the key features of such small targets in the multi-layer abstraction process, resulting in high missed detection rate and widespread false detection.
[0005] 2. Serious interference from complex farmland background: During the image collection process, factors such as uneven lighting, leaf obstruction, and wind-induced blur often occur, and the differences in texture and color between disease spots and healthy leaves are small, making them easily hidden by background noise and reducing the model's discrimination ability and stability.
[0006] 3. When facing blurred disease spot edges and strong local interference, it is difficult to focus on key areas, resulting in attention deviation and inaccurate positioning. SUMMARY
[0007] To address the shortcomings of existing methods, the present application solves the problems of limited small target detection capability of YOLOv8 model and insufficient processing capability for blurred disease spot edges and strong local interference.
[0008] The technical solution adopted by the present application is: a bacillosis disease recognition method based on improved YOLOv8 includes the following steps:
[0009] Step 1, collect crop disease leaf images;
[0010] As a preferred embodiment of the present application, the crops include rice blast and wheat bacterial blight.
[0011] As a preferred embodiment of the present application, the image preprocessing includes: using CLAHE to enhance contrast.
[0012] As a preferred embodiment of the present application, the image preprocessing further includes: using adaptive median filtering.
[0013] As a preferred embodiment of the present application, the adaptive median filter adopts dynamic window noise suppression, and the median z of the pixels in the current window satisfies med z min z med z max If yes, enter the secondary judgment; otherwise, expand the window; in the secondary judgment, if the center pixel z xy z min z xy z max , the original value is retained; otherwise, the noise pixel is replaced by z med .
[0014] As a preferred embodiment of the present application, the local histogram clipping is performed on the image.
[0015] Step two, constructing an improved YOLOv8 model; wherein, all C2f in the Backbone network is replaced by a C2f-CBAM module, and the C2f-CBAM module is embedded in front of the output feature map of the C2f module.
[0016] As a preferred embodiment of the present application, the standard convolution module in the neck network of the improved YOLOv8 model is replaced by a GSConv module.
[0017] As a preferred embodiment of the present application, the improved YOLOv8 model adopts a fusion of Focal Loss classification loss and EIOU Loss regression loss.
[0018] As a preferred embodiment of the present application, the bacteriosis disease recognition system based on the improved YOLOv8 comprises: a memory for storing instructions executable by a processor; and a processor for executing the instructions to realize the bacteriosis disease recognition method based on the improved YOLOv8.
[0019] As a preferred embodiment of the present application, the computer readable medium storing computer program codes realizes the bacteriosis disease recognition method based on the improved YOLOv8 when executed by the processor.
[0020] The beneficial effects of the present application are:
[0021] 1. The image preprocessing mechanism suitable for complex field environment effectively enhances the expression of disease spot features and improves the recognition effect under uneven illumination and background interference;
[0022] 2. The network structure of attention mechanism and multi-scale fusion significantly improves the detection performance of the model on small, overlapping and multiple types of disease spots;
[0023] 3. Lightweight deployment capability: reduce device computing power requirement, adapt to the real-time detection needs of agricultural edge terminals;
[0024] 4. Multi-strategy training optimization and weak supervision learning mechanism: alleviate the sample shortage dilemma and improve the learning ability and generalization ability of the model;
[0025] 5. End-to-end system integration capability: realize the integration of image acquisition, processing, recognition and result output, and meet the actual needs of field real-time identification. BRIEF DESCRIPTION OF DRAWINGS
[0026] Figure 1 is the improved YOLOv8-based bacterial disease identification method flowchart of the application;
[0027] Figure 2 is the CBAM attention mechanism schematic diagram;
[0028] Figure 3 is the C2f-CBAM module schematic diagram of the application;
[0029] Figure 4 is the improved YOLOv8 model effect diagram of the application. DETAILED DESCRIPTION
[0030] The application will be further described below in conjunction with the drawings and examples, which are simplified schematic diagrams and only illustrate the basic structure of the application in a schematic manner, so they only show the components related to the application.
[0031] As shown in Figure 1 , an improved YOLOv8-based bacterial disease identification method includes the following steps:
[0032] Step 1: Collect crop disease leaf images;
[0033] Crops include rice blast and wheat bacterial wilt.
[0034] The image acquisition device for rice blast is a UAV-mounted visible light RGB camera and hyperspectral imaging;
[0035] Collection time: early morning, with obvious light changes;
[0036] Images include rice leaves and early small lesions of rice blast;
[0037] Visible light and hyperspectral images of rice leaves are collected synchronously by a UAV;
[0038] The image acquisition device for wheat bacterial wilt is a handheld portable multispectral imager;
[0039] Collection time: afternoon, with strong light and obvious partial leaf shading;
[0040] Wheat, leaf spot of bacterial wilt, the leaf spot is obvious but similar to the color of the leaf;
[0041] Collect multi-angle wheat leaf images using a handheld device.
[0042] Image preprocessing includes:
[0043] CLAHE is used to enhance contrast, and adaptive median filtering is performed to remove wind-induced blur noise; the filtered image is subjected to ORB algorithm for registration and fusion to generate a multi-channel fused image;
[0044] CLAHE uses limited contrast adaptive histogram equalization to correct uneven field illumination:
[0045] Convert the RGB image to the LAB color space, and perform block processing (8x8 grid) on the luminance channel (L channel);
[0046] The local histogram clipping threshold is set to:
[0047]
[0048] where N is the total number of pixels, B is the number of grid blocks, and a = 0.5 is an empirical coefficient.
[0049] Equalize the clipped histogram to enhance the contrast of the lesion area;
[0050] Adaptive median filtering uses dynamic window noise suppression, with the window radius r initially set to 3 and expanded to a maximum of 7;
[0051] If the median value z of the pixels in the current window satisfies: med
[0052] z min < z med < z max
[0053] Enter the second-level judgment; otherwise, expand the window;
[0054] In the second-level judgment, if the center pixel z satisfies: xy
[0055] z min < z xy < z max
[0056] Keep the original value; otherwise, replace the noise pixel with z med
[0057] Step 2, build an improved YOLOv8 model;
[0058] Step 21, improve C2F module with CBAM; CBAM channel-space dual attention mechanism
[0059] Table 1 Parameter Description
[0060]
[0061] Replace C2f module with C2f-CBAM module in Backbone, C2f-CBAM module is embedded before the output feature map of C2f module;
[0062] As Figure 3 C2f-CBAM module is shown;
[0063] As Figure 2 CBAM module schematic diagram, channel attention submodule: input feature map Global average pooling and max pooling are processed in parallel to generate channel description vector:
[0064]
[0065] Learn channel weights through fully connected layer:
[0066] W c = σ(W1δ(W0v avg +W0v max ))
[0067] Where σ is the Sigmoid function, δ is the ReLU activation, (compression ratio r = 16;
[0068] Spatial attention submodule: max pooling and average pooling along channel axis, concatenated into 7x7 convolution generates spatial weight map: W s = σ(μ 7×7 (F cat ));
[0069] Output feature map:
[0070] Step 22, multi-scale feature fusion improvement;
[0071] Introduce GSConv module (group shuffle convolution) in Neck layer, replace standard convolution: group convolution reduces computational complexity (group number g = 4), shuffle operation enhances cross-group feature interaction;
[0072] The output feature map dimension remains the original YOLOv8 design, compatible with subsequent detection heads.
[0073] Loss function design;
[0074] Classification loss: Focal Loss to solve class imbalance (rice blast vs healthy leaf)
[0075] Table 2 Parameter Description
[0076]
[0077]
[0078] where α = [0.7, 0.3], γ = 3;
[0079] Regression loss: EIOU Loss to optimize the positioning of the bounding box
[0080] Table 3 Parameter Description
[0081]
[0082]
[0083] where, C w ,C h is the minimum bounding box width and height.
[0084] The classification loss and regression loss are weighted and fused, i.e. L = λ1L reg + λ2L cls .
[0085] The model output includes the class of the lesion (rice blast), location information (bounding box coordinates), and confidence; overlapping lesions are processed through density-aware non-maximum suppression (DyNMS) to improve recall.
[0086] The improved YOLOv8 model is evaluated and deployed;
[0087] Training strategy:
[0088] Two-stage transfer learning:
[0089] Dynamic data augmentation includes: Mosaic enhancement introduces a Gaussian blur kernel (σ ∈ [0.1, 2.0]) to simulate out-of-focus
[0090] leaves; MixUp mixing coefficient λ ~ Beta(0.8, 0.8);
[0091] Table 4 Parameter Description
[0092]
[0093]
[0094] 1. Freeze Backbone, load COCO pre-trained weights, train detection head (initial learning rate 3 × 10 -3);
[0095] 2, unfreeze all layers, fine-tune the network (learning rate 1x10 -4 , AdamW optimizer).
[0096] Performance indicators include: disease recognition accuracy, average precision (mAP):
[0097] Table 5 parameter description
[0098]
[0099]
[0100] Table 6 parameter description
[0101]
[0102]
[0103] Calculate the mean value of the IoU threshold in the interval 0.5 to 0.95.
[0104] Experimental results:
[0105] Using TensorRT for FP16 quantization, the model size is compressed to 40% of the original size; deployed on the JetsonNano platform, multiple video streams are processed in parallel through a thread pool (≥15FPS);
[0106] Rice blast early detection: real-time detection of single frame delay is about 65ms, suitable for unmanned aerial vehicle edge devices; mAP@0.5 reaches 92.1%, which is 16.8% higher than the baseline YOLOv8, and the detection accuracy of early small disease spots is significantly improved; effectively support disease warning and precise pesticide application, reduce pesticide use.
[0107] Wheat bacterial leaf blight detection: model inference delay is controlled within 68ms, meeting the real-time detection requirements of portable devices; mAP@0.5 reaches 91.7%, effectively reducing missed detection caused by occlusion and complex background.
[0108] As Figure 4 The recognition effect schematic diagram; the application improves YOLOv8 based on CBAM and GSConv convolution, has wide applicability and excellent performance in different crops and environments; through multi-modal fusion, lightweight design, attention mechanism reinforcement and post-processing strategy optimization, the detection accuracy and real-time response ability of microbacterial diseases are significantly improved, and the application prospect is good.
[0109] The application adopts a double-image preprocessing mechanism: the CLAHE algorithm and the adaptive median filter are jointly applied, so that the image quality is effectively improved, and the visibility and robustness of lesion features under different illumination conditions are enhanced.
[0110] The application fuses C2f by using a CBAM attention mechanism, embeds a CBAM module at different levels of YOLOv8, fuses channel attention and spatial attention, and enhances the feature expression capability of the model on the lesion area.
[0111] The application adopts an improved spatial pyramid pooling structure, effectively captures lesion features of different scales, and improves the recognition performance on small lesions and overlapping diseases.
[0112] Based on the above ideal embodiments according to the application, through the above description, relevant personnel can make various changes and modifications without deviating from the technical idea of the application. The technical scope of the application is not limited to the contents in the specification, and the technical scope must be determined according to the scope of claims.
Claims
1. A bacillus disease identification method based on improved YOLOv8, characterized in that: The following steps are involved: Step 1: Collect images of diseased leaves of crops; Step 2: Build an improved YOLOv8 model. In the Backbone network, all C2f modules are replaced with C2f-CBAM modules. The C2f-CBAM module is embedded in the CBAM module before the output feature map of the C2f module.
2. The bacillus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: Improve the neck network of the YOLOv8 model by replacing the standard convolution module with the GSConv module.
3. The bacillus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: Crops include: Rice blast and wheat bacterial wilt.
4. The bacillus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: The images were preprocessed, including contrast enhancement using CLAHE.
5. The bacillus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: The image preprocessing also includes: using adaptive median filtering.
6. The bacillus disease identification method based on improved YOLOv8 according to claim 5, characterized in that: Adaptive median filtering uses dynamic window noise suppression, and the median value of the pixel in the current window is z med Satisfaction: z min <z med <z max , then enter the second level judgment; Otherwise expand the window; In the secondary judgment, if the center pixel z xy Satisfaction: z min <z xy <z max , retain the original value; otherwise, z med Replace noisy pixels.
7. The bacillus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: The improved YOLOv8 model adopts the fusion of Focal Loss classification loss and EIOU Loss regression loss.
8. The bacillus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: Perform local histogram cropping on the image.
9. The bacillus disease recognition system based on improved YOLOv8 is characterized by: include: a memory for storing instructions executable by the processor; A processor, configured to execute instructions to implement the bacillus disease identification method based on the improved YOLOv8 as described in any one of claims 1 to 8.
10. A computer-readable medium storing computer program code, characterized in that When the computer program code is executed by a processor, the computer program code implements the bacillus disease identification method based on the improved YOLOv8 according to any one of claims 1 to 8.