A honeysuckle target detection and picking point positioning method based on improved YOLOv5
By improving the preprocessing, clustering, and activation functions of the YOLOv5 network, and combining the spp-cbam structure and decision maker, the problems of unclear feature extraction and low accuracy in honeysuckle detection were solved, and efficient honeysuckle picking point location and picking were achieved.
Patent Information
- Application Number
- CN202211665306.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-12-23
AI Technical Summary
The existing YOLOv5 object detection algorithm has problems such as poor feature extraction, poor model generalization, low accuracy and low efficiency in honeysuckle picking, especially when detecting multiple honeysuckle flowers in the same image.
By improving the YOLOv5 network, we adopted bilateral filtering preprocessing, k-means clustering to generate preselected boxes, introduced the HardSwish activation function and spp-cbam structure, and constructed a decision maker to improve feature extraction capability and detection accuracy, and optimize the picking point localization.
It improves the accuracy and generalization of honeysuckle detection, and enhances harvesting efficiency. In particular, it can locate the most suitable harvesting point based on the size of the harvester in complex situations, thereby improving harvesting efficiency.
Smart Images

Figure CN115861768B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of intelligent picking and computer vision, and particularly relates to a honeysuckle target detection and picking point positioning method based on an improved YOLOv5. BACKGROUND
[0002] Honeysuckle is distributed in all provinces of China, has a large planting area, many varieties, and has certain medicinal value. Its main function is to clear heat and detoxify, and is used to treat warm disease fever. It is also convenient to store and brew, so it also has certain economic value. At present, the picking method of honeysuckle mainly relies on manual picking by farmers or small handheld picking devices, which has the problems of time-consuming and laborious and low efficiency. The use of intelligent picking robots can greatly save labor and improve picking efficiency.
[0003] The intelligent picking robot mainly locates the position information of honeysuckle through target detection technology in computer vision to position the accurate picking point for the next picking. The current target detection technology mainly uses deep learning method. With the rapid development of deep learning in recent years, the target detection algorithm represented by YOLOv5 is widely used in the field of intelligent robot recognition.
[0004] However, the above technology still has the following defects:
[0005] (1) The honeysuckle dataset without preprocessing is brought into the original YOLOv5 network for training, which may cause the extracted features to be not obvious, the pre-frame to be inconsistent with the real frame size, and the generalization of the model to be poor.
[0006] (2) Although YOLOv5 is faster than traditional target detection algorithms in training speed, it is difficult to extract the features of small targets, so the original YOLOv5 target detection network still has the problem of low accuracy.
[0007] (3) There are often many honeysuckles in the same image predicted by the network. If the traditional picking method is used to pick the predicted honeysuckles one by one, there will be the problem of low efficiency. SUMMARY
[0008] In order to solve the problems in the prior art, the honeysuckle target detection and picking point positioning method based on the improved YOLOv5 is proposed. The improved YOLOv5 target detection network is used to increase the detection accuracy of honeysuckle without reducing the training speed, improve the generalization of the model, and also locate the most suitable picking point for the growth of single or multiple honeysuckles on the same leaf and according to the size of the picking device, and improve the picking efficiency.
[0009] The technical scheme adopted by the application is as follows:
[0010] A honeysuckle target detection method based on improved YOLOv5, comprising the following steps:
[0011] Step 1, collect honeysuckle image, and pretreat the honeysuckle image;
[0012] Step 2, use k-means clustering to cluster the honeysuckle image annotation box to generate a preselected box, and use the obtained preselected box as the preselected box of the target detection network;
[0013] An improved YOLOv5 network is constructed, which comprises Input layer, Backbone layer, Neck layer and Head layer connected in sequence; wherein the activation function in the CBH module in the Backbone layer and the Neck layer is a HardSwish function; a cbam attention mechanism module is introduced into the spp structure of the Backbone layer, and the structure is improved to spp-cbam structure;
[0014] Step 3, input the honeysuckle image into the improved YOLOv5 network, extract features through the Backbone layer, then input the features into the Neck layer for feature fusion, finally input the features into the Head layer to obtain the prediction box, then perform non-maximum suppression, and draw the predicted honeysuckle position on the image; realize honeysuckle target detection.
[0015] Further, the spp-cbam structure comprises 2 CBH modules, 3 global maximum pooling, 1 cbam attention mechanism module and 1 concat layer; the cbam attention mechanism module and 3 global maximum pooling are connected in parallel between the CBH module and the concat layer; the output of the concat layer is connected to another CBH module; the feature map is transmitted into the cbam attention mechanism module after passing through the CBH module, the cbam attention mechanism module outputs the feature map, 1 feature map without change and 3 feature maps after global maximum pooling, and the concatenated feature map is transmitted into the next CBH module to obtain the output of the spp-cbam structure.
[0016] Further, the CBH module in the Backbone layer and the Neck layer is composed of a convolution layer, a BN layer and an activation layer, wherein the activation function in the activation layer is a HardSwish function.
[0017] Further, the cbam attention mechanism module comprises a channel attention module and a spatial attention module.
[0018] Further, the preprocessing comprises performing bilateral filtering processing on the collected honeysuckle flower images; wherein the standard deviation of the filtering of the color space = 70, and the standard deviation of the filtering of the spatial coordinates = 70.
[0019] Further, the honeysuckle flower images are labeled by using a LabelImg labeling tool, the positions of the honeysuckle flowers in the images are boxed by horizontal frames, and are saved in a YOLO format.
[0020] A honeysuckle flower picking point positioning method in a complex situation comprises the following steps:
[0021] Step 1: collecting honeysuckle flower images;
[0022] Step 2: inputting the honeysuckle flower images into an improved YOLOv5 network, and using the improved YOLOv5 network to predict the position information of the honeysuckle flowers, and outputting the prediction results on the images;
[0023] Step 3: judging whether the honeysuckle flowers are single or multiple growths based on the prediction results, then constructing a minimum picking range frame, and finally positioning the most suitable picking point according to the size of the picker to guide the picker to pick.
[0024] Further, in step 3, a discriminator is constructed to determine the honeysuckle flower prediction frames predicted by the improved YOLOv5 network, and to determine whether the honeysuckle flowers on the same branch are single or multiple growths.
[0025] After the honeysuckle flower prediction frames are input into the discriminator, the predicted honeysuckle flower position coordinates are x, y, w, and h, wherein x and y are the center coordinates of the prediction frame, w and h are the width and height of the prediction frame, if the horizontal or vertical position distance between two prediction frames exceeds twice the sum of the widths or heights of the two prediction frames, it is determined that the two predicted honeysuckle flowers do not grow on the same branch; if the horizontal or vertical position distance between two prediction frames does not exceed twice the sum of the widths or heights of the two prediction frames, it is determined that the two predicted honeysuckle flowers grow on the same branch; if the horizontal or vertical position distance between a third prediction frame and one of the two honeysuckle flower prediction frames determined to grow on the same branch does not exceed twice the sum of the widths or heights of the two prediction frames, it is determined that the three predicted honeysuckle flowers grow on the same branch, and so on, to determine all honeysuckle flowers on the same branch.
[0026] Further, for the honeysuckle flower that is determined to be single growth and does not grow on the same branch with other honeysuckle flowers, the honeysuckle flower is picked individually by using a picker, and the picking point is the center coordinates (x, y) of the prediction frame.
[0027] Further, for all honeysuckle judged to grow on the same branch, a minimum picking range frame is constructed to contain all honeysuckle prediction frames in its horizontal or vertical position, if the horizontal or vertical length of the minimum picking range frame does not exceed the maximum length of the picker, the picking point is positioned at the center position of all honeysuckle on the same branch; if the horizontal or vertical length of the minimum picking range frame exceeds the maximum length of the picker, the picking point is positioned at the center coordinates of the prediction frame of the first honeysuckle on the same branch, and then the same is repeated, and then picked multiple times.
[0028] The beneficial effects of the present application are:
[0029] (1) When performing data preprocessing, all images are subjected to bilateral filtering, highlighting the edge details of honeysuckle, which can better extract features during network training and improve prediction accuracy; at the same time, it can remove part of the noise and make up for the problems of unclear pictures and blurred honeysuckle edges when making the data set.
[0030] (2) When performing data preprocessing, all annotation frames are subjected to k-means clustering to generate multiple prediction frames, and the initial pre-selection frame in the original YOLOv5 network is replaced, which can avoid the problem that the network converges to a local minimum point when automatically calculating the pre-selection frame, and cannot generate an optimal point, thereby improving the training accuracy of the network.
[0031] (3) Replace all Leaky-Relu activation functions in the original YOLOv5 network with HardSwish activation functions, which has the advantages of smooth HardSwish activation function curve and derivable at any point, which improves accuracy without increasing computational complexity, and is more suitable for mobile scenarios than Leaky-Relu activation functions.
[0032] (4) Add the spp structure in the original YOLOv5 network to the attention mechanism cbam module and improve it to spp-cbam structure, which can improve the feature extraction capability of the model in the channel and space, so that the model can locate the area of interest faster, and improve the accuracy of the model; at the same time, the cbam attention mechanism module is added to the spp structure, which reduces the parameter amount of the model compared with adding it in front of or behind the entire spp structure, and improves the prediction efficiency of the model.
[0033] (5) A kind of determinator is added in the honeysuckle picking point positioning method in complex conditions, which can judge whether the honeysuckle on the same branch is single or multiple growth according to the predicted honeysuckle position information, judge the sparseness of honeysuckle, provide a prediction method for the growth of honeysuckle in complex conditions, and provide a basis for positioning the best picking point.
[0034] (6) In the method for positioning the picking point of honeysuckle in complex conditions, the minimum picking range frame of all honeysuckle on the same branch is calculated, and compared with the size of the picker, and the optimal picking point is positioned. Compared with the traditional method of picking one by one, the efficiency of picking is improved. And the positioning method can position the optimal picking point according to the size of the picker and the sparseness of the honeysuckle, and has the advantages of strong adaptability and local conditions. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 is the overall technical flowchart of the method of the present application.
[0036] Figure 2 is the network structure of the improved YOLOv5 of the present application.
[0037] Figure 3 is the spp structure in the existing YOLOv5 network.
[0038] Figure 4 is the spp-cbam structure in the improved YOLOv5 network of the present application.
[0039] Figure 5 is the cbam structure diagram of the attention mechanism module of the present application.
[0040] Figure 6 is the method for determining whether the honeysuckle is grown on the same branch.
[0041] Figure 7 is the positioning diagram of the honeysuckle picking point in complex conditions. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application.
[0043] A honeysuckle target detection method based on improved YOLOv5, as shown in Figure 1 , includes the following steps:
[0044] Step 1, the image of honeysuckle is collected by the camera, and the image is preprocessed before inputting into the network. The honeysuckle image after preprocessing is used as the input of the target detection network, and the target detection network is trained.
[0045] The preprocessing of the collected honeysuckle images includes operations such as dividing, labeling, flipping, mosaic data enhancement, and bilateral filtering on the data set; and obtaining pre-frames through k-means clustering on the honeysuckle image set, and taking the pre-frames obtained through k-means clustering as the pre-frames of the target detection network.
[0046] More specifically, when the honeysuckle images are preprocessed, the data set is divided into a training set and a validation set according to a ratio of 7:3.
[0047] More specifically, all images are labeled using the LabelImg labeling tool, and the positions of honeysuckle in the images are framed with horizontal frames, and saved in YOLO format.
[0048] More specifically, the honeysuckle images are preprocessed using methods such as flipping and mosaic data enhancement provided in the YOLOv5 network.
[0049] More specifically, the honeysuckle images are subjected to bilateral filtering processing. Among them, sigmaColor (standard deviation of filtering in color space) = 70, sigmaSpace (standard deviation of filtering in spatial coordinates) = 70.
[0050] More specifically, in the present application, the labeled frames in all images are clustered through the k-means clustering method; according to the labeled frames in the existing training set samples, nine pre-frames with the closest sizes are clustered, for example: [[13 35]
[2619] [22 43][44 42][82 24][29 77][52 75][103 61][117 140]], and the nine clustered prediction frames are used to replace the original nine pre-frames provided in the YOLOv5 network.
[0051] Step (2), the YOLOv5 target detection network includes an Input layer (input layer), a Backbone layer (main network layer), a Neck layer (feature fusion layer), and a Head layer (detection head layer); the functions of each layer are as follows:
[0052] The Input layer is to preprocess the image, in order to increase the diversity of data and improve the generalization ability of the model, including Mosaic data enhancement;
[0053] The Backbone layer is to extract features from the image, including Focus structure and CSP structure;
[0054] The Neck layer is to fuse features of the image, including FPN and PAN structure;
[0055] The Head layer has three detection heads to generate prediction results for three different sizes of feature maps.
[0056] In the present application, the YOLOv5 target detection network is improved, and the improvements include: (1) the activation function in all CBL (convolution layer-BN layer-activation layer) modules in the Backbone layer and the Neck layer of the YOLOv5 network is changed from Leaky-Relu function to HardSwish function, thereby obtaining a "CBH" module.
[0057] (2) The spp structure in the Backbone layer of the original YOLOv5 target detection network is as shown in Figure 3 The present application adds a cbam attention mechanism module to the spp structure, and the improvement is an spp-cbam structure, and the improved spp-cbam structure is as shown in Figure 4 Therefore, the improved YOLOv5 network is as shown in Figure 2
[0058] As shown in Figure 4 After the feature map is input into the spp structure, it is first passed through a CBH (convolution layer-BN layer-activation layer) module, and then the output of the feature map at this time is input into a cbam attention mechanism module. The output feature map is concatenated with an unchanged feature map in the original spp structure and three feature maps subjected to global maximum pooling, and the concatenated feature map is input into the next CBH (convolution layer-BN layer-activation layer) module, and the output thereof is the output of the improved spp-cbam structure.
[0059] The cbam attention mechanism module includes a channel attention module and a spatial attention module, as shown in Figure 5
[0060] The channel attention module subjects the input feature map to global maximum pooling and global average pooling respectively to obtain two 1*1*C feature maps (C is the number of channels of the feature map), then inputs them into a two-layer neural network respectively, and the resulting channel number is still C. Then, the two features are added and activated by a Sigmoid function, and the resulting feature is multiplied by the original feature map to obtain the feature map after the channel attention module,
[0061] The spatial attention module takes the output of the channel attention module as input and performs channel-based global maximum pooling and global average pooling to obtain two H*W*1 feature maps (H and W are the height and width of the feature map). Then, the two feature maps are concatenated based on the channel, and then a convolution layer is used to reduce the channel number to 1. The result is multiplied by the input of the spatial attention module, and the resulting output is the output of the cbam attention mechanism module.
[0062] Step 3, after the preprocessed image is input into the YOLOv5 network, feature extraction is performed through the improved Backbone layer, then the feature fusion is performed in the Neck layer, and finally the Head layer is input to obtain the prediction box, and non-maximum suppression is performed to draw the predicted honeysuckle position on the image; the honeysuckle target detection is realized.
[0063] Based on the improved YOLOv5 target detection network constructed by the above method, the improved YOLOv5 target detection network is used to realize accurate positioning of the honeysuckle picking point under complex conditions, and the specific implementation is as follows:
[0064] A honeysuckle picking point positioning method under complex conditions, the method comprises the following steps:
[0065] Step (1), the honeysuckle image is collected by the camera, and the honeysuckle data set is preprocessed by using the above preprocessing method;
[0066] Step (2), the preprocessed image is input into the improved YOLOv5 network, and the improved YOLOv5 network is used to predict the position information of the honeysuckle, and the predicted result is output on the image;
[0067] Step (3), based on the prediction result, it is judged whether the honeysuckle is single or multiple growth, then a minimum picking range box is constructed, and finally the most suitable picking point is positioned according to the size of the picker to guide the picker to pick.
[0068] More specifically, in step (3), a discriminator is constructed to determine the honeysuckle prediction box predicted by the improved YOLOv5 network, and it is determined whether the honeysuckle on the same branch is single or multiple growth.
[0069] As Figure 6 As shown in the left drawing, after the honeysuckle prediction box is input into the discriminator, the coordinates of the two predicted honeysuckle positions are (x1, y1, w1, h1) and (x2, y2, w2, h2), wherein x i , y i is the center coordinate of the i-th prediction box, w i , h i is the width and height of the i-th prediction box, and when the horizontal distance between two horizontal prediction boxes is greater than or equal to twice the sum of the widths of the two prediction boxes, that is, there is the following relationship:
[0070] x2-x1≥2(w1+w2)
[0071] Where x2-x1 is the horizontal distance between the two horizontal prediction boxes, and w1+w2 is the sum of the widths of the two prediction boxes, the decision maker determines that the two honeysuckle flowers do not grow on the same branch, i.e., they grow as a single flower. At this point, the optimal picking point is located at the center coordinates (x1-x2) of a single honeysuckle flower. i y i The harvester harvests the items one by one, as shown in the figure, first harvesting the (x1, y1) position, then harvesting the (x2, y2) position; or it can harvest the (x2, y2) position first, then harvesting the (x1, y1) position.
[0072] Conversely, if the horizontal distance between two horizontal prediction boxes is less than twice the sum of their widths, the following relationship exists:
[0073] x2-x1<2(w1+w2)
[0074] The decision-maker determines that if two honeysuckle plants grow on the same branch, then it is considered that multiple plants are growing.
[0075] like Figure 6 As shown in the right figure, after the honeysuckle prediction box is input into the decision maker, let the coordinates of the three predicted honeysuckle positions be (x1, y1, w1, h1), (x2, y2, w2, h2), and (x3, y3, w3, h3), where x and y are the center coordinates of the prediction box, and w and h are the width and height of the prediction box. When the horizontal distance between the first and second horizontal prediction boxes is less than twice the sum of the widths of the two prediction boxes, the following relationship exists:
[0076] x2-x1<2(w1+w2)
[0077] Where x2-x1 is the horizontal distance between the two horizontal prediction boxes, and w1+w2 is the sum of the widths of the two prediction boxes, the decision maker determines that the two honeysuckle plants grow on the same branch.
[0078] If there is a third honeysuckle horizontal prediction box nearby, such as Figure 6 The right figure shows the third prediction box, and this third prediction box is one of the two honeysuckle prediction boxes that have already been identified as being on the same branch (e.g., Figure 6 The right figure shows the second horizontal prediction box. The horizontal distance between these two prediction boxes does not exceed twice the sum of their widths or heights, meaning the following relationship exists:
[0079] x3-x2<2(w2+w3)
[0080] Where x3-x2 is the horizontal distance between the second and third horizontal prediction boxes, and w2+w3 is the sum of the widths of the second and third prediction boxes, the decision maker determines that the third honeysuckle grows on the same branch as the first two.
[0081] By analogy, the decision-maker determines whether all predicted honeysuckle plants are growing individually or in groups.
[0082] For multiple honeysuckle plants determined to be growing on the same branch, such as Figure 7 As shown, a minimum picking range box is generated to include all honeysuckle in its horizontal direction, as shown by the dashed box in the figure. The size of the picker relative to the honeysuckle is shown by the black box in the figure. The position of the honeysuckle prediction box is shown by the black box in the minimum picking range box in the figure.
[0083] like Figure 7 As shown in the left and middle images, when the horizontal distance of the minimum picking range frame is less than the horizontal distance of the picker, the following relationship exists:
[0084] W 框< W 采摘器
[0085] Among them, W 框 W is the horizontal distance of the minimum picking area frame. 采摘器 This refers to the horizontal distance of the harvester. If the number of honeysuckle flowers within the minimum harvesting area is odd, such as... Figure 7 As shown in the left figure, the optimal picking point of the harvester is located at the center coordinates of the middle honeysuckle, which is (x2, y2); if the number of honeysuckle flowers within the minimum picking range is even, such as Figure 7 As shown in the middle figure, the optimal picking point of the harvester is located at the coordinate center of the two honeysuckle flowers in the middle, which is (x2+x3 / 2, y2+y3 / 2).
[0086] like Figure 7 As shown in the right figure, when the horizontal distance of the minimum picking range frame is greater than or equal to the horizontal distance of the picker, the following relationship exists:
[0087] W 框 ≥W 采摘器
[0088] Among them W 框 W is the horizontal distance of the minimum picking area frame. 采摘器 The optimal picking point of the picker is located at the center coordinates (x1, y1) of the first honeysuckle in the horizontal direction. After picking, the honeysuckle is re-determined to be growing as a single or multiple plants. The horizontal distance of the minimum picking range box and the horizontal distance of the picker are compared again, and then picking is carried out again, and so on.
[0089] Figure 7The shown case is the case when the honeysuckle grows vertically, and the case when the honeysuckle grows horizontally is similar, only the horizontal distance x2-x1 is changed to the vertical distance y2-y1, the width sum w1+w2 of the prediction frame is changed to the height sum h1+h2, the horizontal distance W of the minimum picking range frame is changed to the vertical distance H of the minimum picking range frame, and the rest is the same as the horizontal case, which will not be described here.
[0090] The above examples are only used to illustrate the design idea and characteristics of the present application, and the purpose is to enable those skilled in the art to understand the content of the present application and to implement it, and the protection scope of the present application is not limited to the above examples. Therefore, any equivalent changes or modifications made according to the principles and design ideas disclosed by the present application are within the protection scope of the present application.
Claims
1. A honeysuckle target detection method based on improved YOLOv5, characterized in that, It comprises the following steps: Step 1, collecting honeysuckle images, and pre-processing the honeysuckle images; Step 2, using k-means clustering to cluster the honeysuckle image annotation box to generate a pre-selected box, and taking the obtained pre-selected box as the pre-selected box of the target detection network; An improved YOLOv5 network is constructed, which comprises Input layer, Backbone layer, Neck layer and Head layer connected in sequence; wherein the activation function in the CBH module in the Backbone layer and the Neck layer is a HardSwish function; a cbam attention mechanism module is introduced into the spp structure of the Backbone layer, which is improved to an spp-cbam structure; Step 3, taking the honeysuckle image as the input of the improved YOLOv5 network, extracting features through the Backbone layer, then inputting the features into the Neck layer for feature fusion, finally inputting the features into the Head layer to obtain the prediction box, and then performing non-maximum suppression to draw the predicted honeysuckle position on the image; the honeysuckle target detection is realized; The spp-cbam structure comprises 2 CBH modules, 3 global maximum pooling, 1 cbam attention mechanism module and 1 concat layer; the cbam attention mechanism module and the 3 global maximum pooling are connected in parallel between the CBH module and the concat layer; the output of the concat layer is connected to another CBH module; the feature map is transmitted into the cbam attention mechanism module after passing through the CBH module, the cbam attention mechanism module outputs the feature map, which is concatenated with 1 unchanged feature map and 3 global maximum pooled feature maps, and the concatenated feature map is transmitted into the next CBH module to obtain the output of the spp-cbam structure; The CBH module in the Backbone layer and the Neck layer is composed of a convolution layer, a BN layer and an activation layer, wherein the activation function in the activation layer is a HardSwish function.
2. The honeysuckle target detection method based on improved YOLOv5 according to claim 1, characterized in that, The cbam attention mechanism module comprises a channel attention module and a spatial attention module.
3. The honeysuckle target detection method based on improved YOLOv5 according to claim 1, characterized in that, The pre-processing comprises bilateral filtering processing on the collected honeysuckle images; wherein the standard deviation of color space filtering is 70, and the standard deviation of spatial coordinates filtering is 70.
4. The honeysuckle target detection method based on improved YOLOv5 according to claim 1, characterized in that, The honeysuckle images are labeled using the LabelImg labeling tool, the positions of the honeysuckle in the images are boxed with horizontal frames, and the images are saved in YOLO format.
5. A method for positioning a honeysuckle picking point in a complex situation, characterized in that, It comprises the following steps: Step 1, collecting honeysuckle images; Step 2, predicting the position information of the honeysuckle images using the honeysuckle target detection method based on the improved YOLOv5 according to claim 1, and outputting the prediction results on the images; Step 3, judging whether the honeysuckle is single or multiple growth based on the prediction results, then constructing a minimum picking range box, and finally positioning the most suitable picking point according to the size of the picker to guide the picker to pick; An improved YOLOv5 network is constructed, which comprises Input layer, Backbone layer, Neck layer and Head layer connected in sequence; wherein the activation function in the CBH module in the Backbone layer and the Neck layer is a HardSwish function; a cbam attention mechanism module is introduced into the spp structure of the Backbone layer, which is improved to an spp-cbam structure; Step 3, taking the honeysuckle image as the input of the improved YOLOv5 network, extracting features through the Backbone layer, then inputting the features into the Neck layer for feature fusion, finally inputting the features into the Head layer to obtain the prediction box, and then performing non-maximum suppression to draw the predicted honeysuckle position on the image; the honeysuckle target detection is realized; The spp-cbam structure comprises 2 CBH modules, 3 global maximum pooling, 1 cbam attention mechanism module and 1 concat layer; the cbam attention mechanism module and the 3 global maximum pooling are connected in parallel between the CBH module and the concat layer; the output of the concat layer is connected to another CBH module; the feature map is transmitted into the cbam attention mechanism module after passing through the CBH module, the cbam attention mechanism module outputs the feature map, which is concatenated with 1 unchanged feature map and 3 global maximum pooled feature maps, and the concatenated feature map is transmitted into the next CBH module to obtain the output of the spp-cbam structure; The CBH module in the Backbone layer and the Neck layer is composed of a convolution layer, a BN layer and an activation layer, wherein the activation function in the activation layer is a HardSwish function. The cbam attention mechanism module comprises a channel attention module and a spatial attention module. The pre-processing comprises bilateral filtering processing on the collected honeysuckle images; wherein the standard deviation of color space filtering is 70, and the standard deviation of spatial coordinates filtering is 70. The honeysuckle images are labeled using the LabelImg labeling tool, the positions of the honeysuckle in the images are boxed with horizontal frames, and the images are saved in YOLO format. After the honeysuckle flower prediction box input determinator, set the predicted honeysuckle flower position coordinates as x, y, w, h, wherein x, y are the center coordinates of the prediction box, w, h are the width and height of the prediction box, if the horizontal or vertical position distance between two prediction boxes exceeds twice the sum of the width or height of the two prediction boxes, it is determined that the two predicted honeysuckle flowers do not grow on the same branch; if the horizontal or vertical position distance between two prediction boxes does not exceed twice the sum of the width or height of the two prediction boxes, it is determined that the two predicted honeysuckle flowers grow on the same branch; if the horizontal or vertical position distance between the third prediction box and one of the two honeysuckle flower prediction boxes determined to be on the same branch does not exceed twice the sum of the width or height of the two prediction boxes, it is determined that the three predicted honeysuckle flowers grow on the same branch, and so on, to determine all honeysuckle flowers on the same branch; for all honeysuckle flowers determined to grow on the same branch, construct a minimum picking range box to contain all honeysuckle flower prediction boxes in the horizontal or vertical position, if the horizontal or vertical length of the minimum picking range box does not exceed the maximum length of the picker, the picking point is positioned at the center position of all honeysuckle flowers on the same branch; if the horizontal or vertical length of the minimum picking range box exceeds the maximum length of the picker, the picking point is positioned at the center coordinates of the prediction box of the first honeysuckle flower on the same branch, and then the re-determination is carried out, and then the picking is carried out in multiple times.
6. The method according to claim 5, wherein, For the honeysuckle flower determined to grow alone and not to grow with other honeysuckle flowers on the same branch, the picker is used for single picking, and the picking point is the center coordinates (x, y) of the prediction box.
Citation Information
Patent Citations
Picking point positioning method
CN110223349A
Target detection method based on improved YOLOv5 and binocular stereo vision
CN114565900A
Greenhouse tomato identification and detection method adopting CBAM and octave convolution improved YOLOV5
CN115424247A