Navel orange detection method in agricultural environment
By introducing CBAM in the YOLOv8 model, replacing the loss function WIoU_Loss v3, and using GhostNet, the problem of slow detection speed and low accuracy of navel oranges in agricultural environments is solved, and efficient and accurate navel orange detection is achieved, which is suitable for the real-time detection needs of picking robots.
Patent Information
- Application Number
- CN202411572724.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
AI Technical Summary
In the agricultural environment, it is difficult for the prior art to accurately detect navel oranges under conditions of fast real-time detection speed, low model calculation complexity, and small parameters, especially when branches and leaves are lush and light conditions change.
Based on the YOLOv8 model, the convolutional block attention module CBAM was introduced, CIoU_Loss was replaced with WIoU_Loss v3, and the lightweight backbone network GhostNet was introduced to adjust network parameters and conduct expansion training to improve the detection speed and accuracy of the model.
It realizes the rapid and accurate detection of navel oranges in an agricultural environment, meeting the needs of picking robots for real-time detection, and has the advantages of high precision, fast detection speed and lightweight.
Smart Images

Figure CN119516332A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of fruit target detection, and in particular to a navel orange detection method in an agricultural environment. Background Art
[0002] In the current navel orange picking process, manual picking is still the main method for large-scale fruit harvesting in orchards, but this is not only inefficient but also extremely labor-intensive. Therefore, fruit picking robots have become an important direction for agricultural development. In the process of picking robots, navel orange detection technology plays a vital role in the automated harvesting task. Accurate detection of navel oranges on the tree is the premise and basis for realizing automatic picking.
[0003] With the continuous development of artificial intelligence, fruit detection methods based on deep learning have been widely used in the agricultural field. More and more scholars use convolutional neural networks to detect orchard crops (Cao P, Wang Y, Qian KX, et al. Comparisons of hydraulic performance in permanent maglev pump for water-jet propulsion [J]. Advances in Mechanical Engineering, 2014, 6: 438176.), which effectively improves the problems existing in traditional target detection methods. Quan et al. used a pre-trained network method to process the VGG19 network to improve the Faster R-CNN model algorithm, aiming to detect corn seedlings at different growth stages in complex field operation environments (Quan L, Feng H, Lv Y, et al. Maize seedling detection under different growth stages and complex field environments based on an improved Faster R–CNN [J]. Biosystems Engineering, 2019, 184: 1-23.). Although the Faster R-CNN algorithm can achieve fruit recognition with a certain degree of accuracy, it is a two-stage model. The network model is too large and the detection time is long, which cannot meet the real-time detection requirements (Ren S, He K, Girshick R, et al. Faster R-CNN: Towards real-time object detection with region proposal networks [J]. IEEE transactions on pattern analysis and machine intelligence, 2016, 39 (6): 1137-1149.). With the continuous development of deep learning, many researchers have applied the single-stage YOLO series to the agricultural field. Shang Gaogao et al. proposed a lightweight citrus detection model based on improved YOLOv4, and proposed an optimized model pruning method to address problems such as model parameter redundancy. The results showed that the average precision mAP0.5 value of the proposed model in identifying citrus reached 94.22%, which was 1.18% higher than that of the YOLOv4 model (Shang Gaogao, Jiang Kun, Han Jiangyi, et al. A lightweight fruit detection method in orchard environment [J]. Journal of Jiangsu University (Natural Science Edition), 2024, 45(01): 46-52+59.).Compared with YOLOv4, YOLOv5 has greatly improved detection speed and accuracy. Many scholars use YOLOv5s target detection model to achieve accurate and fast detection of citrus, apple flowers, and tea fruit in natural scenes. The model has good robustness and small size, which is suitable for model migration (Chen S, Xiong J, Jiao J, et al. Citrus fruits maturity detection in natural environments based on Convolutional neural networks and visual saliency map [J]. Precision Agriculture, 2022, 23 (5): 1515-1531.). In recent years, Li Huiqin et al. have made improvements based on YOLOv8n and designed a tomato detection model suitable for natural environments, which effectively reduced the misjudgment and false detection during detection. In terms of detection accuracy and speed, the improved model performed well (Li Huiqin, Song Zhaoming, Liu Cunxiang, et al. Improvement of tomato fruit detection model based on YOLOv8n [J / OL]. Journal of Henan Agricultural University, 1-14 [2024-07-23].).
[0004] Although the above methods have made many improvements to target detection technology, most of the experimental studies do not take the actual environment into consideration. In an agricultural environment, navel orange trees have many branches and leaves, which shade the fruits, and the fruits overlap in large quantities. The lighting conditions vary, and the accuracy of recognition and positioning will be affected. Therefore, it is crucial to improve the accuracy of navel orange detection. Summary of the invention
[0005] The purpose of the present invention is to provide a navel orange detection method in an agricultural environment for a picking robot with limited computing power, so as to meet the mobile terminal deployment conditions of the picking robot and solve the problems of slow real-time detection speed, high model calculation complexity and large number of parameters.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is:
[0007] A method for detecting navel oranges in an agricultural environment comprises the following steps:
[0008] Step S1: collecting navel orange images to be detected to form a data set, and dividing the data set into a training set and a test set;
[0009] Step S2: performing data enhancement on part of the data in the training set to expand the training set;
[0010] Step S3: Based on the YOLOv8 model, the convolutional block attention module CBAM is introduced, CIoU_Loss is replaced by WIoU_Loss v3, and finally the lightweight backbone network GhostNet is introduced;
[0011] Step S4: adjusting the network parameters in the current YOLOv8 model, and training the YOLOv8 model based on the expanded training set to obtain a trained navel orange detection model;
[0012] Step S5: The navel orange detection model trained in step S4 is used to detect the test set to complete the navel orange detection in the agricultural environment.
[0013] Furthermore, the specific steps of step S1 are:
[0014] Step S11: collecting navel orange image data on site to form a data set;
[0015] Step S12: randomly divide the data set into a training set and a test set in a ratio of 8:2.
[0016] Furthermore, the specific data enhancement method of step S2 is: performing random horizontal flipping, random cropping, random brightness adjustment, and random rotation on the unprocessed part of the training set, and storing them in XML format.
[0017] Furthermore, the specific steps of step S3 are:
[0018] Step S31: Based on the YOLOv8 model, the feature extraction of the navel orange image is enhanced, and the CBAM attention mechanism is added between the first C2f module and the upsampling in the YOLOv8 neck layer;
[0019] Step S32: Replace the CIoU_Loss function of the original YOLOv8 with the WIoU_Loss v3 function;
[0020] Step S33: In the original YOLOv8 feature extraction network structure, the Conv modules except the first Conv module are replaced with GhostNet modules, and the C2f module is replaced with the C3Ghost module for improvement.
[0021] The beneficial effects of the present invention are as follows: the present invention relates to a navel orange detection model in an agricultural environment. First, the convolutional block attention module CBAM is introduced into the feature extraction link of the YOLOv8 model to improve the generalization ability of the model. Secondly, the WIoU_Loss function is used to accelerate the bounding box regression to make up for the weak generalization and slow convergence speed of the CIoU_Loss function in the detection task. Finally, the lightweight backbone network GhostNet is introduced to improve the detection speed of the model. The detection model disclosed by the present invention can accurately detect navel oranges in a natural environment, and has the advantages of high precision, fast detection speed, and light weight, and can meet the high real-time requirements of the picking robot for navel orange detection in an agricultural environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a general flow chart of a navel orange detection method in an agricultural environment of the present invention;
[0023] Figure 2 It is a network structure diagram of the improved YOLOv8 in the present invention;
[0024] Figure 3 2 is a comparison chart of detection effects of different models in the embodiments of the present invention. DETAILED DESCRIPTION
[0025] The present invention will be further described in detail below in conjunction with the embodiments. Figure 1 As shown, the overall flow chart of a method for detecting navel oranges in an agricultural environment of the present invention. The specific steps of the method are as follows:
[0026] Step S1: collecting navel orange images to be detected to form a data set, and dividing the data set into a training set and a test set;
[0027] Step S11: collecting navel orange image data on site to form a data set;
[0028] Step S12: randomly divide the data set into a training set and a test set in a ratio of 8:2.
[0029] Step S2: performing data enhancement on part of the data in the training set to expand the training set;
[0030] The specific data enhancement method is: perform random horizontal flipping, random cropping, random brightness adjustment, and random rotation on the unprocessed part of the training set, and store it in XML format.
[0031] Step S3: Based on the YOLOv8 model, the convolutional block attention module CBAM is introduced, CIoU_Loss is replaced by WIoU_Loss v3, and finally the lightweight backbone network GhostNet is introduced;
[0032] Step S31: Based on the YOLOv8 model, the feature extraction of the navel orange image is enhanced, and the CBAM attention mechanism is added between the first C2f module and the upsampling in the YOLOv8 neck layer;
[0033] Step S32: Replace the CIoU_Loss function of the original YOLOv8 with the WIoU_Loss v3 function;
[0034] The WIoU_Loss v3 introduced in the network is expressed as:
[0035] L WIoUv1 =R WIoU L IoU (1)
[0036]
[0037] L IoU =1-IoU (3)
[0038]
[0039] Among them, L WIoUv1 represents the WIoU_Loss v1 loss function; R WIoU ∈[1,e) represents the penalty term of WIoU_Loss; x and y are the coordinates of the upper left corner of the frame, x gt With y gt is the coordinate of the upper left corner of the target box, W g and H g Indicates the width and height of the minimum bounding box; L IoU ∈[0,1] represents the IoU loss function; L WIoUv3 is the WIoU_Loss v3 function; α, δ represent hyperparameters used to control the gradient gain r and discreteness β; is the sliding average of the momentum m.
[0040] Step S33: In the original YOLOv8 feature extraction network structure, the Conv modules except the first Conv module are replaced with GhostNet modules, and the C2f module is replaced with the C3Ghost module for improvement.
[0041] GhostNet initially uses standard convolution to generate m layers of raw features. The amount of computation in this part is expressed as:
[0042] Y=X*f+b (6)
[0043]
[0045] Where * represents the convolution operation; b represents the bias term; Y∈Rh ' ×w ' ×n Represents the output feature map; f∈R h ' ×w ' ×n is the convolution filter of this layer; y ij indicates that Y performs a cheap mapping; y′∈Y, represents the j-th linear transformation of source feature i, where Generate multiple corresponding Ghost feature maps y ij .
[0046] Step S4: adjusting the network parameters in the current YOLOv8 model, and training the YOLOv8 model based on the expanded training set to obtain a trained navel orange detection model;
[0047] Step S5: The navel orange detection model trained in step S4 is used to detect the test set to complete the navel orange detection in the agricultural environment.
[0048] The effect of the present invention can be further illustrated by the following simulation.
[0049] 1. Experimental conditions and methods:
[0050] Experimental simulation environment: Pytorch, Ubuntu
[0051] Experimental methods: The original YOLOv8 model was used for detection and the present invention was used for detection.
[0052] 2. Experimental content and results analysis:
[0053] Experimental content: The present invention uses a navel orange dataset with different lighting conditions, different time, different occlusion degree and different distance. The present invention and the original YOLOv8 model are used to perform navel orange detection experiments on the expanded dataset.
[0054] Experimental results analysis: The ablation results obtained by the present invention are shown in Table 1. The effects of different models in detecting navel oranges are shown in Table 1. Figure 3 As shown. Figure 2 It can be seen that the improved YOLOv8 model has reduced missed detections and false detections, and can successfully identify severely occluded fruits, which can meet the requirements of real-time and effective fruit detection by harvesting robots in agricultural environments.
[0055] Table 1 Ablation results
[0056]
[0057] The above contents are only used to illustrate the technical solution of the present invention. Simple modifications or equivalent substitutions of the technical solution of the present invention made by ordinary technicians in this field do not deviate from the essence and scope of the technical solution of the present invention.
Claims
1. A method for detecting navel oranges in an agricultural environment, characterized in that: The following steps are involved: Step S1: collecting navel orange images to be detected to form a data set, and dividing the data set into a training set and a test set; Step S2: performing data enhancement on part of the data in the training set to expand the training set; Step S3: Based on the YOLOv8 model, the convolutional block attention module CBAM is introduced, CIoU_Loss is replaced by WIoU_Loss v3, and finally the lightweight backbone network GhostNet is introduced; Step S4: adjusting the network parameters in the current YOLOv8 model, and training the YOLOv8 model based on the expanded training set to obtain a trained navel orange detection model; Step S5: The navel orange detection model trained in step S4 is used to detect the test set to complete the navel orange detection in the agricultural environment.
2. The navel orange detection method in an agricultural environment according to claim 1, characterized in that: The specific steps of step S1 are: Step S11: collecting navel orange image data on site to form a data set; Step S12: randomly divide the data set into a training set and a test set in a ratio of 8:
2.
3. The navel orange detection method in an agricultural environment according to claim 1, characterized in that: The specific data enhancement method of step S2 is: randomly flipping, randomly cropping, randomly adjusting brightness, and randomly rotating the unprocessed part of the training set, and storing it in XML format.
4. The navel orange detection method in an agricultural environment according to claim 1, characterized in that: The specific steps of step S3 are: Step S31: Based on the YOLOv8 model, the feature extraction of the navel orange image is strengthened, and the CBAM attention mechanism is added between the first C2f module and the upsampling in the neck layer of the YOLOv8 model; Step S32: Replace the CIoU_Loss function of the original YOLOv8 model with the WIoU_Loss v3 function; Step S33: In the feature extraction network structure of the original YOLOv8 model, the Conv modules except the first Conv module are replaced with GhostNet modules, and the C2f module is replaced with the C3Ghost module for improvement.
Citation Information
Cited By
Citrus detection method using frequency domain aggregation attention mechanism and multi-scale encoder
CN120375087A