Tomato segmentation method based on improved YOLOv8 model

By improving the YOLOv8 model, combining data enhancement and lightweight network structure, the problem of misidentification and misidentification in tomato plantations is solved, the accuracy of tomato segmentation and picking efficiency are improved, and labor costs are reduced.

CN118887402APending Publication Date: 2024-11-01HARBIN UNIV OF SCI & TECH

Patent Information

Application Number
CN202411001577.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

There are problems in tomato plantations with high misidentification rates and misidentification, resulting in low efficiency and high labor costs for tomato picking.

Method used

Using the improved YOLOv8 model, data enhancement and manual labeling are performed by taking pictures in tomato plantations, Dropout parameters are adjusted, the backbone network is replaced with MobileNetv3, and variable convolutional DCNv2 and channel attention mechanism CA are introduced at the network head to optimize the model Structure to adapt to the shape and posture of tomatoes.

Benefits of technology

It improves the accuracy and speed of tomato segmentation, reduces the number of model parameters, solves the problems of scarcity and overfitting of data sets, and realizes efficient tomato identification and picking in the agricultural field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887402A_ABST
    Figure CN118887402A_ABST
Patent Text Reader

Abstract

The invention discloses a tomato segmentation method based on an improved YOLOv8 model, and the method mainly comprises the steps: searching a tomato segmentation data set with rich categories, carrying out the data enhancement processing and manual marking of the tomato segmentation data set, expanding the number of the data set, improving a YOLOv8n model, replacing a trunk with MobileNetv3, enabling the model to be light, and carrying out the manual marking of the data set. DCNv2 variable convolution is introduced into a YOLOv8n network head, so that the shape of a target can be better adapted, and a channel attention mechanism is added to the head to pay attention to channel information and space information of a feature layer. The result shows that the average precision of the improved algorithm category is 91.8%, and the method meets the practical requirements in the aspects of recognition accuracy and speed, and further promotes the development of tomato picking robots and intelligent agriculture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning and smart agriculture, and specifically relates to a tomato segmentation method based on an improved YOLOv8 model. Background Art

[0002] Tomatoes are an important crop worldwide, cultivated across a wide range of areas. As a major agricultural country, my country boasts the largest production and consumption of tomatoes. Tomato production and consumption increase farmers' incomes and serve as a key source of export earnings. This massive production undoubtedly drives the demand for labor for harvesting, creating a significant conflict between the demanding harvesting workload and the ever-increasing labor costs. Tomato harvesting is labor-intensive, requiring only a short harvest time, often conducted in harsh environments such as greenhouses. Challenges facing tomato harvesting include an aging population, a large labor demand, a short harvest time, harsh working conditions, and high labor intensity.

[0003] As traditional agriculture gradually moves toward precision, standardization, and facility-based production, numerous intelligent technologies are being applied to automate tomato harvesting, improving efficiency and quality while reducing the labor burden and labor costs, thereby promoting sustainable development of tomato production. The use of machinery and intelligent equipment in agricultural production is becoming increasingly feasible, and artificial intelligence technologies, such as robotics and deep learning, are increasingly being applied in agricultural production. Summary of the Invention

[0004] In response to the above research problems, the present invention provides a tomato segmentation method based on an improved YOLOv8 model. In order to solve the problems of high misidentification rate and missed identification of tomatoes in complex environments such as plantations, the tomato contour is segmented to facilitate the accurate identification of tomato fruits.

[0005] Specifically, the present invention aims to provide a tomato segmentation method based on an improved YOLOv8 model, which includes the following steps:

[0006] S1: Search for tomato segmentation datasets on the Internet, take pictures in tomato plantations, perform data augmentation processing on all tomato pictures, and manually annotate them to expand the dataset.

[0007] Furthermore, the specific steps of S1 are:

[0008] S11: Tomato images downloaded from the Internet and images taken in tomato plantations were augmented by cropping, noise, rotation, etc., and then manually labeled.

[0009] S12: Process the labeled dataset and divide it into training set, validation set, and test set according to the ratio of 8:1:1 to prepare for subsequent model training.

[0010] The above steps can solve the problem of scarce tomato segmentation datasets. At the same time, the segmentation network can accurately identify the tomato outline, which is convenient for subsequent capture.

[0011] S2: Adjust the Dropout parameter. Dropout is a method commonly used in deep learning to reduce overfitting. This method randomly deletes some hidden layer neurons during each round of training. The deleted neurons do not transmit forward or reverse signals. During the test phase, all neurons transmit signals, but the output of each neuron is multiplied by the deletion ratio during training. In this case, the Dropout parameter is set to 0.5.

[0012] The above steps can solve the problem of overfitting of deep learning networks.

[0013] S3: Determine the size of the YOLOv8 network model. Test the n, m, s, x, and l models separately. Considering accuracy and size, compare the five models in terms of parameter size, average class accuracy, and speed. After comprehensive consideration, the YOLOv8n model was ultimately selected.

[0014] The above steps can determine the network model of YOLOv8.

[0015] S4: Improve the YOLOv8n model by replacing the backbone with MobileNetv3 to make the model lightweight. Introduce the deformable convolution DCNv2 to the YOLOv8 network head to better adapt to the target shape, and add the channel attention mechanism CA to the head to focus on the channel information and spatial information of the feature layer.

[0016] Furthermore, the specific steps of S4 are:

[0017] S41: Modify the YOLOv8 network backbone. Although the YOLOv8 network has good results in terms of speed and accuracy, it has many models and requires high computing resources. Therefore, its backbone network is changed to the lighter MobileNetv3 network.

[0018] S42: Add an attention mechanism to the YOLOv8 network. The attention mechanism is an effective means to improve the accuracy of the model. In order to improve the segmentation performance of YOLOv8, a CA attention mechanism is added to its network backbone to focus on the channel information and spatial information of the feature layer.

[0019] S43: Add DCNv2 to the YOLOv8 network backbone. DCNv2 is a convolutional variant of convolutional neural networks. It introduces deformable convolution, which can better adapt to the shape and posture of the target and facilitate the segmentation of the target object. The calculation process of DCNv2 deformable convolution is shown in the following formula.

[0020]

[0021] Where Δp k and Δm k are the learnable offset and modulation scalar of the kth position, Δm k Located in the range [0,1], Δp k is an unrestricted variable, p k and w k are the corresponding positions and convolution parameters in the convolution kernel, respectively. x(p) and y(p) represent the features at position p from the input feature map x and the output feature map y, respectively.

[0022] Through the above steps, we can obtain a tomato segmentation algorithm with a small number of model parameters and good accuracy and speed.

[0023] Compared with existing technologies, this invention addresses the issue of insufficient datasets by utilizing self-photographing and data augmentation of existing datasets. To address the issues of the YOLOv8n network model, such as large number of parameters, low segmentation accuracy, and the risk of false detection and missed detection, an improved YOLOv8n segmentation model is proposed. This improved model structure reduces the number of parameters and improves model detection speed. The optimized network model can be applied to tomato plantations and put into use in the agricultural sector. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] 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 or the description of the prior art. 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.

[0025] Figure 1 It is the overall flow chart of the present invention;

[0026] Figure 2 This is a flow chart of the algorithm of the improved network of the present invention;

[0027] Figure 3 This is the structure diagram of the CA attention mechanism algorithm of the present invention;

[0028] Figure 4 This is a DCNv2 network structure diagram of the present invention;

[0029] Figure 5 This is the MobileNetv3 network structure diagram of the present invention;

[0030] Figure 6 This is a diagram showing the effect of tomato segmentation using the improved network of the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention is described below by means of specific embodiments shown in the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. The structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the limiting conditions under which the present invention can be implemented. Therefore, they have no technical significance. Any modification of the structure, change in the proportional relationship or adjustment of the size should still fall within the scope of the technical content disclosed by the present invention without affecting the efficacy and purpose that can be achieved by the present invention. In addition, in the following description, the description of known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.

[0032] like Figure 1 As shown, the tomato segmentation method based on the improved YOLOv8 model of the present invention includes the following steps:

[0033] S1: Search for tomato segmentation datasets on the Internet, take pictures in tomato plantations, perform data augmentation processing on all tomato pictures, and manually annotate them to expand the dataset.

[0034] Furthermore, the specific steps of S1 are:

[0035] S11: Tomato images downloaded from the Internet and images taken in tomato plantations were augmented by cropping, noise, rotation, etc., and then manually labeled.

[0036] S12: Process the labeled dataset and divide it into training set, validation set, and test set according to the ratio of 8:1:1 to prepare for subsequent model training.

[0037] The above steps can solve the problem of scarce tomato segmentation datasets. At the same time, the segmentation network can accurately identify the tomato outline, which is convenient for subsequent capture.

[0038] S2: Adjust the Dropout parameter. Dropout is a method commonly used in deep learning to reduce overfitting. This method randomly deletes some hidden layer neurons during each round of training. The deleted neurons do not transmit forward or reverse signals. During the test phase, all neurons transmit signals, but the output of each neuron is multiplied by the deletion ratio during training. In this case, the Dropout parameter is set to 0.5.

[0039] The above steps can solve the problem of overfitting of deep learning networks.

[0040] S3: Determine the size of the YOLOv8 network model. Test the n, m, s, x, and l models separately. Considering accuracy and size, compare the five models in terms of parameter size, average class accuracy, and speed. After comprehensive consideration, the YOLOv8n model was ultimately selected.

[0041] The above steps can determine the network model of YOLOv8.

[0042] S4: Improve the YOLOv8n model. Replace the backbone with MobileNetv3 to make the model lightweight. Add DCNv2 to the YOLOv8 network head to better adapt to the target shape. Add CA attention mechanism to the head to focus on the channel information and spatial information of the feature layer. The improved network structure is shown in the figure below. Figure 2 shown.

[0043] Furthermore, the specific steps of S4 are:

[0044] S41: Change the YOLOv8 network backbone. Although the YOLOv8 network has good results in terms of speed and accuracy, it has many models and requires high computing resources. Therefore, its backbone network is changed to a lighter MobileNetv3 network. The MobileNetv3 network structure is as follows: Figure 5 shown.

[0045] S42: Add attention mechanism to YOLOv8 network. Attention mechanism is an effective means to improve model accuracy. In order to improve the segmentation performance of YOLOv8, CA attention mechanism is added to its network backbone to focus on the channel information and spatial information of the feature layer. The network structure of CA attention mechanism is as follows: Figure 3 shown.

[0046] S43: Add DCNv2 to the YOLOv8 network backbone. Deformable convolution DCNv2 is a convolutional variant in convolutional neural networks. It introduces deformable convolution, which can better adapt to the shape and posture of the target and better segment the target object. The DCNv2 network structure is as follows: Figure 4 shown.

[0047] S44: The improved algorithm is used to segment the tomato dataset images in the orchard. The segmentation effect is as follows: Figure 6 shown.

[0048] Through the above steps, we can obtain a tomato segmentation algorithm with a small number of model parameters and good accuracy and speed.

[0049] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations that come within the meaning and range of equivalents of the claims be embraced therein.

[0050] Furthermore, the foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A tomato segmentation method based on improved YOLOv8 model, It is characterized in that The following steps are involved: S1: Search for a tomato dataset on the Internet, take pictures in a tomato plantation, perform data enhancement processing on all tomato pictures and manually annotate them to expand the number of datasets. The specific steps of step S1 are: S11: The tomato pictures downloaded from the Internet and the pictures taken in the tomato plantation were manually annotated after data enhancement by cropping, noise, rotation, etc.; S12: Process the labeled data set and divide it into training set, validation set, and test set according to 8:1:1 to prepare for subsequent model training; S2: Adjust the Dropout parameter. Dropout is a method commonly used in deep learning to reduce overfitting. This method randomly deletes some hidden layer neurons in each round of training. The deleted neurons will not transmit forward or reverse signals. In the test phase, all neurons will transmit signals, but the output of each neuron must be multiplied by the deletion ratio during training. This time, the Dropout parameter is set to 0.5; S3: Determine the YOLOv8 network, test the n, m, s, x, and l models respectively, consider the accuracy and size, compare the parameter size, category average accuracy, and speed of the five models after testing, and finally select the YOLOv8n model after comprehensive consideration; S4: Improve the YOLOv8n model, replace the backbone with MobileNetv3 to make the model lightweight, introduce DCNv2 deformable convolution to the YOLOv8n network head to better adapt to the shape of the target, and add CA attention mechanism to the head to consider the position information. The specific steps of step S4 are: S41: Change the YOLOv8 network backbone. Although the YOLO network has good results in terms of speed and accuracy, it has many models and requires high computing resources. Therefore, its backbone network is changed to a lighter MobileNetv3 network. S42: Add attention mechanism to the YOLOv8 network. The attention mechanism is an effective means to improve the accuracy of the model. In order to improve the segmentation performance of YOLOv8, the CA attention mechanism is added to its network backbone to focus on the channel information and spatial information of the feature layer. S43: DCNv2 is introduced into the YOLOv8 network backbone. DCNv2 is a convolutional variant in convolutional neural networks. It introduces deformable convolution, which can better adapt to the shape and posture of the target and better segment the target object.

Citation Information

Patent Citations

  • Improved yolov5s-based tomato maturity grading method

    CN117152735A

  • Outdoor non-fixed scene weather identification method based on deep learning

    WO2020156028A1

Cited By

  • Spatial heterogeneous visual positioning system of tomato picking robot

    CN119772891A