Chili disease detection system and method based on improved YOLOv7

By improving YOLOv7 technology, a pepper disease detection system was developed, which solved the problem of subjectivity and inefficiency of pepper disease identification and grading in the prior art, and achieved high accuracy and high efficiency of disease identification and grading.

CN119763104APending Publication Date: 2025-04-04SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411881060.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The prior art has problems such as strong subjectivity, low efficiency and low diagnostic accuracy in identification and grading of pepper diseases, and cannot meet the requirements of large-scale, fast and accurate identification.

Method used

A pepper disease detection system based on improved YOLOv7 is adopted, including data collection, data preprocessing, YOLOv7 module, performance estimation, input, identification, grading and output modules. Capsicum fruits and leaves are characterized and disease identification are identified through deep learning technology, and disease degree is graded.

Benefits of technology

Accurate identification and grading of pepper diseases is achieved, the accuracy and efficiency of detection is improved, complex backgrounds and occlusions can be better handled, and the needs of large-scale, fast and accurate identification are met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119763104A_ABST
    Figure CN119763104A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of pepper disease detection, and discloses a pepper disease detection system and method based on improved YOLOv7, and the system comprises a data collection module, a data preprocessing module, a YOLOv7 module, a performance estimation module, an input module, an identification module, a grading module and an output module. According to the method, the lightweight GhostNetV2 is used as the feature extraction network of the model to improve the detection speed, secondly, the cascade fusion network replaces the original feature fusion network to improve the expression ability of the model in a complex background, multi-scale feature extraction and fusion are realized, and finally, the convolution block attention module is introduced, so that the detection efficiency is improved. Important features in the image are focused on, and the accuracy and robustness of the model are improved. Compared with the prior art, the method has better detection performance and distinguishing capability, can better treat shielding among the peppers and identify different disease spots in each background, and achieves the beneficial effects of identifying pepper leaf and fruit diseases and grading the disease degrees of the pepper leaf and fruit diseases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pepper disease detection, and in particular to a pepper disease detection system and method based on improved YOLOv7. Background Art

[0002] Pepper is one of the most economical and widely used agricultural vegetables in the world. It has a wide range of applications in medicine, cosmetics and other fields; it is also an essential ingredient in our dishes and contributes to dietary nutrition. However, due to climate change, pest invasion and natural disasters, pepper plants are susceptible to various diseases during their growth. These diseases can reduce the yield and quality of pepper crops and cause serious economic losses to farmers. Therefore, the segmentation of pepper diseases and the grading of disease severity are of great significance for the evaluation of agricultural production and market economy. Therefore, timely and accurate identification of pepper diseases is essential for effective disease control and sustainable development of the pepper industry.

[0003] At present, the identification method of pepper diseases mainly relies on manual observation and empirical judgment, which is highly subjective, inefficient and has low diagnostic accuracy. In addition, for large-scale pepper disease surveys, traditional methods are not only very time-consuming and labor-intensive, but also prone to errors and omissions, and cannot meet the requirements of large-scale, rapid and accurate identification. Summary of the invention

[0004] Technical issues solved: In view of the shortcomings of the prior art, the present invention provides a pepper disease detection system and method based on improved YOLOv7, which are capable of identifying pepper leaf and fruit diseases and grading their disease severity. The identification and grading are accurate and efficient, achieving the advantages of pepper disease identification and grading research, and solving the problems of the above-mentioned technologies.

[0005] Technical solution: To achieve the above object, the present invention provides the following technical solutions: a pepper disease detection system based on improved YOLOv7, the system comprising a data acquisition module, a data preprocessing module, a YOLOv7 module, a performance estimation module, an input module, a recognition module, a classification module and an output module; The data acquisition module is used to use a mobile phone to shoot videos to obtain pepper fruit and leaf data containing different diseases; The data preprocessing module preprocesses the pepper data video taken by the mobile phone to obtain a picture data set, and marks the diseased pepper leaves and fruits, and finally divides the data set; The YOLOv7 module extracts features from pepper fruits and leaves to obtain identification results of pepper fruits and leaves with diseases, and the learning method is based on improved YOLOv7 network deep learning; The performance estimation module is used to measure the detection results, test their recall rate and precision, and if it is lower than 0.9, return to the target detection module, improve the solution, and re-extract features; The input module inputs the image information required for pepper disease detection into the model; The recognition module is used to recognize pepper leaves and fruits in the input video or image; The grading module is used to calculate the segmentation results of the recognition module and grade the degree of pepper disease; The output module is used to output and present the disease identification and classification data to the terminal display device, and at the same time output the calculated results in a weighted manner; The data acquisition module, data preprocessing module, YOLOv7 module, performance estimation module, input module, recognition module, classification module, and output module are communicatively connected in sequence.

[0006] Preferably, the method of the data preprocessing module is mean normalization, and its feature scaling formula is: ; in, is the average normalized value, is the original value.

[0007] Preferably, the performance estimation module compares the received data with the feature extraction result of the target detection module, and the comparison result includes three parts: TP is the positive class determined as the positive class, FN is the positive class determined as the negative class, and FP is the negative class determined as the positive class; Select recall and precision as evaluation indicators of the algorithm; The calculation formula for recall is: ; The accuracy is calculated as follows: ; The closer all evaluation indicators are to 1, the better the effect.

[0008] Preferably, the data acquisition module calculates:

[0009] in: is the total number of frames extracted from the video; is the total duration of the video.

[0010] Preferably, the data preprocessing module calculates:

[0011]

[0012]

[0013] in: is the total data volume; is the number of samples in the validation set, accounting for 15% of the total data.

[0014] Preferably, the feature extraction process in the YOLOv7 module is:

[0015]

[0016]

[0017]

[0018]

[0019] in: is the size of the grid; is the indicator function, indicating the The grid cell Whether a bounding box is responsible for detecting the target object; is the center coordinate of the predicted bounding box; To predict the width and height of the bounding box; is the confidence of the predicted bounding box; is the true category probability.

[0020] Preferably, the recall rate of the performance estimation module is calculated as:

[0021] in: True positive examples are the number of samples correctly predicted by the model as positive; False negative examples are the number of samples that are actually positive but are mistakenly predicted as negative by the model.

[0022] Preferably, the accuracy of the performance estimation module is calculated as:

[0023] in: False positive examples are the number of samples that are actually negative but are mistakenly predicted as positive by the model.

[0024] Preferably, the performance estimation module comprehensive indicator: F1 score is calculated as: .

[0025] A pepper disease detection method based on improved YOLOv7, the detection method comprising the following steps: Step 1: Walk through the pepper fields manually and use a mobile phone to take direct photos of the pepper fruits and leaves. The shooting angles include vertical downward shooting from above and 45 degrees diagonally downward shooting from the side. Step 2: Preprocess the captured video data, capture a video screenshot every 0.5-1s through the Python program, manually select the available images and randomly distribute them into training and test sets in a ratio of 9:1; Step 3: Use the LabelImg tool to label the pepper objects in the experimental data, generate the corresponding XML label file, and complete the overall construction of the dataset based on the COCO dataset; Step 4: Put the labeled data into the target detection module, perform deep learning on the improved YOLOv7, and use the recall rate and accuracy as the evaluation indicators of the algorithm. If the evaluation index is less than 0.9, improve the solution and retrain the detection model with the wrong recognition data; Step 5. Users can input the required test images through the visualization platform. The model can identify diseased pepper fruits and leaves. At the same time, it can realize the classification study of pepper diseases based on the calculation of the proportion of the diseased area to the total area of ​​leaves and fruits.

[0026] Compared with the prior art, the present invention provides a pepper disease detection system and method based on improved YOLOv7, which has the following beneficial effects: 1. The present invention uses the lightweight GhostNetV2 as the feature extraction network of the model to improve the detection speed. Secondly, the cascade fusion network (CFNet) replaces the original feature fusion network, improves the model's expression ability under complex backgrounds, and realizes multi-scale feature extraction and fusion. Finally, the convolutional block attention module (CBAM) is introduced to focus on important features in the image and improve the accuracy and robustness of the model. It has better detection performance and differentiation ability, can better handle the occlusion between peppers and the identification of different lesions in each background, and achieves the beneficial effect of identifying pepper leaf and fruit diseases and grading their disease severity.

[0027] 2. The present invention tests the accuracy by deploying the YOLOv7GCA model on an Android device. The main functions of the pepper disease recognition application include image acquisition, automatic image saving, CPU-based pepper disease detection, GPU-based pepper disease recognition, and disease grade evaluation of the detection results, achieving the beneficial effects of recognition and classification with accuracy and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 is a system block diagram of the present invention; Figure 2 This is the GhostNetV2 feature extraction network structure diagram; Figure 3 This is the module structure diagram of CBAM attention mechanism; Figure 4 This is the CFNet cascade fusion network structure diagram.

[0029] Figure 5 This is the YOLOv7GCA model structure diagram Figure 6 Comparative experimental results of seven detection models. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] See also Figure 1 , a pepper disease detection system based on improved YOLOv7, the system comprising a data acquisition module, a data preprocessing module, a YOLOv7 module, a performance estimation module, an input module, a recognition module, a classification module and an output module; The data acquisition module is used to use a mobile phone to shoot videos to obtain pepper fruit and leaf data containing different diseases; The data preprocessing module preprocesses the pepper data video taken by the mobile phone to obtain a picture data set, and marks the diseased pepper leaves and fruits, and finally divides the data set; The YOLOv7 module extracts features from pepper fruits and leaves to obtain identification results of pepper fruits and leaves with diseases, and the learning method is based on improved YOLOv7 network deep learning; The performance estimation module is used to measure the detection results, test their recall rate and precision, and if it is lower than 0.9, return to the target detection module, improve the solution, and re-extract features; The input module inputs the image information required for pepper disease detection into the model; The recognition module is used to recognize pepper leaves and fruits in the input video or image; The grading module is used to calculate the segmentation results of the recognition module and grade the degree of pepper disease; The output module is used to output and present the disease identification and classification data to the terminal display device, and at the same time output the calculated results in a weighted manner; The data acquisition module, data preprocessing module, YOLOv7 module, performance estimation module, input module, recognition module, classification module, and output module are communicatively connected in sequence.

[0032] Data collection module: Obtain disease data of pepper fruits and leaves by shooting videos with mobile phones. It is easy to operate, low-cost and suitable for large-scale data collection.

[0033] Data preprocessing module: preprocess the video, generate image data sets, and mark the diseased areas to ensure the quality and availability of the data sets.

[0034] Data partitioning: Divide the data set (training set, validation set, test set) to provide a reliable basis for model training and evaluation.

[0035] YOLOv7 module: Based on the improved YOLOv7 network for deep learning, it can efficiently extract the features of pepper fruits and leaves and achieve accurate identification of diseased areas.

[0036] Improved network structure: By optimizing the network depth and parameters of YOLOv7, the detection accuracy and speed of the model are improved to adapt to the complex scenarios of pepper disease detection.

[0037] Performance estimation module: quantitatively evaluates the detection results of the model by calculating the recall rate and precision rate.

[0038] Automatic optimization mechanism: When the recall rate or accuracy rate is lower than 0.9, the system will automatically return to the target detection module and improve the feature extraction scheme to ensure that the model performance always remains at a high level.

[0039] Input module: supports inputting the pepper image information to be detected into the model to achieve real-time detection.

[0040] Identification module: Identify pepper leaves and fruits in the input video or image to quickly locate the diseased area.

[0041] Classification module: According to the segmentation results of the recognition module, the disease degree is calculated and classified to provide a scientific decision-making basis for agricultural production.

[0042] Weighted output: The results of disease identification and classification are weighted to generate a comprehensive assessment report for easy understanding and application by users.

[0043] Output module: outputs disease identification and classification data to the terminal display device to intuitively present the test results.

[0044] Data sharing: supports the export of calculation results for further analysis and sharing, improving the practicality and scalability of the system.

[0045] Modular architecture: The system adopts a modular design, and each module (data acquisition, preprocessing, YOLOv7, performance estimation, input, recognition, classification, and output) is connected in sequence to ensure efficient operation and flexible expansion of the system.

[0046] Collaborative work: All modules work closely together to form a complete detection process and improve the overall performance of the system.

[0047] Preferably, the method of the data preprocessing module is mean normalization, and its feature scaling formula is: ; in, is the average normalized value, is the original value.

[0048] Preferably, the performance estimation module compares the received data with the feature extraction result of the target detection module, and the comparison result includes three parts: TP is the positive class determined as the positive class, FN is the positive class determined as the negative class, and FP is the negative class determined as the positive class; Select recall and precision as evaluation indicators of the algorithm; The calculation formula for recall is: ; The accuracy is calculated as follows: ; The closer all evaluation indicators are to 1, the better the effect.

[0049] Preferably, the data acquisition module calculates:

[0050] in: is the total number of frames extracted from the video; is the total duration of the video.

[0051] Preferably, the data preprocessing module calculates:

[0052]

[0053]

[0054] in: is the total data volume; is the number of samples in the validation set, accounting for 15% of the total data.

[0055] Preferably, the feature extraction process in the YOLOv7 module is:

[0056]

[0057]

[0058]

[0059]

[0060] in: is the size of the grid; is the indicator function, indicating the The grid cell Whether a bounding box is responsible for detecting the target object; is the center coordinate of the predicted bounding box; To predict the width and height of the bounding box; is the confidence of the predicted bounding box; is the true category probability.

[0061] Preferably, the recall rate of the performance estimation module is calculated as:

[0062] in: True positive examples are the number of samples correctly predicted by the model as positive; False negative examples are the number of samples that are actually positive but are mistakenly predicted as negative by the model.

[0063] Preferably, the accuracy of the performance estimation module is calculated as:

[0064] in: False positive examples are the number of samples that are actually negative but are mistakenly predicted as positive by the model.

[0065] Preferably, the performance estimation module comprehensive indicator: F1 score is calculated as: .

[0066] A pepper disease detection method based on improved YOLOv7, the detection method comprising the following steps: Step 1: Walk through the pepper fields manually and use a mobile phone to take direct photos of the pepper fruits and leaves. The shooting angles include vertical downward shooting from above and 45 degrees diagonally downward shooting from the side. Step 2: Preprocess the captured video data, capture a video screenshot every 0.5-1s through the Python program, manually select the available images and randomly distribute them into training and test sets in a ratio of 9:1; Step 3: Use the LabelImg tool to label the pepper objects in the experimental data, generate the corresponding XML label file, and complete the overall construction of the dataset based on the COCO dataset; Step 4: Put the labeled data into the target detection module, perform deep learning on the improved YOLOv7, and use the recall rate and accuracy as the evaluation indicators of the algorithm. If the evaluation index is less than 0.9, improve the solution and retrain the detection model with the wrong recognition data; Step 5. Users can input the required test images through the visualization platform. The model can identify diseased pepper fruits and leaves. At the same time, it can realize the classification study of pepper diseases based on the calculation of the proportion of the diseased area to the total area of ​​leaves and fruits.

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

Claims

1. A pepper disease detection system based on improved YOLOv7, characterized by: The system includes a data acquisition module, a data preprocessing module, a YOLOv7 module, a performance estimation module, an input module, a recognition module, a classification module and an output module; The data acquisition module is used to use a mobile phone to shoot videos to obtain pepper fruit and leaf data containing different diseases; The data preprocessing module preprocesses the pepper data video taken by the mobile phone to obtain a picture data set, and marks the diseased pepper leaves and fruits, and finally divides the data set; The YOLOv7 module extracts features from pepper fruits and leaves to obtain identification results of pepper fruits and leaves with diseases, and the learning method is based on improved YOLOv7 network deep learning; The performance estimation module is used to measure the detection results, test their recall rate and precision, and if it is lower than 0.9, return to the target detection module, improve the solution, and re-extract features; The input module inputs the image information required for pepper disease detection into the model; The recognition module is used to recognize pepper leaves and fruits in the input video or image; The grading module is used to calculate the segmentation results of the recognition module and grade the degree of pepper disease; The output module is used to output and present the disease identification and classification data to the terminal display device, and at the same time output the calculated results in a weighted manner; The data acquisition module, data preprocessing module, YOLOv7 module, performance estimation module, input module, recognition module, classification module, and output module are communicatively connected in sequence.

2. A pepper disease detection system based on improved YOLOv7 according to claim 1, characterized in that: The method of the data preprocessing module is mean normalization. Its feature scaling formula is: ; in, is the average normalized value, is the original value.

3. A pepper disease detection system based on improved YOLOv7 according to claim 2, characterized in that: The performance estimation module compares the received data with the feature extraction result of the target detection module. The comparison result includes three parts: TP is the positive class judged as the positive class, FN is the positive class judged as the negative class, and FP is the negative class judged as the positive class; Select recall and precision as evaluation indicators of the algorithm; The calculation formula for recall is: ; The accuracy is calculated as follows: ; The closer all evaluation indicators are to 1, the better the effect.

4. A pepper disease detection system based on improved YOLOv7 according to claim 3, characterized in that: The data acquisition module calculates: in: is the total number of frames extracted from the video; is the total duration of the video.

5. The pepper disease detection system based on improved YOLOv7 according to claim 4, characterized in that: The data preprocessing module is calculated as: in: is the total data volume; is the number of samples in the validation set, accounting for 15% of the total data.

6. The pepper disease detection system based on improved YOLOv7 according to claim 5, characterized in that: The feature extraction process in the YOLOv7 module is: in: is the size of the grid; is the indicator function, indicating the The grid cell Whether a bounding box is responsible for detecting the target object; is the center coordinate of the predicted bounding box; To predict the width and height of the bounding box; is the confidence of the predicted bounding box; is the true category probability.

7. The pepper disease detection system based on improved YOLOv7 according to claim 6, characterized in that: The recall rate of the performance estimation module is calculated as: in: True positive examples are the number of samples that the model correctly predicts as positive; False negative examples are the number of samples that are actually positive but are mistakenly predicted as negative by the model.

8. The pepper disease detection system based on improved YOLOv7 according to claim 7, characterized in that: The accuracy of the performance estimation module is calculated as: in: False positive examples are the number of samples that are actually negative but are mistakenly predicted as positive by the model.

9. The pepper disease detection system based on improved YOLOv7 according to claim 8, characterized in that: The performance estimation module comprehensive indicator: F1 score is calculated as: 。 10. A pepper disease detection method based on improved YOLOv7, characterized in that: The detection method is applied to the system according to claim 1, and the detection method comprises the following steps: Step 1: Walk through the pepper fields manually and use a mobile phone to take direct photos of the pepper fruits and leaves. The shooting angles include vertical downward shooting from above and 45 degrees diagonally downward shooting from the side. Step 2: Preprocess the captured video data, capture a video screenshot every 0.5-1s through the Python program, manually select the available images and randomly distribute them into training and test sets in a ratio of 9:1; Step 3: Use the LabelImg tool to label the pepper objects in the experimental data, generate the corresponding XML label file, and complete the overall construction of the dataset based on the COCO dataset; Step 4: Put the labeled data into the target detection module, perform deep learning on the improved YOLOv7, and use the recall rate and accuracy as the evaluation indicators of the algorithm. If the evaluation index is less than 0.9, improve the solution and retrain the detection model with the wrong recognition data; Step 5. Users can input the required test images through the visualization platform. The model can identify diseased pepper fruits and leaves. At the same time, it can realize the classification study of pepper diseases based on the calculation of the proportion of the diseased area to the total area of ​​leaves and fruits.

Citation Information

Patent Citations

  • Pepper disease and insect pest identification method and system based on hierarchical detection double-task model

    CN116612386A

  • Crop identification and leaf disease detection method and system

    CN118297877A