Tomato seedling detection and counting method based on multi-scale feature fusion

Through the detection and counting method of multi-scale feature fusion and combined with specific network modules, the problem of low detection accuracy of tomato seedlings in seedlings is solved, efficient and accurate seedling detection and counting is achieved, and the intelligence and accuracy of agricultural production is improved.

CN119785222APending Publication Date: 2025-04-08HUZHOU UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510045570.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the detection and counting of tomato seedlings in seedling trays, especially when the seedlings are highly cross-overlapping, the detection accuracy and robustness are limited, resulting in low counting efficiency, high cost and high error rate.

Method used

The detection and counting method of multi-scale feature fusion is adopted, and the data preprocessing enhancement module, model training module and model detection and counting module are combined with the ASF-P2 feature fusion neck network, RepVGGBlock feature extraction module and ContextGuideFusionModule feature interaction fusion module to optimize detection accuracy and robustness.

Benefits of technology

It realizes efficient and accurate detection and counting of tomato seedlings in the seedling tray environment, improves detection accuracy and robustness, reduces the error rate and cost of manual counting, and promotes the intelligence and accuracy of agricultural production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785222A_ABST
    Figure CN119785222A_ABST
Patent Text Reader

Abstract

The invention discloses a tomato seedling detecting and counting method based on multi-scale feature fusion, and aims to provide an efficient and accurate solution for detecting and counting tomato seedlings in a seedling raising plate. In the aspect of data preprocessing, image feature information is enhanced by adopting image translation, overturning, cutting and CLAHE methods, and the quality and diversity of images are improved. In the model training module, an ASF-P2 feature fusion neck network performs multi-scale feature extraction, a RepVGGBlock feature extraction module enhances the feature extraction capability through multi-path convolution and jump connection, and a ContextGuideFusion Module module guides feature fusion and channel dimension dynamic adjustment weight through context, so that the attention of the model to key features is further improved, and the feature extraction capability of the model is improved. And the interference of irrelevant background information is reduced. According to the method, by optimizing multi-scale information fusion, the precision and robustness of seedling detection are improved, the problems of low efficiency, high cost and high error rate in manual counting are solved, and the detection accuracy under the condition that seedlings are highly crossed and overlapped is improved. The model can accurately detect and count tomato seedlings in a seedling raising tray, has a hole positioning function, and supports intelligentization and automation of seedling management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of precision agricultural production, and specifically relates to a tomato seedling detection and counting method based on multi-scale feature fusion. Background Art

[0002] With the rapid development of smart agriculture and precision agriculture, how to improve agricultural production efficiency and ensure food supply has become a key issue that needs to be solved urgently. In this context, greenhouse seedling tray planting technology can significantly improve the survival rate and quality of seedlings, thereby maximizing production and efficiency. This technology helps to ensure the accurate statistics of the number of seedlings, reduce labor costs, and improve the management efficiency of plant factories. However, the traditional manual counting method is not only limited by factors such as the energy and mood of the staff, but also has high labor costs and low efficiency, and it is often difficult to ensure the accuracy of the counting. Counting errors may lead to improper management of the number of seedlings, missing the best time to go to market, and thus affecting profits. Therefore, there is an urgent need for a high-precision tomato seedling detection and counting model in the seedling tray to improve the intelligence and accuracy of management and promote agricultural production to develop in a more efficient and precise direction; Existing seedling counting methods mainly focus on the detection of scattered seedlings in field environments. Computer vision and deep learning technologies can perform automated detection and counting of seedlings more accurately. These methods are usually based on image recognition technology, which greatly improves the counting efficiency and accuracy by training deep learning models to identify the morphological characteristics of seedlings and reduces manual intervention. However, most of these studies focus on scenarios with obvious gaps between seedlings. In the face of highly overlapping seedlings, the detection accuracy and robustness of existing methods are still limited. In addition, although some studies have focused on the detection and counting of plant seedlings in seedling tray environments, there is still a lack of systematic and in-depth exploration of the problem of detecting whether each hole is empty or has multiple seedlings. Solving this problem can help companies quickly and accurately count the number of seedlings, optimize the tasks of transplanting multiple seedlings and replanting empty holes, thereby improving production efficiency and achieving a high degree of automation in seedling management. Summary of the invention

[0003] Purpose of the invention: The purpose is to provide a tomato seedling detection and counting model method based on multi-scale feature fusion, which can efficiently and accurately detect and count tomato seedlings in a seedling tray environment. By combining information at multiple scales, the detection accuracy and robustness are optimized, thereby solving the problems of low efficiency, high cost, and high error rate of manual counting, and solving the limitations of existing methods in low detection accuracy when seedlings are highly overlapped. This method will provide a more intelligent and efficient seedling management solution for agricultural production and promote the further development of precision agriculture;

[0004] Technical solution: 1. A tomato seedling detection and counting method based on multi-scale feature fusion, the detection and counting method comprising a data preprocessing enhancement module, a model training module and a model detection and counting module, and using the data acquisition module, the model training module and the model detection and counting module to detect and count tomato seedling images in a seedling tray, specifically the following steps: (1) The tomato seedling images constitute a set of tomato seedling target detection datasets in seedling trays. The tomato seedling target detection datasets are used as original data samples. The data preprocessing enhancement module performs preprocessing operations on the tomato seedling datasets, using horizontal and vertical translation and flipping, specified angle image shearing, and limited contrast adaptive histogram equalization (CLAHE) methods to enhance image feature information, thereby forming a set of training set images; (2) The training set images are detected and counted using the model training module, which includes the ASF-P2 feature fusion neck network, the RepVGGBlock feature extraction module, and the ContextGuideFusionModule feature interaction fusion module. The ASF-P2 feature fusion neck network receives the feature information of the YOLOv8 backbone network, performs multi-scale feature extraction operations on the tomato seedling leaf features, and realizes multi-scale feature fusion enhancement; the RepVGGBlock feature extraction module enhances the feature extraction capabilities of the tomato seedling leaf color, texture, and seedling density and distribution information through multi-path convolution and jump connection operations. In addition, through re-parameterization, the module merges multiple convolution operations into a larger convolution kernel in the inference stage, thereby improving the computational efficiency, thereby improving the detection and counting efficiency of the model, and promoting the improvement of enterprise production efficiency and benefits. The ContextGuideFusionModule feature interaction fusion module dynamically adjusts the weights in the channel dimension through context-guided feature fusion and multi-path feature aggregation strategies, so that the model can focus on key features and reduce the interference of background and irrelevant information; (3) Use the model detection and counting module to perform target detection and counting on the test data set, and input the tomato seedling target detection data set in the seedling tray into the model training module to achieve accurate statistics on the number of seedlings in the seedling tray. At the same time, the model can determine whether there are tomato seedlings in each hole and give the specific number. In addition, the model also has an empty hole positioning function, which can accurately identify the holes in the seedling tray where no seedlings are planted; The data preprocessing enhancement operation is: The method of the present invention requires preprocessing of the input image, including: the maximum translation of the image in the horizontal and vertical directions does not exceed 10%; the image has a 50% probability of being flipped left and right, but not flipped vertically. At the same time, the image is enhanced by the contrast-limited adaptive histogram equalization (CLAHE) method. The image is divided into an 8x8 grid, and each small block is independently histogram equalized, and when enhancing the contrast, the maximum contrast gain is limited to twice the original histogram; The ASF-P2 feature fusion neck network is: The input of the ASF-P2 feature fusion neck network includes P2, P3, P4, and P5 multi-scale feature maps from the backbone network. The features of each scale are fused and enhanced through multi-scale feature fusion through Zoom_cat and ScalSeq operations. Specifically, Zoom_cat is used to splice three-scale feature maps: it performs maximum pooling operations on low-scale feature maps, performs nearest neighbor upsampling on high-scale feature maps, and finally splices them in the channel dimension to achieve the fusion of three-scale features. The ScalSeq module enhances the multi-scale expression capability of features by performing convolution operations on high-scale features, upsampling low-scale features, splicing features of each scale, performing 3D maximum pooling, and finally removing the second dimension to restore it to a 2D tensor; The RepVGGBlock feature extraction module is: First, multiple convolution paths are used to process the input feature map, including 1×1 convolution, 3×3 convolution depth and batch normalization operations to enhance the ability to extract multiple features. On each path, features of different scales are fused through jump connections to retain more detailed information. During the training phase, RepVGGBlock uses multiple convolution kernels of different sizes for feature extraction. However, after training, a re-parameterization method is used to merge multiple convolution operations into a larger convolution kernel, thereby reducing the amount of computation during inference and improving inference efficiency. The ContextGuideFusionModule feature interaction fusion module is as follows: This module effectively fuses multi-scale features through a series of operations. First, the two input feature maps x0 and x1 are channel-aligned. If their number of channels is inconsistent, the number of channels of x0 is adjusted through 1×1 convolution to match that of x1. Next, the adjusted x0 and x1 are concatenated in the channel dimension into a new feature map x_concat. Then, x_concat is fed into the squeeze and excitation (SE) attention mechanism to generate a set of channel-level weights that reflect the importance of each channel. These weights are weighted channel by channel with the original x0 and x1, respectively, to obtain the weighted feature maps x0_weight and x1_weight. Finally, the weighted feature maps are added to the original feature maps and concatenated again in the channel dimension to output the final fused feature maps. In this way, ContextGuideFusionModule implements multi-scale feature fusion based on the attention mechanism, enhances the model's attention to key features, and thus improves the model's representation ability; 2. According to the detection and counting method, the training loss is required to be: The loss function includes a modified cross entropy (VFL Loss) classification loss function and a regression loss. The modified cross entropy (VFL Loss) classification loss function is implemented by adding a variance weighted term to the standard cross entropy loss, and the formula can be expressed as: in, is the one-hot encoding value of the true label; The class probability value predicted by the model; and is a regulating factor used to balance the contribution of cross entropy loss and variance weighting term; is the variance of the model’s predicted probability distribution, which is used to measure the uncertainty between categories; The regression loss consists of CIoU Loss and DFL. CIoU is an improved IoU loss that measures the difference between the predicted box and the true box. Compared with the traditional IoU, CIoU adds a comprehensive consideration of the center point distance, aspect ratio, and area overlap of the bounding box, thereby providing more comprehensive guidance in the optimization process. Its formula is: Among them, IoU is the intersection over union ratio; is the square of the Euclidean distance between the predicted box and the true box; It is the length of the minimum diagonal of the bounding box between the predicted box and the real box; is the aspect ratio difference, calculated as: in, and are the width and height of the prediction box, respectively. and is the width and height of the real frame; DFL is an improved focal loss used to further optimize bounding box regression, especially for the imbalance problem in bounding box prediction (i.e., the imbalance of positive and negative samples). The goal of DFL is to better handle the optimization of difficult samples (such as small objects, distant objects, etc.) by adjusting the focal factor in the loss function. Its formula is: in, and represents the predicted bounding box position, is the true bounding box position, and are the upper and lower bounds of the predicted bounding box position; 3. According to the detection and counting method of claim 1, the model hyperparameter setting is required: The learning iteration cycle is 300 cycles, the batch size is 16, and the learning rate is 1e-2; Beneficial effects: Using the tomato seedling target detection dataset in the seedling tray annotated by agricultural experts, the training set, validation set, and test set were divided into training set, validation set, and test set in a ratio of 8:1:1 to ensure the reliability and fairness of model training; The ASF-P2 feature fusion neck network is used to extract feature information from the backbone network and efficiently fuse and filter the multi-scale features of the P2, P3, P4, and P5 layers of the backbone network. The network can effectively integrate low-level and high-level features at different levels, suppress noise, and highlight important areas of tomato seedling leaves, thereby improving the robustness and accuracy of target detection; The RepVGGBlock feature extraction module can effectively capture the core visual features of tomato seedling leaves, such as morphological contours, edge details, and texture features of leaves, and retain the useful information of the upper layer through skip connections. This core information helps improve the model's recognition accuracy for tomato seedlings, especially when the leaf morphology is complex or the seedlings are densely packed; The ContextGuideFusionModule feature interaction fusion module further ensures that the information sent to the head network is more accurate and clean through efficient feature interaction fusion. This module can deeply mine context information and strengthen the representation of key features, thereby enhancing the semantic consistency and expression ability of features, and optimizing the positioning and recognition accuracy of seedlings in images, especially when there is overlap and occlusion between seedlings; The model uses the improved cross entropy (VFL Loss) classification loss function to ensure the accuracy of tomato seedling classification, and uses CIoU Loss and DFL to ensure the reliability and efficiency of anchor box regression. BRIEF DESCRIPTION OF THE DRAWINGS

[0005] Figure 1 Schematic diagram of the input and output image of tomato seedling data in the seedling tray Figure 2 Flowchart for tomato seedling detection and counting Figure 3 Schematic diagram of the neck network for ASF-P2 feature fusion Figure 4 Schematic diagram of the RepVGGBlock feature extraction module Figure 5 Schematic diagram of the feature interaction fusion module of ContextGuideFusionModule. DETAILED DESCRIPTION

[0006] Implementation case: The multi-scale feature fusion tomato seedling detection and counting model method provided by the present invention detects and counts tomato seedlings. The specific operation is carried out in the following steps: 1. Tomato seedlings target detection dataset in seedling tray The tomato seedlings in seedling trays target detection dataset contains 201 RGB images of tomato seedlings in seedling trays in a plant factory environment, including 161 training sets, 20 validation sets, and 20 test sets, which are annotated by agricultural experts with the professional title of senior agronomist. 2. Data Preprocessing The method of the present invention requires that the input image is an RGB image, with a TXT file containing annotation information, and the maximum translation of the image in the horizontal and vertical directions is limited to 10%; the image has a 50% probability of being flipped left and right, but will not be flipped vertically. At the same time, the image is enhanced using the contrast-limited adaptive histogram equalization (CLAHE) method; 3. Model training The model designed by the present invention is based on the improved neck network of the YOLOv8 model, which is divided into the backbone network, the neck network and the head network. The redesigned ASF-P2 feature fusion neck network replaces the original neck network, and further adds the RepVGGBlock feature extraction module and the ContextGuideFusionModule feature interaction fusion module to improve the accuracy of detection and counting; The backbone network inherits the design of YOLOv8. The input of this model is an image of shape [16,3,640,640], where the batch size is 16 and the height and width of the image are both 640. First, the image passes through a convolutional layer, which converts the number of input channels from 3 to 16 and reduces the spatial size by half, with an output shape of [16,16,320,320]. Next, through another convolutional layer, the spatial size of the feature map is reduced again to [16,32,160,160]. Then, the features are further processed by the C2f block, and the output shape remains [16,32,160,160]. At this point, the feature map is passed through a convolutional layer, and the spatial size becomes [16,64,80,80], and the number of feature channels increases to 64. Next, after processing by the C2f block, the output shape is still [16,64,80,80]. After the convolutional layer, the spatial size of the feature map becomes [16, 128, 40, 40], and the number of channels increases to 128. After that, after the C2f block, the output shape is [16, 128, 40, 40], and the feature map is further refined. Next, after the convolutional layer, the feature map size becomes [16, 256, 20, 20], the number of channels increases to 256, and then the C2f block outputs the shape [16, 256, 20, 20]. Next, after being processed by the spatial pyramid pooling (SPPF) module, the feature map is still [16, 256, 20, 20]. This module enhances the expressiveness of multi-scale features; The neck network is the ASF-P2 feature fusion neck network. After the convolution layer, the number of channels is reduced to 128, and the output shape is [16, 128, 20, 20]. Then, another convolution layer increases the number of channels of the feature map to 128, and the output shape becomes [16, 128, 40, 40]. The following Zoom_cat module combines features from different scales, and the output shape is [16, 128, 40, 40]. After being processed by the RepVGGBlock module, the feature map output shape is still [16, 128, 40, 40]. Subsequently, the convolution layer reduces the number of channels to 64, and the output is [16, 64, 40, 40]. The convolution layer continues to increase the number of channels of the feature map to 64, and the output is [16, 64, 80, 80]. At this point, the Zoom_cat module once again fuses the features from different layers, and the output shape is [16,128,80,80]. After that, it is processed by the RepVGGBlock module, and the output shape is [16,128,80,80]. Next, after the convolution layer, the spatial size of the feature map becomes [16,128,40,40]. Then, the Concat module is used to concatenate the features of different layers, and the output shape is [16,256,40,40]. Next, after the RepVGGBlock module is processed, the output shape is [16,256,40,40]. After that, the convolution layer, the feature map size becomes [16,128,20,20]. Then, the Concat module is used to concatenate the features again, and the output shape is [16,256,20, 20]. The features are further processed by the RepVGGBlock module, and the output shape is [16, 256, 20, 20]. Then, the multi-scale feature fusion is performed by the ScalSeq module, and the output shape is [16, 256, 20, 20]. Then, the ContextGuideFusionModule module performs context information fusion, and the output is [16, 64, 20, 20]. Finally, the feature map is upsampled by the upsampling layer (Upsample), and the output shape is [16, 64, 40, 40]. Then, it is concatenated with other features by the Concat module, and the output shape is [16, 128, 40, 40]. After being processed by the RepVGGBlock module, the output shape is [16, 128, 40, 40]. Finally, the ContextGuideFusionModule module performs context fusion on the features again, and the output is [16, 32, 40, 40]. Finally, after the head network, the model outputs [16, 2, [64, 128, 128, 128]], which is the detection result containing the target category and bounding box information. The entire model extracts and refines features through a series of convolution, feature fusion and context-guided modules, and finally achieves efficient target detection tasks; 4. Model result output analysis The model can detect and count tomato seedling data in batches. The number of tomato seedlings and holes in each RGB image can be counted and the results can be marked in the upper left corner.

[0007] This method uses the following four performance indicators to measure model performance: Precision, Recall, mAP@0.5 (average precision, IoU threshold is 0.5) and mAP@0.5:0.95 (average precision, IoU threshold is between 0.5 and 0.95). The accuracy calculation formula is as follows: in, Represents true positive examples, that is, the number of samples correctly predicted as positive; Represents false positive examples, that is, the number of samples that are incorrectly predicted as positive; The recall calculation formula is as follows: in, Indicates a true example; represents false negative examples, that is, the number of samples that are incorrectly predicted as negative; The average precision calculation formula is as follows: in, is the number of categories, At different recall rates The precision value under , that is, the area under the precision-recall curve. mAP@0.5 calculates the average precision of the model prediction results under different categories when the IoU (Intersection over Union) threshold is set to 0.5. The mAP@0.5:0.95 indicator calculates the average precision under each IoU threshold from 0.5 to 0.95 with a step size of 0.05, and then averages these precision values; The results of the present invention on the tomato seedling target detection dataset in the seedling tray are: Precision 90.3%, Recall 91%, mAP@0.5 94.9%, mAP@0.5:0.95 62.3%. In comparison, the results of YOLOv8n are: Precision 88.6%, Recall 86.5%, mAP@0.5 90.4%, mAP@0.5:0.95 55.4%. The present invention exceeds YOLOv8n in all indicators, among which Precision is improved by 1.7 percentage points, Recall is improved by 4.5 percentage points, mAP@0.5 is improved by 4.5 percentage points, and mAP@0.5:0.95 is improved by 6.9 percentage points. This shows that the performance of the present invention in the tomato seedling target detection task is better than YOLOv8n, and it has higher detection accuracy and better robustness; Judging from the large-scale use in actual agricultural factories, the present invention has significant practical production application value. It can improve work efficiency, reduce labor costs, and ensure the accuracy of seedling counting in large-scale seedling management. Through intelligent detection and counting, the errors caused by human factors are reduced, the seedling distribution and management are optimized, and the efficiency of the seedling tray is improved. In addition, the method has strong adaptability and can operate stably in different environments and different seedling distribution densities, further promoting the development of agricultural production towards precision and automation; As mentioned above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be interpreted as limiting the present invention itself. Various changes can be made to it in form and detail without departing from the spirit and scope of the present invention defined in the appended claims.

Claims

1. A tomato seedling detection and counting method based on multi-scale feature fusion, the detection and counting method comprising a data preprocessing enhancement module, a model training module and a model detection and counting module, and using the data acquisition module, the model training module and the model detection and counting module to detect and count tomato seedling images in a seedling tray, specifically the following steps: (1) The tomato seedling images constitute a set of tomato seedling target detection datasets in seedling trays. The tomato seedling target detection datasets are used as original data samples. The data preprocessing enhancement module performs preprocessing operations on the tomato seedling datasets, using horizontal and vertical translation and flipping, specified angle image shearing, and limited contrast adaptive histogram equalization (CLAHE) methods to enhance image feature information, thereby forming a set of training set images; (2) The training set images are detected and counted using the model training module, which includes the ASF-P2 feature fusion neck network, the RepVGGBlock feature extraction module, and the ContextGuideFusionModule feature interaction fusion module. The ASF-P2 feature fusion neck network receives the feature information of the YOLOv8 backbone network, performs multi-scale feature extraction operations on the tomato seedling leaf features, and realizes multi-scale feature fusion enhancement; the RepVGGBlock feature extraction module enhances the feature extraction capabilities of the tomato seedling leaf color, texture, and seedling density and distribution information through multi-path convolution and jump connection operations. In addition, through re-parameterization, the module merges multiple convolution operations into a larger convolution kernel in the inference stage, thereby improving the computational efficiency, thereby improving the detection and counting efficiency of the model, and promoting the improvement of enterprise production efficiency and benefits. The ContextGuideFusionModule feature interaction fusion module dynamically adjusts the weights in the channel dimension through context-guided feature fusion and multi-path feature aggregation strategies, so that the model can focus on key features and reduce the interference of background and irrelevant information; (3) Use the model detection and counting module to perform target detection and counting on the test data set, and input the tomato seedling target detection data set in the seedling tray into the model training module to achieve accurate statistics on the number of seedlings in the seedling tray. At the same time, the model can determine whether there are tomato seedlings in each hole and give the specific number. In addition, the model also has an empty hole positioning function, which can accurately identify the holes in the seedling tray where no seedlings are planted; The data preprocessing enhancement operation is: The method of the present invention requires preprocessing of the input image, specifically including: The maximum translation of the image in the horizontal and vertical directions does not exceed 10%; the image has a 50% probability of being flipped left and right, but not vertically. At the same time, the image is enhanced using the contrast-limited adaptive histogram equalization (CLAHE) method. The image is divided into an 8x8 grid, and each small block is independently histogram equalized. When enhancing the contrast, the maximum contrast gain is limited to twice the original histogram. The ASF-P2 feature fusion neck network is: The input of the ASF-P2 feature fusion neck network includes P2, P3, P4, and P5 multi-scale feature maps from the backbone network. The features of each scale are fused and enhanced through multi-scale feature fusion through Zoom_cat and ScalSeq operations. Specifically, Zoom_cat is used to splice three-scale feature maps: it performs maximum pooling operations on low-scale feature maps, performs nearest neighbor upsampling on high-scale feature maps, and finally splices them in the channel dimension to achieve the fusion of three-scale features. The ScalSeq module enhances the multi-scale expression capability of features by performing convolution operations on high-scale features, upsampling low-scale features, splicing features of each scale, performing 3D maximum pooling, and finally removing the second dimension to restore it to a 2D tensor; The RepVGGBlock feature extraction module is: First, multiple convolution paths are used to process the input feature map, including 1×1 convolution, 3×3 convolution depth and batch normalization operations to enhance the ability to extract multiple features. On each path, features of different scales are fused through jump connections to retain more detailed information. During the training phase, RepVGGBlock uses multiple convolution kernels of different sizes for feature extraction. However, after training, a re-parameterization method is used to merge multiple convolution operations into a larger convolution kernel, thereby reducing the amount of computation during inference and improving inference efficiency. The ContextGuideFusionModule feature interaction fusion module is as follows: This module effectively fuses multi-scale features through a series of operations. First, the two input feature maps x0 and x1 are aligned in channels. If their number of channels is inconsistent, the number of channels of x0 is adjusted to match that of x1 through 1×1 convolution. Next, the adjusted x0 and x1 are concatenated in the channel dimension into a new feature map x_concat. Then, x_concat is fed into the squeeze-and-excitation (SE) attention mechanism to generate a set of channel-level weights that reflect the importance of each channel. These weights are weighted channel by channel with the original x0 and x1, respectively, to obtain the weighted feature maps x0_weight and x1_weight. Finally, the weighted feature maps are added to the original feature maps and concatenated again in the channel dimension to output the final fused feature maps. In this way, ContextGuideFusionModule implements multi-scale feature fusion based on the attention mechanism, enhances the model's attention to key features, and thus improves the model's representation ability.

2. According to the detection and counting method of claim 1, the training loss is required to be: The loss function includes the improved cross entropy (VFL Loss) classification loss function and regression loss. The improved cross entropy (VFLLoss) classification loss function is implemented by adding a variance-weighted term to the standard cross entropy loss, and the formula can be expressed as: in, is the one-hot encoding value of the true label; The class probability value predicted by the model; and is a regulating factor used to balance the contribution of cross entropy loss and variance weighting term; is the variance of the model’s predicted probability distribution, which is used to measure the uncertainty between categories; The regression loss consists of CIoU Loss and DFL. CIoU is an improved IoU loss that measures the difference between the predicted box and the true box. Compared with the traditional IoU, CIoU adds a comprehensive consideration of the center point distance, aspect ratio, and area overlap of the bounding box, thereby providing more comprehensive guidance in the optimization process. Its formula is: Among them, IoU is the intersection over union ratio; is the square of the Euclidean distance between the predicted box and the true box; It is the length of the minimum diagonal of the bounding box between the predicted box and the real box; is the aspect ratio difference, calculated as: in, and are the width and height of the prediction box, respectively. and is the width and height of the real frame; DFL is an improved focal loss used to further optimize bounding box regression, especially for the imbalance problem in bounding box prediction (i.e., the imbalance of positive and negative samples). The goal of DFL is to better handle the optimization of difficult samples (such as small objects, distant objects, etc.) by adjusting the focal factor in the loss function. Its formula is: in, and represents the predicted bounding box position, is the true bounding box position, and are the upper and lower bounds of the predicted bounding box position.

3. The detection and counting method according to claim 1 requires the model hyperparameter settings: The learning iteration cycle is 300 cycles, the batch size is 16, and the learning rate is 1e-2.

Citation Information

Cited By

  • Handheld soybean seedling condition intelligent evaluation device based on deep learning

    CN121121019A