Table grape detection method applied to agricultural robot picking
Through data augmentation and multi-scale fusion technology, combined with SE attention mechanism and non-maximum suppression method, the recognition accuracy and speed of grape picking robots in complex scenarios is improved, and the problem of insufficient recognition accuracy and speed in the existing technology is solved. It realizes efficient grape detection and automated picking.
Patent Information
- Application Number
- CN202411012767.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-07-26
AI Technical Summary
Existing grape picking robots have poor recognition accuracy and slow recognition speed in complex scenarios, especially due to high influence on lighting conditions and environmental factors, resulting in low detection accuracy and low efficiency.
A target detection method including data augmentation, feature extraction, multi-scale fusion and attention mechanism is adopted to extract the shape, color and texture information of grapes through feature extraction neural networks and ELSAN structures, and improve the attention mechanism through SPPF module and SE attention mechanism. Detection accuracy and speed, combined with non-maximum suppression method to optimize the segmentation ability of overlapping grapes.
It improves the accuracy and speed of grape recognition, enhances the detection performance in complex scenarios, reduces the interference of artificially set thresholds, and provides an efficient and automated picking solution.
Smart Images

Figure CN119131781A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and in particular, relates to a method for detecting table grapes used in robot picking. Background Art
[0002] As an important economic crop, table grapes are widely planted throughout my country. However, the current harvesting of table grapes is mainly done manually, which is labor-intensive and time-consuming. Due to the increasing aging population and the loss of rural labor, intelligent harvesting robots are needed to replace manual labor. Grape harvesting robots need to be able to walk independently and smoothly in the vineyard to ensure comprehensive traffic capacity and stability of operation; secondly, the visual recognition system should be able to quickly and accurately identify and locate grapes, and work effectively even in the case of partial occlusion or grape overlap; finally, the robotic arm needs to quickly and accurately reach and pick grapes, while being able to cope with changes in the position of grapes caused by environmental factors. The harvesting robot system is mainly composed of a control system, a visual recognition system, and a mechanical system, in which the mechanical system includes a walking mechanism, a bracket, a storage box, a robotic arm, and an end effector. The recognition and positioning accuracy and speed of the visual system are crucial to improving the precision and efficiency of the harvesting robot. At the same time, given that grapes are extremely vulnerable to damage, an efficient and accurate visual recognition system is indispensable for the performance of the harvesting robot.
[0003] Traditional target detection is mainly based on machine learning and digital image processing technology. These methods use basic features such as color, shape and texture of objects for matching. However, since their thresholds need to be manually determined, these methods have poor robustness and generalization capabilities. They are greatly affected by lighting conditions, detection environment and various human subjective factors, which can easily lead to problems such as low detection accuracy, incomplete detection and low efficiency.
[0004] In recent years, with the rapid development of computer vision, target detection algorithms based on deep learning have begun to be applied in the agricultural field. At present, target detection algorithms based on deep learning are mainly divided into two-stage and single-stage. Due to the poor real-time performance of the two-stage, it is difficult to apply it to actual agricultural scenarios. YOLO is a typical single-stage target detection algorithm based on CNN. Compared with traditional algorithms, it has greater advantages in speed and accuracy, is more in line with the requirements of agricultural scenarios, and can quickly detect and locate targets. However, when the conventional YOLO algorithm is applied on embedded devices, it is still limited by accuracy and speed. Summary of the invention
[0005] In order to overcome the shortcomings of the existing technology and solve the problems of poor recognition accuracy and slow recognition speed of grape picking robots in complex scenes, the present invention provides a fresh grape detection method applied to agricultural robot picking, which improves the recognition accuracy and recognition speed of fresh grapes in complex scenes.
[0006] The technical solution adopted by the present invention to solve its technical problem is:
[0007] A method for detecting table grapes used in agricultural robot picking, the method comprising the following steps:
[0008] Step 1: Collect the data of the grape image dataset, perform mosaic data enhancement operation on the data, obtain richer data samples, and then perform subsequent feature extraction operations;
[0009] Step 2: Extract features from the preprocessed image and generate feature vectors. The process is as follows: the data sample is input into the feature extraction neural network as a training sample, and a feature map is obtained through convolution, pooling and activation operations. The feature map is then input into the ELSAN structure to extract the shape, color and texture surface information of the grapes.
[0010] Step 3: Multi-scale fusion of the extracted features: The feature map output by the feature extraction neural network realizes feature fusion at different levels through the feature pyramid structure;
[0011] Step 4: During training,
[0012] The image is divided into n*n cells, and the grapes in each cell are judged based on the features obtained by the convolution operation, and the boundary information of the grapes in the cell is obtained, and the position and category of the grapes are predicted, and then compared with the calibrated real grape position and category; the loss function is calculated, and the weights of each layer of the neural network are corrected by back propagation according to the loss function to adjust the model parameters;
[0013] Step 5: Determine whether the training has reached the end condition. If not, return to step 4; if it has, stop the training and output the model result.
[0014] Step 6: Use the trained model to perform target detection operations and use the non-maximum suppression method to delete redundant prediction boxes.
[0015] Furthermore, in step 2, the process of ELSAN extracting information is as follows:
[0016] 2.1.1. The input feature map is divided into two parts, namely, cross-level connection and stack calculation block. The cross-level connection is used to speed up the reasoning speed, and the stack calculation block is used to enrich the gradient information and improve the learning ability.
[0017] 2.1.2. Use the feature tensor superposition concat operation to reduce the speed of the algorithm accessing memory;
[0018] 2.1.3. Finally, the channel shuffling operation is performed to improve the fusion of feature information in different channels.
[0019] Furthermore, in step 2, the SPPF module is introduced to perform pooling operations on the input feature map at different scales, and the operation results are concatenated to obtain rich feature information; the SE attention mechanism is added before the SPPF module to obtain the optimal feature weights between its channels; the process is as follows:
[0020] 2.2.1. First, the input feature map H×W×C is spatially compressed, and global average pooling is performed in the spatial dimension to obtain a 1×1×C feature map;
[0021] 2.2.2. Perform full connection layer operation learning on the compressed feature map to obtain a feature map with channel attention;
[0022] 2.2.3. Combine the feature map with channel attention with the original feature map, and obtain the final feature map with channel attention by multiplying the weight coefficient channel by channel.
[0023] Furthermore, the process of step 3 is as follows:
[0024] 3.1. Gradually reduce the resolution of the image through downsampling operations, while extracting higher-level semantic information to obtain a feature map with low resolution but more abstract and global information;
[0025] 3.2. Upsample the low-resolution feature map to a higher resolution through upsampling operation to obtain a more local and detailed feature map;
[0026] 3.3. The upsampled high-resolution feature map is fused with the original feature map layer by layer to obtain rich contextual information.
[0027] Furthermore, in step 4, the loss function is defined as:
[0028] Loss 总体 =Loss 置信度 +Loss 定位
[0029] Among them, Loss 置信度 The binary cross entropy loss function used is used to calculate the difference between the confidence score obtained by the prediction and the actual situation; Loss 定位 The α-IoU used introduces power loss based on IoU and analyzes the loss function and gradient weight features. The positioning loss function is defined as follows:
[0030]
[0031] Among them, α is the coefficient of the positioning loss function, which can adapt to different recognition models; IoU is the intersection over union ratio of the predicted box and the true box, and the formula is defined as follows:
[0032]
[0033] In step 5, each training cycle is set to include N training rounds, where N is an integer. After each training cycle, the evaluation index mAP of each training cycle is calculated, and the formula is as follows:
[0034]
[0035] AP=∫P(R)dR
[0036]
[0037] Among them, k is the number of grape categories, TP is the number of true positive samples, that is, samples that are grapes but are also identified as grapes, FP is the number of false positive samples, that is, samples that are not grapes but are identified as grapes, and FN is the number of false negative samples, that is, samples that are grapes but are identified as non-grapes; different confidence levels will be obtained when predicting the results, that is, the probability that the algorithm believes it is grapes. Only when the confidence level is greater than the set confidence threshold will it be recorded in TP. Therefore, different confidence thresholds will produce different precision P and recall rate R; in order to reduce the interference of the artificially set confidence threshold on the algorithm evaluation, when the confidence threshold changes from 0-1, the current precision P and recall rate R are recorded, and a curve with the horizontal axis being the recall rate R and the vertical axis being the precision P is established, and the area AP surrounded by the precision-recall rate curve and the coordinate axis is calculated;
[0038] The mAP is calculated once in each training cycle, and the current maximum mAP is saved. When the mAP in X training cycles is less than the maximum mAP, the training stops, and the model parameters of the last training round of the training cycle corresponding to the maximum mAP are taken as the final training results.
[0039] Preferably, in step 5, if the training is not stopped when the maximum training round is reached, the model parameters of the last round of training in the training cycle corresponding to the maximum mAP are used as the final training results. This solution is to avoid the extreme situation where the stopping condition cannot be met, and the maximum training round is often taken as a larger value.
[0040] Of course, the end condition of step 5 can also be the maximum training rounds. Once the training rounds reach the maximum training rounds, the training stops, and the round training model parameters with the smallest loss function are used as the final training result. This solution is relatively inefficient.
[0041] Preferably, in step 6, the non-maximum value suppression method is defined as follows:
[0042]
[0043] Among them, M is the bounding box with the highest confidence, b i represents the comparison bounding box in the current target, N t is the threshold, α-IoU(M,b i ) is the loss function and σ is the penalty coefficient.
[0044] More preferably, in step 1, the mosaic data enhancement operation includes random cropping, rotation, scaling, splicing, brightness adjustment and masking operations.
[0045] In step 2 of the present invention, before the training samples after data enhancement are input into the backbone network to obtain the backbone network, a new backbone network is used to replace the original backbone network of YOLO. The new backbone network deletes the residual units and transition layers in the original network, improves the reasoning speed of the model and the ability to extract features on small sample data sets, and introduces channel shuffling operations in the new backbone network to increase the ability to fuse features in different channel layers and improve the detection performance of the model.
[0046] In the step 3, the SE attention mechanism is introduced before the multi-scale feature fusion. Based on global pooling and squeeze excitation, the SE module can obtain global information and adaptively adjust the feature weights. SE is integrated into CSPDarknet53 to connect YOLO, establish the interdependence between model channels, and adaptively recalibrate the feature response in the channel direction, thereby improving the network performance.
[0047] In step 4, a new convolution operation is introduced into the neck network of YOLO to replace the original convolution operation, thereby reducing the extraction of redundant features in the neck network, accelerating the reasoning speed of the model, and improving the spatial feature extraction capability of the model.
[0048] In the present invention, the intelligent picking task of the grape picking robot can be decomposed into three subtasks: 1) The picking robot needs to be able to walk alone and steadily in the vineyard, maintaining the global passability and global operation stability; 2) The visual recognition system can quickly and accurately identify and locate grapes, can identify grapes in the case of partial occlusion, and can segment overlapping grapes; 3) The robotic arm needs to quickly and accurately approach and pick grapes, and can also cope with the situation where the grapes are forced to move by unknown forces in the environment. Therefore, the picking robot includes a mechanical structure, a visual recognition system 3, and a control system containing robotic arm control and visual recognition, wherein the mechanical mechanism includes a walking mechanism 6, a bracket 1, a storage box 5, a robotic arm 2, and an end effector 4. The main functions of each module are as follows: (1) Visual recognition system. When the grape picking robot moves to the workspace, the recognition system first identifies and locates the grape bunches. At this time, the main purpose is to preliminarily locate and distinguish overlapping grape bunches, and guide the subsequent picking plan. Then, the robotic arm is driven to approach the grapes, identify the fruit stems, and locate the picking point. The robot arm is controlled by positioning feedback of the picking point to reduce the damage to the grape bunches. (2) Control system. The mechanical structure of the picking robot is controlled according to the information obtained by the recognition system. That is, the path planning and walking control of the walking mechanism of the picking robot are carried out, and the trajectory and posture of the robot arm are planned and controlled. Due to the limited space of the picking robot, an embedded device is used as the control center of the picking robot. The embedded system of the picking robot must perform image processing, target detection, and control the robot arm and mobile platform, so it has high requirements for the real-time performance of the target detection algorithm.
[0049] The beneficial effects of the present invention are mainly manifested in:
[0050] 1) The present invention improves the ability of grape feature extraction by designing a new backbone network, effectively assists the training of small-scale data sets and accelerates the reasoning speed of target detection.
[0051] 2) The present invention replaces the convolution operation of the neck network of the YOLO model, thereby reducing the redundant features of the grapes and improving the ability of spatial feature extraction.
[0052] 3) The present invention designs an optimization scheme combining the YOLO model with the attention mechanism, combines the attention of space and channels to effectively suppress irrelevant features, so that the model has better performance in complex scenes, and better copes with the problems of cluttered background of grape growth, unclear targets, and easy occlusion.
[0053] 4) The present invention improves the segmentation capability of overlapping grapes by designing a new non-maximum suppression method, which effectively improves the accuracy and efficiency of fruit detection, thereby providing a reliable detection solution for automated harvesting in agricultural scenarios that does not rely on manual experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a design flow chart of the present invention;
[0055] Figure 2 It is a network structure diagram of the present invention;
[0056] Figure 3 It is the ELSAN network structure diagram of the present invention;
[0057] Figure 4 is a schematic diagram of a picking robot, wherein 1 represents a bracket, 2 represents a robotic arm, 3 represents a visual recognition system, 4 represents an end effector, 5 represents a storage box, and 6 represents a mobile platform. DETAILED DESCRIPTION
[0058] The present invention will be further described below in conjunction with the accompanying drawings.
[0059] Reference Figure 1 to Figure 3 , a method for detecting table grapes used in agricultural robot picking, comprising the following steps:
[0060] Step 1: Load the data of the grape image dataset into the model, perform mosaic data enhancement on the image to obtain richer data samples, and then perform subsequent feature extraction operations;
[0061] In this embodiment, the grape image taken by a camera or mobile phone is subjected to mosaic data enhancement operations, including random cropping, rotation, scaling, splicing, brightness adjustment, masking, etc. Some scenes in reality are simulated to enrich the diversity of samples and enhance the learning ability of small samples.
[0062] Step 2: Extract features from the preprocessed image and generate feature vectors: Before inputting the data-enhanced training samples into the backbone network, a new backbone network is used to replace the original backbone network of YOLO. The new backbone network deletes the residual units and transition layers in the original network, which improves the model's reasoning speed and the ability to extract features on small sample data sets. In addition, a channel shuffling operation is introduced into the new backbone network to increase the ability to fuse features in different channel layers and improve the detection performance of the model.
[0063] This embodiment uses ELSAN to replace the C3 and CBS structures in the original backbone network. Figure 1 As shown in the figure, the 640×640×3 preprocessed grape picture is input into the feature extraction network, and a 32×32×64 feature map is obtained through convolution, pooling and activation operations (CBS module). The feature map is then input into the ELSAN structure to extract its surface information such as shape, color, texture, etc., and the network structure is continuously deepened to obtain richer semantic information.
[0064] The process of ELSAN extracting information is as follows:
[0065] 2.1.1. Divide the input feature map into two parts: cross-level connection and stack calculation block. Cross-level connection is used to speed up the reasoning speed, and stack calculation block is used to enrich gradient information and improve learning ability.
[0066] 2.1.2. Use the feature tensor superposition concat operation to reduce the speed of the algorithm accessing memory;
[0067] 2.1.3. Finally, the channel shuffling operation is performed to improve the fusion of feature information in different channels;
[0068] The SPPF module is introduced to perform pooling operations on the input feature map at different scales, and the operation results are spliced to obtain rich feature information. In order to better perform multi-scale fusion operations, the SE attention mechanism is added before the SPPF module to obtain the optimal feature weights between its channels. The process is as follows:
[0069] 2.2.1. First, the input feature map H×W×C is spatially compressed, and global average pooling is performed in the spatial dimension to obtain a 1×1×C feature map;
[0070] 2.2.2. Perform full connection layer operation learning on the compressed feature map to obtain a feature map with channel attention;
[0071] 2.2.3. Combine the feature map with channel attention with the original feature map, and obtain the final feature map with channel attention by multiplying the weight coefficient channel by channel.
[0072] Step 3: Multi-scale fusion of the extracted features: The feature map output by the feature extraction network realizes feature fusion at different levels through the feature pyramid structure. The process is as follows:
[0073] 3.1. Gradually reduce the resolution of the image through downsampling operations, while extracting higher-level semantic information to obtain a feature map with low resolution but more abstract and global information;
[0074] 3.2. Upsample the low-resolution feature map to a higher resolution through upsampling operation to obtain a more local and detailed feature map;
[0075] 3.3. The high-resolution feature map obtained by upsampling is fused layer by layer with the original feature map to obtain rich context information;
[0076] In this process, the C3_Flase module is replaced with the C3P module to improve the neck network, such as Figure 1As shown in the figure, because redundant feature information will appear when multi-scale features are fused, only one-quarter of the channels are selected for convolution operation in C3P to improve the detection speed of the model.
[0077] Step 4: Training process
[0078] The image is divided into n*n cells, and the grapes in each cell are judged based on the features obtained by the convolution operation, and the boundary information of the grapes in the cell is obtained, and the position and category of the grapes are predicted, and then compared with the calibrated real grape position and category; the loss function is calculated, and the weights of each layer of the neural network are corrected by back propagation according to the loss function to adjust the model parameters;
[0079] The loss function is defined as:
[0080] Loss 总体 =Loss 置信度 +Loss 定位
[0081] Among them, Loss 置信度 The binary cross entropy loss function used is used to calculate the difference between the confidence score obtained by the prediction and the actual situation; Loss 定位 The α-IoU used introduces power loss based on IoU and analyzes the loss function and gradient weight features. The positioning loss function is defined as follows:
[0082]
[0083] Among them, α is the coefficient of the positioning loss function, which can adapt to different recognition models; IoU is the intersection over union ratio of the predicted box and the true box, and the formula is defined as follows:
[0084]
[0085] Step 5: Determine whether the training has reached the end condition. If not, return to step 4; if it has, stop the training and output the model result.
[0086] In step 5, each training cycle is set to include N training rounds, where N is an integer (N is 10). After each training cycle, the evaluation index mAP of each training cycle is calculated, and the formula is as follows:
[0087]
[0088] AP=∫P(R)dR
[0089]
[0090] Among them, k is the number of grape categories, TP is the number of true positive samples, that is, samples that are grapes but are also identified as grapes, FP is the number of false positive samples, that is, samples that are not grapes but are identified as grapes, and FN is the number of false negative samples, that is, samples that are grapes but are identified as non-grapes; different confidence levels will be obtained when predicting the results, that is, the probability that the algorithm believes it is grapes. Only when the confidence level is greater than the set confidence threshold will it be recorded in TP. Therefore, different confidence thresholds will produce different precision P and recall rate R; in order to reduce the interference of the artificially set confidence threshold on the algorithm evaluation, when the confidence threshold changes from 0-1, the current precision P and recall rate R are recorded, and a curve with the horizontal axis being the recall rate R and the vertical axis being the precision P is established, and the area AP surrounded by the precision-recall rate curve and the coordinate axis is calculated;
[0091] The mAP is calculated once in each training cycle, and the current maximum mAP is saved. When the mAP in X (for example, X is 8) training cycles is less than the maximum mAP, the training stops, and the model parameters of the last round of training in the training cycle corresponding to the maximum mAP are taken as the final training results.
[0092] In step 5, if the training is not stopped when the maximum number of training rounds (e.g., 600) is reached, the model parameters of the last round of training in the training cycle corresponding to the maximum mAP are used as the final training results. This solution is to avoid the extreme situation where the stopping condition cannot be met, and the maximum number of training rounds is often taken as a larger value.
[0093] Of course, the end condition of step 5 can also be the maximum training rounds (for example, 600 rounds). Once the training rounds reach the maximum training rounds, the training stops, and the round training model parameters with the smallest loss function are used as the final training result. This solution is relatively inefficient.
[0094] Step 6: Target detection and non-maximum suppression
[0095] Since the YOLO algorithm is a detection method based on anchor frames, it is necessary to extract the most suitable target through the non-maximum suppression method. In the present invention, the Soft Alpha_NMS method is used to replace the original NMS method to improve the algorithm's detection ability for grapes in overlapping scenes.
[0096] The non-maximum suppression method is used to replace the original method. Combined with Alpha-IoU, there is a finer division for the deletion and retention of the prediction box, which helps to improve the detection accuracy of the algorithm in overlapping scenes. The non-maximum suppression method is defined as follows:
[0097]
[0098] Among them, M is the bounding box with the highest confidence, b i represents the comparison bounding box in the current target, N t is the threshold, usually set to 0.5, α-IoU(M,b i ) is the loss function and σ is the penalty coefficient.
[0099] Reference Figure 4 , the fresh grape detection method is applied to agricultural picking robots, including the following picking process: 1) rely on the visual system to navigate and locate the mobile platform so that the grapes that can be picked can enter the working space of the picking robot; 2) the robot uses a high-precision visual recognition system to identify the position and size of the grapes. During the recognition process, the robot will calculate the precise coordinates of the grapes and plan the optimal picking path; 3) when approaching the grapes, the robot will adjust the position of its mechanical arm according to the coordinates and posture of the grape picking point, and use a shear-clamp integrated end mechanism to avoid damage to the fruit; 4) after picking, the robot will place the grapes in the storage box it carries and continue to perform the next round of search and picking tasks. Through such an automated process, the mobile grape picking robot greatly improves the picking efficiency and quality, reduces labor costs and time consumption, and also reduces human interference in the vineyard during the operation.
[0100] The contents described in the embodiments of this specification are merely enumerations of implementation forms of the inventive concept and are for illustrative purposes only. The protection scope of the present invention should not be considered to be limited to the specific forms described in this embodiment, and the protection scope of the present invention also extends to equivalent technical means that can be thought of by ordinary technicians in this field based on the inventive concept.
Claims
1. A method for detecting table grapes used in agricultural robot picking, characterized in that: The method comprises the following steps: Step 1: Collect the data of the grape image dataset, perform mosaic data enhancement operation on the data, obtain richer data samples, and then perform subsequent feature extraction operations; Step 2: Extract features from the preprocessed image and generate feature vectors. The process is as follows: the data sample is input into the feature extraction neural network as a training sample, and a feature map is obtained through convolution, pooling and activation operations. The feature map is then input into the ELSAN structure to extract the shape, color and texture surface information of the grapes. Step 3: Multi-scale fusion of the extracted features: The feature map output by the feature extraction neural network realizes feature fusion at different levels through the feature pyramid structure; Step 4: During the training process, the image is divided into n*n cells. The grapes in each cell are judged based on the features obtained by the convolution operation, and the boundary information of the grapes in the cell is obtained. The position and category of the grapes are predicted, and then compared with the calibrated real grape position and category; the loss function is calculated, and the weights of each layer of the neural network are corrected by back propagation according to the loss function to adjust the model parameters; Step 5: Determine whether the training has reached the end condition. If not, return to step 4; if it has, stop the training and output the model result. Step 6: Use the trained model to perform target detection operations and use the non-maximum suppression method to delete redundant prediction boxes.
2. A method for detecting table grapes for picking by agricultural robots according to claim 1, characterized in that in step 2, the process of extracting information by ELSAN is as follows: 2.1.
1. The input feature map is divided into two parts, namely, cross-level connection and stack calculation block. The cross-level connection is used to speed up the reasoning speed, and the stack calculation block is used to enrich the gradient information and improve the learning ability. 2.1.
2. Use the feature tensor superposition concat operation to reduce the speed of the algorithm accessing memory; 2.1.
3. Finally, the channel shuffling operation is performed to improve the fusion of feature information in different channels.
3. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 1 or 2, characterized in that: In step 2, the SPPF module is introduced to perform pooling operations on the input feature map at different scales, and the operation results are concatenated to obtain rich feature information; the SE attention mechanism is added before the SPPF module to obtain the optimal feature weights between its channels; the process is as follows: 2.2.
1. First, the input feature map H×W×C is spatially compressed, and global average pooling is performed in the spatial dimension to obtain a 1×1×C feature map; 2.2.
2. Perform full connection layer operation learning on the compressed feature map to obtain a feature map with channel attention; 2.2.
3. Combine the feature map with channel attention with the original feature map, and obtain the final feature map with channel attention by multiplying the weight coefficient channel by channel.
4. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 1 or 2, characterized in that: The process of step 3 is as follows: 3.
1. Gradually reduce the resolution of the image through downsampling operations, while extracting higher-level semantic information to obtain a feature map with low resolution but more abstract and global information; 3.
2. Upsample the low-resolution feature map to a higher resolution through upsampling operation to obtain a more local and detailed feature map; 3.
3. The upsampled high-resolution feature map is fused with the original feature map layer by layer to obtain rich contextual information.
5. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 1 or 2, characterized in that: In step 4, the loss function is defined as: Loss overall = Loss confidence + Loss positioning Among them, the binary cross entropy loss function used by Loss confidence is used to calculate the difference between the confidence score obtained by the prediction and the actual situation; the α-IoU used by Loss positioning introduces power loss on the basis of IoU and analyzes the loss function and gradient weight characteristics. The positioning loss function is defined as follows: Among them, α is the coefficient of the positioning loss function, which can adapt to different recognition models; IoU is the intersection over union ratio of the predicted box and the true box, and the formula is defined as follows:
6. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 1 or 2, characterized in that: In step 5, each training cycle is set to include N training rounds, where N is an integer. After each training cycle, the evaluation index mAP of each training cycle is calculated, and the formula is as follows: AP=∫P(R)dR Where k is the number of grape categories, TP is the number of true positive samples, that is, samples that are grapes but are also identified as grapes, FP is the number of false positive samples, that is, samples that are not grapes but are identified as grapes, and FN is the number of false negative samples, that is, samples that are grapes but are identified as non-grapes; when predicting results, when the confidence is greater than the set confidence threshold, it will be recorded in TP. When the confidence threshold changes from 0-1, the precision P and recall rate R of the current round of training are recorded, and the area AP surrounded by the precision-recall curve and the coordinate axis is calculated; The mAP is calculated once in each training cycle, and the current maximum mAP is saved. When the mAP in X training cycles is less than the maximum mAP, the training stops, and the model parameters of the last round of training in the training cycle corresponding to the maximum mAP are taken as the final training results.
7. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 6, characterized in that: In step 5, if the training is not stopped when the maximum number of training rounds is reached, the model parameters of the last round of training in the training cycle corresponding to the maximum mAP are used as the final training results.
8. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 1 or 2, characterized in that: In step 6, the non-maximum value suppression method is defined as follows: Among them, M is the bounding box with the highest confidence, b i represents the comparison bounding box in the current target, N t is the threshold, α-IoU(M,b i ) is the loss function and σ is the penalty coefficient.
9. A method for detecting table grapes used for picking by agricultural robots as claimed in claim 1 or 2, characterized in that: In step 1, the mosaic data enhancement operation includes random cropping, rotation, scaling, splicing, brightness adjustment and masking operations.
Citation Information
Patent Citations
Grape identification method in non-structural environment based on improved YOLOv4
CN115050021A
Small target detection method based on improved YOLOv5
CN117710965A
Persimmon fruit detection method based on improved YOLOv5 model
CN118196757A
Cited By
Plant growth condition monitoring method, system and equipment and storage medium
CN119478708A
