Facility Tomato Leaf Lesion Detection Method and Targeted Spraying Device
By applying the improved Yolov5 algorithm and CBAM module in the detection of lesions in the tomato leaf lesions in the facility, combined with the targeted spraying device, the problem of low disease detection efficiency in the tomato leaf lesions in the facility is solved, and high-precision and automated lesions identification and prevention are achieved.
Patent Information
- Application Number
- CN202210516355.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-05-12
AI Technical Summary
The tomato leaf disease detection efficiency of facilities is low, and it is difficult for the existing technology to achieve rapid and accurate lesions identification and timely prevention and treatment.
Using the Yolov5 algorithm based on One-Stage structure, the CBAM channel space attention module is added to the CSP structure of the Backbone backbone network, the loss function is improved, the tomato leaf lesions detection method is constructed, and the targeted spraying device is combined to realize automatic detection and spraying.
The accuracy and efficiency of detection of lesions in the tomato leaf part of the facility have been improved, accurate and reliable lesions identification and automatic spraying have been achieved, and the efficiency of disease prevention and control in the tomato orchard in the facility has been significantly improved.
Smart Images

Figure CN114937009B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crop pest and disease identification and targeted spraying, and particularly relates to a method for detecting leaf lesions of greenhouse tomatoes and a targeted spraying device. Background Art
[0002] The cultivation of greenhouse tomatoes has improved the growth environment of tomatoes to a certain extent, but tomato leaf diseases are still one of the main hazards to tomato crops. The color values and lesion characteristics of tomato leaves and fruits can directly reflect the nutritional status and the degree of leaf diseases of tomatoes. Judging the growth status of crops through tomato leaves and fruits is the most direct and effective method. Based on the analysis of the planting scale of modern agriculture tomatoes, the method of manual detection is not only time-consuming and laborious, but also inefficient. Machine vision target detection can not only save manpower, but also significantly improve the efficiency compared with manual detection. In addition, if the diseases on tomato leaves are diagnosed but no timely measures are taken for prevention and control, the significance of diagnosing the diseases will be lost. Therefore, it is of great significance to urgently invent a method for detecting leaf lesions of greenhouse tomatoes and a targeted spraying device that integrates flexible movement, accurate identification, timely feedback of data and prevention and control. Summary of the Invention
[0003] The primary object of the present invention is to provide a method for detecting leaf lesions of greenhouse tomatoes, which can accurately detect the leaf lesions of greenhouse tomatoes.
[0004] To achieve the above object, the technical solution adopted by the present invention is as follows: A method for detecting leaf lesions of greenhouse tomatoes includes the following steps: S100, obtaining the original image of the greenhouse tomato plant without damage and non-destructively; S200, scaling the original image to a standard size through the Input input end and setting an initial anchor box; S300, the image output from the Input input end enters the Backbone backbone network, and is sliced into a feature map through the Focus module in sequence, undergoes a convolution operation with a convolution kernel, and undergoes feature aggregation through the CBAM_CSP structure; S400, the feature map after aggregation enters the Neck network layer to aggregate parameters and extract the leaf lesion features of greenhouse tomatoes; S500, the extracted feature map enters the Head output end, and target prediction is performed through the leaf lesion features in the weight file trained by the Prediction structure and the loss function to detect the lesions in the image.
[0005] Compared with the prior art, the present invention has the following technical effects: For the leaf disease spots of greenhouse tomatoes, a CBAM channel spatial attention module is added to the CSP structure of the Backbone main network according to the Yolov5 algorithm based on the One-Stage structure, the loss function is improved, and the improved algorithm is used to improve the detection accuracy of leaf disease spots of greenhouse tomatoes. The detection results based on the improved algorithm are accurate, and the method is reliable and highly practical.
[0006] Another object of the present invention is to provide a targeted spraying device that can conveniently achieve disease spot detection and targeted spraying prevention and control in a greenhouse tomato orchard.
[0007] To achieve the above object, the technical solution adopted by the present invention is: A targeted spraying device includes a moving unit, a target detection unit, and a spraying unit. The moving unit is used to carry the target detection unit and the spraying unit and drive these two units to move along a set path. The target detection unit detects the leaf image of greenhouse tomatoes according to steps S100 - S500, and the spraying unit sprays the corresponding liquid medicine to the disease part of greenhouse tomatoes according to the detection result of the target detection unit.
[0008] Compared with the prior art, the present invention has the following technical effects: By setting the moving unit, the device can be conveniently moved autonomously in the greenhouse tomato orchard. The target detection unit carried thereon can accurately and reliably detect the disease spots of the set tomatoes. When the disease spots are detected, it can also control the spraying unit to spray medicine automatically, which is very convenient to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 is a schematic flow chart of the disease spot detection method in the present invention;
[0010] Figure 2 is a schematic structural diagram of the Backbone main network;
[0011] Figure 3 is a schematic structural diagram of the targeted spraying device in the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0012] The following combines Figures 1 to 3 to further describe the present invention in detail.
[0013] Refer to Figure 1, the present invention discloses a method for detecting leaf lesions of greenhouse tomatoes, which includes the following steps: S100, obtaining the original image of the greenhouse tomato plant without damage and non-destructively; S200, scaling the original image to a standard size through the Input input end and setting the initial anchor box; S300, the image output by the Input input end enters the Backbone backbone network, and is successively sliced into feature maps through the Focus module, subjected to convolution operations of convolutional kernels, and subjected to feature aggregation through the CBAM_CSP structure; S400, the aggregated feature maps enter the Neck network layer to aggregate parameters and extract the leaf lesion features of greenhouse tomatoes; S500, the extracted feature maps enter the Head output end, and target prediction is performed through the leaf lesion features in the weight file trained by the Prediction structure and the loss function to detect the lesions in the image. For the leaf disease of leaf lesions of greenhouse tomatoes, according to the Yolov5 algorithm based on the One-Stage structure, a CBAM channel spatial attention module is added to the CSP structure of the Backbone backbone network, the loss function is improved, and the detection accuracy of leaf lesions of greenhouse tomatoes is improved by using the improved algorithm. The detection result based on the improved algorithm is accurate, and the method is reliable and highly practical.
[0014] Further, the Input input end in step S200, the Neck network layer in step S400, and the Head output end in step S500 are the same as the Input input end, Neck network layer, and Head output end in the Yolov5s network; the Backbone backbone network in step S300 is based on the Backbone backbone network in the Yolov5s network, and a CBAM channel spatial attention module is added after the Concat module in the CSP1_X module in the Backbone backbone network of the Yolov5s network. Here, by modifying the Yolov5s network, the network structure we need is formed, and the model obtained after training the network can detect the leaf lesions of greenhouse tomatoes more accurately.
[0015] Refer to Figure 3, Further, the steps of feature aggregation by the Backbone backbone network in step S300 include: S310, the feature map processed by slicing convolution in the Focus module enters the CBL module for convolution layer Conv, batch normalization BN, and activation function Leaky Relu processing; S320, enters the CBAM_BottleneckCSP1_1 structure, which is divided into two channels. One channel performs Conv convolution, and the other channel continuously performs a CBL module, a residual component Res unit, and a Conv convolution; S330, the two channels enter Concat for feature fusion of a residual component; S340, enters the CBAM module, first passes through the Channel Attention Module, and then passes through the Spatial Attention Module to optimize the features; S350, the optimized features are processed by BN, Leaky Relu, and CBL, and complete the CBAM_BottleneckCSP1_1 structure; S360, the optimized features perform the following operations twice in a row: first CBL processing and then enter the CBAM_BottleneckCSP1_3 structure for feature fusion of three residual components; S370, after CBL processing, enter the SPP structure for multi-scale feature fusion to complete the feature fusion of the feature map. Here, by introducing the CBAM module, the Channel Attention Module and Spatial Attention Module in it can well optimize the features and improve the accuracy of the detection results.
[0016] Further, in step S500, the loss function is the Weight Loss function, which consists of two major functions: the object and classification loss function and the bounding box regression loss function. Different loss functions will also affect the network parameters after training. Here, a dual loss function is used, and the network trained can more accurately identify the leaf lesions of greenhouse tomatoes. Specifically, the Weight Loss function is calculated by the following formula:
[0017]
[0018]
[0019]
[0020] In the formula, the range of α is [0,1], the range of β is [0, 4], p is the predicted output after passing through the Sigmoid function, and y is the true sample label; A cis the minimum box area containing the prediction box and the target box; Target Box is the target box area; Predict Box is the prediction box area; IoU is the intersection over union of the target box and the prediction box.
[0021] Here, the training weight file and the weight loss function Weight Loss for processing the feature map consist of two major functions: the object and classification loss function, and the bounding box regression loss function. In the original Yolov5 algorithm, the object and classification loss function is BCE With Logits, and the bounding box regression loss function is GIoU. For the weight adjustment of the object loss function, we add coefficients α and (1 - α) in front of the BCEWith Logits function, where the range of α is [0, 1]. After training and detecting the leaf lesions of greenhouse tomatoes, α = 0.5; for the weight adjustment of the classification loss function, we add a coefficient (1 - p) β and p β , the range of β is [0, 4]. After training and detecting the leaf lesions of greenhouse tomatoes, β = 3; for the GIoU function, we increase the combined area of the ground truth box and the prediction box, and finally obtain the improved weight loss function Weight Loss.
[0022] Refer to Figure 3 , the present invention also discloses a targeted spraying device, including a moving unit 10, a target detection unit 20, and a spraying unit 30. The moving unit 10 is used to carry the target detection unit 20 and the spraying unit 30 and drive these two units to move along a set path. The target detection unit 20 detects the leaf images of greenhouse tomatoes according to steps S100 - S500, and the spraying unit 30 sprays corresponding liquid medicine to the diseased parts of greenhouse tomatoes according to the detection results of the target detection unit 20. By setting the moving unit 10, the device can be conveniently moved autonomously in the greenhouse tomato garden. The target detection unit 20 carried thereon can accurately and reliably detect the lesions of the set tomatoes. When lesions are detected, it can also control the spraying unit 30 to spray medicine automatically, which is very convenient to use.
[0023] Furthermore, the mobile unit 10 includes wheels 11, a vehicle body 12, a lidar 13, and a single-chip microcomputer 14; the lidar 13 is used to scan the terrain of the greenhouse tomato garden, and the single-chip microcomputer 14 is used to construct a topographic map scanned by the lidar 13 and plan the inspection route of the mobile unit 10; the single-chip microcomputer 14 is also connected to and controls the target detection unit 20, and the target detection unit 20 transmits the types of detected lesions and the position information in the image to the single-chip microcomputer 14. The spraying unit 30 includes a medicine barrel 31, a filter screen 32, a water pump 33, an electrostatic spray gun 34, and an electrostatic nozzle 35. Multiple groups of spraying units 30 are provided. The medicine barrel 31 in each group of spraying units 30 is used to hold the liquid medicine for different lesions. The filter screen 32 is used to filter impurities in the liquid medicine. The water pump 33 extracts the liquid medicine from the medicine barrel 31 through the electrostatic spray gun 34 and sprays it onto the diseased parts of the greenhouse tomatoes through the electrostatic nozzle 35; the power supply 36 is used to supply power to the water pumps 33 in multiple groups of spraying units 30. It is very convenient to complete the control of the target detection unit 20 and the spraying unit 30 through the single-chip microcomputer 14.
Claims
1. A method for detecting leaf lesions of greenhouse tomatoes, characterized in that: It includes the following steps: S100, Obtain the original image of the greenhouse tomato plant without damage and non-destructively; S200, The original image is scaled to a standard size through the Input input end and the initial anchor box is set; S300, The image output by the Input input end enters the Backbone backbone network for feature aggregation. The specific steps include: S310, The feature map processed by slice convolution in the Focus module enters the CBL module for convolution layer Conv, batch normalization BN, and activation function Leaky Relu processing; S320, Enter the CBAM_BottleneckCSP1_1 structure, which is divided into two channels. One channel performs Conv convolution, and the other channel sequentially performs a CBL module, a residual component Res unit, and a Conv convolution; S330, The two channels enter Concat for feature fusion of a residual component; S340, Enter the CBAM module, first pass through the channel attention module ChannelAttebtion Module, and then pass through the spatial attention module SpatialAttention Module to optimize the features; S350, The optimized features are processed by BN, Leaky Relu, and CBL, and complete the CBAM_BottleneckCSP1_1 structure; S360, The optimized features perform the following operations twice in a row: first CBL processing and then enter the CBAM_BottleneckCSP1_3 structure for feature fusion of three residual components; S370, After CBL processing, enter the SPP structure for multi-scale feature fusion to complete the feature fusion of the feature map; S400, The aggregated feature map enters the Neck network layer to aggregate parameters and extract the leaf lesion features of greenhouse tomatoes; S500, The extracted feature map enters the Head output end, and the leaf lesion features of greenhouse tomatoes in the weight file trained by the Prediction structure and the loss function are used for target prediction to detect the lesions in the image.
2. The method for detecting leaf lesions of greenhouse tomatoes according to claim 1, characterized in that: The Input input end in step S200, the Neck network layer in step S400, and the Head output end in step S500 are the same as the Input input end, Neck network layer, and Head output end in the Yolov5s network; the Backbone backbone network in step S300 is based on the Backbone backbone network in the Yolov5s network, and a CBAM channel spatial attention module is added after the Concat module in the CSP1_X module in the Backbone backbone network of the Yolov5s network.
3. The method for detecting leaf lesions of greenhouse tomatoes according to claim 1, characterized in that: In the step S500 described above, the loss function is the Weight Loss function, which consists of two major functions: the target and classification loss function, and the bounding box regression loss function.
4. The method for detecting leaf lesions of greenhouse tomatoes according to claim 3, characterized in that: the Weight Loss function is calculated by the following formula: Wherein, the range of α is [0, 1], the range of β is [0, 4], p is the predicted output after passing through the Sigmoid function, and y is the true sample label; A c is the area of the smallest box containing the predicted box and the target box; Target Box is the area of the target box; Predict Box is the area of the predicted box; IoU is the intersection over union of the target box and the predicted box.
5. The method for detecting leaf lesions of greenhouse tomatoes according to claim 4, characterized in that: α = 0.5 and β = 3 as described above.
6. A targeted spraying device, characterized in that: it includes a moving unit (10), a target detection unit (20), and a spraying unit (30). The moving unit (10) is used to carry the target detection unit (20) and the spraying unit (30) and drive these two units to move along a set path. The target detection unit (20) detects the image of the leaves of greenhouse tomatoes according to the steps S100 - S500 in claim 1, and the spraying unit (30) sprays the corresponding liquid medicine to the diseased parts of the greenhouse tomatoes according to the detection results of the target detection unit (20).
7. The targeted spraying device according to claim 6, characterized in that: the moving unit (10) includes wheels (11), a vehicle body (12), a lidar (13), and a single-chip microcomputer (14); the lidar (13) is used to scan the terrain of the greenhouse tomato orchard, and the single-chip microcomputer (14) is used to construct the topographic map scanned by the lidar (13) and plan the inspection route of the moving unit (10); the single-chip microcomputer (14) is also connected to and controls the target detection unit (20), and the target detection unit (20) transmits the type of detected lesions and the position information in the image to the single-chip microcomputer (14).
8. The targeted spraying device according to claim 7, characterized in that: the spraying unit (30) includes a medicine barrel (31), a filter screen (32), a water pump (33), an electrostatic spray gun (34), and an electrostatic nozzle (35). There are multiple groups of spraying units (30). The medicine barrel (31) in each group of spraying units (30) is used to hold the liquid medicine for different lesions. The filter screen (32) is used to filter impurities in the liquid medicine. The water pump (33) pumps the liquid medicine from the medicine barrel (31) through the electrostatic spray gun (34) and sprays it to the diseased parts of the greenhouse tomatoes through the electrostatic nozzle (35); a power supply (36) is used to supply power to the water pumps (33) in multiple groups of spraying units (30).
Citation Information
Patent Citations
Improved YOLOv5-based string-type tomato real-time detection method
CN114022878A
Lightweight target detection method
CN114120019A