A lightweight kiwi detection method based on an improved YOLOv8 model
By improving the YOLOv8 model, replacing key modules, and expanding training data, the accuracy and speed issues of kiwi detection on resource-limited equipment were resolved, achieving efficient kiwi identification and location, and supporting automatic harvesting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies struggle to efficiently and accurately identify kiwifruit on mobile devices with limited computing resources, resulting in insufficient accuracy and speed for harvesting robots in identifying and locating target fruits in complex environments.
An improved YOLOv8 model was adopted, which replaced the C2f module with the EMBC module, the nearest neighbor upsampling with the Dysample upsampling operator, and the head network with the TADDH probe to build a lightweight kiwi detection model. Data augmentation and annotation were performed, and iterative training was conducted to improve the robustness of the model.
It significantly improves the accuracy and resource utilization of kiwifruit detection, optimizes detection performance, is suitable for equipment with limited computing resources, and supports real-time detection and automatic harvesting of kiwifruit.
Smart Images

Figure CN119723563B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a lightweight kiwi fruit detection method based on an improved YOLOv8 model. Background Technology
[0002] Kiwifruit is a highly nutritious fruit with a unique flavor and significant economic benefits. In recent years, China's kiwifruit industry has developed rapidly, with a total output of 23,900 tons and a planting area of 67,000 hectares, both ranking among the world's top. Currently, kiwifruit harvesting relies mainly on manual labor, which is labor-intensive, and harvesting costs account for more than 25% of production costs. To overcome the increasingly severe labor shortage, improve harvesting efficiency, and extend shelf life, developing an accurate and efficient harvesting robot has become a research hotspot. During the operation of the harvesting robot, the accuracy and speed of target fruit identification and positioning are key factors determining harvesting efficiency.
[0003] Therefore, providing a lightweight kiwi fruit detection method based on an improved YOLOv8 model, enabling it to run efficiently on mobile devices with limited computing resources and to quickly and accurately identify target fruits in complex environments, thereby achieving automated harvesting, is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] In view of this, the present invention provides a lightweight kiwi detection method based on an improved YOLOv8 model, which can effectively simulate the complex situations and input changes that the model may face in real application scenarios, and retrain the model to significantly improve the robustness of the model.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] A lightweight kiwi detection method based on an improved YOLOv8 model includes the following steps:
[0007] Data acquisition steps: Acquire images of unpicked kiwifruit;
[0008] Data preprocessing steps: The images are augmented and labeled to form a kiwifruit dataset;
[0009] Model building steps: Replace the C2f module in the YOLOv8 model with the EMBC module, replace the nearest neighbor upsampling module in the YOLOv8 model with the Dysample upsampling operator, and replace the original probe in the head network of the YOLOv8 model with the TADDH probe; build an improved YOLOv8 model.
[0010] Model training steps: Input the kiwi dataset from the data preprocessing step into the improved YOLOv8 model, iterate continuously to obtain the optimal weights, and obtain the trained improved YOLOv8 model.
[0011] Image detection steps: Detect kiwifruit in complex environments using a trained improved YOLOv8 model.
[0012] Optionally, in the above method, the image augmentation step includes rotation, partial magnification, and noise addition, and the data annotation uses LabelImg to annotate the augmented image.
[0013] Optionally, in the model building steps of the above method, the EMBC module may include replacing the SE module in the MBCnov network with an ESE unit.
[0014] Optionally, in the model building steps described above, the Dysample upsampling operator includes an input, a linear layer, pixel shuffling, pixel addition, resampling, and an output.
[0015] Optionally, in the model building step of the above method, the TADDH probe includes a depthwise convolutional structure and a task alignment structure.
[0016] The above method, optionally, includes a deep convolutional structure comprising two cascaded deep convolutional modules, each comprising a convolutional layer, a Group Norm normalization layer, and an activation function. The task alignment structure comprises a localization branch, a classification branch, and feature fusion.
[0017] As can be seen from the above technical solutions, compared with the prior art, the present invention provides a lightweight kiwi detection method based on an improved YOLOv8 model, which has the following beneficial effects: 1) The present invention uses ESE units to replace the SE modules in the MobileNetV2 network, which better maintains the integrity of information between channels without explicit dimensionality reduction; 2) The present invention introduces the Dysample upsampling operator, which can significantly improve the detection accuracy of the model in real-time kiwi detection and effectively improve resource utilization; 3) The present invention uses the TADDH probe, which greatly reduces the number of parameters, optimizes the cooperation between tasks, and effectively improves the overall detection performance; 4) The present invention improves the YOLOv8 model, which not only has significant effectiveness, but also has a more concise and efficient structural design, which can effectively support subsequent kiwi location and automatic harvesting. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of the improved YOLOv8 model disclosed in this invention;
[0020] Figure 2 This is a flowchart of a lightweight kiwi fruit detection method based on an improved YOLOv8 model disclosed in this invention.
[0021] Figure 3 This is a diagram illustrating the SE to ESE transformation disclosed in this invention.
[0022] Figure 4 This is a structural diagram of the Dysample upsampling operator disclosed in this invention;
[0023] Figure 5 This is a structural diagram of the TADDH disclosed in this invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0026] Reference Figure 1 and Figure 2 As shown, this invention discloses a lightweight kiwifruit detection method based on an improved YOLOv8 model, comprising the following steps:
[0027] Data acquisition steps: Acquire images of unpicked kiwifruit;
[0028] Data preprocessing steps: The images are augmented and labeled to form a kiwifruit dataset;
[0029] Model building steps: Replace the C2f module in the YOLOv8 model with the EMBC module, replace the nearest neighbor upsampling module in the YOLOv8 model with the Dysample upsampling operator, and replace the original probe in the head network of the YOLOv8 model with the TADDH probe; build an improved YOLOv8 model.
[0030] Model training steps: Input the kiwi dataset from the data preprocessing step into the improved YOLOv8 model, iterate continuously to obtain the optimal weights, and obtain the trained improved YOLOv8 model.
[0031] Image detection steps: Detect kiwifruit in complex environments using a trained improved YOLOv8 model.
[0032] Furthermore, in the data preprocessing steps, image augmentation includes rotation, partial magnification, and noise addition. Data annotation uses LabelImg to annotate the augmented image.
[0033] Furthermore, in the data preprocessing step, the training set, validation set, and test set are divided in a 7:2:1 ratio.
[0034] Furthermore, in the model building steps, the EMBC module includes replacing the SE module in the MBCnov network with an ESE unit.
[0035] Specifically, first, MBCnov expands the channels of the input feature map through a 1x1 convolutional layer; then, it enters the depthwise separable convolutional part for feature extraction; subsequently, the SE module enhances useful features and suppresses unimportant features by explicitly modeling the interdependencies between feature channels, thereby improving the model's representational ability; after this, a 1x1 convolutional layer is used to compress the number of channels; finally, residual connections are applied to alleviate the gradient vanishing problem in deep networks and accelerate the model training process. The MobileNetV2 network, by employing depthwise separable convolutions and a linear bottleneck structure, effectively reduces model parameters and computational cost while maintaining good feature extraction performance.
[0036] In the MBCnov network, the SE module, as an effective attention mechanism, originally contained two fully connected layers, which respectively played the roles of reducing and expanding the dimensionality of feature channels. However, while the dimensionality reduction operation reduced computational complexity, it inevitably led to a certain degree of information channel loss. (Refer to...) Figure 3 As shown, in order to further improve the feature extraction effect, an ESE unit is introduced. Its core idea is to simplify the traditional two fully connected layers into one, thereby better maintaining the integrity of information between channels without explicit dimensionality reduction.
[0037] Furthermore, in the model building steps, the Dysample upsampling operator includes an input end, a linear layer, pixel shuffling, pixel addition, resampling, and an output end.
[0038] Specifically, the nearest neighbor interpolation method interpolates only based on the values of adjacent pixels, ignoring the spatial relationships and contextual information between pixels. This can lead to blurred or lost-of-detail edges of the kiwi fruit in areas with drastic lighting changes or shadows. For small objects and occluded kiwi fruits, the limited number of pixels they occupy already results in relatively scarce detail.
[0039] In nearest neighbor interpolation, edge and texture information is more easily lost, leading to a decrease in detection accuracy. To overcome these shortcomings, the Dysample upsampling operator is introduced, referring to... Figure 4 As shown, given a feature map X of size C×H×W, where C represents the number of channels, and H and W represent the height and width, respectively, the offset is first generated through a linear layer. At this time, the offset The shape is 2s 2 ×H×W, then it needs to be adjusted to 2×sH×sW through pixel shuffling. The adjusted offset... With the original sampling network Pixels are added together to obtain the sample set Right now:
[0040]
[0041] Then, the grid sample function positions with respect to S are obtained, and the input feature map X is resampled to obtain a new feature map X' with size C×sH×sW. This process can be represented as follows:
[0042]
[0043] Furthermore, refer to Figure 5 As shown, in the model building steps, the TADDH probe includes a deep convolutional structure and a task alignment structure.
[0044] Furthermore, the deep convolutional structure includes two cascaded deep convolutional modules, which include a convolutional layer, a Group Norm normalization layer, and an activation function. The task alignment structure includes a localization branch, a classification branch, and feature fusion.
[0045] Specifically, TADDH aims to optimize the model's detection head design, achieving improved detection performance while reducing the number of parameters. First, to reduce the number of parameters in the detection head, TADDH introduces a deep convolutional structure during the image information extraction stage. This design not only enhances the model's ability to learn complex features but also improves training stability and adaptability to different batch sizes through Group Norm. Compared to the original detection head's structure consisting of two 3×3 convolutions and one 1×1 convolution, TADDH's convolutional structure significantly reduces the number of parameters by concatenating two deep convolutional modules, while simultaneously improving feature extraction capabilities. Then, to enhance the interaction between two independent tasks, TADDH learns task interaction features from multiple convolutional layers through a feature extractor, obtaining joint features. The localization branch uses DCNV2 and interaction features to generate DCNV2 offsets and masks, while the classification branch uses interaction features for dynamic feature selection. Finally, TADDH scales the results of the localization branch to achieve better fusion between the classification and localization branches.
[0046] Furthermore, in the model training step, the training set is used to train the model. During training, the model continuously adjusts its parameters to minimize the loss function. Simultaneously, in each training round, the model is evaluated on the validation set to check its generalization ability. After multiple training rounds, the weights obtained in the round with the best results are taken as the optimal weights. The model with the optimal weights generated after training is then used to detect images in the test set for final evaluation, forming the trained YOLOv8 model.
[0047] Furthermore, the improved YOLOv8 model implementation environment includes: the server platform hardware environment is an NVIDIA GeForce RTX 4090D graphics card, an AMD EPYC 9754 CPU, and 60GB of memory; the software environment is Windows 10, Python 3.8, PyTorch 2.0.0, and CUDA 11.8. The comparison results are shown in Table 1.
[0048] Table 1 Comparison of Experimental Data
[0049]
[0050] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0051] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A lightweight kiwi fruit detection method based on an improved YOLOv8 model, characterized in that, The method comprises the following steps: a data acquisition step: acquiring an image of un-picked kiwifruit; a data preprocessing step: expanding and labeling the image to form a kiwifruit dataset; a model construction step: replacing a C2f module in a YOLOv8 model with an EMBC module, replacing a nearest neighbor up-sampling module in the YOLOv8 model with a Dysample up-sampling operator, and replacing an original detection head in a head network of the YOLOv8 model with a TADDH detection head; and constructing an improved YOLOv8 model; a model training step: inputting the kiwifruit dataset of the data preprocessing step into the improved YOLOv8 model, iteratively obtaining optimal weights, and obtaining a trained improved YOLOv8 model; an image detection step: detecting kiwifruit in a complex environment by using the trained improved YOLOv8 model. In the model construction step, the EMBC module comprises replacing an SE module in an MBCnov network with an ESE unit, wherein the ESE unit simplifies two traditional fully connected layers into one fully connected layer. The TADDH detection head comprises a deep convolution structure and a task alignment structure. The deep convolution structure comprises two deep convolution modules connected in series, and each deep convolution module comprises a convolution layer, a Group Norm normalization layer, and an activation function. The task alignment structure comprises a positioning branch, a classification branch, and feature fusion.
2. The light-weight kiwifruit detection method based on the improved YOLOv8 model according to claim 1, wherein in the data preprocessing step, the image expansion comprises rotation, partial enlargement, and noise addition, and the data labeling uses LabelImg to label the expanded image.
3. The light-weight kiwifruit detection method based on the improved YOLOv8 model according to claim 1, wherein in the model construction step, the Dysample up-sampling operator comprises an input end, a linear layer, pixel shuffling, pixel addition, resampling, and an output end.
Citation Information
Patent Citations
Security check picture contraband image detection method and device based on YOLOv5-Mobilenet network model and computer storage medium
CN117218583A
Fruit detection method and system in complex environment based on improved YOLOv8n and application
CN118537718A
Improved target detection method based on YOLOv8s
CN118982734A
Lightweight remote sensing image target detection method fusing dynamic upsampling
CN119027817A