Strawberry maturity detection method and system based on YOLOv8 model
By adopting the improved YOLOv8 model in strawberry ripening detection, combining GIS geographic information and multi-scale features, the problems of large manual operation errors and slow detection response speed in the prior art are solved, and efficient and accurate strawberry ripening detection is achieved.
Patent Information
- Application Number
- CN202411931519.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-23
AI Technical Summary
The existing strawberry maturity detection method requires manual image acquisition and processing, resulting in large errors and inability to realize real-time detection. The data calculation of the YOLOV3 model is huge and feature extraction is single, resulting in slow detection response speed and low accuracy.
The strawberry ripening method based on the YOLOv8 model is adopted to obtain the geographical information of the strawberry planting area through GIS, build the YOLOv8 model and make improvements, including the introduction of ShuffleNetV2 backbone network, data enhancement, multi-scale feature fusion and attention mechanism, and improve detection accuracy and response speed.
It realizes efficient and high-precision for strawberry ripening, supports timely picking of strawberries, and solves the problems of large errors and difficult real-time detection caused by manual operations in the existing technology.
Smart Images

Figure CN120030404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of strawberry maturity detection, and in particular to a strawberry maturity detection method and system based on a YOLOv8 model. Background Art
[0002] Object detection is a very simple task for humans. Even babies a few months old can recognize some common objects. However, until ten years ago, it was still a difficult task for machines to learn object detection. Object detection requires identifying and locating all instances of a target in the field of vision (such as cars, pedestrians, road signs, etc.). Together with other similar tasks, such as classification, segmentation, motion estimation, scene understanding, etc., it constitutes a basic problem in the field of computer vision.
[0003] After searching, a strawberry maturity detection method and device based on YOLOV3 is disclosed according to the utility model patent with Chinese patent number CN114724140A. The method and device collect strawberry images and preprocess the strawberry images to obtain preprocessed images; the maturity is detected according to the strawberry maturity recognition model of YOLOV3, and the maturity detection result is output.
[0004] During the use of the above detection method, the collection and processing of images require manual operation, which will lead to large collection errors. In addition, the image is collected by a fixed-point camera, which is prone to omissions. When there is a problem with the image acquisition device, the state of the strawberry cannot be detected in real time. In addition, the YOLOv8 model has huge data calculation and single feature extraction, which leads to slow detection response speed and low detection accuracy. Therefore, a strawberry maturity detection method and system based on the YOLOv8 model are proposed to solve the above problems. Summary of the invention
[0005] 1. Technical issues to be solved
[0006] In view of the shortcomings of the prior art, the present invention provides a strawberry maturity detection method and system based on the YOLOv8 model, which have the advantages of high detection accuracy and convenient for timely picking of strawberries, and solves the problems that the above-mentioned detection method requires manual operation for image collection and processing during use, which will lead to large collection errors. In addition, the image is collected by a fixed-point camera, which is prone to omissions, and when the image collection device has problems, the state of the strawberries cannot be detected in real time. In addition, the YOLOv8 model has huge data calculation and single feature extraction, which leads to slow detection response speed and low detection accuracy.
[0007] (II) Technical solution
[0008] In order to achieve the above-mentioned purpose of high detection accuracy and facilitate timely picking of strawberries, the present invention provides the following technical solution: a strawberry maturity detection method based on the YOLOv8 model, comprising the following steps:.
[0009] Step 1: Obtain geographic information of the designated strawberry planting area through GIS, and build a two-dimensional geographic model based on the GIS platform to collect information such as the distribution location, soil moisture, temperature and light of the strawberries;
[0010] Step 2: Clean and normalize the collected data to establish a strawberry maturity detection data set;
[0011] Step 3: Build a YOLOv8 model for strawberry maturity detection;
[0012] Step 4: Improve the YOLOv8 model, including introducing ShuffleNetV2 as the backbone network, enhancing the training data, introducing a multi-scale feature fusion mechanism, and introducing an attention mechanism;
[0013] Step 5: Train the improved YOLOv8 model, use the training set to train the strawberry maturity detection model, use the test set to test the effectiveness of the strawberry maturity detection model, and obtain the trained strawberry maturity detection model;
[0014] Step 6: Collect image data of the strawberries to be tested and other information collected by GIS, input the images and data into the trained improved YOLOv8 model, and output the strawberry maturity detection results and picking judgment results.
[0015] Preferably, the content acquired by the GIS platform includes: strawberry planting areas, weather conditions, strawberry pests and diseases, etc.
[0016] Preferably, the YOLOv8 detection of strawberry maturity also includes the following steps:
[0017] 1) Preparation of strawberry maturity detection dataset: real-life photography in a greenhouse, divided into three categories: mature, immature, and strawberry pedicels, and provided YOL annotation, including pictures and corresponding labels;
[0018] 2) After obtaining the data and the corresponding annotation information, the data must be processed, including data enhancement, random rotation, random cropping, color jitter, Gaussian noise, horizontal flip, and vertical flip operations on the collected images;
[0019] 3) Assign the dataset to training set, validation set and test set;
[0020] 4) Build a YOLOv8 model, import the training set content into the model, train the model, and verify the accuracy of strawberry maturity detection through the validation set and test set;
[0021] 5) Input the image to be tested into the YOLOv8 model to obtain the maturity of the strawberry.
[0022] Preferably, the loss function of YOLOv8 includes classification loss+boundary regression loss+distance loss.
[0023] Preferably, the classification loss is a cross entropy loss, which is used to measure the classification accuracy of the model for the target category, and the loss only calculates the loss of positive samples;
[0024] The boundary regression loss, which is the CloU (CompleteloU) loss, is used to measure the overlap between the predicted border and the real target box, mainly considering the differences in border position, size, and aspect ratio, and is also only calculated for positive samples;
[0025] The distance loss is used to perform fine regression on the distance of the anchor points.
[0026] Preferably, the improvement of the YOLOv8 model in step 3 includes:
[0027] ESNet, as the backbone network of YOLOv8, Shuffle NetV2, has better adaptability on mobile terminals than other networks. In order to further improve the performance and information expression between channels, ESNet adopts the method of adding channel attention mechanism (Squeeze-and-Excitation Module) to strengthen the feature information between network channels.
[0028] Preferably, the SE attention mechanism is a lightweight attention mechanism that can improve the performance of the model without adding too many parameters and computational complexity. Structurally, the SE module is mainly divided into three steps: First, feature compression is performed through a Squeeze operation to obtain a global receptive field;
[0029] The compressed vector is then processed using the Excitation operation to better capture the relationship between channels;
[0030] Finally, the feature vector is fully multiplied with the original vector, so that the original feature map increases the feature information of each channel.
[0031] Preferably, the multi-scale feature fusion mechanism, YOLOv8 adopts a multi-trunk feature fusion method, which can effectively improve the performance of target detection. GhostNet+ShuffleNet or SwinTransformer+ShuffleNet can be used as the backbone network, and features at different levels can be fused through technologies such as feature pyramid network (FPN) and cross-scale feature fusion.
[0032] Preferably, the strawberry maturity detection system comprises a main control module, a GIS strawberry information acquisition module, a data processing C2f module, a SE module, a Ghost module, a model training module and a strawberry maturity output module;
[0033] The main control module controls each module in the strawberry maturity detection system, so as to achieve the effect of working in coordination to enable the yolov8 model to be used normally;
[0034] GIS strawberry information collection module uses the GIS system to mark various conditions including strawberry planting distribution, pests and diseases, light, soil, etc., making the maturity detection standard more diversified and accurate;
[0035] The data processing C2f module makes the YOLOv8 model more lightweight;
[0036] The SE module strengthens the characteristic information of the network channel, thereby strengthening the characteristic information of the maturity of the strawberry, and further improving the response efficiency of the YOLOv8 model;
[0037] The Ghost module is a lightweight convolution module that can generate more features with fewer parameters and improve the learning ability of the model to prevent feature loss;
[0038] The model training module further trains the improved YOLOv8 model;
[0039] The strawberry maturity output module imports the image and data into the YOLOv8 model, and outputs the data through the strawberry maturity output module, thereby providing a judgment basis for strawberry picking.
[0040] (III) Beneficial effects
[0041] Compared with the prior art, the present invention provides a strawberry maturity detection method and system based on the YOLOv8 model, which has the following beneficial effects:
[0042] 1. The strawberry maturity detection method based on the YOLOv8 model, through steps one to six, makes the strawberry maturity detection more efficient and accurate than YOLOv3, thereby providing a feasible judgment basis for strawberry picking and making the strawberry maturity detection more convenient.
[0043] 2. The strawberry maturity detection system based on the YOLOv8 model, through the main control module, GIS strawberry information acquisition module, data processing C2f module, SE module, Ghost module, model training module and strawberry maturity output module, each module cooperates with each other to make the strawberry maturity detection more efficient and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 Schematic diagram of the strawberry maturity detection method of the present invention;
[0045] Figure 2 This is a schematic diagram of the strawberry maturity detection system module of the present invention;
[0046] Figure 3 Schematic diagram of the attention mechanism module of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] See also Figure 1-3 , a strawberry maturity detection method based on the YOLOv8 model, comprising the following steps:
[0049] Step 1: Obtain geographic information of the designated strawberry planting area through GIS, and build a two-dimensional geographic model based on the GIS platform to collect information such as the distribution location, soil moisture, temperature and light of the strawberries;
[0050] Step 2: Clean and normalize the collected data to establish a strawberry maturity detection data set;
[0051] Step 3: Build a YOLOv8 model for strawberry maturity detection;
[0052] Step 4: Improve the YOLOv8 model, including introducing ShuffleNetV2 as the backbone network, enhancing the training data, introducing a multi-scale feature fusion mechanism, and introducing an attention mechanism;
[0053] Step 5: Train the improved YOLOv8 model, use the training set to train the strawberry maturity detection model, use the test set to test the effectiveness of the strawberry maturity detection model, and obtain the trained strawberry maturity detection model;
[0054] Step 6: Collect image data of the strawberries to be tested and other information collected by GIS, input the images and data into the trained improved YOLOv8 model, and output the strawberry maturity detection results and picking judgment results.
[0055] exist Figure 1 and Figure 2 The content obtained by the GIS platform includes: strawberry planting area, weather conditions, strawberry pests and diseases, etc.
[0056] The greenhouses within the preset range are monitored, and the weather conditions, temperature conditions, and pests and diseases during the specified strawberry growth period are recorded through the time series model, providing a multi-angle judgment basis for the detection of strawberry maturity.
[0057] Furthermore, the YOLOv8 detection of strawberry maturity also includes the following steps:
[0058] 1) Preparation of strawberry maturity detection dataset: real-life photography in a greenhouse, divided into three categories: mature, immature, and strawberry pedicels, and provided YOL annotation, including pictures and corresponding labels;
[0059] 2) After obtaining the data and the corresponding annotation information, the data must be processed, including data enhancement, random rotation, random cropping, color jitter, Gaussian noise, horizontal flip, and vertical flip operations on the collected images;
[0060] 3) Assign the dataset to training set, validation set and test set;
[0061] 4) Build a YOLOv8 model, import the training set content into the model, train the model, and verify the accuracy of strawberry maturity detection through the validation set and test set;
[0062] 5) Input the image to be tested into the YOLOv8 model to obtain the maturity of the strawberry.
[0063] Specifically, through the unified YOLO label output, the picture is made unified and the computing efficiency is improved. Through different rotation, cropping and flipping processing of the picture, the model can collect strawberries of different shapes, sizes, growth conditions, colors and positions, making feature extraction more efficient and detection accuracy higher.
[0064] exist Figure 1In the above, the loss function of YOLOv8 includes classification loss + boundary regression loss + distance loss. The classification loss is cross entropy loss, which is used to measure the classification accuracy of the model for the target category. This loss only calculates the loss of positive samples;
[0065] The boundary regression loss, which is the CloU (CompleteloU) loss, is used to measure the overlap between the predicted border and the real target box, mainly considering the differences in border position, size, and aspect ratio, and is also only calculated for positive samples;
[0066] The distance loss is used to perform fine regression on the distance of the anchor points.
[0067] Specifically, the design goal of this loss function is to comprehensively consider the accuracy of classification and positioning, so that YOLOv8 can simultaneously optimize these two aspects in the target detection task.
[0068] exist Figure 3 In the step 3, the improvement of the YOLOv8 model includes:
[0069] ESNet, as the backbone network of YOLOv8, ShuffleNetV2, has better adaptability on mobile terminals than other networks. In order to further improve the performance and information expression between channels, ESNet adopts the method of adding channel attention mechanism (Squeeze-and-ExcitationModule) to strengthen the feature information between network channels.
[0070] It also includes that the SE attention mechanism is a lightweight attention mechanism that can improve the performance of the model without adding too many parameters and computational complexity. Structurally, the SE module is mainly divided into three steps: the following steps: first, feature compression is performed through the Squeeze operation to obtain the global receptive field; then the compressed vector is processed using the Excitation operation to better capture the relationship between channels; finally, the feature vector is fully multiplied with the original vector so that the original feature map adds the feature information of each channel.
[0071] Specifically, the SE attention mechanism is a lightweight attention mechanism. It first performs feature compression through the Squeeze operation. Assuming that a feature map of size C×H×W is input, the feature vector is compressed into a C×1×1 feature vector using global pooling (GlobalAvgPool), thereby obtaining the global receptive field.
[0072] The second step is to use the Excitation operation to process the compressed vector in order to better capture the relationship between channels. Two fully connected neural networks are used here. According to the set parameter r, the first layer reduces the length of the vector to the original, and then increases the nonlinear relationship between channels through the ReLU activation function. The second layer restores the length to the original size to fit the complex correlation between channels, and then passes the vector through the Hardsigmoid activation function to obtain a vector with a value between 0 and 1, which represents the importance of each channel.
[0073] Finally, the feature vector is fully multiplied with the original vector, so that the original feature map increases the feature information of each channel.
[0074] First, a feature map with C channels is convolved by a 1×1 point convolution, and the output channel number is C / α, where α is a hyperparameter, usually 0.5. Then the remaining CC / α channels are convolved in depth, and finally the two convolutions are concatenated to generate the same feature map as the ordinary convolution layer. The Ghost module can reduce the number of convolution parameters and increase the depth of convolution calculation by controlling α.
[0075] In addition, the multi-scale feature fusion mechanism, YOLOv8 adopts a multi-trunk feature fusion method, which can effectively improve the performance of target detection. GhostNet+ShuffleNet or SwinTransformer+ShuffleNet can be used as the backbone network, and features at different levels can be fused through technologies such as feature pyramid network (FPN) and cross-scale feature fusion.
[0076] Through multi-scale fusion, feature extraction is made more accurate and efficient, thereby improving the accuracy of strawberry maturity detection.
[0077] exist Figure 2 In the method, the strawberry maturity detection system comprises a main control module, a GIS strawberry information acquisition module, a data processing C2f module, a SE module, a Ghost module, a model training module and a strawberry maturity output module;
[0078] The main control module controls each module in the strawberry maturity detection system, so as to achieve the effect of working in coordination to enable the yolov8 model to be used normally;
[0079] GIS strawberry information collection module uses the GIS system to mark various conditions including strawberry planting distribution, pests and diseases, light, soil, etc., making the maturity detection standard more diversified and accurate;
[0080] The data processing C2f module makes the YOLOv8 model more lightweight;
[0081] The SE module strengthens the characteristic information of the network channel, thereby strengthening the characteristic information of the maturity of the strawberry, and further improving the response efficiency of the YOLOv8 model;
[0082] The Ghost module is a lightweight convolution module that can generate more features with fewer parameters and improve the learning ability of the model to prevent feature loss;
[0083] The model training module further trains the improved YOLOv8 model;
[0084] The strawberry maturity output module imports the image and data into the YOLOv8 model, and outputs the data through the strawberry maturity output module, thereby providing a basis for judging strawberry picking.
[0085] In summary, the strawberry maturity detection system based on the YOLOv8 model, through the main control module, GIS strawberry information acquisition module, data processing C2f module, SE module, Ghost module, model training module and strawberry maturity output module, each module cooperates with each other to make the strawberry maturity detection more efficient and accurate.
[0086] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0087] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A strawberry maturity detection method based on the YOLOv8 model, characterized in that: Includes the following steps:. Step 1: Obtain geographic information of the designated strawberry planting area through GIS, and build a two-dimensional geographic model based on the GIS platform to collect information such as the distribution location, soil moisture, temperature and light of the strawberries; Step 2: Clean and normalize the collected data to establish a strawberry maturity detection data set; Step 3: Build a YOLOv8 model for strawberry maturity detection; Step 4: Improve the YOLOv8 model, including introducing ShuffleNetV2 as the backbone network, enhancing the training data, introducing a multi-scale feature fusion mechanism, and introducing an attention mechanism; Step 5: Train the improved YOLOv8 model, use the training set to train the strawberry maturity detection model, use the test set to test the effectiveness of the strawberry maturity detection model, and obtain the trained strawberry maturity detection model; Step 6: Collect image data of the strawberries to be tested and other information collected by GIS, input the images and data into the trained improved YOLOv8 model, and output the strawberry maturity detection results and picking judgment results.
2. A strawberry maturity detection method based on the YOLOv8 model according to claim 1, characterized in that: The content acquired by the GIS platform includes: strawberry planting areas, weather conditions, strawberry pests and diseases, etc.
3. A strawberry maturity detection method based on the YOLOv8 model according to claim 1, characterized in that: The YOLOv8 detection of strawberry maturity also includes the following steps: 1) Preparation of strawberry maturity detection dataset: real-life photography in a greenhouse, divided into three categories: mature, immature, and strawberry pedicels, and provided YOL annotation, including pictures and corresponding labels; 2) After obtaining the data and the corresponding annotation information, the data must be processed, including data enhancement, random rotation, random cropping, color jitter, Gaussian noise, horizontal flip, and vertical flip operations on the collected images; 3) Assign the dataset to training set, validation set and test set; 4) Build a YOLOv8 model, import the training set content into the model, train the model, and verify the accuracy of strawberry maturity detection through the validation set and test set; 5) Input the image to be tested into the YOLOv8 model to obtain the maturity of the strawberry.
4. A strawberry maturity detection method based on the YOLOv8 model according to claim 1, characterized in that: The loss function of YOLOv8 includes classification loss + boundary regression loss + distance loss.
5. A strawberry maturity detection method based on the YOLOv8 model according to claim 4, characterized in that: The classification loss is the cross entropy loss, which is used to measure the classification accuracy of the model for the target category. This loss only calculates the loss of positive samples. The boundary regression loss, which is the CloU (CompleteloU) loss, is used to measure the overlap between the predicted border and the real target box, mainly considering the differences in border position, size, and aspect ratio, and is also only calculated for positive samples; The distance loss is used to perform fine regression on the distance of the anchor points.
6. A strawberry maturity detection method based on the YOLOv8 model according to claim 1, characterized in that: The improvement of the YOLOv8 model in step 3 includes: ESNet, as the backbone network of YOLOv8, ShuffleNetV2, has better adaptability on mobile terminals than other networks. In order to further improve the performance and information expression between channels, ESNet adopts the method of adding channel attention mechanism (Squeeze-and-ExcitationModule) to strengthen the feature information between network channels.
7. A strawberry maturity detection method based on the YOLOv8 model according to claim 1, characterized in that: The SE attention mechanism is a lightweight attention mechanism that can improve the performance of the model without adding too many parameters and computational complexity. Structurally, the SE module is mainly divided into three steps: First, feature compression is performed through the Squeeze operation to obtain the global receptive field; The compressed vector is then processed using the Excitation operation to better capture the relationship between channels; Finally, the feature vector is fully multiplied with the original vector, so that the original feature map increases the feature information of each channel.
8. A strawberry maturity detection method based on the YOLOv8 model according to claim 1, characterized in that: The multi-scale feature fusion mechanism, YOLOv8 adopts a multi-trunk feature fusion method, which can effectively improve the performance of target detection. GhostNet+ShuffleNet or SwinTransformer+ShuffleNet can be used as the backbone network, and features at different levels can be fused through technologies such as feature pyramid network (FPN) and cross-scale feature fusion.
9. A strawberry maturity detection system based on the YOLOv8 model, comprising a system serving the strawberry maturity detection method according to any one of claims 1 to 8, characterized in that: The strawberry maturity detection system comprises a main control module, a GIS strawberry information acquisition module, a data processing C2f module, a SE module, a Ghost module, a model training module and a strawberry maturity output module; The main control module controls each module in the strawberry maturity detection system, so as to achieve the effect of working in coordination to enable the yolov8 model to be used normally; GIS strawberry information collection module uses the GIS system to mark various conditions including strawberry planting distribution, pests and diseases, light, soil, etc., making the maturity detection standard more diversified and accurate; The data processing C2f module makes the YOLOv8 model more lightweight; The SE module strengthens the characteristic information of the network channel, thereby strengthening the characteristic information of the maturity of the strawberry, and further improving the response efficiency of the YOLOv8 model; The Ghost module is a lightweight convolution module that can generate more features with fewer parameters and improve the learning ability of the model to prevent feature loss; The model training module further trains the improved YOLOv8 model; The strawberry maturity output module imports the image and data into the YOLOv8 model, and outputs the data through the strawberry maturity output module, thereby providing a judgment basis for strawberry picking.
Citation Information
Patent Citations
Strawberry maturity detection method and device based on YOLO V3
CN114724140A
Cited By
Potato crop growth monitoring method and system based on remote sensing image
CN120876939A