A pineapple maturity target detection method based on a YOLOv10 model
By improving the YOLOv10 model, introducing ECA attention and deformable convolution, and embedding multi-scale residual dense blocks, the problems of missed detection and false detection in the detection of pineapple eye maturity of YOLOv10 were solved, and higher detection accuracy and efficiency were achieved.
Patent Information
- Application Number
- CN202510550730.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-04-29
AI Technical Summary
The existing YOLOv10 model has problems with missed detection and false detection in pineapple eye maturity detection, especially when the pineapple eyes are irregularly arranged, have large size differences, have different growth angles, and are blocked by leaves, which cannot meet the needs of agricultural production.
By improving the YOLOv10 model, introducing the ECA attention mechanism and deformable convolution (DCN), embedding multi-scale residual dense blocks (C2f-RDB) in the C2f-CIB module, and extracting pineapple eye feature information through multi-scale convolution operations, the detection accuracy is improved by combining a weighted average algorithm.
It significantly improves the accuracy and efficiency of pineapple eye detection, enhances the model's ability to extract features from eyes of different sizes, alleviates the gradient vanishing problem, promotes feature reuse and gradient flow, and improves detection efficiency and accuracy.
Smart Images

Figure CN120088774B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fruit and vegetable maturity detection, in particular to a pineapple maturity target detection method based on a YOLOv10 model. BACKGROUND
[0002] At present, the picking method of pineapples is mainly one-time manual picking according to the degree of maturity, and the detection of pineapple maturity mainly relies on manual experience, relying on the color, appearance and size of the fruit skin to judge, which has low precision and often leads to low picking efficiency, poor storage and other problems. Rapid maturity recognition of pineapples through machine vision is an important support for mechanized picking.
[0003] In recent years, with the rapid development of artificial intelligence technology, target detection algorithms based on deep learning have been widely used in the identification of fruit and vegetable maturity. Fruit maturity detection algorithms based on deep learning mainly fall into two categories. One is the algorithm that generates candidate regions first and then classifies and regresses the bounding box, mainly based on R-CNN, Faster R-CNN and Mask-CNN. The other is the algorithm that directly predicts the class and bounding box of the target in a single neural network, mainly based on YOLO target detection algorithm and SSD (Single Shot MultiBox Detector) target detection algorithm. Compared with the two, R-CNN and other algorithms have higher accuracy, while YOLO and other algorithms have faster processing speed.
[0004] The previous fruit and vegetable maturity recognition based on YOLO mainly classifies and recognizes fruits based on the surface color of the fruit. However, when it comes to pineapples, the skin color changes irregularly, and the skin color of the same pineapple may change due to multiple factors. In this case, the skin color of the same pineapple may show multiple degrees of maturity at different angles. This situation leads to false detection in the pineapple maturity recognition method based on machine vision.
[0005] YOLOv10 is an advanced single-stage target detection algorithm that can effectively identify targets through its unique network architecture and optimization techniques. Although YOLOv10 performs well in terms of detection accuracy and speed, it still has some limitations in recognizing the complexity and subtle features of pineapple eye maturity. At the same time, it has the problems of missing detection and false detection when facing the irregular arrangement of pineapple eyes, large size difference, different growth angles of pineapple eyes, different maturity of the same pineapple, and leaf blocking of pineapple eyes, which cannot meet the needs of agricultural production. SUMMARY
[0006] The purpose of the present application is to provide a pineapple maturity target detection method based on a YOLOv10 model, which can detect pineapple eyes that cannot be detected by existing detection models and effectively solve the problem of leaf blocking of pineapple eyes.
[0007] To achieve the above object, the present application provides the following scheme:
[0008] A pineapple maturity target detection method based on a YOLOv10 model, comprising:
[0009] Obtaining a pineapple image to be detected;
[0010] Inputting the pineapple image to be detected into a pineapple maturity detection model, outputting a fruit eye maturity score in the pineapple image to be detected, and obtaining a maturity level of the pineapple in the pineapple image to be detected, wherein the pineapple maturity detection model is constructed based on an improved YOLOv10 model and obtained through a training set, the improved YOLOv10 model is obtained by improving a feature extraction network structure of a traditional YOLOv10 model, and the training set is a pineapple image containing pineapple fruit eye maturity annotation.
[0011] Optionally, obtaining the training set comprises: collecting original pineapple images in a growth process, removing the original pineapple images that do not meet a preset rule, annotating the maturity of pineapple fruit eyes in the remaining original pineapple images, and obtaining the training set.
[0012] Optionally, improving the feature extraction network structure of the traditional YOLOv10 model comprises: replacing the convolution of the neck network in the traditional YOLOv10 model with a deformable convolution, embedding an ECA attention mechanism between a C2f layer and a Detect layer of the traditional YOLOv10 model, and embedding a multi-scale residual dense block in a C2F-CIB module in the traditional YOLOv10 model.
[0013] Optionally, embedding the multi-scale residual dense block in the C2F-CIB module in the traditional YOLOv10 model comprises:
[0014] Replacing the convolution in the C2F-CIB module with a serial multi-scale convolution, and performing residual dense connection on the serial multi-scale convolution, wherein the multi-scale residual dense block performs multi-scale convolution operation on initial features obtained through a backbone network and a neck network of the pineapple maturity detection model, extracts pineapple fruit eye feature information, inputs the pineapple fruit eye feature information and the initial features into a convolution layer for dimension reduction, adds the features after dimension reduction to the initial features, and obtains a final output feature map.
[0015] Optionally, the multi-scale residual dense block performing multi-scale convolution operation on the initial features obtained through the backbone network and the neck network of the pineapple maturity detection model comprises:
[0016] The preliminary feature is input into a first scale convolution layer for convolution operation to obtain a first feature map;
[0017] The first feature map and the preliminary feature are input into a second scale convolution layer for splicing and convolution operation to obtain a second feature map;
[0018] The first feature map, the second feature map and the preliminary feature are input into a third scale convolution layer for splicing and convolution operation to obtain a third feature map;
[0019] The first feature map, the second feature map, the third feature map and the preliminary feature are input into a fourth scale convolution layer for splicing and convolution operation to obtain a fourth feature map.
[0020] Optionally, obtaining the maturity level of the pineapple in the to-be-detected pineapple image comprises: respectively giving different weights to the mature eye, the semi-mature eye, the unripe eye and the developing eye, performing weighted average on the weights and the maturity score of the eyes in the to-be-detected pineapple image to obtain a pineapple maturity score in the to-be-detected pineapple image, and obtaining the maturity level of the pineapple in the to-be-detected pineapple image according to the pineapple maturity score.
[0021] Optionally, the expression of the weighted average is:
[0022] ;
[0023] ;
[0024] wherein D is the pineapple maturity score, X is the total number of labeled eyes, x1, x2, x3 and x4 are respectively the number of mature eyes, semi-mature eyes, unripe eyes and developing eyes, D1 k1 , D2 k2 , D3 k3 and D4 k4 are respectively the eye score of the k1th mature eye, the eye score of the k2th semi-mature eye, the eye score of the k3th unripe eye and the eye score of the k4th developing eye.
[0025] The present application has the advantages that: the present application introduces ECA attention into the YOLOv10 model, improves the detection ability of the model for pineapple eyes of different sizes, and improves the prediction accuracy of the position and size of the pineapple eyes. The introduction of the deformable convolution DCN replaces the ordinary convolution, so that the model can better adapt to the scale and shape changes of the pineapple eyes, improve the robustness of the model, and the introduction of the multi-scale convolution residual dense block forms C2f-RDB in C2f-CIB, which improves the reuse rate of features, strengthens the extraction of feature information of eyes of different sizes, obtains more eye feature representations, and significantly improves the detection efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0027] Figure 1 This is an example diagram of the calyx apex angle and the fruit eye diameter according to an embodiment of the present invention;
[0028] Figure 2 : The diagrams are characteristic diagrams of pineapple eyes of different maturity levels according to an embodiment of the present invention, wherein (a) is a pineapple fruit in the developmental stage, (b) is a pineapple fruit in the immature stage, (c) is a pineapple fruit in the mid-ripe stage, (d) is a pineapple fruit in the mature stage, (e) is a side view of a fruit eye in the developmental stage, (f) is a side view of a fruit eye in the immature stage, (g) is a side view of a fruit eye in the mid-ripe stage, (h) is a side view of a fruit eye in the mature stage, (i) is a top view of a fruit eye in the developmental stage, (j) is a top view of a fruit eye in the immature stage, (k) is a top view of a fruit eye in the mid-ripe stage, and (l) is a top view of a fruit eye in the mature stage;
[0029] Figure 3 1. The C2f-RDB and C2f-CIB structures of the embodiments of the present invention are shown in FIG. 1 , where (a) is a C2f-RDB structure diagram and (b) is a C2f-CIB structure diagram.
[0030] Figure 4 Schematic diagram of test results of the pineapple maturity detection method based on the improved YOLOv10 in an embodiment of the present invention;
[0031] Figure 5 This is a structural diagram of the improved YOLOv10 model according to an embodiment of the present invention;
[0032] Figure 6 This is a structural diagram of the ECA attention mechanism according to an embodiment of the present invention;
[0033] Figure 7 This is a DCN convolutional structure diagram of an embodiment of the present invention;
[0034] Figure 8 This is a diagram of the residual dense unit RDB structure according to an embodiment of the present invention;
[0035] Figure 9 Loss curve diagrams of different models according to an embodiment of the present invention;
[0036] Figure 10 The present invention provides a flowchart of a pineapple maturity target detection method based on the YOLOv10 model. DETAILED DESCRIPTION
[0037] The technical solutions in the embodiments of the present application will be apparently and completely described below with reference to 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 the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0038] In order to make the above objectives, characteristics and advantages of the present application more apparent, comprehensible and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0039] As shown in the Figure 10 The present embodiment provides a pineapple maturity target detection method based on a YOLOv10 model, which comprises the following steps:
[0040] obtaining a pineapple image to be detected;
[0041] inputting the pineapple image to be detected into a pineapple maturity detection model to output a fruit eye maturity score in the pineapple image to be detected, and obtaining a maturity grade of the pineapple in the pineapple image to be detected, wherein the pineapple maturity detection model is constructed based on an improved YOLOv10 model and obtained through a training set, the improved YOLOv10 model is obtained by improving a feature extraction network structure of a traditional YOLOv10 model, and the training set is a pineapple image containing pineapple fruit eye maturity annotation.
[0042] The present embodiment provides a pineapple maturity recognition method based on an improved YOLOv10. The model introduces Efficient Channel Attention (ECA) attention, introduces deformable convolution Deformable Convolutional Networks (DCN) to replace ordinary convolution, introduces multi-scale convolution and residual dense blocks C2f-RDB at C2f-CIB, and significantly improves the detection efficiency and accuracy.
[0043] Further, obtaining the training set comprises: collecting original pineapple images in a growth process, removing original pineapple images that do not meet a preset rule, annotating the maturity of pineapple fruit eyes in the remaining original pineapple images, and obtaining the training set.
[0044] Specifically, images of pineapples during growth are collected and screened, and original state images that do not meet preset rules are removed to obtain target images as a data set. According to the eye shape of the pineapple, the eye shape of the pineapple at 14 days, 42 days, 70 days and 91 days after setting is used to divide and label the maturity of the pineapple into four levels, and a pineapple eye maturity image data set is obtained. The data set is divided into a training set, a validation set and a test set.
[0045] Further, the improved feature extraction network structure of the traditional YOLOv10 model includes: using a deformable convolution to replace the convolution in the neck network of the traditional YOLOv10 model, embedding an ECA attention mechanism between the C2f layer and the Detect layer of the traditional YOLOv10 model, and embedding a multi-scale residual dense block in the C2F-CIB module in the traditional YOLOv10 model.
[0046] Further, the embedding of the multi-scale residual dense block in the C2F-CIB module in the traditional YOLOv10 model includes:
[0047] The convolution in the C2F-CIB module is replaced by a serial multi-scale convolution, and the serial multi-scale convolution is residual dense connected, wherein the multi-scale residual dense block performs multi-scale convolution operation on the preliminary features obtained by the backbone network and the neck network of the input pineapple maturity detection model, extracts pineapple eye feature information, inputs the pineapple eye feature information and the initial features into a convolution layer for dimension reduction, adds the features after dimension reduction to the preliminary features, and obtains the final output feature map.
[0048] Specifically, the working steps of the C2f-RDB module include: first, replacing the ordinary convolution in the C2f-CIB with 1x1, 3x3, 5x5 and 7x7 multi-scale convolutions, performing serial operations on the 1x1, 3x3, 5x5 and 7x7 multi-scale convolutions, and extracting pineapple eye feature information of four maturity levels. The four serial multi-scale convolutions are residual dense connected, the input end of each convolution layer is the input combination of all previous layers, all intermediate feature maps are spliced along the channel dimension, a 1x1 convolution layer is used for dimension reduction, local features are fused to obtain a final feature map, the result of fusing local features is added to the input feature map to obtain a final output feature map.
[0049] The working steps of the DCN are as follows: first, a feature map is generated using a traditional convolution operation. Second, while generating the feature map, the offset of each convolution position is predicted through another convolution layer to obtain a two-dimensional vector representing the offset of the convolution kernel center relative to the standard position. The predicted offset is used to adjust the position of the standard convolution kernel, and then the convolution operation is applied to adaptively adjust the local set structure of the input feature map.
[0050] The ECA attention mechanism is embedded between the C2f layer and the Detect layer of the YOLOv10 model, irrelevant information output by the C2f layer is suppressed, the final positioning and classification ability of the Detect layer on the target is enhanced, the detection ability of the model on pineapple eye of different sizes is improved, and the prediction accuracy of the pineapple eye position and size is improved.
[0051] Furthermore, the multi-scale residual dense block performs multi-scale convolution operation on the preliminary features obtained by the backbone network and the neck network of the pineapple maturity detection model, including:
[0052] The preliminary features are input into the first scale convolution layer for convolution operation to obtain a first feature map;
[0053] The first feature map and the preliminary features are input into the second scale convolution layer for splicing and convolution operation to obtain a second feature map;
[0054] The first feature map, the second feature map and the preliminary features are input into the third scale convolution layer for splicing and convolution operation to obtain a third feature map;
[0055] The first feature map, the second feature map, the third feature map and the preliminary features are input into the fourth scale convolution layer for splicing and convolution operation to obtain a fourth feature map, wherein the first feature map, the second feature map, the third feature map and the fourth feature map are the extracted pineapple eye feature information.
[0056] Further, obtaining the maturity level of the pineapple image to be detected includes: respectively assigning different weights to the mature eye, the semi-mature eye, the unripe eye and the developing eye, and performing weighted average on the pineapple fruit in the pineapple image to be detected according to the weights and the eye maturity score in the pineapple image to be detected, obtaining the pineapple maturity score in the pineapple image to be detected, and obtaining the maturity level of the pineapple in the pineapple image to be detected according to the pineapple maturity score.
[0057] Further, the expression of weighted average is:
[0058] ;
[0059] ;
[0060] wherein D is the pineapple maturity score, X is the total number of labeled eyes, x1, x2, x3 and x4 are the number of mature eyes, semi-mature eyes, unripe eyes and developing eyes, respectively, D1 k1 , D2 k2 , D3 k3 , D4 k4The fruit eye score of the k1th mature stage fruit eye, the fruit eye score of the k2th middle mature stage fruit eye, the fruit eye score of the k3th immature stage fruit eye, and the fruit eye score of the k4th development stage fruit eye, respectively.
[0061] The accompanying drawings are referred to in the following description of the embodiments. Figures 1-9 The method of the present embodiment is further described:
[0062] The present embodiment identifies the maturity of pineapple by the fruit setting days, the calyx top angle of pineapple fruit eye, and the fruit eye diameter. The calyx top angle and the fruit eye diameter are as shown in Figure 1 A pineapple maturity target detection method based on a YOLOv10 model is provided, which specifically comprises the following steps:
[0063] Collecting pineapple images during growth and screening, and removing original state images that do not meet the preset rules to obtain target images as a data set;
[0064] According to the fruit eye morphology of pineapple, the fruit eye morphology of pineapple fruit at 14 days, 42 days, 70 days, and 91 days of fruit setting is used to divide the maturity of pineapple fruit into four levels, and a pineapple fruit eye maturity image data set is obtained. The characteristics of pineapple fruit eye of different maturity are as shown in Figure 2 (a)-(l), and the maturity level division is as shown in Table 1.
[0065] Table 1
[0066]
[0067] The traditional YOLOv10 model is improved by replacing the ordinary convolution in the original model with a deformable convolution, adding an ECA attention mechanism, and integrating a C2f-RDB module of a multi-scale residual dense unit to construct a pineapple maturity detection model. The pineapple maturity detection model is an improved YOLOv10 model as shown in Figure 5 .
[0068] This example combines a residual dense unit RDB (Residual Dense Block), a multi-scale convolution, and a C2f module to design a new C2f-RDB module, i.e., a multi-scale residual dense block. The structure diagrams of the C2f-RDB module and the C2f-CIB module are as shown in Figure 3 (a) and Figure 3 (b), and the residual dense unit RDB is as shown in Figure 8 .
[0069] First, replace the ordinary convolution in the C2f-CIB module with a multi-scale convolution with a size of 1x1, 3x3, 5x5, and 7x7.
[0070] The input pineapple eye data set is subjected to 1x1, 3x3, 5x5, and 7x7 convolution operations on the preliminary features obtained by the backbone network and the neck network, the input of each convolution layer is the input combination of all previous layers, the output of the last dense convolution layer is added to the original input to obtain the final output.
[0071] The working steps of the C2f-RDB module include:
[0072] First, replace the ordinary convolution in C2f-CIB with 1x1, 3x3, 5x5, and 7x7 multi-scale convolution.
[0073] The 1x1, 3x3, 5x5, and 7x7 multi-scale convolution operations are serially operated to extract four maturity pineapple eye feature information;
[0074] The four serial multi-scale convolutions are densely connected with residuals, and the input of each convolution layer is the input combination of all previous layers;
[0075] All intermediate feature maps are spliced along the channel dimension;
[0076] Dimensionality reduction is performed through a 1x1 convolution layer, and local features are fused to obtain the final feature map;
[0077] The result of local feature fusion is added to the input feature map, i.e., the preliminary feature, to obtain the final output feature map.
[0078] The multi-scale RDB module splicing process is:
[0079] The input feature map is F0;
[0080] First layer: input: F0, convolution operation: F1=Conv 1×1 (F0);
[0081] Second layer: input: concat(F0+F1), convolution operation: F2=Conv 3×3 (concat(F0+F1));
[0082] Third layer: input: concat(F0+F1+F2), convolution operation: F3=Conv 5×5 (concat(F0+F1+F2));
[0083] Fourth layer: concat(F0+F1+F2+F3), convolution operation: F4=Conv 7×7 (concat(F0+F1+F2+F3));
[0084] The local feature fusion process is: F local =Conv 1×1(concat(F0+F1+F2+F3+F4));
[0085] The residual connection output is: F out= F local +F0.
[0086] Among them, F0, F1, F2, F3, and F4 are the preliminary features, first feature map, second feature map, third feature map, and fourth feature map obtained by the backbone network and the neck network respectively. local is the local feature fusion map after dimensionality reduction, F out is the final output feature map, and concat is a splicing operation.
[0087] This embodiment adds the output of the last layer of dense convolution to the original input. This alleviates the vanishing gradient problem, promotes feature reuse and gradient flow, and enhances the model's expressiveness.
[0088] Use DCN to replace the ordinary convolution in the neck network of YOLOv10. The DCN convolution structure is as follows Figure 7 As shown in the figure, the DCN working steps are as follows:
[0089] First, a traditional convolution operation is used to generate feature maps.
[0090] Secondly, while generating the feature map, another convolutional layer is used to predict the offset of each convolution position. A two-dimensional vector is obtained, which represents the offset of the convolution kernel center relative to the standard position.
[0091] The predicted offset is used to adjust the position of the standard convolution kernel, and then the convolution operation is applied to adaptively adjust the local collection structure of the input feature map.
[0092] The deformable convolution calculation process is:
[0093] ;
[0094] ;
[0095] Where, Represents the output feature map Middle position characteristics. Indicates that the input feature map is at position The pixel value at . is the center position of the convolution kernel, It is an enumeration value relative to the center position in the convolution kernel. Indicates the The weights of the convolution kernels. Indicates the added offset. The size and dilation of the receptive field are defined as A 3x3 kernel with a dilation rate of 1 is defined as shown in the formula
[0096] The ECA attention mechanism is embedded between the C2f layer and the Detect layer of the YOLOv10 model. By suppressing irrelevant information output by the C2f layer, the ability of the Detect layer to locate and classify targets is enhanced, thereby improving the model's detection ability for different sizes of pineapple eyes and improving the prediction accuracy of pineapple eye positions and sizes. The Detect layer is part of the Head layer and is responsible for specific detection tasks. In YOLOv10, the Detect layer uses a dual-head design, namely One-to-many Head and One-to-one Head. These two heads participate in calculating the loss simultaneously during training, while only One-to-one Head is used during inference prediction. This design helps to solve the problem of redundant predictions in post-processing and achieves NMS-free (Non-Maximum Suppression-free) end-to-end detection.
[0097] As shown in Figure 6 The ECA attention mechanism structure diagram is shown in the following figure, and the working steps of the ECA attention mechanism are as follows:
[0098] First, the input feature map is subjected to global average pooling (GAP), which compresses the features of each channel into a scalar value.
[0099] Next, a one-dimensional convolution (1D Convolution) is used to model the interdependence between channels: , k is the convolution kernel, and φ represents a series of operations in the ECA module.
[0100] The kernel size of one-dimensional convolution is calculated by a fixed formula, which is based on the parity of the number of channels C.
[0101] The formula is as follows:
[0102] ;
[0103] Where the input feature map is of the shape (B, C, H, W), where B is the batch size, C is the number of channels, H and W are the height and width of the feature map respectively, γ is a scaling factor, b is a constant, and odd represents the nearest odd number to k.
[0104] An activation function Sigmoid is used after one-dimensional convolution to map the attention weight to the interval [0, 1], Figure 6 Sigmoid activation function.
[0105] Finally, the calculated attention weights are applied to the input feature map to adjust the importance of each channel. The shape of the output feature map output is still (B, C, H, W).
[0106] The pineapple fruit eye prediction value is calculated by the pineapple fruit weighted average formula to obtain the pineapple comprehensive maturity score.
[0107] The fruit eye in the development period (14 days after fruit setting), the fruit eye in the unripe period (42 days after fruit setting), the fruit eye in the medium-ripe period (70 days after fruit setting), and the fruit eye in the ripe period (91 days after fruit setting) are assigned weights of 0.14, 0.42, 0.70, and 0.91, respectively. The pineapple fruit weighted average formula is:
[0108] ;
[0109] ;
[0110] wherein D is the pineapple maturity score, X is the total number of labeled fruit eyes, x1, x2, x3, and x4 are the number of fruit eyes in the ripe period, the medium-ripe period, the unripe period, and the development period, respectively, D1 k1 , D2 k2 , D3 k3 , and D4 k4 are the fruit eye scores of the k1th fruit eye in the ripe period, the k2th fruit eye in the medium-ripe period, the k3th fruit eye in the unripe period, and the k4th fruit eye in the development period, respectively, and when the D value is in the ranges of 0.91-0.70, 0.70-0.42, 0.42-0.14, and 0.14-0, it corresponds to the ripe period, the medium-ripe period, the unripe period, and the development period of the pineapple grade, respectively.
[0111] The training set and the validation set data are input into the model for training and validation. After each training round, the validation set is used for validation. After a certain number of training, if the weight obtained by training is tested using the test set, the effect does not meet the requirements for use, the training parameters are further adjusted, and the training is retrained until the result meets the use standard, and the optimal detection model is obtained, as shown in Figure 4 the pineapple maturity detection result tested using the test set.
[0112] The pineapple image to be detected is input into the obtained optimal detection model, and different maturity pineapples are detected from the pineapple image to be detected by the optimal detection model.
[0113] The specific implementation method is as follows:
[0114] The Precision (P), Recall (R) and mean Average Precision (mAP) are used as the evaluation indexes of the model in this embodiment. The calculation of the Precision P is shown in formula (1), and the calculation of the Recall R is shown in formula (2). The formula for calculating the average precision is shown in (3), and the mean Average Precision mAP is the average precision X of all categories AP After summation, the mean value is taken.
[0115] (1) ;
[0116] (2) ;
[0117] (3) ;
[0118] wherein TP (True Positive) is the true positive, that is, the number of samples correctly predicted as positive class by the model. FP (False Positive) is the false positive, that is, the number of samples incorrectly predicted as positive class by the model. FN (False Negative) represents the number of relevant information not identified. Each part of the improved embodiment contributes to improving the performance of the model. The original YOLOv10 model is used as the baseline model, the ablation experiment is performed, and the mAP@0.5, mAP@0.5:0.95, P and R evaluation indexes are used to evaluate the performance of the model. The ablation experiment results are shown in Table 2.
[0119] Table 2
[0120]
[0121] In order to verify the performance of the optimized YOLOv10 model, the optimized YOLOv10 model is compared with the mainstream target detection models Faster-RCNN, SSD, RetinaNet, YOLO5 and YOLOv7, YOLOv8 and YOLOv10 baseline model on the same device and the same data set, and the detection effect comparison is shown in Table 3.
[0122] Table 3
[0123]
[0124] The experimental device configuration is as follows:
[0125] The operating system used in the experiment is Window 10, the CPU model is Intel(R) Core(TM) i7-12700F CPU@2.10Ghz, and the GPU is NVIDIA GeForce RTX3080Ti (40G). PyTorch1.10.0 deep learning framework is used for training, and the GPU acceleration library is CUDA11.5. The SGD optimizer is used during learning, the initial learning rate is 0.01, the weight decay number is 0.0005, the learning momentum is 0.900, and the network input dimension is 640*640. The model training period is 200 rounds, and the batch size is 32. The loss value of the network decreases rapidly in the first 50 training rounds, and the loss value basically tends to be stable after 100 rounds, as shown in FIG. 8. Figure 9
[0126] The above-described embodiments are only descriptions of the preferred modes of the present application and do not limit the scope of the present application. Various modifications and improvements to the technical solutions of the present application made by those of ordinary skill in the art without departing from the design spirit of the present application shall fall within the protection scope of the present application as defined by the claims.
Claims
1. A pineapple ripeness target detection method based on a YOLOv10 model, characterized in that, The method comprises the following steps: acquiring a pineapple image to be detected; inputting the pineapple image to be detected into a pineapple maturity detection model to output a fruit eye maturity score of the pineapple image to be detected and acquire a maturity grade of the pineapple in the pineapple image to be detected, wherein the pineapple maturity detection model is constructed based on an improved YOLOv10 model and obtained through a training set, the improved YOLOv10 model is obtained by improving a feature extraction network structure of a traditional YOLOv10 model, and the training set is a pineapple image containing pineapple fruit eye maturity annotation. embedding a multi-scale residual dense block in a C2F-CIB module in the traditional YOLOv10 model comprises: replacing a convolution in the C2F-CIB module with a serial multi-scale convolution and performing residual dense connection on the serial multi-scale convolution, wherein the multi-scale residual dense block performs multi-scale convolution operation on initial features obtained through a backbone network and a neck network of the pineapple maturity detection model, extracts pineapple fruit eye feature information, inputs the pineapple fruit eye feature information and the initial features into a convolution layer for dimension reduction, adds the features after dimension reduction to the initial features, and acquires a final output feature map; the working steps of the C2f-RDB module comprise: replacing a general convolution in the C2f-CIB with 1×1, 3×3, 5×5, and 7×7 multi-scale convolutions and performing serial operation on the 1×1, 3×3, 5×5, and 7×7 multi-scale convolutions; the expression of weighted average is: ; ; Wherein, D is the pineapple maturity score, X is the total number of marked eyes, x1, x2, x3, x4 are the number of eyes in the mature period, the semi-mature period, the immature period and the development period respectively, D1 k1 , D2 k2 , D3 k3 , D4 k4 are the eye scores of the k1th mature period eye, the k2th semi-mature period eye, the k3th immature period eye and the k4th development period eye respectively.
2. The pineapple ripeness target detection method based on a YOLOv10 model according to claim 1, characterized in that, acquiring the training set comprises: collecting original pineapple images in a growth process, removing the original pineapple images that do not meet a preset rule, annotating the maturity of pineapple fruit eyes in the remaining original pineapple images, and acquiring the training set.
3. The pineapple ripeness target detection method based on a YOLOv10 model according to claim 1, characterized in that, improving the feature extraction network structure of the traditional YOLOv10 model comprises: replacing the convolution of the neck network of the traditional YOLOv10 model with a deformable convolution, embedding an ECA attention mechanism between a C2f layer and a Detect layer of the traditional YOLOv10 model, and embedding a multi-scale residual dense block in a C2F-CIB module in the traditional YOLOv10 model.
4. The pineapple ripeness target detection method based on a YOLOv10 model according to claim 1, characterized in that, the multi-scale residual dense block performing multi-scale convolution operation on the initial features obtained through the backbone network and the neck network of the pineapple maturity detection model comprises: inputting the initial features into a first scale convolution layer for convolution operation to acquire a first feature map; inputting the first feature map and the initial features into a second scale convolution layer for splicing and convolution operation to acquire a second feature map; inputting the first feature map, the second feature map, and the initial features into a third scale convolution layer for splicing and convolution operation to acquire a third feature map; inputting the first feature map, the second feature map, the third feature map, and the initial features into a fourth scale convolution layer for splicing convolution operation to acquire a fourth feature map.
5. The pineapple ripeness target detection method based on YOLOv10 model according to claim 1, characterized in that, The method comprises the following steps: acquiring the maturity grade of the pineapple in the to-be-detected pineapple image comprises: respectively giving different weights to the mature eye, the medium-mature eye, the unripe eye and the developing eye, performing weighted average according to the weights and the eye maturity score in the to-be-detected pineapple image, acquiring the pineapple maturity score in the to-be-detected pineapple image, and acquiring the maturity grade of the pineapple in the to-be-detected pineapple image according to the pineapple maturity score.
Citation Information
Patent Citations
Lightweight YOLOv4-based pineapple maturity analysis method
CN116453111A
Infrared remote sensing image target detection method based on YOLOv8, electronic equipment and computer readable storage medium
CN118887511A