A rice common disease diagnosis system based on image recognition technology
Patent Information
- Application Number
- CN202610984614.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-09-18
AI Technical Summary
如公开号CN109711471A采用传统卷积神经网络来实现水稻病害识别,其在田间光照不均、杂草遮挡、图像噪声等复杂场景下,对病斑特征提取不充分,易发生漏检、误检;同时由于该模型结构复杂、计算开销大,对硬件要求高,无法在普通终端设备部署,且仅停留在算法识别层面,未配套可视化操作系统,实际落地性差
[0041] 1. The disease diagnosis system of this invention has high recognition accuracy and strong anti-interference ability. This invention embeds the SE attention mechanism on the basis of YOLOv8s to enhance the ability to extract lesion features and effectively resist interference from field light, noise and weeds. The average recognition accuracy of six common rice diseases, namely rice blast, bacterial blight, brown spot, sheath blight, stripe leaf blight and stripe leaf blight, is close to 90%. The precision, recall and F1-score are all better than traditional convolutional networks and native YOLOv8s.
Smart Images

Figure CN122780944A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of smart agriculture, computer vision, and deep learning image recognition technology, specifically to a diagnostic system for common rice diseases based on image recognition technology. Background Technology
[0002] Rice is a major food crop in my country, with a wide planting area and a large economic impact. Rice diseases can cause reduced yields and deterioration in quality, seriously threatening national food security and the economic benefits of farmers. Common rice diseases mainly include six categories: rice blast, bacterial blight, brown spot, sheath blight, leaf streak, and rice stripe.
[0003] Currently, there are three main methods for diagnosing rice diseases: First, manual visual inspection by farmers, which relies entirely on personal planting experience and has a very high misdiagnosis rate for early-stage small lesions and diseases with similar symptoms; second, field inspection by agricultural technicians, which has limited coverage and slow response, and cannot meet the real-time monitoring needs of large-scale contiguous rice fields; and third, laboratory instrument testing, which has high detection accuracy, but is cumbersome, time-consuming, and has high equipment and maintenance costs, making it difficult to implement in rapid field diagnosis scenarios.
[0004] With the application of deep learning technology in agricultural vision, existing rice disease identification solutions have many shortcomings. For example, CN109711471A uses a traditional convolutional neural network to identify rice diseases. However, in complex scenarios such as uneven lighting, weed obstruction, and image noise, it fails to fully extract lesion features, easily leading to missed or false detections. Furthermore, due to the model's complex structure, high computational cost, and demanding hardware requirements, it cannot be deployed on ordinary terminal devices and only focuses on algorithmic recognition without a supporting visual operating system, resulting in poor practical applicability. In addition, most existing technologies only achieve single image classification functions, failing to support video or batch image detection, thus lacking comprehensive functionality and failing to meet the diverse detection needs of modern agriculture.
[0005] Therefore, to overcome the shortcomings of traditional manual diagnosis (low efficiency, high false positive rate, long laboratory testing cycle, high hardware cost), and existing image recognition models (insufficient extraction of small lesion features, weak anti-interference ability, high false negative and false positive rates in complex field environments, complex model structure, high computing power requirements, and difficulty in deployment on ordinary terminals), and to address the limitations of existing technologies (lack of visual user interface, high user threshold, and support for only single-scene detection), a lightweight, high-precision, anti-interference, and visually interactive rice disease diagnosis system with integrated detection of single images, batch images, and videos, and automatic result statistics and export, has become an urgent technical problem to be solved in this field. Summary of the Invention
[0006] To address the problems existing in the prior art, the present invention aims to provide a diagnostic system for common rice diseases based on image recognition technology, which can be applied to the intelligent detection, identification, and integrated online and offline diagnosis of various diseases in field rice.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0008] A diagnostic system for common rice diseases based on image recognition technology is disclosed. The system is developed entirely in Python, with the backend based on the PyTorch deep learning framework to build an improved YOLOv8s model, and the frontend based on the PyQt5 framework to build a visual human-computer interaction interface. The overall process of the system includes dataset collection, image annotation, data augmentation, model training, frontend and backend development, system integration and deployment.
[0009] The system operating environment includes both hardware and software environments.
[0010] The hardware environment used for model training was an Intel i7-12700F CPU and a GeForce RTX 3090 GPU; the system deployment was a regular desktop or portable computer, which could run normally even without a high-end graphics card.
[0011] The software environment uses Windows 10 or later as the operating system, Python 3.8.10 as the development language, PyTorch 1.8.0 as the deep learning framework, PyQt5 as the interface development framework, OpenCV as the image processing tool, and LabelImg as the data annotation tool.
[0012] The system adopts a three-layer architecture, including a data layer, a business logic layer, and a view layer. The three layers are independent and decoupled, and interact bidirectionally with each other.
[0013] Furthermore, the data layer is responsible for rice disease image / video acquisition, dataset annotation, data augmentation, image standardization preprocessing, and detection result storage and export, providing standardized data for model training and online detection;
[0014] Furthermore, the business logic layer, which is the core algorithm layer of the system, is an improved model based on the PyTorch framework with YOLOv8s+SE attention mechanism, responsible for inference operations such as image feature extraction, lesion localization, disease classification, and result filtering.
[0015] Furthermore, the view layer is the system's visualization and interaction layer. It develops an operation interface based on the PyQt5 framework and is responsible for receiving user commands and displaying the original image, detection and annotation results, and statistical data.
[0016] Furthermore, the data layer is designed in detail as follows:
[0017] The data layer includes a dataset acquisition unit, a data annotation unit, a data augmentation unit, and an image preprocessing unit.
[0018] The dataset collection unit, in conjunction with field photography and publicly available agricultural datasets, collected images of six diseases: rice blast, bacterial blight, brown spot, sheath blight, stripe blight, and stripe leaf blight. It also supplemented the images with samples of healthy rice leaves and suspected diseased leaves, for a total of 10,855 images.
[0019] The data annotation unit uses the LabelImg open-source annotation tool to select rice lesion areas within the image using the smallest rectangular box and annotate the disease category; the annotation file is in TXT format, corresponding one-to-one with the JPG image, and the label content includes the target category, the center coordinates of the annotation box, the box width, and the box height, and the format is adapted to the YOLO series models.
[0020] The data augmentation unit calls OpenCV functions to perform image cropping, horizontal flipping, vertical flipping, multi-angle rotation, brightness adjustment, adding Gaussian noise, and adding salt-and-pepper noise to simulate complex field shooting environments. Data augmentation is performed only on the training and validation sets; the original images are retained for testing to ensure the authenticity and validity of the test results. Data augmentation can expand sample diversity and effectively prevent model overfitting.
[0021] The image preprocessing unit performs size unification and pixel normalization on the images and video frames input to the system, removes blurry and invalid images, and outputs image data that conforms to the YOLOv8s model input standard.
[0022] Furthermore, the detailed design of the business logic layer is as follows:
[0023] The core of the business logic layer is an improved model of YOLOv8s+SE channel attention mechanism. The improved model is built on the PyTorch framework and embeds the SE channel attention mechanism on the basis of the native YOLOv8s network. Through model training and inference, the model's ability to extract important features is enhanced.
[0024] Furthermore, the native YOLOv8s network uses a C2f module in the backbone network to extract shallow texture and deep semantic features; the neck network uses an FPN+PAN multi-scale feature fusion structure to adapt to the detection of lesions of different sizes; and the output end uses an anchor-free detection strategy to directly predict the location, size and disease type of lesions.
[0025] Furthermore, the SE channel attention mechanism embeds the SE channel attention module into the end of the C2f module connecting the neck network and the detection head of the YOLOv8s network, and at the multi-scale feature fusion node. Through compression and excitation operations, it adaptively adjusts the feature channel weights, strengthens the effective features of lesions, suppresses background interference such as weeds, soil, and light, and improves the ability to identify small lesions and similar diseases.
[0026] Furthermore, in the model training and inference phases, the optimizer used during the training phase is stochastic gradient descent (SGD), with a batch size of 32 and a maximum number of iterations of 300. After the model converges, the optimal weight file is saved. During the inference phase, the weights are loaded, and redundant detection boxes are removed using a non-maximum suppression algorithm, resulting in the output of structured detection results.
[0027] Furthermore, the detailed design of the view layer is as follows:
[0028] The view layer is developed based on PyQt5 + Qt Designer and adopts the MVC design pattern. It includes a functional interaction area, a result display area, a data statistics area, and a result export area.
[0029] Furthermore, the functional interaction area is equipped with five function buttons: single image detection, batch image detection, video detection, start detection, and result export, which receive user operation commands and transmit them to the backend;
[0030] Furthermore, the result display area is divided into an image display sub-area and a target details sub-area, which displays the detection image with labeled boxes, disease names, and confidence levels in real time, while also displaying detailed information such as lesion coordinates and size;
[0031] Furthermore, the data statistics area records the serial number, image name, detection time, disease type, target quantity, detection time, and storage path in a table format;
[0032] Furthermore, the results export function supports exporting statistical data to Excel format, and the labeled images are saved separately for easy archiving and data analysis.
[0033] The overall workflow of the rice common disease diagnosis system based on image recognition technology of this invention is as follows:
[0034] (1) Preliminary preparation: Complete dataset collection, annotation, and data augmentation; train and save the YOLOv8s+SE model weights based on PyTorch;
[0035] (2) System startup: Run the Python main program, load the PyQt5 interface and model weights, and complete the front-end and back-end initialization;
[0036] (3) Data import: The user selects a single image, an image folder or a video file, and the system automatically completes the image preprocessing;
[0037] (4) Model detection: The preprocessed data is fed into the backend model to complete feature extraction, lesion detection and disease classification;
[0038] (5) Results feedback: The backend sends the detection results back to the frontend interface, displaying the labeled images and statistical tables;
[0039] (6) Results export: Users can export detection data and images as needed to complete a diagnostic process.
[0040] The beneficial effects of this invention are as follows:
[0041] 1. The disease diagnosis system of this invention has high recognition accuracy and strong anti-interference ability. This invention embeds the SE attention mechanism on the basis of YOLOv8s to enhance the ability to extract lesion features and effectively resist interference from field light, noise and weeds. The average recognition accuracy of six common rice diseases, namely rice blast, bacterial blight, brown spot, sheath blight, stripe leaf blight and stripe leaf blight, is close to 90%. The precision, recall and F1-score are all better than traditional convolutional networks and native YOLOv8s.
[0042] 2. This invention is based on the native YOLOv8s network and adds an improved model with an SE channel attention mechanism. It has a small number of parameters, fast inference speed, does not require high-end computing equipment, can be deployed on ordinary desktop computers and portable terminals, and is suitable for field mobile detection scenarios. The system is lightweight and has a low deployment threshold.
[0043] 3. The disease diagnosis system of this invention has comprehensive functions and wide adaptability to various scenarios. It supports three types of detection: single image, batch image, and video, and covers a variety of operation scenarios such as single-point sampling and whole-field inspection, realizing full automation of detection, statistics, and export.
[0044] 4. This invention is based on a visual graphical interface developed using PyQt5. No programming knowledge is required, and farmers and grassroots agricultural technicians can quickly get started. It is suitable for large-scale promotion and application. The system is simple to operate and has strong universality.
[0045] 5. This invention is based on the native YOLOv8s network and adds an SE channel attention mechanism, which has excellent simulation capabilities. It simulates complex field environments through multi-dimensional data enhancement. The dataset has rich scenarios, and the model can maintain stable recognition performance on rice disease images in different regions and at different growth stages. Attached Figure Description
[0046] Figure 1 _This is a three-layer architecture design diagram of the rice disease diagnosis system of the present invention;
[0047] Figure 2 _This is a flowchart illustrating the model design of the rice disease diagnosis system of the present invention;
[0048] Figure 3 The diagram below shows the usage flowchart of the rice disease diagnosis system of this invention. Detailed Implementation
[0049] To illustrate the invention in detail, the following embodiments are described in conjunction with the accompanying drawings to facilitate a better understanding of the invention by those skilled in the art, but these embodiments do not limit the invention in any way. It should be noted that the embodiments represent preferred embodiments of the invention and are intended to illustrate the conditions under which the invention can be implemented, rather than limiting the experimental conditions.
[0050] Example:
[0051] The three-layer architecture design diagram of the rice common disease diagnosis system based on image recognition technology of this invention is shown below. Figure 1 As shown, it mainly includes a data layer, a business logic layer, and a view layer. The implementation process of the data layer includes image acquisition, LabelImg annotation, multi-method data augmentation, and image preprocessing. The implementation of the business logic layer is mainly based on the YOLOv8s+SE improved model built on the PyTorch framework, which enhances the basic model's ability to extract features of lesions. The view layer is a visualization page developed based on PyQt5, which supports the detection of single images, batch images, and video content, and also supports the export of detection results.
[0052] The model design flowchart of the system of this invention is as follows: Figure 2 As shown, the specific implementation steps are as follows:
[0053] S1. Hardware and Software Configuration: This invention uses the Windows 10 operating system and deploys Python 3.8.10, PyTorch 1.8.0, PyQt5, OpenCV, and all dependency libraries of LabelImg. The training device is configured with an Intel i7-12700F CPU, 32GB of RAM, and a GeForce RTX 3090 12GB GPU; the deployment device is a regular office desktop computer.
[0054] S2, Data Collection: Field images of rice diseases were collected using mobile phones, as well as publicly available scientific research datasets. The original datasets included eight types of diseases: rice blast, bacterial blight, brown spot, sheath blight, stripe blight, stripe leaf blight, healthy leaves, and suspected diseased leaves. The image pixels were standardized to 640*640.
[0055] S3, Dataset Augmentation: OpenCV was used to perform data augmentation operations such as flipping, rotating, brightness adjustment, and adding noise, which expanded the original dataset and obtained a total of 10,855 images of rice diseases.
[0056] S4, Data Labeling: All images were labeled using the LabelImg tool to generate YOLO format label files. The images were then divided into a training set of 7653 images, a validation set of 1786 images, and a test set of 1416 images in an 8:1:1 ratio. The labeled data is shown in Table 1.
[0057] Table 1. Statistics on the total number of images and bounding boxes used for model training in this invention.
[0058] Training set 7653 23642 Validation set 1786 5376 Test set 1416 4586 Total number 10855 33604
[0059] The dataset is categorized into rice blast, bacterial blight, brown spot, sheath blight, stripe leaf spot, and rice stripe leaf blight. Additionally, two new categories, suspected disease and normal images, have been added to improve model accuracy. Specific disease type classification statistics are shown in Table 2.
[0060] Table 2. Detailed statistics on the total number of specific disease images and annotation boxes used for model training in this invention.
[0061] Rice blast 1528 5327 Leaf blight 1674 5407 Brown spot 1344 3378 Sheath blight 1179 4007 Leaf scald 843 3271 Striped leaf blight 1203 3751 Suspected disease 1760 5132 Normal 1324 3331 Total 10855 33604
[0062] S5, Model Selection and Design: Based on the PyTorch framework, the native YOLOv8s network is loaded. The core of this invention is to embed the SE attention module at the end of the C2f module of the neck network and the multi-scale feature fusion node to complete the construction of the improved model.
[0063] S6, Model Training: Set training parameters: Optimizer SGD, initial learning rate 0.01, momentum 0.937, weight decay 0.0005, batch size 32, number of iterations 300. Input the dataset into the model for training. Stop training when the model loss and accuracy no longer change, and save the optimal weight file.
[0064] S7, Model Validation: This invention primarily uses four performance metrics—precision, recall, mAP50, and mAP50-95—to compare and determine whether the invention improves performance compared to the basic YOLOv8s model. Validation was performed on a large dataset, and the data comparisons are shown in Table 3.
[0065] Table 3 Performance Comparison Results of the Basic YOLOv8s Model and the YOLOv8s+SE Model of This Invention
[0066] Base yolov8s 0.825 0.844 0.859 0.559 Invention yolov8s+SE 0.878 0.892 0.891 0.572
[0067] As shown in Table 3, it is clear that the YOLOv8s+SE model shows significant improvements in several key performance indicators compared to the original YOLOv8s model. For example, in terms of precision, the YOLOv8s model achieves 0.825, while the YOLOv8s-SE model improves to 0.878, indicating enhanced accuracy in target identification. Recall increases from 0.844 to 0.892, suggesting a reduction in misclassification of targets as background. mAP50 (mean precision at an intersection-union threshold of 0.5) improves from 0.859 to 0.891, and mAP50-95 (mean precision from an intersection-union threshold of 0.5 to 0.95) improves from 0.559 to 0.572. These improvements demonstrate that the model has achieved comprehensive optimization of detection accuracy for all target categories at different intersection-union thresholds, resulting in improved overall detection performance.
[0068] After completing key steps such as model training and page design, the deployment, application, and use of this invention can proceed. The specific usage process is as follows: Figure 3 As shown.
[0069] S8, System Startup: This refers to the automatic loading interface of the project system involved in this invention.
[0070] S9, diagnostic scenario selection, specifically the following functions can be implemented.
[0071] S9.1 Single Image Selection: Field images of diseases are captured and imported through the "Single Image Detection" function. The system completes the detection within 1 second, and the interface displays the annotation box, disease name, and confidence level.
[0072] S9.2 Batch Image Selection: Select a folder to store multiple images, and the system will automatically traverse and detect them, recording all data in a table.
[0073] S9.3 Video Selection: Import field inspection videos, and the system will detect and annotate them frame by frame in real time;
[0074] S10, Disease Diagnosis Result Analysis: Displays the detection image with a labeled box, disease name, and confidence level, while also showing detailed information such as lesion coordinates and size.
[0075] S11, Export Diagnostic Results: Click the export button to save the statistical table as an Excel file and archive the labeled images locally.
[0076] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to specific embodiments, the present invention is not limited thereto. For those skilled in the art, without departing from the technical principles of the present invention, various improvements, modifications, or equivalent substitutions can be made to the relevant embodiments based on the above-described technical content, including any changes or equivalent transformations made according to the core solution of the present invention, all of which fall within the protection scope of the present invention.
Claims
1. A diagnostic system for common rice diseases based on image recognition technology, characterized in that, The system comprises a data layer, a business logic layer, and a view layer; these layers interact bidirectionally. The data layer includes a dataset acquisition unit, a data annotation unit, a data augmentation unit, and an image preprocessing unit, used to complete rice disease image acquisition, dataset annotation, multi-method data augmentation, and image standardization processing. The business logic layer uses a YOLOv8s+SE improved disease recognition model built on the PyTorch framework to extract lesion features and complete disease detection and classification. The view layer uses a visual interactive interface developed on the PyQt5 framework to receive user operation commands and display detection results and statistical data.
2. The rice common disease diagnosis system based on image recognition technology according to claim 1, characterized in that, The data annotation unit uses the LabelImg tool to generate files that correspond one-to-one between JPG images and TXT tags. The tags include the disease category, annotation box coordinates, and annotation box size.
3. The rice common disease diagnosis system based on image recognition technology according to claim 1, characterized in that, The data augmentation unit implements image cropping, flipping, rotation, brightness adjustment, adding Gaussian noise, and adding salt and pepper noise based on OpenCV, and only performs data augmentation on the training set and validation set.
4. The rice common disease diagnosis system based on image recognition technology according to claim 1, characterized in that, The YOLOv8s+SE improved disease identification model includes a trunk C2f module, a neck FPN+PAN feature fusion module, an SE channel attention module, and a detection head; the SE channel attention module is embedded at the end of the C2f module where the neck FPN+PAN feature fusion module connects to the detection head, as well as at the multi-scale feature fusion node.
5. The rice common disease diagnosis system based on image recognition technology according to claim 4, characterized in that, The SE channel attention module is used to adaptively adjust the feature channel weights, enhance the response of rice lesion features, and suppress field background interference.
6. The rice common disease diagnosis system based on image recognition technology according to claim 1, characterized in that, The view layer includes a functional interaction area, a result display area, a data statistics area, and a result export area; the functional interaction area is equipped with a single image detection button, a batch image detection button, a video detection button, a start detection button, and a result export button.
7. The rice common disease diagnosis system based on image recognition technology according to claim 6, characterized in that, The results display area includes an image display sub-area and a target details sub-area. The image display sub-area is used to display the detection image with labeled boxes and confidence levels; the target details sub-area is used to display the coordinates and size information of the lesions.
8. The rice common disease diagnosis system based on image recognition technology according to claim 6, characterized in that, The data statistics area is in tabular form, recording image name, detection time, disease type, number of targets, detection time, and file path; the result export button supports exporting Excel spreadsheets and annotated images.
9. The rice common disease diagnosis system based on image recognition technology according to claim 1, characterized in that, The system was developed using Python. The optimizer for model training was SGD, with an initial learning rate of 0.01, a batch size of 32, and 300 iterations.
10. The rice common disease diagnosis system based on image recognition technology according to claim 1, characterized in that, The system detects six rice diseases: rice blast, bacterial blight, brown spot, sheath blight, leaf streak, and rice stripe blight. It supports three detection methods: single image, batch images, and video.
Citation Information
Patent Citations
A rice disease image recognition method based on a deep convolutional neural network
CN109711471A