Low-load tomato fruit detection method for complex shielding of facility environment

By constructing a homemade facility agriculture tomato data set and improving the YOLOv10 model as D3-YOLOv10, dynamic convolution and D-KLA attention mechanism are adopted, combined with the WIoU boundary regression loss function based on scaling factor, and optimizing the model through the knowledge distillation method of semantic frequency prompts, the problem of insufficient feature extraction capability and low edge positioning accuracy of tomato detection in facility agriculture is solved, and efficient and accurate tomato detection and model lightweighting are achieved.

CN119600434APending Publication Date: 2025-03-11HARBIN UNIV OF SCI & TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411593723.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In facility agriculture scenarios, especially under different fruit sizes and occlusions, existing detection algorithms have problems such as insufficient feature extraction capabilities, low edge positioning accuracy, and high parameter complexity, making it difficult to achieve efficient and accurate tomato detection.

Method used

The homemade facility agricultural tomato data set was constructed, and the two-stage category balance method based on the diffusion model and image enhancement preprocessing were used to improve the YOLOv10 model to D3-YOLOv10, dynamic convolution and D-KLA attention mechanism were adopted, combined with the WIoU boundary regression loss function based on the scaling factor, and the model was optimized through the knowledge distillation method of semantic frequency prompts.

Benefits of technology

The model's adaptability to tomato targets of different sizes and ripening degrees and its sensitivity to occlusion characteristics is improved, the detection edge accuracy and model convergence speed are enhanced, and efficient and accurate tomato detection is achieved, while reducing the number of model parameters and calculation complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005126238270000041
    Figure BDA0005126238270000041
  • Figure BDA0005126238270000051
    Figure BDA0005126238270000051
  • Figure BDA0005126238270000055
    Figure BDA0005126238270000055
Patent Text Reader

Abstract

The invention provides a low-load tomato fruit detection method oriented to complex shielding of a facility environment, and belongs to the field of target detection. The method comprises the following steps: firstly, combining a plurality of self-adaptive convolution kernels by using a dynamic convolution so as to better extract rich features of fruits; besides, a D-KLA attention mechanism is designed at the end stage of the neck network, and irregular deformation and shielding problems of tomatoes are focused through adaptive adjustment of a receptive field. Then, a WIoU boundary regression loss function based on a scale factor is constructed, and the accuracy and convergence of boundary detection are improved; and finally, optimizing the detection model by adopting a knowledge distillation method based on semantic frequency prompt, and realizing light weight of the model. And detecting the verification set through the trained tomato target detection model, and evaluating the performance of the verification set. Compared with other methods, the method has the advantages that the optimal performance of tomato fruit detection is realized in a complex shielding environment, the problems of pipeline shielding, leaf shielding and mutual shielding among fruits in a facility environment are effectively relieved, the detection precision is remarkably improved, and the parameter quantity and the calculation complexity of the model are greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of target detection, and in particular relates to a low-load tomato fruit detection method facing complex occlusion in a facility environment. Background Art

[0002] As an important vegetable crop, tomatoes occupy a key position in the agricultural economy and dietary structure. However, the harvesting process of tomatoes is still highly dependent on manual labor, resulting in high costs and limited efficiency. With the rapid advancement of artificial intelligence technology, automated robots are expected to gradually replace manual labor and undertake tasks such as harvesting, identification, and yield estimation. In facility agriculture, the growth environment of tomatoes is complex, facing problems such as interlaced leaves and branches, overlapping fruits, and uneven maturity, which poses a severe challenge to the accuracy of the detection system. Accurate and efficient tomato detection is one of the key technologies to achieve intelligent automatic picking and promote the development of precision agriculture. However, in the scenario of facility agriculture, the existing detection algorithms still have problems such as insufficient feature extraction ability, low edge positioning accuracy, and high parameter complexity when dealing with different fruit sizes and occlusions, and are in urgent need of further optimization. With the extensive theoretical progress of target detection and image segmentation technology, deep learning provides higher speed and accuracy than traditional machine vision due to its advanced feature extraction and automatic learning capabilities. As a single-stage target detection algorithm, YOLO is highly valued by scholars for its superior execution speed and accuracy, and is widely used in agricultural target detection. Many studies have improved the detection accuracy by improving the YOLO model, but this is usually accompanied by the challenges of increased model size, increased parameters, and increased computing requirements. Therefore, research institutions have begun to focus on the development of lightweight object detection algorithms. Through techniques such as pruning, quantization, model compression, designing lightweight architectures, and removing redundant layers, model parameters and floating-point operations have been successfully reduced. However, this simplification often leads to the loss of key features, which in turn reduces detection accuracy and feature representation capabilities, affecting overall performance. Therefore, new technologies are urgently needed to achieve an ideal balance between detection accuracy and model lightweighting. Summary of the invention

[0003] In order to solve the above problems, the present invention provides a low-load tomato fruit detection method for complex occlusion in facility environment, the method comprising the steps of:

[0004] Step S110. Construct a self-made facility agriculture tomato dataset, obtain the original tomato images in the facility agriculture environment through the acquisition equipment, and use the two-stage category balance method based on the diffusion model to construct a tomato image dataset with balanced maturity. After image enhancement preprocessing, divide it into a training set, a validation set, and a test set;

[0005] Step S120. Construct a facility agriculture tomato fruit detection model D based on dynamic convolution and D-KLA improved YOLOv103 -YOLOv10, based on dynamic convolution, DyFasterNet is built to replace the C2f module in YOLOv10, improving the network's ability to adapt to tomato targets of different sizes and maturity; the D-KLA attention mechanism is introduced at the Neck end of the network to improve the network's sensitivity to tomato fruit deformation and occlusion features;

[0006] Step S130. A new boundary regression loss function is constructed based on the WIoU of the scaling factor to improve the accuracy and convergence of the model in detecting boundaries; the improved D 3 -YOLOv10 model, which reduces the number of model parameters and floating-point operations;

[0007] Step S140: Using the trained D 3 -YOLOv10 model evaluates its performance on the validation set and conducts comparative experiments with FasterRCNN, YOLOv8, and YOLOv10.

[0008] Furthermore, the image acquisition described in step S110 uses an Intel Realsense D435 depth camera to capture a total of 878 original images under natural light, and the image resolution is reset to 640×640 pixels.

[0009] The two-stage class balancing method based on the diffusion model is used to alleviate the imbalance problem of maturity classes in the dataset. The ratio of ripe, semi-ripe and unripe tomatoes is adjusted to 16:15:18 by this method. This method is divided into two stages as follows:

[0010] (1) Phase 1: Building a tomato image generation model that learns the pattern of standard normal distribution noise, samples from it, and gradually removes the noise to generate high-quality target data samples, ultimately producing an enhanced semi-ripe tomato image;

[0011] (2) The second stage: construct a tomato image synthesis method based on foreground object search, train two encoders to extract background and foreground features respectively, and evaluate their compatibility by calculating feature similarity, and then use these compatibilities to synthesize images; the images generated in the first stage and their corresponding mask images are used as the foreground input of the network, while the background input is selected from the images of the original tomato dataset for further processing and analysis. To enhance the authenticity of the synthesized image, the present invention randomly selects one to five foreground images and selects the synthesis points at the points with dark light and dense branches and leaves;

[0012] The image enhancement method includes: preprocessing the maturity category equalization data set with Gaussian noise, salt and pepper noise, random rotation and flipping operations to obtain an enhanced image data set; the data set includes three categories: unripe, semi-ripe, and ripe, and is divided into a training set of 2205 images, a validation set of 264 images, and a test set of 264 images, which are respectively used for training and evaluating models.

[0013] The DyFasterNet module is constructed by using dynamic convolution operation in step S120. The composition of DyFasterNet is a dynamic convolution module formed by the CPSNet network format. CPSNet combines residual connection and dense connection. The expression formula of the dynamic convolution calculation process is:

[0014]

[0015] in, represents input features, * represents convolution operation, Represents the i-th convolution weight tensor, the weight tensor is regarded as a set of convolution kernels, α i is the corresponding dynamic coefficient, Y represents the weighted sum of all dynamically selected convolution kernels, and the dynamic coefficient α i Controls the contribution of the convolution kernel, which is dynamically generated according to different input samples, α i The calculation formula is:

[0016] α i =softmax(MLP(Pool(X))) (2)

[0017] in, represents input features, Pool represents global average pooling operation, MLP represents multi-layer perceptron network, and softmax is the activation function;

[0018] The D-KLA attention mechanism is introduced at the Neck end of the network, where the D-KLA attention mechanism is a deformable large kernel convolution attention mechanism, which consists of a deformable convolution and a depth-separable hole convolution. The expression formula of the calculation process is:

[0019] F Attention =Conv×(Deform-DW-D-Conv(Deform-DW-Conv(F′))) (3)

[0020]

[0021] in, represents the input features, F′=GELU(Conv(F)), represents the element-wise multiplication operation, represents the feature concatenation operation, It is the result of the attention operation. Conv represents 1×1 convolution. Deform-DW-Conv represents the addition of deformable convolution to the deep convolution operation. The deformable convolution allows the adjustment of the sampling grid and the integer offset to be deformed freely. Deform-DW-D-Conv represents the addition of deformable convolution to the deep separable convolution. The deep separable convolution uses fewer parameters and calculations to construct a large convolution kernel and increase the range of the receptive field.

[0022] Furthermore, the WIoU based on the scaling factor described in step S130 is used as the bounding box loss function. First, the expression formula of the WIoU loss function is:

[0023]

[0024] Among them, IoU represents the intersection-over-union ratio between the prediction box and the target box; represents the center distance between the anchor box and the target box, x and y are the center coordinates of the anchor box, x gt ,y gt is the center coordinate of the target box, W g , H g is the width and height of the minimum bounding box; γ represents the non-monotonic focusing factor, α and δ are hyperparameters, and β represents the outlier degree of the anchor box. represents the data momentum mean, Represents the monotonic focusing coefficient; the larger the outlier degree, the worse the quality of the anchor frame. Assigning a smaller gradient gain to the anchor frame with a larger outlier value can effectively prevent low-quality samples from generating large harmful gradients and increase attention to ordinary samples;

[0025] In order to improve the accuracy and convergence of the detection boundary, the auxiliary bounding box intersection over union (IoU) is generated based on the scaling factor. inner The calculation process is:

[0026]

[0027]

[0028] union=(w gt *h gt )*(ratio) 2 +(w*h)*(ratio) 2 -inter (11)

[0029]

[0030] Among them, the target box and anchor box are represented as b gt , b, the center coordinates of the target box and the anchor box are expressed as (x c ,y c ), the width and height of the target box are w gt 、h gt , the width and height of the anchor box are w and h respectively, and ratio∈[1,1.5] is the scaling factor. Respectively represent the left boundary value, right boundary value, upper boundary value, and lower boundary value of the target box based on the ratio factor ratio transformation. l , b r , b t , b b , respectively represent the left boundary, right boundary, upper boundary, and lower boundary values ​​of the anchor box based on the ratio factor ratio. Among them, inter and union are the intersection and union of the scaled target box and anchor box respectively;

[0031] Finally, the WIoU expression based on the scaling factor proposed by the present invention is:

[0032]

[0033] in, is the loss of WIoU, IoU is the intersection-over-union ratio of the original target box and the anchor box, IoU inner is the intersection-over-union ratio of the scaled target box and the anchor box.

[0034] The knowledge distillation method based on semantic frequency cues described in step S130 is mainly divided into two stages. In the initial stage, frequency cues are inserted into the teacher model to capture and absorb the contextual information of semantic frequency during the training process; during the distillation, frequency cues are used to generate pixel-by-pixel frequency masks to guide the student model to learn the teacher model to accurately locate the region of interest in each frequency band; wherein the teacher model is D 3 -YOLOv10 model is a pre-trained model trained on a custom dataset. The teacher model size is S (depth: 0.33, width: 0.5, maximum number of channels: 1024); the student model adopts a smaller N structure (depth: 0.33, width: 0.25, maximum number of channels: 1024). The distillation layers are selected at different depths of the model, namely the 2nd, 4th, 6th, 8th, 12th, 16th, 20th and 24th layers. These layers are the gradual evolution from low-level features to high-level semantic information. The student model can learn the knowledge of the teacher model at different scales and semantic levels.

[0035] The performance evaluation test process using the validation set described in step S140 is as follows: the validation set is input into the trained network, and the model establishes a consistent dual allocation strategy during feature extraction and forward propagation to generate prediction categories or target position information; the average accuracy of each category is calculated to obtain the mean of the average accuracy of each category.

[0036] The beneficial effects of the present invention are:

[0037] The present invention provides a low-load tomato fruit detection method for complex occlusion in facility environments, which has the following advantages:

[0038] (1) The method constructs a homemade tomato image dataset containing different maturity levels and multiple lighting conditions, and proposes a two-stage category balancing method based on the diffusion model, which effectively solves the problem of imbalanced sample categories in the dataset.

[0039] (2) The method invented a low-load tomato fruit detection model for complex occlusion in facility environments. It used a dynamic convolutional network and D-KLA attention mechanism to improve YOLOv10, which enhanced the network's adaptability to tomato targets of different sizes and maturity, and at the same time enhanced its sensitivity to tomato deformation and occlusion features.

[0040] (3) The method invented a boundary regression loss function based on the scaling factor WIoU, which further improved the edge detection accuracy and model convergence speed. The knowledge distillation method based on semantic frequency cues was used to optimize the detection model, reduce the floating-point operations of the model parameters, and achieve higher detection accuracy; BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 creative labor.

[0042] Figure 1 It is a flow chart of a low-load tomato fruit detection method for complex occlusion of facility environment according to the present invention;

[0043] Figure 2 This is a self-made tomato image dataset of the facility environment of the present invention, and an example diagram of enhanced image comparison;

[0044] Figure 3 The D 3 -Overall framework diagram of YOLOv10;

[0045] Figure 4 This is an architecture diagram of the knowledge distillation method based on semantic frequency cues for lightweight models of the present invention;

[0046] Figure 5 The recognition accuracy of the existing target detection methods is compared on the homemade tomato dataset in this paper. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.

[0048] Exemplary Methods

[0049] like Figure 1 , a low-load tomato fruit detection method for complex occlusion in facility environment, the method steps are as follows:

[0050] Step S110: First, the original tomato image dataset of different maturity is acquired through the image acquisition device. Secondly, the imbalanced category problem of the original tomato image dataset is processed by the two-stage category balancing method based on the diffusion model, and the number of semi-ripe tomatoes is increased to obtain a tomato image dataset with a maturity category balance of 16:15:18. Finally, the dataset is preprocessed by using image enhancement methods such as Gaussian noise, salt and pepper noise, random rotation and flipping operations to obtain an enhanced image dataset such as Figure 2 As shown, it is divided into training set, validation set and test set.

[0051] Step S120. Construct a facility agriculture tomato detection model D based on dynamic convolution and D-KLA to improve YOLOv10 3 -YOLOv10. Figure 3 As shown, the specific steps include:

[0052] DyFasterNet, which is built based on dynamic convolution and CSPNet network, replaces the original C2F module in the YOLOv10 network. This module extracts local effective features adapted to the fruit size by aggregating multiple adaptive convolution kernels. DyFasterNet is composed of a dynamic convolution module in the CPSNet network format. CPSNet combines residual connections and dense connections. For input features After the dynamic convolution operation, the weighted sum of the dynamic convolution kernel can be obtained as Where * represents the convolution operation, Represents the i-th convolution weight tensor, the weight tensor is regarded as a set of convolution kernels, αi is the corresponding dynamic coefficient. Dynamic coefficient α i Controls the contribution of the convolution kernel, which is dynamically generated according to different input samples. The dynamic coefficient α i =softmax(MLP(Pool(X))), where Pool represents the global average pooling operation, MLP represents the multi-layer perceptron network, and softmax is the activation function.

[0053] At the same time, the Deformable Large Kernel Attention Mechanism (D-KLA) is used as the attention module. It is designed in the terminal stage of the Neck network. By adaptively adjusting the receptive field, it increases the attention to the irregular deformation and occlusion of the tomato. The D-KLA attention mechanism is a deformable large kernel convolution attention mechanism, which consists of deformable convolution and depth-separable dilated convolution. It aims to combine the receptive field of large convolution kernels and the flexibility of deformable convolution to extract the features of irregularly shaped targets. The output features obtained after this attention mechanism are: Among them, Conv represents 1×1 convolution, is the result of the attention part, and its expression is F Attention =Conv×(Deform-DW-D-Conv(Deform-DW-Conv(F′))), Deform-DW-Conv represents the element-wise multiplication operation, Deform-DW-Conv represents the addition of deformable convolution to the deep convolution operation, and the deformable convolution adaptively adjusts the sampling position of the convolution kernel through the offset. Deform-DW-D-Conv represents the addition of deformable convolution to the deep separable convolution, and the deep separable convolution uses fewer parameters and calculations to construct a large convolution kernel and increase the range of the receptive field. Among them, F′=GELU(Conv(F)), GELU represents the activation function used to enhance nonlinearity.

[0054] Step S130: Constructing the FM-WIoU based on the scaling factor as the boundary regression loss function. First, in the loss function based on WIoU Based on this, an auxiliary bounding box is constructed. Secondly, the intersection over union (IoU) of the target box and the anchor box based on the scaling factor transformation is calculated. inner , calculated as follows:

[0055]

[0056] union=(w gt *h gt )*(ratio) 2 +(w*h)*(ratio) 2 -inter

[0057]

[0058] Among them, the target box and anchor box are represented as b gt , b, the center coordinates of the target box and the anchor box are expressed as (x c ,y c ), the width and height of the target box are w gt 、h gt , the width and height of the anchor box are w and h respectively. ratio∈[1,1.5] is the scaling factor. Respectively represent the left boundary value, right boundary value, upper boundary value, and lower boundary value of the target box based on the ratio factor ratio transformation. l , b r , b t , b b , respectively, represent the anchor box based on the ratio factor ratio transformation of the left boundary, right boundary, upper boundary, and lower boundary.

[0059] Finally, the WIoU expression based on the scaling factor proposed by the present invention is:

[0060]

[0061] in, is the loss of WIoU, IoU is the intersection-over-union ratio of the original target box and the anchor box, IoU inner is the intersection-over-union ratio of the scaled target box and the anchor box.

[0062] Construct a knowledge distillation network based on semantic frequency cues, such as Figure 4 As shown in the figure, the method is mainly divided into two stages. In the initial stage, frequency cues are inserted into the teacher model to capture and absorb the contextual information of semantic frequency during training. During the distillation period, the frequency cues are used to generate pixel-by-pixel frequency masks to guide the student model to learn the teacher model to accurately locate the region of interest in each frequency band. The teacher model is D 3 -YOLOv10 model is a pre-trained model trained on a custom dataset. The teacher model size is S, with a depth of 0.33, a width of 0.5, and a maximum number of channels of 1024. The student model uses a smaller N structure, with a depth of 0.33, a width of 0.25, and a maximum number of channels of 1024. The distillation layers are selected at the 2nd, 4th, 6th, 8th, 12th, 16th, 20th, and 24th layers.

[0063] Step S140: Send the training set to D 3 -YOLOv10 detection model is trained to obtain an improved tomato detection model. The trained D3 -YOLOv10 model performance, and compared with DETR, YOLOv10, YOLOv8, etc. Figure 5 shown.

[0064] Through this implementation, firstly, an original data set of tomatoes of different maturity is constructed based on the image acquisition device, and a balanced data set is generated using the two-stage balance method of the diffusion model. After image enhancement preprocessing, it is divided into a training set, a validation set, and a test set. Then, the DyFasterNet module is constructed using dynamic convolution to replace the C2f module, and the D-KLA attention mechanism is introduced at the Neck end. The WIoU based on the scaling factor is used as the boundary loss function. And through knowledge distillation based on semantic frequency cues, the model parameters are reduced and the detection accuracy is maintained. Finally, the superiority of the improved model is verified through comparative experiments with Faster R-CNN, YOLOv10 and YOLOv8.

[0065] To further illustrate, assuming that the self-made tomato dataset of the present invention is used to train the existing target detection method, the detection results obtained according to the improved method of this embodiment will be significantly better than the accuracy of most existing methods.

[0066] Detailed description of the invention Results

[0067] This implementation uses a self-made facility agriculture tomato dataset and performs maturity category balancing to obtain a category-balanced tomato dataset. The details of the dataset are described as follows:

[0068] A self-made tomato dataset, with a total of 878 original images collected, and the image resolution was reset to 640×640 pixels. The dataset was preprocessed using image enhancement methods such as Gaussian noise, salt and pepper noise, random rotation and flipping operations to obtain an enhanced image dataset; the dataset contains three categories: unripe, semi-ripe, and ripe, and the maturity category ratio is set to 16:15:18 through the category balancing method. It is further divided into a training set of 2205 images, a validation set of 264 images, and a test set of 264 images.

[0069] In order to verify the superiority of this implementation (Ours), this implementation is compared with several existing target detection methods, including FasterRCNN, Detr, YOLOv8s, YOLOv10s and other methods. These methods will be compared on the above self-made tomato dataset in terms of mAP@.50, mAP@.50-90, Parameters, and FLOPs. mAP represents the average precision value. The larger the index, the more accurate the model is in detecting tomato targets. mAP@.50 is the average precision value calculated when the IoU threshold is 0.50; mAP@.50-90 is the average precision value calculated when the IoU threshold is 0.50 to 0.90; the parameters (Parameters) and floating-point operations (FLOPs) of the model are used to measure the complexity of the model, reflecting the amount of calculation that the data undergoes in a complex network; the fewer the number of parameters and floating-point operations, the lower the complexity of the network. The specific data comparison is shown in Table 1.

[0070] Table 1 Comparative experiments on the homemade tomato dataset on different models

[0071] Model mAP@.50(%) mAP@.50-90(%) Parameters(M) FLOPs(G) FasterRCNN 83.5 56.5 28.3 948.2 DETR 86.4 53.1 36.7 101.4 yolov8s 88.3 66.4 11.1 28.4 yolov10s 87.3 63.1 8.0 24.5 ours 91.8 66.8 3.7 8.6

[0072] By comparing the data in the above table, we can clearly see that Ours achieves the best performance, significantly improves the accuracy of tomato detection, and reduces the model complexity. The experimental results fully demonstrate the superiority of Ours, because Ours can better capture tomato fruits with complex occlusions in the facility environment, greatly improves the detection accuracy compared to other models, and reduces the number of parameters and calculations. Ours uses dynamic convolution and deformable convolution as key points to obtain richer feature information of occluded tomatoes and tomatoes of different scales, thereby improving the robustness in the complex environment of facility agriculture. A large number of experiments show that this method is superior to existing methods.

[0073] This implementation proposes a low-load tomato fruit detection method for complex occlusion in facility environments, which is used for tomato picking, yield estimation and other scenarios in agricultural production. First, the original tomato dataset is processed by the category balancing method to obtain a tomato dataset with balanced maturity categories. Then, a tomato fruit detection model D is constructed for complex occlusion scenarios based on dynamic convolution and D-KLA attention mechanism. 3-YOLOv10, and use WIoU based on the scaling factor as the bounding box loss function. Finally, the model is optimized by knowledge distillation based on semantic frequency cues to reduce the number of model parameters and calculations, and the model is evaluated. The experimental results on the homemade tomato dataset show that this implementation has higher detection accuracy and lower model complexity than other methods, and achieves a good balance between detection accuracy and lightweight. It shows good accuracy in tomato fruit detection with complex occlusion in the facility agricultural environment, provides a new visual recognition method for intelligent picking, and promotes the deployment and application of target detection algorithms on devices with limited computing power.

[0074] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. In addition, the appended claims of the present invention are intended to cover all changes and modifications that fall within the scope and boundaries of the appended claims, or the equivalent forms of such scope and boundaries.

Claims

1. A low-load tomato fruit detection method for complex occlusion in facility environment, characterized in that: The method comprises the steps of: Step S110. Construct a self-made facility agriculture tomato dataset, obtain the original tomato images in the facility agriculture environment through the acquisition equipment, and use the two-stage category balance method based on the diffusion model to construct a tomato image dataset with balanced maturity. After image enhancement preprocessing, divide it into a training set, a validation set, and a test set; Step S120. Construct a facility agriculture tomato fruit detection model D based on dynamic convolution and D-KLA improved YOLOv10 3 -YOLOv10, based on dynamic convolution, DyFasterNet is built to replace the C2f module in YOLOv10, improving the network's ability to adapt to tomato targets of different sizes and maturity; the D-KLA attention mechanism is introduced at the Neck end of the network to improve the network's sensitivity to tomato deformation and occlusion features; Step S130. A new boundary regression loss function is constructed based on the WIoU of the scaling factor to improve the accuracy and convergence of the model in detecting boundaries; the improved D 3 -YOLOv10 model, which reduces the number of model parameters and floating-point operations; Step S140: Using the trained D 3 -YOLOv10 model evaluates its performance on the validation set and conducts comparative experiments with FasterRCNN, YOLOv8, and YOLOv10. The two-stage category balancing method based on the diffusion model described in step S110 is used to alleviate the imbalance problem of maturity categories in the data set. In the first stage, a high-quality semi-ripe tomato image is generated by sampling from a standard normal distribution through a generative model and gradually removing noise. In the second stage, a semi-ripe tomato synthesis method for foreground object search is designed, two encoders are trained to extract background and foreground features, and image synthesis is performed using feature similarity. Through this method, the ratio of ripe, semi-ripe and unripe tomatoes is adjusted to about 16:15:18; The image enhancement method includes: preprocessing the maturity category balanced data set with Gaussian noise, salt and pepper noise, random rotation and flipping operations to obtain an enhanced image data set; the data set includes three categories: immature, semi-mature, and mature, and is divided into a training set of 2205 images, a validation set of 264 images, and a test set of 264 images, which are used for training and evaluating models respectively; The DyFasterNet module is constructed by using dynamic convolution operation in step S120. The composition of DyFasterNet is a dynamic convolution module formed by the CPSNet network format. CPSNet combines residual connection and dense connection. The expression formula of the dynamic convolution calculation process is: in, represents input features, * represents convolution operation, Represents the i-th convolution weight tensor, the weight tensor is regarded as a set of convolution kernels, α i is the corresponding dynamic coefficient, Y represents the weighted sum of all dynamically selected convolution kernels, and the dynamic coefficient α i Controls the contribution of the convolution kernel, which is dynamically generated according to different input samples, α i The calculation formula is: α i =softmax(MLP(Pool(X))) (2) in, represents input features, Pool represents global average pooling operation, MLP represents multi-layer perceptron network, and softmax is the activation function; In step S120, the D-KLA attention mechanism is introduced at the Neck end of the network, wherein the D-KLA attention mechanism is a deformable large kernel convolution attention mechanism, which consists of a deformable convolution and a depth-separable dilated convolution. The expression formula of the calculation process is: F Attention =Conv×(Deform-DW-D-Conv(Deform-DW-Conv(F′))) (3) in, represents the input feature, F′=GELU(Conv(F)), where GELU represents the activation function used to enhance nonlinearity, represents the element-wise product operation, represents the feature concatenation operation, It is the result of the attention operation. Conv represents 1×1 convolution. Deform-DW-Conv represents the addition of deformable convolution to the deep convolution operation. The deformable convolution adaptively adjusts the sampling position of the convolution kernel through the offset. Deform-DW-D-Conv represents the addition of deformable convolution to the deep separable convolution. The deep separable convolution constructs a large convolution kernel with fewer parameters and calculations, thereby increasing the range of the receptive field.

2. The low-load tomato fruit detection method for complex occlusion in facility environment according to claim 1 is characterized in that: The WIoU based on the scaling factor in step S130 is used as the bounding box loss function. First, the expression formula of the WIoU loss function is: Among them, IoU represents the intersection-over-union ratio between the prediction box and the target box; represents the center distance between the anchor box and the target box, x and y are the center coordinates of the anchor box, x gt ,y gt is the center coordinate of the target box, W g , H g is the width and height of the minimum bounding box; γ represents the non-monotonic focusing factor, α and δ are hyperparameters, and β represents the outlier degree of the anchor box. represents the data momentum mean, Represents the monotonic focusing coefficient; the larger the outlier degree, the worse the quality of the anchor frame. Assigning a smaller gradient gain to the anchor frame with a larger outlier value can effectively prevent low-quality samples from generating large harmful gradients and increase attention to ordinary samples; In order to improve the accuracy and convergence of the detection boundary, the WIoU expression based on the scaling factor proposed in the present invention is: in, is the loss of WIoU, IoU is the intersection-over-union ratio of the target box and the anchor box, IoU inner The intersection-over-union ratio of the target box and the anchor box generated by the scaling factor is calculated as follows: union=(w gt *h gt )*(ratio) 2 +(w*h)*(ratio) 2 -inter (12) Among them, the target box and anchor box are represented as b gt , b, the center coordinates of the target box and the anchor box are expressed as (x c ,y c ), the width and height of the target box are w gt 、h gt , the width and height of the anchor box are w and h respectively, and ratio∈[1,1.5] is the scaling factor. They represent the left, right, upper, and lower boundary values ​​of the target box based on the ratio factor ratio transformation, respectively. l , b r , b t , b b , respectively represent the left boundary, right boundary, upper boundary and lower boundary values ​​of the anchor frame based on the ratio factor ratio transformation; among them, inter and union are the intersection and union of the target frame and the anchor frame generated after scaling based on the ratio factor; The knowledge distillation method based on semantic frequency cues described in step S130 is mainly divided into two stages. In the initial stage, frequency cues are inserted into the teacher model to capture and absorb the contextual information of semantic frequency during the training process; during the distillation, frequency cues are used to generate pixel-by-pixel frequency masks to guide the student model to learn the teacher model to accurately locate the region of interest in each frequency band; wherein the teacher model is D 3 -YOLOv10 model is a pre-trained model trained on a custom dataset. The teacher model size is S, with a depth of 0.33, a width of 0.5, and a maximum number of channels of 1024. The student model uses a smaller N structure, with a depth of 0.33, a width of 0.25, and a maximum number of channels of 1024. The distillation layers are selected at the 2nd, 4th, 6th, 8th, 12th, 16th, 20th, and 24th layers. The performance evaluation test is performed through the validation set as described in step S140, and the prediction process is as follows: the validation set is input into the trained network, and the model establishes a consistent dual allocation strategy during feature extraction and forward propagation to generate prediction categories or target position information; the average accuracy of each category is calculated to obtain the mean of the average accuracy of each category.

Citation Information

Cited By

  • Improved YOLOv8n-based cloudy orchard multi-class sheltered pear detection method

    CN121661511A

  • Infrared target detection method and system based on YOLO improved model

    CN122176463A

  • An infrared target detection method and system based on a YOLO improved model

    CN122176463B