Efficient blueberry maturity detection method based on improved YOLOv8

By improving the YOLOV8 model, the introduction of CWFM, DBBNCSPELAN, and Seam modules solves the limitations of blueberry maturity detection in complex scenarios, and achieve higher detection accuracy and reasoning speed. Essence

CN119380202APending Publication Date: 2025-01-28KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411834567.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In complex scenarios, blueberry ripening has limitations and it is difficult to ensure detection accuracy, especially when the fruits are densely distributed, severe occlusion and uneven lighting conditions.

Method used

Improve the YOLOV8 model, and introduce the feature fusion module of the Channel Weight Fusion Module (CWFM) feature fusion module, DBBNCSpeland structural weight parameterization module, and Seam blocking attention module to improve the fineness and adaptability of the model's multi -scale characteristics fusion, improve the detection in complex scenes. performance.

Benefits of technology

Effectively improve the fineness and flexibility of the model's fusion of different scale characteristics, improve the detection accuracy and reasoning speed of complex scenarios, and can better deal with the problems of dense distribution, severe obstruction and uneven lighting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119380202A_ABST
    Figure CN119380202A_ABST
Patent Text Reader

Abstract

The invention relates to an efficient blueberry maturity detection method based on improved YOLOv8, and belongs to the technical field of computer vision. The method comprises the following steps: collecting a greenhouse blueberry picture data set; preprocessing the blueberry picture data set, including cutting blueberry pictures and labeling the blueberry pictures, the labeling being divided into three types: immature, semi-mature and mature; dividing the preprocessed data set into a training set, a verification set and a test set; the YOLOv8 model is improved; training the improved YOLOv8 model by using the divided training set, and performing hyper-parameter tuning by using the verification set so as to store an optimal model; and finally, evaluating the improved YOLOv8 model by using a test set in combination with evaluation indexes. According to the method, the blueberry maturity can be rapidly and accurately detected in a complex scene, and a theoretical basis is provided for an automatic blueberry picking technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an efficient blueberry maturity detection method based on improved YOLOv8, and belongs to the technical field of computer vision. Background Art

[0002] Blueberries are known as "super fruits" because they are rich in anthocyanins, flavonoids and ascorbic acid, which have been shown to help protect eyesight, prevent cancer and improve cardiovascular health. According to data from the International Blueberry Organization (IBO) in the "Global Blueberry Industry Status Report (2023)", China has become the world's largest blueberry producer. Rapid and accurate detection and positioning can help fruit farmers improve picking efficiency, which is of great significance for controlling the growth process of blueberries and optimizing crop management strategies. At present, the picking of blueberries mainly relies on manual operation based on human experience and judgment, but with the expansion of the scale of planting, the traditional manual picking method is time-consuming and labor-intensive, and it is difficult to meet the current needs of large-scale and high-efficiency production. Therefore, the realization of automated blueberry picking technology will be a very promising solution to this problem.

[0003] Traditional fruit and vegetable detection algorithms are mainly based on features such as color, texture and shape, using computer image processing technology or shallow machine learning algorithms to detect targets. However, in complex scenes, the detection targets are easily affected by factors such as occlusion, illumination and dense distribution, which often leads to poor performance of these traditional detection algorithms. In recent years, with the rapid development of artificial intelligence algorithms, target detection technology based on deep learning has been widely used in the field of computer vision. This type of technology can be divided into single-stage models and two-stage models. Among them, the two-stage model is represented by Faster R-CNN. The characteristics of this type of model are high detection accuracy, but its computational complexity is large and the reasoning speed is slow, which is difficult to meet the needs of real-time applications. Compared with the two-stage model, the single-stage model only completes target classification and bounding box regression in one stage, so the reasoning speed and computational complexity are faster and lower than the two-stage model, and it is more suitable for deployment on edge devices. Among them, the YOLO series algorithm, as a typical representative of the single-stage method, is widely used in the field of smart agriculture with its excellent performance. In existing studies, the YOLOv5 model is used to detect the maturity of blueberries, and certain results have been achieved. However, in complex scenes, these methods still have limitations and are difficult to be used universally when faced with problems such as dense distribution of fruits, severe occlusion, and uneven lighting conditions. Therefore, in order to solve the problem of blueberry maturity detection in complex scenes, the present invention selects the eighth generation algorithm YOLOv8 of the YOLO series and improves it, and proposes an efficient blueberry maturity detection model in complex scenes. Summary of the invention

[0004] The purpose of the present invention is to provide an efficient blueberry maturity detection method based on improved YOLOv8, aiming to solve the technical problem that blueberry maturity detection has limitations and it is difficult to ensure detection accuracy in complex scenes with dense distribution of fruits, severe occlusion and uneven lighting conditions.

[0005] To achieve the above object, the technical solution of the present invention is to propose an efficient blueberry maturity detection method based on improved YOLOv8, which is implemented by the following steps:

[0006] Step 1: Take pictures of blueberry trees in a greenhouse environment from multiple angles to obtain a blueberry image dataset;

[0007] Step 2: Preprocess the blueberry image dataset and divide it into training set, validation set and test set in proportion;

[0008] Step 3: Improve the original YOLOv8 model. Use the Channel Weighted Fusion Module (CWFM) feature fusion module to improve the Spatial Pyramid Pooling Fast (SPPF) module of the original YOLOv8 model; use the DBBNCSPELAN structure reparameterization module to improve the network structure of the original YOLOv8 model; use the SEAM occlusion attention module to improve the detection head of the original YOLOv8 model;

[0009] Step 4: Use the training set and validation set to train the improved YOLOv8 model;

[0010] Step 5: Use the test set to test the trained improved YOLOv8 model, calculate the evaluation indicators of the model on the test set, and complete the detection accuracy and lightweight performance evaluation of the model.

[0011] The Step 2 is specifically as follows:

[0012] The preprocessing includes image cropping, cleaning and labeling;

[0013] The image is cropped by moving 500 pixels in the height and width directions each time, and cropped to an image with a resolution of 1024×1024;

[0014] The cleaning is to delete the pictures without blueberries, overexposed and blurred pictures;

[0015] The labeling is to label the cropped image using a labeling tool, and the labeling categories are divided into three categories: immature, semi-ripe and ripe. During the labeling process, the minimum circumscribed rectangle of each blueberry is used for labeling.

[0016] Specifically, the present invention divides the blueberry image dataset into a training set, a validation set, and a test set in a ratio of 4:1:1.

[0017] In Step 3, the CWFM feature fusion module is used to improve the SPPF module of the original YOLOv8 model to enhance the flexibility of the model for multi-scale feature fusion. Specifically:

[0018] First, the output features of the four different scale branches of the feature fusion part of the SPPF module are ,in Branch output features, , H and W represent the height and width of the output feature respectively, The number of channels of the output feature, i represents the branch index; the learnable weights are initialized as , N represents the total number of channels of the output feature maps of the four branches of different scales, is the weight value of the Nth channel dimension of the output feature;

[0019] Next, initialize the weights After normalization, we get , the normalization formula is as follows:

[0020]

[0021] in, is a constant used for numerical stability, Output the weight value of the feature on the i-th channel dimension;

[0022] Afterwards, Through a one-dimensional convolutional layer with Efficient Convolutional Attention (ECA) Perform convolution processing, The specific configuration is as follows:

[0023]

[0024] in, Respectively represent the number of input channels and output channels, Represents the convolution kernel size, which is adaptively adjusted by the total number of channels. represents the offset term, which is used to calculate the benchmark for adjusting the convolution kernel k. represents the scaling factor, which is used to control the scaling degree of k, and p represents the padding size of the convolution kernel;

[0025] Thus, through The weight value of the layer processing is ;

[0026] Finally, and Multiply them together to get the final weight value , Represents the weight value of the Nth channel dimension of the output feature after weight multiplication, and then the final weight value The feature maps of the four branches of different scales are weighted in the channel dimension to obtain , where cat represents the branch output feature in the channel dimension The splicing operation is performed, and g represents the weighted feature map, which can effectively improve the model's precision and adaptability to the fusion of features of different scales.

[0027] In Step 3, the DBBNCSPELAN structure reparameterization module is used to improve the network structure of the original YOLOv8 model as follows:

[0028] The DBBNCSPELAN structure reparameterization module can improve the model's ability to extract multi-scale features without affecting the inference speed. Its Diverse Branch Block (DBB) module consists of a ,one ,one and a A multi-branch network is composed of and Respectively represent 1 1 and 3 3 convolutional layers, BN represents batch normalization layer, and AVG represents average pooling layer;

[0029] After training is completed, the parameters of the multi-branch network are converted into a standard single-channel convolutional network module through a structural reparameterization operation and applied to the inference stage of the model.

[0030] The structure reparameterization operation is used to convert the parameters of the multi-branch network into a standard single-channel convolutional network module:

[0031] First, The structure is equivalent to a Conv k×k layer;

[0032] Assumptions , represents the parameters of a convolution kernel, where C represents the number of input channels, D represents the number of output channels, and k represents the size of the convolution kernel. and Represent the input feature map and output feature map respectively, where H1 and W1 represent the height and width of the input feature map, H2 and W2 represent the height and width of the output feature map, and the output feature map The calculation formula is as follows:

[0033]

[0034] In the formula, represents the bias term, B represents the broadcast function, and maps the bias term b to the dimension of the output feature map , * represents the convolution operation. For the BN layer, the parameters include the mean μ, variance σ, learnable scale factor γ and bias β. For the output feature of the i-th channel of the Conv-BN structure , the formula is as follows:

[0035]

[0036] in, represents the mean value of all pixels on the i-th channel, represents the learnable scaling factor of the ith channel, represents the standard deviation of all pixels on the i-th channel, represents the learnable bias term of the i-th channel;

[0037] Expand the brackets in the formula to get the reparameterized convolution kernel parameters on the i-th channel and the bias term , as shown in the following formula:

[0038]

[0039] in Represents the convolution kernel parameters on the i-th channel;

[0040] Then, The structure is equivalent to a Conv k×k layer;

[0041] Assume that Conv 1×1 The convolution kernel shape of the layer is D×C×1×1, Conv k×k The convolution kernel shape of the layer is E×D×k×k, where D is 1×1 The number of output channels in the layer, in Conv k×k The number of input channels in the layer, C represents Conv 1×1 The number of input channels of Conv k×k The number of output channels, 1×1 and k×k represent the spatial dimensions of the convolution kernel;

[0042] Put two BN layers, The equivalent transformation operation is fused into two convolutional layers to obtain , and get the fused output feature map , the formula is as follows:

[0043]

[0044] in, and represents the convolution kernel parameters after equivalent operation conversion, and Represents the bias term after equivalent operation conversion;

[0045] Expand the above formula to get the following formula:

[0046]

[0047] Among them, because It is a 1×1 convolution kernel, so only linear combinations of channel features are performed on the input feature map I;

[0048] Next, the parameters of the 1×1 convolution kernel and the k×k convolution kernel are linearly reorganized and merged into a new k×k convolution operation to obtain a new convolution kernel. , where T represents the transposed convolution, ;

[0049] for , is the convolution operation of a constant matrix and a two-dimensional convolution kernel, let Q , is a constant matrix whose elements are all q, G is a two-dimensional convolution kernel, and we get ,in Represents the two-dimensional convolution kernel The summation operation of all elements is performed, based on which the bias term for the i-th output channel is , the formula is as follows:

[0050]

[0051] Where d represents the channel index of the input feature, m represents the height index of the convolution kernel, n represents the width index of the convolution kernel, and i represents the output channel index. Finally, we get ;

[0052] Finally, The structure is equivalent to a convolution layer;

[0053] For an average pooling operation applied to C channels with kernel size k and stride s, it is equivalent to a convolution operation with the same k and s. For the convolution kernel , in the spatial feature dimension, the convolution kernel parameters are , in the channel feature dimension, the convolution kernel parameters are all 0.

[0054] In Step 3, the SEAM occlusion attention module is used to improve the detection head of the original YOLOv8 model, specifically:

[0055] The improvements not only reduce the parameters and computational overhead, but also improve the expressiveness of the model. The average pooling layer and the fully connected layer are used to enhance the global perception ability, integrate the information between channels, and then the exponential normalization is used to amplify the feature differences and improve the model's ability to recognize subtle differences and sensitivity. Finally, the feature values ​​that have undergone the exponential normalization operation are used as attention weights to multiply the original input features to enhance the expression of important features. The specific operations are as follows:

[0056] First, the SEAM occlusion attention module consists of a depthwise separable convolutional layer with residual connections, an average pooling layer, a two-layer fully connected layer, and an exponential normalization layer;

[0057] Secondly, the depth-wise separable convolution layer is used to perform separate convolution operations on each channel of the feature map using different depth convolutions, and the output of each channel is linearly combined using point convolution;

[0058] Subsequently, the output features of the depthwise separable convolutional layer are passed through an average pooling layer and a fully connected layer, and the output features of the fully connected layer are then exponentially normalized to expand the feature value range from [0, 1] to [1, e];

[0059] Finally, the exponentially normalized feature values ​​are multiplied by the original input features as attention weights.

[0060] The Step 4 is specifically as follows:

[0061] Use the training set to train the improved YOLOv8 model and use the validation set for fine-tuning. After training, save the optimal model weights.

[0062] The Step 5 is specifically as follows:

[0063] The mAP0.5 and mAP0.5:0.95 of the model on the test set are calculated to evaluate the detection accuracy of the model. mAP represents the average accuracy. The higher the mAP, the more accurate the model detection. Intersection Over Union (IOU) is the overlap index between the real box and the predicted box. 0.5 represents the threshold of the index. The higher the IOU threshold, the higher the evaluation requirement of the model. At the same time, the present invention uses the parameter amount and the calculation amount to evaluate the lightweight performance of the model.

[0064] The beneficial effects of the present invention are as follows: the present invention can effectively improve the model's sophistication and flexibility in fusing features of different scales. The training and reasoning stages are decoupled through a structural reparameterization method. In the training stage, the model uses a multi-branch structure to extract rich semantic information and feature representations; in the reasoning stage, the single-path structure that converts the multi-branch structure in the training stage can accelerate the model's reasoning speed while maintaining high precision. An occlusion attention mechanism is introduced, and visualization experiments show that it can effectively improve the occlusion problem of blueberries in complex scenes. This method provides a new idea for the automated detection of fruit maturity that deals with complex backgrounds and occlusion problems, helps promote the development of smart agriculture, and provides theoretical support for research in related fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 It is a schematic diagram of the process of the present invention;

[0066] Figure 2 This is a blueberry label image marked by the Labelimg tool in an embodiment of the present invention;

[0067] Figure 3 This is a network model diagram of the improved YOLOv8 model in an embodiment of the present invention;

[0068] Figure 4 This is a structural diagram of a CWFM module in an embodiment of the present invention;

[0069] Figure 5 It is a block diagram of DBBNCSPELAN module in an embodiment of the present invention;

[0070] Figure 6 This is a structural diagram of the SEAM attention module in an embodiment of the present invention;

[0071] Figure 7 This is a visualization comparison experiment result diagram in an embodiment of the present invention. DETAILED DESCRIPTION

[0072] The content of the present invention is further described below in conjunction with the accompanying drawings and specific implementation modes, but this does not limit the scope of the present invention.

[0073] Example 1: Figure 1 As shown in the figure, an efficient blueberry maturity detection method based on improved YOLOv8 is shown in the figure. The specific steps are as follows:

[0074] Step 1: Take pictures of blueberry trees in a greenhouse environment from multiple angles to obtain a blueberry image dataset;

[0075] In this embodiment, blueberry images are collected from a blueberry planting base at noon and afternoon, and the weather conditions are sunny and cloudy. The acquisition device is a NIKON Z30 camera with a resolution of 5568×3712 pixels. Finally, 1268 pictures are collected to form the blueberry image dataset of the present invention.

[0076] Step 2: Preprocess the blueberry image dataset and divide it into training set, validation set and test set in proportion;

[0077] First, since the resolution of the collected blueberry image dataset is 5568×3712, it is not suitable for direct input into the model, so the dataset needs to be cropped. The present invention crops the dataset images to 1024×1024. In order to avoid information loss and ensure the integrity of the image boundary features, the cropping step size needs to be set. The present invention sets the cropping step size to 500 pixels, that is, the cropping is performed by moving 500 pixels each time in the height and width directions.

[0078] Then, the preprocessed blueberry dataset is labeled using the LabelImg labeling tool. Blueberry labeling categories are divided into three categories: unripe, semi-ripe, and ripe, and the labeling format is YOLO. During the labeling process, the minimum enclosing rectangle of each blueberry is used to mark it to minimize the background area, thereby improving the positioning accuracy of the target object. The use of LabelImg is as follows: Figure 2 shown.

[0079] Finally, the labeled blueberry dataset is divided into training set, validation set and test set in a ratio of 4:1:1.

[0080] Step 3: Improve the original YOLOv8 model. Use the CWFM feature fusion module to improve the SPPF module of the original YOLOv8 model. Use the DBBNCSPELAN structure reparameterization module to improve the network structure of the original YOLOv8 model. Use the SEAM occlusion attention module to improve the detection head of the original YOLOv8 model. The improved YOLOv8 model network structure is shown in the figure below. Figure 3 As shown;

[0081] Specifically, the CWFM feature fusion module is used to improve the SPPF module of the original YOLOv8 model, such as Figure 4As shown in the figure, the CWFM feature fusion module uses learnable weights to weight feature maps of different scales. Through training, the model can dynamically adjust these weights to help the model better capture multi-scale information and improve the performance of the model in complex scenarios. The main workflow of the CWFM feature fusion module is as follows: first, the output feature maps of the four branches of the SPPF module are input, and then the four feature maps are spliced ​​in the channel dimension. After that, the learnable weights are normalized, and then the normalized learnable weights are convolved using a one-dimensional convolution with ECA characteristics to emphasize local information and improve the flexibility of information interaction between different channels, and then the final weight value is obtained. Subsequently, the final weight value is weighted with the spliced ​​features to obtain the output feature map.

[0082] Specifically, the network structure of the original YOLOv8 model is improved using the DBBNCSPELAN structure reparameterization module. Figure 5 As shown in the figure, this module can not only improve the detection model's ability to extract multi-scale features in complex backgrounds, but also has a reparameterization feature, which can switch between the training and reasoning stages to improve the reasoning efficiency of the model. The main workflow of DBBNCSPELAN is as follows: In the training stage, the DBB module in the DBBNCSPELAN module is divided into multiple branches to extract feature information of different scales in parallel, where each convolution layer or average pooling layer is followed by a batch normalization layer. In the reasoning stage, a structural reparameterization operation is performed to convert multiple branches into an ordinary single-channel 3×3 convolution branch.

[0083] Specifically, the detection head of the original YOLOv8 model is improved using the SEAM occlusion attention module. Figure 6 As shown in Figure 2, the detection head is the part of the target detection model responsible for generating the final prediction results. Figure 6It can be seen that the detection head is divided into two branches, one is the bounding box regression branch, and the other is the classification branch. The present invention adds the SEAM occlusion attention module to the first CBS module of the two branches respectively to improve the model's ability to handle the blueberry fruit occlusion problem. The main workflow of the SEAM occlusion attention module is: first, through a depth-separable convolution, where the depth-separable convolution is divided into two parts: first, a depth convolution with residual connection, which performs an independent convolution operation on each channel of the input feature map, effectively reducing the number of parameters and computational complexity of the model; second, a point convolution, which combines the output of the depth convolution to fuse information from different channels. Then, through an average pooling layer and a fully connected layer, the output features from the fully connected layer are subjected to an exponential normalization operation to expand the eigenvalue range from [0,1] to [1,e]. The normalization operation can amplify the difference in eigenvalues, making it easier for the model to distinguish subtle differences and improve the sensitivity of the model. Finally, the output after the exponential normalization operation is multiplied with the original feature as the attention weight.

[0084] Step 4: Use the training set to train the improved YOLOv8 model, and then use the validation set to tune it to save the optimal training model.

[0085] Step 5: Use the test set to test the trained improved YOLOv8 model, calculate the evaluation indicators of the model on the test set, and complete the detection accuracy and lightweight performance evaluation of the model.

[0086] Specifically, the present invention uses four evaluation indicators, namely mAP0.5, mAP0.5:0.95, parameter amount and calculation amount, to evaluate the detection accuracy and lightweight performance of the model. The calculation formula is as follows:

[0087]

[0088]

[0089]

[0090]

[0091] In the formula, P represents precision, R represents recall, TP represents the number of samples correctly predicted as positive by the model, FP represents the number of samples incorrectly predicted as positive by the model, and FN represents the number of samples incorrectly predicted as negative by the model. Changes in TP, FP, and FN directly affect the P and R of the model, and thus affect the average precision (AP) index. At the same time, TP, FP, and FN are also affected by different IOU thresholds. 0.5 represents an IOU threshold of 0.5, and 0.5:0.95 represents an evaluation of a series of IOU thresholds from 0.5 to 0.95, and then the average of the evaluations under these thresholds is taken. The higher the IOU threshold, the higher the evaluation requirements of the model. The closer the AP value is to 1, the better the recognition effect of the model. The average precision (mAP) value evaluates the comprehensive detection performance of the model on all categories by averaging the AP of each category. The number of parameters refers to the total number of all parameters that need to be trained in the model. The smaller the number of parameters, the lighter the model. The amount of calculation refers to the number of floating-point operations required for the model to perform reasoning. The smaller the amount of calculation, the faster the model reasoning speed.

[0092] In order to further demonstrate the performance advantages of the improved YOLOv8 model, the present invention also introduces several current mainstream target detection models, such as YOLOv5, YOLOv6, YOLOv8 and YOLOv10 for comparative experiments. The hyperparameters used by all models in the comparative experiments are kept consistent, and 200 epochs are uniformly trained. The experimental results are shown in Table 1.

[0093] Table 1 Comparative experimental results of different target detection models

[0094] The results in Table 1 show that the improved YOLOv8 model has the best modeling effect and outperforms the compared models in all indicators. Compared with the baseline model YOLOv8, the improved YOLOv8 model has improved mAP0.5 and mAP0.5:0.95 by 1.0% and 1.4%, respectively, and reduced the number of parameters and the amount of calculation by 33.4% and 39.8%, respectively. Comparing the improved model with the latest technology YOLOv10, the improved model has improved mAP0.5 and mAP0.5:0.95 by 1.2% and 1.5%, respectively, and reduced the number of parameters and the amount of calculation by 7.5% and 30.2%, respectively.

[0095] In order to further verify the detection effect of the improved model in complex scenes, this paper selected three pictures with highly occluded scenes to conduct a comparative experiment on the visual detection effect of the improved model. The baseline models YOLOv8 and YOLOv10 were selected for comparison. The results are as follows: Figure 7 As shown in the figure, the yellow dotted circle indicates missed detection or inaccurate positioning, and the blue dotted circle indicates wrong detection. Figure 7In the first row of images, the YOLOv8 model has two false detections. One is that the unripe blueberries blocked by leaves are missed, and the other is that the detection frame positioning range is too large. The YOLOv10 model also has missed detections. Figure 7 In the second row of images, YOLOv8 missed and misdetected the blue pipe cover, mistaking it for a ripe blueberry, while YOLOv10 missed the unripe blueberry hidden by the leaves in the shadow. Figure 7 In the third row of pictures, neither YOLOv8 nor YOLOv10 detected the ripe blueberries blocked by blueberries and leaves. The improved YOLOv8 model can accurately classify and detect all target objects in these three scenes, indicating that the method of the present invention has high accuracy and stability in detecting the ripeness of blueberries with high occlusion in complex scenes. Based on the above results, the effectiveness of the improvement of the present invention is demonstrated, and its prediction accuracy basically meets the requirements of actual use, and has feasibility of application.

[0096] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. An efficient blueberry maturity detection method based on improved YOLOv8, characterized in that: The specific steps include: Step 1: Take pictures of blueberry trees in a greenhouse environment from multiple angles to obtain a blueberry image dataset; Step 2: Preprocess the blueberry image dataset and divide it into training set, validation set and test set in proportion; Step 3: Improve the original YOLOv8 model. Use the CWFM feature fusion module to improve the SPPF module of the original YOLOv8 model. Use the DBBNCSPELAN structure reparameterization module to improve the network structure of the original YOLOv8 model. Use the SEAM occlusion attention module to improve the detection head of the original YOLOv8 model. Step 4: Use the training set and validation set to train the improved YOLOv8 model; Step 5: Use the test set to test the trained improved YOLOv8 model, calculate the evaluation indicators of the model on the test set, and complete the detection accuracy and lightweight performance evaluation of the model.

2. According to claim 1, an efficient blueberry maturity detection method based on improved YOLOv8 is characterized in that: The Step 2 is specifically as follows: The preprocessing includes image cropping, cleaning and labeling; The image is cropped by moving 500 pixels in the height and width directions each time, and cropped to an image with a resolution of 1024×1024; The cleaning is to delete the pictures without blueberries, overexposed and blurred pictures; The labeling is to label the cropped image using a labeling tool, and the labeling categories are divided into three categories: immature, semi-ripe and ripe. During the labeling process, the minimum circumscribed rectangle of each blueberry is used for labeling.

3. According to claim 1, an efficient blueberry maturity detection method based on improved YOLOv8 is characterized in that: In Step 3, the CWFM feature fusion module is used to improve the SPPF module of the original YOLOv8 model as follows: First, the output features of the four different scale branches of the feature fusion part of the SPPF module are ,in Branch output features, , H and W represent the height and width of the output feature respectively, The number of channels of the output feature, i represents the branch index; the learnable weights are initialized as , N represents the total number of channels of the output feature maps of the four branches of different scales, is the weight value of the Nth channel dimension of the output feature; Next, initialize the weights After normalization, we get , the normalization formula is as follows: ; in, is a constant used for numerical stability, Output the weight value of the feature on the i-th channel dimension; Afterwards, Through a one-dimensional convolutional layer with ECA characteristics Perform convolution processing, The specific configuration is as follows: ; in, Respectively represent the number of input channels and output channels, Represents the convolution kernel size, which is adaptively adjusted by the total number of channels. represents the offset term, which is used to calculate the benchmark for adjusting the convolution kernel k. represents the scaling factor, which is used to control the scaling degree of k, and p represents the padding size of the convolution kernel; Thus, through The weight value of the layer processing is ; Finally, and Multiply them together to get the final weight value , Represents the weight value of the Nth channel dimension of the output feature after weight multiplication, and then the final weight value The feature maps of the four branches of different scales are weighted in the channel dimension to obtain , where cat represents the branch output feature in the channel dimension Perform a concatenation operation, and g represents the weighted feature map.

4. According to claim 1, an efficient blueberry maturity detection method based on improved YOLOv8 is characterized in that: In Step 3, the DBBNCSPELAN structure reparameterization module is used to improve the network structure of the original YOLOv8 model as follows: The DBBNCSPELAN structure reparameterization module, in which the DBB module consists of a ,one ,one and a A multi-branch network is composed of and Respectively represent 1 1 and 3 3 convolutional layers, BN represents batch normalization layer, and AVG represents average pooling layer; After training, the parameters of the multi-branch network are converted into a standard single-channel convolutional network module through a structural reparameterization operation.

5. According to claim 4, an efficient blueberry maturity detection method based on improved YOLOv8 is characterized in that: The structure reparameterization operation is used to convert the parameters of the multi-branch network into a standard single-channel convolutional network module: First, The structure is equivalent to a Conv k×k layer; Assumptions , represents the parameters of a convolution kernel, where C represents the number of input channels, D represents the number of output channels, and k represents the size of the convolution kernel. and Represent the input feature map and output feature map respectively, where H1 and W1 represent the height and width of the input feature map, H2 and W2 represent the height and width of the output feature map, and the output feature map The calculation formula is as follows: ; In the formula, represents the bias term, B represents the broadcast function, and maps the bias term b to the dimension of the output feature map , * represents the convolution operation. For the BN layer, the parameters include the mean μ, variance σ, learnable scale factor γ and bias β. For the output feature of the i-th channel of the Conv-BN structure , the formula is as follows: ; in, represents the mean value of all pixels on the i-th channel, represents the learnable scaling factor of the ith channel, represents the standard deviation of all pixels on the i-th channel, represents the learnable bias term of the i-th channel; Expand the brackets in the formula to get the reparameterized convolution kernel parameters on the i-th channel and the bias term , as shown in the following formula: ; in Represents the convolution kernel parameters on the i-th channel; Then, The structure is equivalent to a Conv k×k layer; Assume that Conv 1×1 The convolution kernel shape of the layer is D×C×1×1, Conv k×k The convolution kernel shape of the layer is E×D×k×k, where D is 1×1 The number of output channels in the layer, in Conv k×k The number of input channels in the layer, C represents Conv 1×1 The number of input channels of Conv k×k The number of output channels, 1×1 and k×k represent the spatial dimensions of the convolution kernel; Put two BN layers, The equivalent transformation operation is fused into two convolutional layers to obtain , and get the fused output feature map , the formula is as follows: ; in, and represents the convolution kernel parameters after equivalent operation conversion, and Represents the bias term after equivalent operation conversion; Expand the above formula to get the following formula: ; Among them, because It is a 1×1 convolution kernel, so only linear combinations of channel features are performed on the input feature map I; Next, the parameters of the 1×1 convolution kernel and the k×k convolution kernel are linearly reorganized and merged into a new k×k convolution operation to obtain a new convolution kernel. , where T represents the transposed convolution, ; for , is the convolution operation of a constant matrix and a two-dimensional convolution kernel, let Q , is a constant matrix whose elements are all q, G is a two-dimensional convolution kernel, and we get ,in Represents the two-dimensional convolution kernel The summation operation of all elements is performed, based on which the bias term for the i-th output channel is , the formula is as follows: ; Where d represents the channel index of the input feature, m represents the height index of the convolution kernel, n represents the width index of the convolution kernel, and i represents the output channel index. Finally, we get ; Finally, The structure is equivalent to a convolution layer; For an average pooling operation applied to C channels with kernel size k and stride s, it is equivalent to a convolution operation with the same k and s. For the convolution kernel , in the spatial feature dimension, the convolution kernel parameters are , in the channel feature dimension, the convolution kernel parameters are all 0.

6. The efficient blueberry maturity detection method based on improved YOLOv8 according to claim 1 is characterized in that: In Step 3, the SEAM occlusion attention module is used to improve the detection head of the original YOLOv8 model as follows: First, the SEAM occlusion attention module consists of a depthwise separable convolutional layer with residual connections, an average pooling layer, a two-layer fully connected layer, and an exponential normalization layer; Secondly, the depth-wise separable convolution layer is used to perform separate convolution operations on each channel of the feature map using different depth convolutions, and the output of each channel is linearly combined using point convolution; Subsequently, the output features of the depthwise separable convolutional layer are passed through an average pooling layer and a fully connected layer, and the output features of the fully connected layer are then exponentially normalized to expand the feature value range from [0, 1] to [1, e]; Finally, the exponentially normalized feature values ​​are multiplied by the original input features as attention weights.