Deep learning-based rice pest detection and identification method and system
Through the improved convolutional neural network yolov5 model, a specific model is designed for rice pest recognition in different scenarios, which solves the problems of misjudgment and low efficiency in the existing technology, and achieves rapid and accurate pest recognition and control decisions, which meets the needs of the big Real-time area identification requirements.
Patent Information
- Application Number
- CN202411211324.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has problems of misjudgment and low efficiency in rice pest recognition, especially in various environments, which are difficult to accurately classify, and manual identification requires a lot of professional knowledge and cannot meet the needs of large-scale real-time identification.
Using the deep learning method based on the improved convolutional neural network yolov5, we design models for insect situation measurement lamps and images taken in the field. Through image classification and target detection, we identify the species, location and number of rice pests, and judge based on the detection results. Whether to take preventive measures.
It improves the accuracy and efficiency of rice pest recognition, can quickly and accurately detect pests in different scenarios, reduces the subjectivity of manual identification and human resources requirements, and meets the needs of large-scale real-time identification.
Smart Images

Figure CN119251545A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crop pest identification, and in particular to a rice pest detection and identification system based on deep learning. Background Art
[0002] Rice is one of the most important food crops in my country and even in the world. It provides food for nearly 50% of the world's population. However, it is vulnerable to a variety of pests and diseases during its growth. These pests and diseases will not only reduce the growth and development speed of rice, reduce the number of effective tillers and panicles, but also may lead to a decline in rice quality and even cause large-scale crop failure. Therefore, timely identification and prevention can ensure a healthy rice growth environment and achieve stable and high rice yields. The current mainstream method of rice pest identification is still manual identification, that is, mainly visual observation, which is difficult and subjective, and requires a lot of manpower and material resources. It faces the dilemma of talent gap and cannot meet the needs of real-time identification of large-scale rice pests. Deep learning technology is a technology that has been valued and rapidly developed in recent years, and it plays an important role in many fields. In terms of rice pest control, there are many types of rice pests, with huge differences in scale, or the two are similar, or they have different shapes. In the face of these difficulties, there is an urgent need for a simple and effective method that can accurately eliminate pests of rice crops in a variety of environments, thereby ensuring the safe production of rice and protecting food security.
[0003] The present invention aims to solve the problems that rice pests have a large scale span in various scenarios, some species are difficult to accurately classify due to similar morphology, and manual identification requires a lot of professional knowledge but is still prone to misjudgment. In order to improve the accuracy and efficiency of rice pest identification, a rice pest detection and identification system based on deep learning is proposed. Summary of the invention
[0004] In view of the difficulties and shortcomings in the existing technology and applications, the technical problem to be solved by the present invention is to provide a rice pest detection and identification method and system. The method adopts a solution based on the improved traditional convolutional neural network yolov5, and aims at the needs of pest identification in two application scenarios. The first is the image collected by the insect monitoring lamp. Such images generally have a white background. The second is the image taken by the equipment in the field. The target location of such images is generally stems and leaves, and the background is generally green. The processing requirements for the model in the two cases are different, so the networks are designed separately for the two cases to detect rice pests quickly and accurately in a more efficient way.
[0005] The present application achieves the above-mentioned effects through the following technical solutions: a rice pest detection and identification method based on deep learning, the method comprising the following steps: S1: Collect rice pest image Image1; S2: Classify the rice pest image image1. If the image is taken by an insect monitoring light and the target background is white, it is marked as white_image; if the image is taken in the field, that is, the background is rice leaves, which is green, it is marked as green_image; S3: Select the type of image to be detected, select the trained model white_model or green_model to be used, and output the recognition result, which includes the type, location and number of pests; S4: Determine whether to carry out prevention and control of the type of pest based on the test results. If the warning standard has been reached, the information of the pest and its prevention and control measures, dosage and type of pesticides are displayed.
[0006] Furthermore, the classification of the rice pest image image1 includes, the first type, scenes of insect monitoring lights and images taken in the field with a handheld camera under a natural background, wherein the image characteristics of the insect monitoring lights are simple background, a single color, a large number of pest species contained in the image, and small targets; the second type of image comes from pest images taken in the field with a handheld camera, and the characteristics of this type of image are complex background, with one leaf as the background, and the pests in the image are mostly of only one type, or only one.
[0007] Furthermore, S3 includes the recognition of images under the insect detection lamp or images of rice pests in the field background. If images under the insect detection lamp are used, the trained yolo network, white_model, is called to recognize rice pests in the image and output recognition results, including the type, location and quantity of the pests. If the rice pest image with field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the recognition results, including the type and location of the pests.
[0008] Furthermore, if the image under the insect monitoring lamp is used, the trained YOLO network, white_model, is called to identify the rice pests in the image and output the identification results, including the type, location and number of the pests: S311: Obtain the rice pest dataset dataset_white photographed by the insect monitoring lamp, and construct the rice pest dataset dataset1 under the insect monitoring lamp; S312: Use labelimg software to use different labels for different types of pests in the rice pest dataset dataset1 under the insect monitoring lamp. Non-rice pests are not labeled. The labels uniformly use the English names of the pest species, including two rice planthoppers Delphacidae, rice leaf roller Cnaphalocrocis medinalis and Chilo suppressalis. The annotation file is saved in the folder with the same path as the image folder, and a yolo format annotation file is generated, including the category of the pest and the annotation target box information; S313: Divide the labeled data set into a training set Train and a validation set Val according to a set ratio, and use the training set to train the yolov5 model; S314: When the mAP of the validation set reaches the set threshold, the training is terminated and the model training weight result is saved; S315: Detect the pest image file under the insect monitoring light according to the trained improved yolov5 model, and output the image image1_result with the annotation box and the pest category.
[0009] Furthermore, if the rice pest image with field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the identification results, including the type and location of the pests: S321 Obtain the public rice pest image datasets VOC2007 and IP102 from field photos and online searches, which contain 9 types of rice pests, and construct dataset dataset2 together with the real-shot images; S322: Use labelimg software to use different labels for different types of pests in the pest dataset dataset2. Non-rice pests are not labeled. The labels are uniformly labeled with the English abbreviations of the pests. The annotation files are saved in the same folder as the image folder. Generate annotation files in yolo format, including the category of the pests and the annotation target box information. S323: Divide the labeled data set into a training set Train and a validation set Val according to a set ratio, and use the training set to train the yolov5 model; S324: When the mAP of the validation set reaches the set threshold, the training is terminated and the model training weight result is saved; S325: Detect pest image files under field background according to the trained improved yolov5 model, and output image image1_result with annotation boxes and pest categories. Different categories are marked with boxes of different colors.
[0010] Furthermore, S4 is specifically that the pest detection results are displayed in the picture with marked boxes of different colors, with the detected categories and confidence levels, the number of marked boxes of each category in the statistical results is counted, and whether to take large-scale prevention and control measures is determined based on the number.
[0011] The present application also provides a rice pest detection and identification system based on deep learning, the system comprising: A software interaction module, which is used to obtain and display rice pest images, select detection models and monitoring data and other interactive buttons; An image processing module, wherein the image processing module is used to detect rice pest images under the insect detection lamp and rice pests in the field using the trained improved YOLO model; An image preview module, which is used to view the rice pest images to be detected and the detection results; The intelligent prevention and control module determines whether prevention and control is needed based on the type and quantity of the detected pests.
[0012] Compared with the prior art, the advantages of the present invention are: Different solutions are proposed based on the characteristics of two different scenarios.
[0013] The solutions for different scenarios are targeted and the model is simple and easy to deploy.
[0014] 3. The improved detection model has more advantages in detection and has higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a flow chart of the method of the present invention; Figure 2 It is a system interface diagram of the present invention. DETAILED DESCRIPTION
[0016] The detection and identification of rice pests is of great significance to agricultural production. The presence of pests will not only directly affect the growth and yield of rice, but also may lead to the spread of diseases. The similarity between pests and rice leaves, changes in lighting conditions, different shooting angles, etc., may affect the accurate identification of pests.
[0017] In response to these challenges, the present invention proposes a rice pest detection and identification method based on deep learning. This method can accurately identify rice pests in images through a lightweight detection model combined with model improvements suitable for a variety of detection environments. On this basis, the pests are further classified to identify their types and possible disease risks.
[0018] The present invention expands and optimizes the pest detection and identification model, and proposes a series of improvement measures by splitting, recombining and reusing existing technologies to improve the accuracy and efficiency of pest detection. These improvement measures not only maintain the commonalities with the original technology, but also introduce new technical solutions to address specific problems in rice pest detection.
[0019] The present application discloses a rice pest detection and identification method and system based on deep learning, which is implemented based on the convolutional neural network yolo model modeling method. The present invention improves, expands and reuses this technology. The implementation of the specific technical solution has many similarities with the original technology and also has many different improvement measures, which are specifically stated.
[0020] First, a brief introduction to the YOLO model: Yolov5 model, open source code address: https: / / github.com / ultralytics / yolov5, yolo is a single-stage target detection algorithm. The core idea of the algorithm is to transform the target detection problem into a regression problem. Through a single forward propagation, the bounding box and category probability of the target are directly predicted in the image. The detection process is fast and suitable for real-time application scenarios.
[0021] The present application achieves the above-mentioned effects through the following technical solutions: a rice pest detection and identification method based on deep learning, the method comprising the following steps: S1: Collect rice pest image Image1; S2: Classify the rice pest image image1. If the image is taken by an insect monitoring light and the target background is white, it is marked as white_image; if the image is taken in the field, that is, the background is rice leaves, which is green, it is marked as green_image; S3: Select the type of image to be detected, select the trained model white_model or green_model to be used, and output the recognition result, which includes the type, location and number of pests; S4: Determine whether to carry out prevention and control of the type of pest based on the test results. If the warning standard has been reached, the information of the pest and its prevention and control measures, dosage and type of pesticides are displayed.
[0022] Furthermore, the classification of the rice pest image image1 includes, the first type, scenes of insect monitoring lights and images taken in the field with a handheld camera under a natural background, wherein the image characteristics of the insect monitoring lights are simple background, a single color, a large number of pest species contained in the image, and small targets; the second type of image comes from pest images taken in the field with a handheld camera, and the characteristics of this type of image are complex background, with one leaf as the background, and the pests in the image are mostly of only one type, or only one.
[0023] Furthermore, S3 includes the recognition of images under the insect detection lamp or images of rice pests in the field background. If images under the insect detection lamp are used, the trained yolo network, white_model, is called to recognize rice pests in the image and output recognition results, including the type, location and quantity of the pests. If the rice pest image with field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the recognition results, including the type and location of the pests.
[0024] Furthermore, if the image under the insect monitoring lamp is used, the trained YOLO network, white_model, is called to identify the rice pests in the image and output the identification results, including the type, location and number of the pests: S311: Obtain the rice pest dataset dataset_white photographed by the insect monitoring lamp, and construct the rice pest dataset dataset1 under the insect monitoring lamp; S312: Use labelimg software to use different labels for different types of pests in the rice pest dataset dataset1 under the insect monitoring lamp. Non-rice pests are not labeled. The labels uniformly use the English names of the pest species, including two rice planthoppers Delphacidae, rice leaf roller Cnaphalocrocis medinalis and Chilo suppressalis. The annotation file is saved in the folder with the same path as the image folder, and a yolo format annotation file is generated, including the category of the pest and the annotation target box information; S313: Divide the labeled data set into a training set Train and a validation set Val according to a set ratio, and use the training set to train the yolov5 model; S314: When the mAP of the validation set reaches the set threshold, the training is terminated and the model training weight result is saved; S315: Detect the pest image file under the insect monitoring light according to the trained improved yolov5 model, and output the image image1_result with the annotation box and the pest category.
[0025] Furthermore, if the rice pest image with field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the identification results, including the type and location of the pests: S321 Obtain the public rice pest image datasets VOC2007 and IP102 from field photos and online searches, which contain 9 types of rice pests, and construct dataset dataset2 together with the real-shot images; S322: Use labelimg software to use different labels for different types of pests in the pest dataset dataset2. Non-rice pests are not labeled. The labels are uniformly labeled with the English abbreviations of the pests. The annotation files are saved in the same folder as the image folder. Generate annotation files in yolo format, including the category of the pests and the annotation target box information. S323: Divide the labeled data set into a training set Train and a validation set Val according to a set ratio, and use the training set to train the yolov5 model; S324: When the mAP of the validation set reaches the set threshold, the training is terminated and the model training weight result is saved; S325: Detect pest image files under field background according to the trained improved yolov5 model, and output image image1_result with annotation boxes and pest categories. Different categories are marked with boxes of different colors.
[0026] Furthermore, S4 is specifically that the pest detection results are displayed in the picture with marked boxes of different colors, with the detected categories and confidence levels, the number of marked boxes of each category in the statistical results is counted, and whether to take large-scale prevention and control measures is determined based on the number.
[0027] The present application also provides a rice pest detection and identification system based on deep learning, the system comprising: A software interaction module, which is used to obtain and display rice pest images, select detection models and monitoring data and other interactive buttons; An image processing module, wherein the image processing module is used to detect rice pest images under the insect detection lamp and rice pests in the field using the trained improved YOLO model; An image preview module, which is used to view the rice pest images to be detected and the detection results; The intelligent prevention and control module determines whether prevention and control is needed based on the type and quantity of the detected pests.
[0028] Example 1: The following is a detailed description of a rice pest detection and identification method based on deep learning in this application, which includes the following steps: S1: Collect rice pest image Image1 in a pest collection device or in a natural scene; S2: Classify the rice pest image image1 obtained by shooting. If the image comes from the insect monitoring light, that is, the target background is white, it is marked as white_image. If the image comes from the field, that is, the background is rice leaves, which is green, it is marked as green_image. S3: Select the type of image to be detected, that is, select the trained models white_model and green_model to be used; S4: If the image under the insect monitoring light is used, the trained YOLO network, namely white_model, is called to identify the rice pests in the image and output the identification results, including the type, location and number of the pests; S5: If the rice pest image in the field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the identification result, which includes the type and location of the pests; S6: Determine whether to carry out prevention and control of the pest according to the test results. If the warning standard has been reached, the pest information, prevention and control measures, dosage and type of pesticides, etc. are displayed; In a first aspect, step S4 of the above scheme provides a rice pest identification method based on the YOLO network, which identifies images containing multiple pests collected under an insect monitoring light.
[0029] The S4 contains the following contents: First, we obtained the rice pest dataset photographed by the insect monitoring lamp, constructed the rice pest dataset under the insect monitoring lamp, and then labeled the rice pests in the dataset. We used labelimg software to use different labels for different types of pests in the rice pest dataset under the insect monitoring lamp. Non-rice pests were not labeled. The labels uniformly used the English names of the pest species, including two types of rice planthoppers (Delphacidae), rice leaf roller (Cnaphalocrocis medinalis) and Chilo suppressalis (Chilo The annotation file (suppressalis) is saved in a folder with the same path as the image folder, and a YOLO format annotation file is generated, including the category of pests and the annotation target box information. The annotated data set is then divided into a training set Train and a validation set Val in a ratio of 4:1, and the training set is used to train the YOLOv5 model. When the mAP of the validation set reaches the set threshold of 95%, the training is terminated and the model training weight result is saved. This weight can be used to detect rice pests under the insect monitoring lamp. The location and quantity of various pests can be obtained by counting the number of target detection boxes, and the data is output.
[0030] In a second aspect, step S5 of the above scheme provides a rice field pest detection and identification method based on the YOLO model, which is used to detect pest types in the rice leaf background and other backgrounds.
[0031] The S5 includes the following: Obtain rice pest images from the public datasets VOOC2007 and IP102, and construct a rice pest dataset in the field background; then use labelimg software to use different labels for different types of pests in the pest dataset dataset2, and do not label non-rice pests. The labels are uniformly labeled with the English abbreviations of the pests. The label files are saved in a folder with the same path as the image folder, and a yolo format label file is generated, including the category of the pest and the label target box information. After that, the labeled dataset is divided into a training set Train and a validation set Val in a ratio of 4:1, and the training set is used to train the yolov5 model. When the mAP of the validation set reaches the set threshold of 95%, the training is terminated and the model training weight results are saved. According to the trained improved yolov5 model, the pest image file in the field background is detected, and the image image1_result with the label box and the pest category is output. Different categories are marked with boxes of different colors.
[0032] Example 2: The present application also provides a rice pest detection and identification system based on deep learning, the system interface diagram is as follows Figure 2 As shown, the system comprises: A software interaction module, which is used to obtain and display rice pest images, select a detection model, including two detection models, and interactive buttons such as monitoring data; An image processing module, wherein the image processing module is used to detect rice pest images under the insect detection lamp and rice pests in the field using the trained improved YOLO model; An image preview module, which can view the rice pest images to be detected and the detection results; A smart control module, which determines whether control is needed based on the type and quantity of detected pests; Furthermore, in the software interaction module and the image processing module, rice pest image dataset dataset_white and dataset_green units, labelimg unit, yolo model training unit and first output unit are included; wherein, The rice pest image datasets dataset_white and dataset_green are respectively from self-photographing and network dataset downloading, wherein dataset_white is self-photographing and dataset_green is from network dataset integration.
[0033] The labelimg unit uses labelimg software to label the rice pests in each image in the rice pest image data set, and the labeling file is saved in a label folder under the same path as the image folder, and a labeling file in yolo format is generated, which includes the category of the pest and the position information of the labeling box; The yolo model training unit divides the rice pest image datasets dataset_white and dataset_green into a training set and a test set in a ratio of 4:1, and uses the training sets to train the yolo models respectively; When the average accuracy of the validation set reaches the specified threshold, the training ends and the corresponding model training weight results are saved; The output unit detects rice pests in the picture according to the trained YOLO model, and marks the target with a labeling frame of different colors with confidence.
Claims
1. A rice pest detection and identification method based on deep learning, characterized in that: The method comprises the following steps: S1: Collect rice pest image Image1; S2: Classify the rice pest image image1. If the image is taken by an insect monitoring light and the target background is white, it is marked as white_image; if the image is taken in the field, that is, the background is rice leaves, which is green, it is marked as green_image; S3: Select the type of image to be detected, select the trained model white_model or green_model to be used, and output the recognition result, which includes the type, location and number of pests; S4: Determine whether to carry out prevention and control of the type of pest based on the test results. If the warning standard has been reached, the information of the pest and its prevention and control measures, dosage and type of pesticides are displayed.
2. A rice pest detection and identification method based on deep learning according to claim 1, characterized in that: The classification of the rice pest image image1 includes the first type, the scene of the insect monitoring lamp and the image taken by a handheld camera in the field under the natural background, wherein the image characteristics of the insect monitoring lamp are simple background, single color, large number of pest species contained in the image, and small target; the second type of image comes from the pest image taken by a handheld camera in the field, the characteristics of this type of image are complex background, with one leaf as the background, and the pests in the image are mostly of only one type, or only one.
3. The rice pest detection and identification method based on deep learning according to claim 1, characterized in that: The S3 includes the recognition of the image under the insect detection lamp or the rice pest image in the field background. If the image under the insect detection lamp is used, the trained yolo network, white_model, is called to recognize the rice pests in the image and output the recognition result, which includes the type, location and number of the pests; If the rice pest image with field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the recognition results, including the type and location of the pests.
4. The rice pest detection and identification method based on deep learning according to claim 1, characterized in that: If the image under the insect monitoring light is used, the trained YOLO network is called, and white_model identifies the rice pests in the image and outputs the identification results, including the type, location and number of the pests. S311: Obtain the rice pest dataset dataset_white photographed by the insect monitoring lamp, and construct the rice pest dataset dataset1 under the insect monitoring lamp; S312: Use labelimg software to use different labels for different types of pests in the rice pest dataset dataset1 under insect monitoring lamps. Non-rice pests are not labeled. The labels uniformly use the English names of pest species, including two rice planthoppers Delphacidae, rice leaf roller Cnaphalocrocis medinalis, and striped stem borer Chilo suppressalis. The annotation file is saved in the folder with the same path as the image folder, and a yolo format annotation file is generated, including the category of the pest and the annotation target box information; S313: Divide the labeled data set into a training set Train and a validation set Val according to a set ratio, and use the training set to train the yolov5 model; S314: When the mAP of the validation set reaches the set threshold, the training is terminated and the model training weight result is saved; S315: Detect the pest image file under the insect monitoring light according to the trained improved yolov5 model, and output the image image1_result with the annotation box and the pest category.
5. The rice pest detection and identification method based on deep learning according to claim 1, characterized in that: If the image of rice pests in the field background is used, the trained YOLO network, i.e. green_model, is called to identify the rice pests in the image and output the identification results, including the type and location of the pests: S321 Obtain the public rice pest image datasets VOC2007 and IP102 from field photos and online searches, which contain 9 types of rice pests, and construct dataset dataset2 together with the real-shot images; S322: Use labelimg software to use different labels for different types of pests in the pest dataset dataset2. Non-rice pests are not labeled. The labels are uniformly labeled with the English abbreviations of the pests. The annotation files are saved in the same folder as the image folder. Generate annotation files in yolo format, including the category of the pests and the annotation target box information. S323: Divide the labeled data set into a training set Train and a validation set Val according to a set ratio, and use the training set to train the yolov5 model; S324: When the mAP of the validation set reaches the set threshold, the training is terminated and the model training weight result is saved; S325: Detect pest image files under field background according to the trained improved yolov5 model, and output image image1_result with annotation boxes and pest categories. Different categories are marked with boxes of different colors.
6. The rice pest detection and identification method based on deep learning according to claim 1, characterized in that: Specifically, S4 is that the pest detection results are displayed in the picture with marked boxes of different colors, with the detected categories and confidence levels, and the number of marked boxes of each category in the statistical results is determined, and whether to take large-scale prevention and control measures is determined based on the number.
7. A rice pest detection and identification system based on deep learning, characterized in that: The system comprises: A software interaction module, which is used to obtain and display rice pest images, select detection models and monitoring data and other interactive buttons; An image processing module, wherein the image processing module is used to detect rice pest images under the insect detection lamp and rice pests in the field using the trained improved YOLO model; An image preview module, which is used to view the rice pest images to be detected and the detection results; The intelligent prevention and control module determines whether prevention and control is needed based on the type and quantity of the detected pests.
Citation Information
Patent Citations
Model generation method and device, electronic equipment and storage medium
CN112329732A
Rapid pest detection method based on improved YOLO V4
CN114220035A
Rice disease and pest identification method based on improved YOLOV5
CN117746427A
Rice disease early warning and prevention system and method based on artificial intelligence
CN118097423A
