Method and system for detecting front shape of pepper flower based on improved YOLOv8
By introducing the C2f-CAA-Star module and the advanced screening feature pyramid network structure into the YOLOv8n structure, the problem of difficult to balance the identification efficiency and accuracy of the chili flower detection method in the prior art is solved, and efficient and accurate chili flower frontal morphology detection is achieved.
Patent Information
- Application Number
- CN202411715806.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
AI Technical Summary
The chili flower detection method used in the prior art for point-teaching robots cannot achieve an effective balance between recognition efficiency and recognition accuracy, which affects efficient and precise pollination.
The positive morphology detection method of pepper flower based on improved YOLOv8 is adopted. By introducing the C2f-CAA-Star module into the YOLOv8n structure, the C2f in some backbone networks is replaced, and a higher-order screening feature pyramid network structure is adopted at the neck to improve the model's ability to identify remote context information and multimorphic features.
It effectively improves the accuracy of the frontal morphology detection of chili flowers and has advantages in detection speed. It is suitable for automatic pollination of chili flowers in the field of agricultural intelligence.
Smart Images

Figure CN119625718A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent agricultural technology, and in particular to a pepper flower front morphology detection method and system based on improved YOLOv8. Background Art
[0002] Pepper is a genus of Capsicum in the Solanaceae family, and is an annual or limited perennial herb. It is native to tropical regions of Central and South America and was introduced to China in the late 16th century. It is currently one of the most widely planted vegetables in China, and has achieved year-round production. As the largest single vegetable in my country, pepper not only meets the needs of urban and rural residents for fresh food and seasoning, but also plays a key role in many fields such as food processing, medical beauty, leisure agriculture and export trade. In the process of pepper cultivation, the yield of pepper is closely related to its pollination process. Effective pollination can not only increase the number of fruits per plant, but also improve the size, shape and number of seeds of the fruit, which directly affects the yield and quality of pepper.
[0003] Pepper flowers are hermaphroditic flowers with petals, stamens and pistils. There are usually 5 stamens with yellow anthers; the pistil consists of an ovary, style and stigma. During the flowering period of peppers, natural wind and insect dispersal can achieve a certain degree of pollination. However, on the one hand, due to the large-scale greenhouse cultivation of modern agriculture, the effect of natural pollination is not ideal, and artificial pollination methods need to be used to remedy it; on the other hand, in order to increase yields, modern cultivation technology combines genetic improvement and hybrid breeding methods to cultivate male sterile lines to avoid artificial emasculation, and improve the production efficiency of greenhouse peppers through artificial cross-pollination. The methods of artificial pollination include manual spot pollination (pollen is applied to the style, and each flower can be spot pollinated 3-4 times), duster pollination (put the pollen into the duster, aim at the flower and vibrate gently, and spray each flower 2-3 times), motorized sprayer pollination (pollen is prepared into a suspension, and the pollen liquid is evenly sprayed on the flower with a sprayer), etc. For artificial cross-pollination of pepper, due to the limitation of the number of stamens and the comprehensive consideration of spraying quality, most of them currently use artificial spot pollination for pollination. However, artificial spot pollination is inefficient and costly. Therefore, it has become an inevitable trend in the development of modern agriculture to use spot pollination robots to replace manual pollination of pepper flowers. However, there is no report on pepper flower pollination robots. One of the reasons is that in the spot pollination robot system, visual detection and precise control technology are its core. The system first detects the position and morphology of pepper flowers in real time, and then ensures the pollination accuracy through precise control. In visual detection, since the pistil column is usually located in the center of the front flower, and the diameter of pepper flowers is usually 1-3 cm, the robot can identify the pistil column by detecting the front morphology of pepper flowers, and the robot arm can achieve precise pollination by using a larger spot pollination head. However, in the natural state and background, pepper flower plants are intertwined, pepper flowers have different shapes, and the stamens are small. The front and non-front morphology of pepper flowers are difficult to detect, which belongs to the multi-morphology and small target detection problem, and puts forward high requirements on the computational complexity and resource consumption of the model.
[0004] In recent years, deep learning-based target detection methods have developed rapidly in the agricultural field. For example, the improved Faster R-CNN model MatDet can effectively detect the maturity of tomatoes; another study proposed a kiwi flower automatic recognition method based on K-means clustering and convolutional neural network with a high detection success rate. In addition, the multi-category detection method based on YOLOv5l and Euclidean distance realizes the rapid recognition of kiwi inflorescence and its distribution. The lightweight LWFormer network combines moving windows and dual-channel attention mechanisms to improve the efficiency of flower recognition and greatly reduce the number of model parameters. In terms of orchard monitoring, the flowering period monitoring method based on S-YOLO combined with the Internet of Things technology realizes remote monitoring of orchard flowering and estimation of flowering intensity. In addition, the improved COF-YOLOv8n network successfully copes with the challenges of occlusion, complex background and small target detection of oil tea fruit in the natural environment, and is suitable for counting and tracking oil tea fruit, providing reliable support for automated harvesting and orchard management. However, research on pollination robots identifying pepper flower morphology is still relatively scarce, especially on the accurate detection of the front and non-front morphologies of pepper flowers under complex backgrounds.
[0005] Therefore, in order to achieve efficient and accurate pollination, the detection of the front and non-front faces of pepper flowers is an important prerequisite. However, the mainstream algorithms currently used for detection, such as the two-stage target detection algorithm Faster R-CNN, and the one-stage target detection algorithms YOLO (You Only Look Once) series and SSD (Signal Shot MultiBox Detector). Although these algorithms have good performance in different scenarios, the complexity and computing resource requirements of some models limit their widespread application in actual agricultural production. Summary of the invention
[0006] In order to solve the problems existing in the above-mentioned prior art, the present invention provides a pepper flower front morphology detection method and system based on improved YOLOv8, which solves the technical problem that the existing pepper flower detection method used for point-pollution robots cannot achieve an effective balance between recognition efficiency and recognition accuracy, affecting the efficient and accurate pollination of point-pollution robots.
[0007] A method for detecting the front morphology of a chili flower based on an improved YOLOv8 comprises collecting chili flower data to prepare a data set, using the data set to train and verify an improved YOLOv8 model, and finally using the trained improved YOLOv8 model to identify the front morphology of the chili flower. In the improved YOLOv8 model, a backbone network uses C2f-CAA-Star, a Neck network uses a high-order screening feature pyramid network, and a model head uses a Detect-E model.
[0008] Furthermore, the C2f-CAA-Star optimizes the C2f module by replacing the original bottleneck structure with the CAA Star Block. The CAA Star Block first performs a convolution operation on the input data, then extracts features through two fully connected operations, one of which performs activation, and then fuses the outputs through the term-by-term multiplication operation of the star operation. Finally, the context anchor enhancement unit, i.e., CAA, is introduced to combine the final result with the initial input data, and generate the final output through another convolution step.
[0009] Furthermore, the core idea of the star operation is to fuse two linearly transformed features by element-by-element multiplication. Compared with the traditional addition operation, the star operation can effectively improve the nonlinear expression ability of the feature. Its basic operation can be expressed by the following formula:
[0010]
[0011] Among them, W1 and W2 are weight matrices, X is the input feature, b1 and b2 are bias terms, and ⊙ represents element-by-element multiplication. In this way, the star operation can map the input features to a high-dimensional nonlinear space, thereby enhancing the expressiveness of the model.
[0012] Furthermore, the CAA includes extracting local area features through global average pooling on the input feature map, and using one-dimensional depth-separable convolution to capture contextual information in different directions. In this process, the features are enhanced layer by layer through global pooling and convolution operations, and the contextual attention weights are generated through the Sigmoid activation function to weight the input feature map.
[0013] Furthermore, the high-order screening feature pyramid network, HSFPN, includes a feature selection module and a feature fusion module. The feature selection module uses a channel attention mechanism to screen feature maps from different levels to strengthen the morphological feature representation related to the pepper flower while suppressing the interference of irrelevant features. This process is achieved through global average pooling and global maximum pooling operations, ensuring that the feature map effectively retains key information while reducing the dimension. In the feature fusion module, HSFPN achieves size matching and information fusion of feature maps through transposed convolution and bilinear interpolation.
[0014] As an upsampling technique, transposed convolution can not only increase the resolution of feature maps, but also adapt to data by learning parameters to better reconstruct features. Bilinear interpolation provides a simple and efficient way to adjust the size of feature maps to facilitate the fusion of features at different levels.
[0015] HSFPN optimizes and integrates the underlying detail features and high-level semantic features through a multi-level, highly selective feature extraction and fusion mechanism, thereby enhancing the model's ability to represent the multi-morphology of the target. This fusion strategy significantly improves the accuracy and robustness of pepper flower morphology recognition, providing more effective technical support for intelligent agricultural applications.
[0016] In addition, HSFPN uses a series of refined feature screening mechanisms to extract the most recognizable key information from multi-scale features. This design enables the model to maintain high detection accuracy and stability when dealing with lighting changes, complex background interference, etc. Therefore, the introduction of HSFPN not only improves the recognition effect, but also reduces the dependence on computing resources, and has good practicality and scalability.
[0017] Furthermore, the formation process of the Detect-E model is as follows: the head of YOLOv8 is improved by the EMS-Conv module to enhance the ability to capture details and reduce the number of model parameters, and then the head of YOLOv8 is enhanced by using the concept of parameter sharing to form the Detect-E model.
[0018] The head parameters of YOLOv8 are relatively large, which limits its performance in extracting complex spatial structure information. In addition, YOLOv8 uses a single-scale prediction and its dynamic learning ability is limited, which faces certain challenges when dealing with changing scenes. The structure of chili flowers is complex and the morphology is diverse, and traditional single-scale prediction methods have difficulty capturing these detailed features. The above design enhances YOLOv8's ability to extract complex scene features of chili flowers and further achieves lightweight.
[0019] Furthermore, the core steps of the EMS-Conv module include: first, dividing the input feature map into two groups by channel, the first group is used to process the original image and extract basic features; the second group further divides the unprocessed features into two parts, which are convolved by 3×3 and 5×5 convolution kernels respectively; then these convolution results are connected with the basic features of the first group to form an independent feature expression; finally, the spliced output is channel-fused through a 1×1 convolution layer, and dimensionality reduction is achieved at the same time to improve the feature expression capability.
[0020] A chili flower front morphology detection system based on improved YOLOv8, wherein the data acquisition module is used to collect and preprocess the chili image data to be identified, the recognition module includes an improved YOLOv8 model trained in a chili flower front morphology detection method based on improved YOLOv8, the recognition module is used to identify the data output by the data acquisition module to clarify the chili flower front morphology image, and the result output model transmits the chili flower front morphology image output by the recognition module to a required position.
[0021] The beneficial effects of the present invention include:
[0022] The present invention proposes a lightweight detection model for the front morphology of pepper flowers based on YOLOv8, which is specially optimized for detecting pepper flower targets with complex backgrounds and variable morphologies. The model introduces the C2f-CAA-Star module in the YOLOv8n structure to replace the C2f in part of the backbone network, thereby enhancing the model's ability to capture remote contextual information and more effectively expressing the morphological characteristics and spatial relationships of pepper flowers. At the same time, the neck adopts a high-order screening feature pyramid network structure to further enhance the model's ability to recognize different morphological characteristics of pepper flowers and ensure detection accuracy under complex backgrounds. The experimental results show that the present invention effectively improves the accuracy of pepper flower front morphology detection and has advantages in detection speed compared to mainstream algorithms, providing an efficient detection method for automatic pollination of pepper flowers in the field of agricultural intelligence. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a structural diagram of the existing YOLOv8 model involved in the embodiments of the present application.
[0024] Figure 2 This is a structural diagram of the improved YOLOv8 model involved in the embodiments of the present application.
[0025] Figure 3 This is a structural diagram of C2f-CAA-Star involved in an embodiment of the present application.
[0026] Figure 4 It is a structural diagram of the HSFPN involved in the embodiment of the present application.
[0027] Figure 5 This is a structural diagram of the EMS-Conv involved in the embodiment of the present application.
[0028] Figure 6 This is a structural diagram of Detect-E involved in an embodiment of the present application.
[0029] Figure 7 This is a specific example of pepper flower image data enhancement involved in the embodiments of the present application.
[0030] Figure 8 The detection results of the first and second groups of chili flowers are compared using the original YOLOv8n model and the improved CHE-YOLOv8 lightweight model involved in the embodiments of the present application.
[0031] Fig. 9 The detection results of the third and fourth groups of chili flowers are compared using the original YOLOv8n model and the improved CHE-YOLOv8 lightweight model involved in the embodiments of the present application. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0033] A method for detecting the frontal morphology of a chili flower based on an improved YOLOv8 comprises collecting chili flower data to prepare a data set, using the data set to train and verify an improved YOLOv8 model, and finally using the trained improved YOLOv8 model to identify the frontal morphology of the chili flower. The improved YOLOv8 model is as follows: Figure 2 As shown, the backbone network uses C2f-CAA-Star, the Neck network uses a high-order screening feature pyramid network, and the model head uses the Detect-E model.
[0034] The performance of the model is optimized through three major technical improvements: using C2f-CAA-Star to replace some of the original C2f modules in the backbone network; using a high-order screening feature pyramid network in the Neck network; and using Detect-E as the head of the algorithm.
[0035] Specifically, the structure diagram of the existing YOLOv8 model is as follows Figure 1 As shown;
[0036] Specifically, the present invention aims to overcome the complexity and high computing resource consumption of traditional algorithm models. The data of pepper flowers comes from the "Sichuan pepper" variety of the Southwest Pepper Innovation Breeding Research Base in Zigong City, Sichuan Province. By shooting with the XIAOMI10S device, a data set containing 1157 front and non-front morphological images of pepper flowers was constructed. In order to increase the diversity and balance of the data set, improve the extraction effect of the front morphological features of pepper flowers, and reduce the workload of manual annotation, the Python program was used to perform offline data enhancement processing on the annotated images. Taking into account the differences in lighting conditions, there are large differences in the quality of the original images, resulting in uneven data. Therefore, enhancement methods such as brightness adjustment, noise addition, image translation and horizontal flipping are used to eventually expand the data set to 6942 images. The data set is divided into a training set, a validation set, and a test set in a ratio of 8:1:1.
[0037] In another embodiment, the C2f-CAA-Star optimizes the C2f module by replacing the original bottleneck structure with the CAA Star Block. The CAA Star Block first performs a convolution operation on the input data, then extracts features through two fully connected operations, one of which is activated, and then the output is fused through the term-by-term multiplication operation of the star operation. Finally, the context anchor enhancement unit, i.e., CAA, is introduced to combine the final result with the initial input data, and the final output is generated through another convolution step.
[0038] By introducing a C2f-CAA-Star module into the backbone network, such as Figure 3 As shown in the figure, it can improve the model's feature extraction ability, making it more adaptable and accurate in complex tasks. The C2f-CAA-Star module first convolves the input data and then extracts features through two fully connected layers. Then, the output is multiplied and fused item by item through the "star operation", and CAA is introduced to combine with the initial input data.
[0039] The core idea of the star operation is to merge two linearly transformed features by element-by-element multiplication. Compared with the traditional addition operation, the star operation can effectively improve the nonlinear expression ability of the feature. Its basic operation can be expressed by the following formula
[0040]
[0041] Among them, W1 and W2 are weight matrices, X is the input feature, b1 and b2 are bias terms, and ⊙ represents element-by-element multiplication. In this way, the star operation can map the input features to a high-dimensional nonlinear space, thereby enhancing the expressiveness of the model.
[0042] CAA is a mechanism that focuses on improving the ability to extract features and capture contextual information. Through the integration of context and the redistribution of feature weights, it can significantly improve the recognition accuracy of the model for small targets and blurred samples in complex scenarios. The core idea of CAA is to extract local area features through global average pooling on the input feature map, and use one-dimensional depth-separable convolution to capture contextual information in different directions. This process achieves layer-by-layer enhancement of features through global pooling and convolution operations, and generates contextual attention weights through the Sigmoid activation function to weight the input feature map.
[0043] In another embodiment, the high-order screening feature pyramid network, i.e., HSFPN, includes a feature selection module and a feature fusion module. The feature selection module uses a channel attention mechanism to screen feature maps from different levels to strengthen the morphological feature representation related to the chili flower while suppressing the interference of irrelevant features. This process is achieved through global average pooling and global maximum pooling operations, ensuring that the feature map effectively retains key information while reducing the dimension. In the feature fusion module, HSFPN achieves size matching and information fusion of feature maps through transposed convolution and bilinear interpolation.
[0044] As an upsampling technique, transposed convolution can not only increase the resolution of feature maps, but also adapt to data by learning parameters to better reconstruct features. Bilinear interpolation provides a simple and efficient way to adjust the size of feature maps to facilitate the fusion of features at different levels.
[0045] HSFPN optimizes and integrates the underlying detail features and high-level semantic features through a multi-level, highly selective feature extraction and fusion mechanism, thereby enhancing the model's ability to represent the multi-morphology of the target. This fusion strategy significantly improves the accuracy and robustness of pepper flower morphology recognition, providing more effective technical support for intelligent agricultural applications.
[0046] In addition, HSFPN uses a series of refined feature screening mechanisms to extract the most recognizable key information from multi-scale features. This design enables the model to maintain high detection accuracy and stability when dealing with lighting changes, complex background interference, etc. Therefore, the introduction of HSFPN not only improves the recognition effect, but also reduces the dependence on computing resources, and has good practicality and scalability.
[0047] For the recognition of the frontal and non-frontal forms of chili flowers, an advanced feature fusion strategy, the high-order screening feature pyramid network, is used. This network is derived from the in-depth exploration of feature fusion technology, especially when dealing with objects with complex backgrounds and variable forms. Through the carefully designed feature selection and fusion mechanism, HSFPN greatly improves the model's expression of the multi-morphological features of chili flowers, thereby enhancing the accuracy and robustness of recognition.
[0048] The core of HSFPN lies in its dual-module structure: feature selection module and feature fusion module, such as Figure 4As shown in the figure. Feature selection uses the channel attention (CA) mechanism to screen feature maps from different levels to strengthen the morphological feature representation related to pepper flowers while suppressing the interference of irrelevant features. The channel attention mechanism is implemented through global average pooling and global maximum pooling operations, ensuring that the feature map effectively retains key information while reducing the dimension. In feature fusion, HSFPN adopts an innovative strategy to effectively combine high-level semantic information with low-level detail information. This strategy achieves size matching and information fusion of feature maps through transposed convolution and bilinear interpolation techniques. As an upsampling technique, transposed convolution can not only increase the resolution of feature maps, but also adapt to data by learning parameters to better reconstruct features. Bilinear interpolation provides a simple and efficient way to adjust the size of feature maps to facilitate the fusion of features at different levels.
[0049] In another embodiment, the formation process of the Detect-E model is as follows: the head of YOLOv8 is improved by the EMS-Conv module to enhance the ability to capture details and reduce the number of model parameters, and then the head of YOLOv8 is enhanced by using the concept of parameter sharing to form the Detect-E model.
[0050] The head parameters of YOLOv8 are relatively large, which limits its performance in extracting complex spatial structure information. In addition, YOLOv8 uses a single-scale prediction and its dynamic learning ability is limited, which faces certain challenges when dealing with changing scenes. The structure of chili flowers is complex and the morphology is diverse, and traditional single-scale prediction methods have difficulty capturing these detailed features. The above design enhances YOLOv8's ability to extract complex scene features of chili flowers and further achieves lightweight.
[0051] Traditional convolutional neural networks usually rely on convolution kernels of a single scale, which has limitations when dealing with targets or complex scenes with multi-scale features. In contrast, multi-scale convolution technology can more comprehensively extract and integrate multi-level feature information. As a classic multi-scale strategy, FPN further enhances the expression ability of multi-scale features by combining bottom-up feature aggregation and top-down feature propagation. EMS-Conv effectively integrates feature information of different scales by introducing multi-scale convolution operations, enhances the model's performance in capturing global structures and local details, and can significantly improve the detection accuracy of structures such as Figure 5 shown.
[0052] The core steps of the EMS-Conv module include: first, the input feature map is divided into two groups by channel. The first group is used to process the original image and extract basic features; the second group further divides the unprocessed features into two parts, which are convolved by 3×3 and 5×5 convolution kernels respectively; next, these convolution results are connected with the basic features of the first group to form an independent feature expression; finally, the spliced output is channel-fused through a 1×1 convolution layer, and dimensionality reduction is implemented at the same time to improve the feature expression capability.
[0053] Based on the concept of parameter sharing, the head of YOLOv8 is enhanced. Specifically, EMS-Conv is used to improve the original convolution module and the Detect-E structure is proposed. Figure 6 This method merges the four standard convolutional layers in the original network into two and replaces one of the standard convolutional layers with EMS-Conv. Through this improvement, the model can maintain the accuracy of the original model's pepper flower frontal orientation detection while maintaining a lightweight head design and reducing the number of model parameters.
[0054] Accurate detection of the front morphology of pepper flowers is a key step in achieving automated pepper flower pollination. In response to this demand, the present invention proposes a lightweight detection model for the front morphology of pepper flowers based on YOLOv8, which is specially optimized for pepper flower target detection with complex backgrounds and variable morphologies. The model introduces the C2f-CAA-Star module in the YOLOv8n structure to replace the C2f in part of the backbone network, thereby enhancing the model's ability to capture remote contextual information and more effectively expressing the morphological characteristics and spatial relationships of pepper flowers. At the same time, the neck adopts a high-order screening feature pyramid network structure to further enhance the model's ability to recognize different morphological characteristics of pepper flowers and ensure detection accuracy under complex backgrounds. The experimental results show that the present invention effectively improves the accuracy of pepper flower front morphology detection and has certain advantages in detection speed compared to mainstream algorithms. The invention provides an efficient detection method for automatic pollination of pepper flowers in the field of agricultural intelligence.
[0055] In order to verify the technical effect of the present invention, the corresponding simulation experiments are carried out as follows:
[0056] 1.1、Dataset establishment
[0057] The pepper flower data comes from the "Sichuan Pepper" variety of the Southwest Pepper Innovation Breeding Research Base in Zigong City, Sichuan Province. The data set is collected and self-made by using the XIAOMI 10S device. The data set contains two targets: the front and non-front forms of pepper flowers, with a total of 1,157 pictures. In order to increase the diversity and balance of the data set, improve the extraction effect of the front morphological features of pepper flowers, and reduce the workload of manual annotation, the Python program was used to perform offline data enhancement processing on the annotated images. Due to different lighting conditions, there are large differences in the quality of the original captured images, resulting in unbalanced data. Therefore, enhancement methods such as brightness adjustment, noise addition, image translation and horizontal flipping are used to expand the data set, and finally the data set is expanded to 6,942 images. The data set is divided into training set, validation set and test set in a ratio of 8:1:1. For specific examples of data enhancement, see Figure 7 The images were manually annotated using Labelimg software, and the annotation results were stored in XML file format, which contained information such as image category, target box coordinates, and image size.
[0058] 1.2 Experimental environment configuration and network parameters
[0059] The experiment was run on the Ubuntu 22.04 operating system, using Anaconda 3 to develop the virtual environment, with Python 3.9, PyTorch 2.4.0, CUDA 12.1 as the code environment, and using NVIDIA RTX 4060TI 16G GPU for training and verification. The hyperparameter settings of the network in the experiment are shown in Table 1.
[0060] Table 1 Hyperparameter settings
[0061]
[0062] 1.3 Model Evaluation Indicators
[0063] This embodiment mainly uses mean Average Precision (mAP)@0.5, mAP@0.5:0.95 and F1-Score as evaluation indicators to evaluate the accuracy of the model. The first two indicators represent the average detection accuracy of the model under different IoU (Intersection over Union) thresholds, mAP@0.5 measures the detection accuracy when IoU=0.5, and mAP@0.5:0.95 combines the accuracy between IoU from 0.5 to 0.95. The F1 value is an indicator used to measure the comprehensive performance of the model, which is the harmonic mean of P (Precision) and R (Recall).
[0064]
[0065]
[0066]
[0067] Among them, TP represents the number of samples correctly predicted as positive, FP represents the number of samples incorrectly predicted as positive, and FN represents the number of actual positive examples predicted as negative.
[0068] mAP is determined by integrating the precision-recall (PR) curve as shown below:
[0069]
[0070] In addition, in order to comprehensively evaluate the performance of the model, the model floating-point operations and the number of model parameters are also considered. These indicators can reflect the advantages of the model.
[0071] 2.1 Neck comparison experiment
[0072] In order to verify the effectiveness of the HSFPN module in fusing multi-scale features, it is systematically compared with a variety of advanced feature processing methods, such as BIFPN [1] 、SlimNeck [2] ,AFPN [3] GFPN [4] A detailed performance evaluation is carried out and the experimental results are shown in Table 2.
[0073] Taking YOLOv8n as the benchmark model, the performance is evaluated by gradually introducing different feature fusion structures. Experimental results show that the BIFPN structure reduces GFLOPs from 8.1G to 7.1G and the number of parameters from 3.10M to 1.99M while maintaining the mAP performance. The SlimNeck structure further improves the model's mAP@0.5:0.95 to 58.8%, and achieves a more balanced performance in terms of precision and recall, which are 90.3% and 86.1% respectively. The AFPN and GFPN structures have both significantly improved the mAP indicator, with mAP@0.5 reaching 91% and 90.5% respectively. Among them, GFPN performed the best in terms of precision, reaching 91.5%. However, the GFPN structure causes the number of parameters to increase to 3.25M, and the recall rate is relatively low at 82.6%.
[0074] In contrast, the proposed HSFPN structure performs well in all indicators. Its mAP@0.5 reaches 90.9%, and its mAP@0.5:0.95 is 58.7%. At the same time, GFLOPs is further reduced to 6.8G, and the number of parameters is only 1.93M. HSFPN also achieves a good balance in precision and recall, which are 90.8% and 85.3% respectively, proving its effectiveness and superiority in optimizing YOLOv8n performance.
[0075] Table 2 Performance comparison of different neck structures
[0076]
[0077]
[0078] Note: mAP@0.5 is the average precision when the IoU threshold is 0.5, and mAP@0.5:0.95 is the average precision of the IoU from 0.5 to 0.95.
[0079] 2.2 Model Ablation Experiment
[0080] Through ablation experiments, the effectiveness of the three improved methods in the pepper flower front morphology detection task is fully verified. In order to ensure the fairness of the experiment, all parameters and experimental equipment are completely consistent. Table 3 shows the impact of each module on the overall performance of the model.
[0081] By replacing the second, third and fourth C2f modules in the original backbone network with C2f-Star-CAA, the model's mAP@0.5, mAP@0.5:0.95, GFLOPs, and parameter count are increased by 0.5%, 0.4%, 0.8G, and 0.29M, respectively. This shows that although the introduction of the contextual anchor enhancement unit in C2f-Star increases the amount of computation and parameters of the model, it significantly improves the detection accuracy while maintaining a small model growth.
[0082] After the introduction of the HSFPN module, the model's mAP@0.5 increased to 90.9%, and mAP@0.5:0.9 increased to 58.7%, demonstrating its superiority in multi-scale feature fusion. At the same time, GFLOPs dropped to 6.8G, and the number of parameters was reduced to 1.93M, proving that HSFPN can effectively reduce computational complexity while improving accuracy.
[0083] After adding the Detect-E module, although the mAP value did not increase significantly, the GFLOPs dropped to 5.9G and the number of parameters was reduced to 2.64M, demonstrating its advantage in reducing computational costs. At the same time, the C2f-Star-CAA and HSFPN modules were introduced, and the mAP value was significantly improved, and the GFLOPs dropped to 7.7G. When the three modules were applied at the same time, the experimental results showed that mAP@0.5 reached 92.3%, mAP@0.5:0.9 was 58.4%, and the F1 score reached 87.93%. At the same time, GFLOPs dropped to 5.5G and the number of parameters was reduced to 1.84M, demonstrating the good balance between accuracy and complexity of the model.
[0084] Through ablation experiments, the significant contribution of each module to the pepper flower front orientation detection task was verified. The three improvement schemes improved the detection accuracy to varying degrees and effectively reduced the computational complexity of the model, ultimately achieving a perfect balance between high accuracy and light weight.
[0085] Table 3 Ablation experiment results
[0086]
[0087]
[0088] 2.3 Comparison of model effects before and after improvement
[0089] Four pictures are randomly selected for prediction, and the original YOLOv8n model and the improved YOLOv8 model, namely the improved CHE-YOLOv8 lightweight model, are used for comparison. The results are as follows: Figure 8-9 As shown in the first set of pictures, Figure 8 As can be seen from the first row of images in the figure, the improved model shows higher confidence in target detection and more accurate positioning of the target area. In contrast, the confidence of the original model is lower and the target box deviates from the center of the pistil.
[0090] In the second set of pictures, Figure 8 In the second row of pictures, although the original model detected the flowers, its confidence is still lower than that of the improved model. The improved model not only improves the confidence, but also locates the target flowers more accurately. Fig. 9 In the first row of pictures, the original model failed to detect the target, resulting in missed detection. The improved model successfully detected the target and accurately positioned it. Fig. 9 In the second row of pictures, the improved network achieves higher accuracy.
[0091] By comparison, we can see that the improved model effectively improves the accuracy of detection and significantly reduces the probability of missed detection and false detection. This further proves the superiority of the improved model in the detection of the front and non-frontal morphology of pepper flowers.
[0092] 2.4 Comparative Experiments of Different Algorithms
[0093] In order to evaluate the performance of the improved CHE-YOLOv8 lightweight model, a series of comparative experiments were conducted with various widely used object detection models, including the two-stage object detection algorithm Faster R-CNN, as well as the one-stage object detection algorithms YOLOv5, YOLOv7, and the extension to end-to-end object detection methods such as YOLOv10. [5] In addition, some YOLOv8 variants were experimentally compared, which were combined with other advanced network structures: for example, SwinTransformer [6] Combined with the YOLOv8 architecture, its self-attention mechanism improves the ability to capture image details; or use MobileNetV4 [7] Replace the backbone network and improve computing efficiency by relying on its efficient and lightweight design; learn from Gold-YOLO [8] Innovation and solid neck form the advantage of YOLOv8-Gold [9] The experimental results are shown in Table 4.
[0094] From Table 4, CHE-YOLOv8 achieves the best mAP@0.5, and its GFLOPs reaches 5.5G. Although it is not as small as the model of YOLOv5n, compared with other algorithms, its GFLOPs and parameter volume have obvious advantages, and it is suitable for deployment in resource-constrained environments. v8-SwinTransformer shows advantages over most existing algorithms in both mAP value and F1 score, however, its GFLOPs is as high as 79.1G, which has an adverse effect on deployment on resource-constrained edge devices.
[0095] Although the mAP value of CHE-YOLOv8 is slightly lower than that of some models, it performs well in terms of comprehensive performance, computational complexity, and number of parameters, making it an efficient and accurate model for the frontal morphology detection task of pepper flowers. The model achieves an excellent balance between efficiency and accuracy, making it very suitable for deployment of point-feeding robots in actual scenarios.
[0096] Table 4 Performance comparison of different detection algorithms
[0097]
[0098]
[0099] 3. Summary
[0100] The front morphology detection of pepper flowers is a key step in realizing automatic pepper flower pollination. To this end, the present invention proposes a lightweight model based on an improved YOLOv8 model, namely an improved CHE-YOLOv8. The model directly replaces the C2f in part of the backbone network by introducing the C2f-CAA-Star module in YOLOv8n, thereby enhancing the ability to extract remote context information; the neck structure adopts HSFPN to enhance the model's ability to express the multi-morphological features of pepper flowers. EMS-Conv is introduced in the head, so that the model further reduces GFLOPs and parameter quantity while maintaining the original accuracy. The main conclusions are as follows:
[0101] 1) Compared with the original YOLOv8n, CHE-YOLOv8 has improved performance in multiple key indicators: mAP@0.5 increased from 90.0% to 92.3%, mAP@0.5:0.95 increased from 57.5% to 58.4%, and F1 score increased from 85.90% to 87.93%. At the same time, the computational complexity of the model has been significantly reduced, the amount of floating-point operations has been reduced from 8.1G to 5.5G, and the number of parameters has been reduced from 3.01M to 1.84M.
[0102] 2) Compared with mainstream models such as Faster R-CNN, YOLOv5n, and YOLOv7, CHE-YOLOv8 shows obvious advantages: mAP@0.5 reaches 92.3%, surpassing YOLOv5n's 90.0% and YOLOv7's 89.7%. The floating-point computing capacity is only 5.5G, far lower than Faster R-CNN's 178.0G, showing high computing efficiency.
[0103] Specifically, the prior art references involved in the simulation experiment are as follows:
[0104] [1]TAN M,PANG R,LE Q V.Efficientdet: Scalable and efficient object detection[C] / / Proceedings of the IEEE / CVF conference on computer vision and pattern recognition.2020:10781-10790.
[0105] [2]LI H,LI J,WEI H,et al.Slim-neck by GSConv:a lightweight-design forreal-time detector architectures[J].Journal of Real-Time Image Processing,2024,21(3):62.
[0106] [3]ZHAO Z,PAN Y,GUO G,et al.YOLO-AFPN:Marrying YOLO and AFPN forexternal damage detection of transmission lines[J].IET Generation,Transmission&Distribution,2024,18(9):1935-1946.
[0107] [4]MEI M,ZHOU Z,LIU W,et al.GOI-YOLOv8 Grouping Offset and IsolatedGiraffeDet Low-Light Target Detection[J].Sensors,2024,24(17):5787.
[0108] [5]WANG A,CHEN H,LIU L,et al.Yolov10:Real-time end-to-end objectdetection[J / OL].ArXiv,(2024-05-23)[2024-10-13].https: / / arxiv.org / abs / 2405.14458.
[0109] [6]LIU Z,LIN Y,CAO Y,et al.Swin transformer:Hierarchical visiontransformer using shifted windows[C] / / Proceedings of the IEEE / CVFinternational conference on computer vision.2021:10012-10022.
[0110] [7]QIN D,LEICHNER C,DELAKIS M,et al.MobileNetV4-Universal Models for the Mobile Ecosystem[J / OL].ArXiv,(2024-04-16)[2024-10-13].https: / / arxiv.org / abs / 2404.10518.
[0111] [8]WANG C, HE W, NIE Y, et al. Gold-YOLO: Efficient object detector viagather-and-distribute mechanism[J]. Advances in Neural Information ProcessingSystems, 2024, 36.
[0112] [9]BENELMOSTAFA BE,AITELHAJ R,ELMOUFID M,et al.Detecting BrokenGlass Insulators for Automated UAV Power Line Inspection Based on an ImprovedYOLOv8Model[C] / / International Conference on Advanced Intelligent Systems forSustainable Development.Cham:Springer Nature Switzerland,2023:309-321.
[0113] A pepper flower front morphology detection system based on improved YOLOv8 comprises a data acquisition module, a recognition module and a result output module, wherein the data acquisition module is used to acquire pepper image data to be identified and perform preprocessing, the recognition module uses a trained improved YOLOv8 model to identify data output by the data acquisition module to clarify the pepper flower front morphology image, and the result data model transmits the pepper flower front morphology image output by the recognition module to a required position.
[0114] The above-mentioned embodiments only express the specific implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the technical solution concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A pepper flower front morphology detection method based on improved YOLOv8, characterized in that: The method includes collecting chili flower data to make a data set, using the data set to train and verify an improved YOLOv8 model, and finally using the trained improved YOLOv8 model to recognize the front morphology of the chili flower. In the improved YOLOv8 model, the backbone network uses C2f-CAA-Star, the Neck network uses a high-order screening feature pyramid network, and the model head uses the Detect-E model.
2. A pepper flower front morphology detection method based on improved YOLOv8 according to claim 1, characterized in that: The C2f-CAA-Star optimizes the C2f module by replacing the original bottleneck structure with the CAA Star Block. The CAA Star Block first performs a convolution operation on the input data, then extracts features through two fully connected operations, one of which is activated, and then the output is fused through the term-by-term multiplication operation of the star operation. Finally, the context anchor enhancement unit, i.e. CAA, is introduced to combine the final result with the initial input data, and the final output is generated through another convolution step.
3. A pepper flower front morphology detection method based on improved YOLOv8 according to claim 2, characterized in that, The core idea of the star operation is to fuse two linearly transformed features by element-by-element multiplication. The basic operation can be expressed as follows: Among them, W1 and W2 are weight matrices, X is the input feature, b1 and b2 are bias terms, and ⊙ represents element-by-element multiplication.
4. A pepper flower front morphology detection method based on improved YOLOv8 according to claim 2, characterized in that: The CAA includes extracting local area features through global average pooling on the input feature map, and using one-dimensional depth-separable convolution to capture contextual information in different directions. In this process, the features are enhanced layer by layer through global pooling and convolution operations, and the contextual attention weight is generated through the Sigmoid activation function to weight the input feature map.
5. The method for detecting the frontal morphology of pepper flowers based on improved YOLOv8 according to claim 1, characterized in that: The high-order screening feature pyramid network, i.e., HSFPN, includes a feature selection module and a feature fusion module. The feature selection module uses a channel attention mechanism to screen feature maps from different levels to strengthen the morphological feature representation related to pepper flowers while suppressing the interference of irrelevant features. In the feature fusion module, size matching and information fusion of feature maps are achieved through transposed convolution and bilinear interpolation.
6. The method for detecting the frontal morphology of pepper flowers based on improved YOLOv8 according to claim 1, characterized in that: The formation process of the Detect-E model is as follows: the head of YOLOv8 is improved by the EMS-Conv module to enhance the ability to capture details and reduce the number of model parameters, and then the head of YOLOv8 is enhanced by using the concept of parameter sharing to form the Detect-E model.
7. The method for detecting the frontal morphology of pepper flowers based on improved YOLOv8 according to claim 6, characterized in that: The operation steps of the EMS-Conv module include: first, dividing the input feature map into two groups according to the channel, the first group is used to process the original image and extract the basic features; the second group further divides the unprocessed features into two parts, which are convolved by 3×3 and 5×5 convolution kernels respectively; then these convolution results are connected with the basic features of the first group to form an independent feature expression; finally, the spliced output is channel-fused through a 1×1 convolution layer, and dimensionality reduction is achieved at the same time to improve the feature expression ability.
8. A pepper flower front morphology detection system based on improved YOLOv8, characterized in that: The invention comprises a data acquisition module, a recognition module and a result output module, wherein the data acquisition module is used to acquire the pepper image data to be identified and perform preprocessing, the recognition module comprises the improved YOLOv8 model trained in the pepper flower front morphology detection method based on improved YOLOv8 as described in any one of claims 1 to 7, the recognition module is used to identify the data output by the data acquisition module to clarify the pepper flower front morphology image, and the result output model transmits the pepper flower front morphology image output by the recognition module to the required position.
Citation Information
Cited By
Tomato fruit maturity detection method based on YOLOv11
CN120472453A