Corn tassel counting and yield estimation method and device based on unmanned aerial vehicle RGB image and improved YOLOv9

By improving the YOLOv9 model, combining the adaptive spatial attention module and SIoU loss function, the problem of inaccurate ear counting is solved, and the rapid and accurate detection and yield estimation of ears are achieved.

CN120451831APending Publication Date: 2025-08-08ANHUI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510527139.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing drone-based and deep learning-based corn ear detection methods are not accurate enough in field environments to count corn ears and are easily affected by occlusion and background interference, resulting in ineffective detection.

Method used

Using the improved YOLOv9 model, the model's extraction ability and positioning accuracy of corn ear features are improved by adding an adaptive spatial attention module and a lightweight feature extraction module PNCSPELAN, combined with the SIoU loss function.

Benefits of technology

It realizes rapid and accurate detection of corn ears in actual field environments, improves the accuracy and detection efficiency of corn ear counting, and supports efficient estimation of corn yield.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451831A_ABST
    Figure CN120451831A_ABST
Patent Text Reader

Abstract

The invention relates to a corn tassel counting and yield estimation method based on an unmanned aerial vehicle RGB image and improved YOLOv9. The method comprises the following steps: constructing a corn tassel detection data set; the YOLOv9 model is improved, and an improved YOLOv9 model is obtained; a trained YOLOv9 model is obtained; evaluating the trained YOLOv9 model on the verification set by using an evaluation index; detecting a corn tassel target and counting the number of corn ears corresponding to each variety; predicting the corn yield. The improved YOLOv9 model provided by the invention can quickly and accurately detect tassel targets in the image and count the number of tassels in a field cell corresponding to the image, so that effective counting of corn tassels in an actual field environment is realized; the adaptive space attention module can improve the corn tassel feature extraction capability of the model and enhance key space features so as to improve the tassel feature learning capability of the model; the SIoU loss function is used to promote the model to quickly and accurately position, and the detection effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of unmanned aerial vehicle (UAV) RGB image processing and target detection based on deep learning, and in particular to a method and device for corn tassel counting and yield estimation based on UAV RGB imagery and improved YOLOv9. Background Art

[0002] Corn is a major grain crop worldwide. Accurate and efficient yield estimation plays a vital role in planning agricultural resource management and allocation, developing rational marketing plans, and promoting scientific breeding. Corn yield is correlated with kernel number per ear, thousand-kernel weight, and number of ears. These three parameters can be used to quickly estimate corn yield. In practice, kernel number per ear and thousand-kernel weight are primarily determined by the corn variety, for which previously measured data can be referenced. However, number of ears requires statistical analysis. In traditional agricultural production, ear counts are primarily calculated manually, which is labor-intensive, prone to omissions, and inefficient.

[0003] In recent years, with the development of drones and deep learning technologies, these technologies have been widely used to achieve automated detection of corn tassels, achieving certain results. Compared with manual methods, this technology offers lower costs and higher detection efficiency. However, existing drone- and deep learning-based corn tassel detection methods often suffer from inaccurate ear counting results, a limited number of varieties, reduced counting accuracy due to occlusion and background interference, and limited ability to extract features from corn tassels, making them unsuitable for practical field corn yield estimation tasks. Summary of the Invention

[0004] In order to solve the problem that corn ears in field environments are easily blocked by leaves and block each other, which easily causes interference and affects the detection effect of the model, the primary purpose of the present invention is to provide a corn ear counting and yield estimation method based on drone RGB images and improved YOLOv9, which can effectively count corn ears in actual field environments, quickly and accurately locate them, improve detection effects, and achieve efficient corn yield estimation.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for counting corn tassels and estimating yield based on drone RGB images and improved YOLOv9, the method comprising the following steps in sequence:

[0006] (1) An unmanned aerial vehicle (UAV) equipped with an RGB sensor was used to obtain corn tassel images at the heading stage in a corn field and preprocessed them to construct a corn tassel detection dataset. The dataset was then divided into a training set, a validation set, and a test set.

[0007] (2) Improve the YOLOv9 model to obtain an improved YOLOv9 model: add the adaptive spatial attention module to the backbone network of the YOLOv9 model, use the lightweight feature extraction module, namely the PNCSPELAN module, to replace the RepNCSPELAN4 module in the backbone network of the YOLOv9 model, and replace the CIoU loss function of the YOLOv9 model with the SIoU loss function;

[0008] (3) Input the training set into the improved YOLOv9 model for training to obtain the trained YOLOv9 model;

[0009] (4) Evaluate the trained YOLOv9 model using the evaluation index on the validation set and select the corn tassel detection model with the optimal weight;

[0010] (5) Input the test set into the optimally weighted corn tassel detection model, detect the corn tassel target and count the number of corn tassels corresponding to each variety;

[0011] (6) Predict corn yield based on the number of corn ears.

[0012] In step (1), the pretreatment specifically includes the following steps:

[0013] (1a) The acquired corn tassel image at the heading stage is cropped, horizontally and vertically flipped, randomly color-changed, and random noise is added;

[0014] (1b) Use the annotation tool Make Sense to annotate each image and save the annotation information in .txt format.

[0015] In step (2), the adaptive spatial attention module, i.e., the ASA module, includes a depthwise separable convolution block, an average pooling layer, a convolution with a kernel size of 1×1, and a sigmoid function; the ASA module is added after each PNCSPELAN module in the backbone network of the YOLOv9 model;

[0016] The input feature map is fed into the depthwise separable convolution block. The feature map output by the depthwise separable convolution block is element-wise multiplied with the input feature map to obtain the processed features. The processed features are average-pooled along the channel to obtain a feature map containing spatial information. The feature map containing spatial information is processed using a convolution kernel of size 1×1 to generate spatial attention weights. The spatial attention weights are normalized using the Sigmoid function to obtain normalized spatial attention weights. The normalized spatial attention weights are multiplied with the input feature map to obtain a weighted feature map. The specific formula is as follows:

[0017] Output=X*Sigmoid(Conv 1×1(AvgPool(X*F DBR (X))))

[0018] F DBR =relu(BN(DWConv 3×3 (X)))

[0019]

[0020] Among them, F DBR represents a depth-wise separable convolutional block; X represents the input feature map, X∈R C×H×W ; AvgPool represents the pooling operation along the channel dimension; Conv 1×1 Indicates a convolution with a convolution kernel size of 1×1; Output is the output of the ASA module, and the output size is C×H×W, where C is the number of channels, H is the height of the output, and W is the width of the output; DWConv 3×3 represents a depth-separable convolution with a convolution kernel size of 3×3; BN represents a batch normalization operation, and relu represents an activation function; e -x The Sigmoid function is the negative power of the natural exponential function, which limits the output to the range of 0 to 1.

[0021] In step (2), the SIoU loss function is composed of angle loss, distance loss, shape loss and IoU loss;

[0022] The calculation formula of the angle loss Λ is as follows:

[0023]

[0024] in, and are the horizontal and vertical coordinates of the center point of the real frame, and are the horizontal and vertical coordinates of the center point of the prediction box; x is the horizontal axis, y is the vertical axis, c h is the maximum value of the difference between the ordinates of the center points of the real frame and the predicted frame, σ is the distance between the center points of the real frame and the predicted frame, and α is the angle between the line connecting the center points of the real frame and the predicted frame and the horizontal axis;

[0025] Calculate the distance loss Δ based on the angle loss Λ:

[0026]

[0027] γ=2-Λ

[0028]

[0029] in, Represents the control information of angle and distance, ρ x Represents the horizontal axis distance between the real box and the predicted box, ρ y Indicates the vertical distance between the real box and the predicted box, c w is the maximum value of the difference between the horizontal coordinates of the center points of the real box and the predicted box, γ contains angle information; t is the coordinate axis variable;

[0030] The calculation formula of the shape loss Ω is as follows:

[0031]

[0032] Among them, w gt and h gt Represent the width and height of the real box respectively, w and h represent the width and height of the predicted box respectively, and θ represents the proportion of control shape loss; Represents aspect ratio information, ω w Represents the width ratio of the real box to the predicted box, ω h Represents the ratio of the height of the real box to the predicted box;

[0033] Finally, add the IoU loss and combine the angle loss Λ, distance loss Δ, and shape loss Ω to get the final SIoU loss, i.e., L box , the formula is as follows:

[0034]

[0035] Among them, L box is the bounding box loss function, B GT represents the area of the true box, and B represents the area of the predicted box.

[0036] In step (2), the PNCSPELAN module includes a convolution with a convolution kernel size of 3×3, a split operation, two PConvBlock modules, a connection operation along the channel dimension, and a convolution with a convolution kernel size of 1×1; first, the input feature map is sent to the convolution block with a convolution kernel size of 3×3 for feature extraction, a split operation along the channel is performed, and a part of the features are sent to the PConvBlock module for deep feature extraction. Finally, the features not processed by the PConvBlock module and the features processed by the PConvBlock module twice are connected along the channel dimension, and finally a convolution operation with a convolution kernel size of 1×1 is performed to obtain the output:

[0037] x1,x2=SiLU(BN(Conv 3×3 (x0)))

[0038] x3=PConvBlock(x2)

[0039] x4=PConvBlock(x3)

[0040] x5=Concat(x1,x2,x3,x4)

[0041] x6=Conv 1×1 (x5)

[0042] Among them, x0 is the input feature map, x1, x2, x3, x4, x5 are all intermediate feature maps, x6 is the output of the PNCSPELAN module; BN is the batch normalization operation, SiLU is the activation function, Concat represents the connection operation along the channel dimension, Conv 3×3 Convolution kernel size is 3×3, Conv 1×1 It is a convolution with a convolution kernel size of 1×1;

[0043] The PConvBlock module includes a split operation, PConv convolution, channel rearrangement operation, Concat operation and convolution with a convolution kernel size of 1×1; the input features are first split along the channel into two parts, one part of the features performs a PConv convolution operation, and then a channel rearrangement operation is performed. The features after the channel rearrangement operation are then connected with the other part of the features along the channel, and finally the connected features are processed using a convolution kernel size of 1×1 to obtain the output features;

[0044] First, the input feature, the intermediate feature map x2, is split along the channel to obtain features x7 and x9:

[0045] x7,x9=split(x2)

[0046] In the formula, split represents the split operation;

[0047] The feature x7 is convolved with a convolution kernel size of 3×3 and the channel is rearranged to obtain the feature x8:

[0048] x8=CS(PConv 3×3 (x7))

[0049] Among them, PConv 3×3 represents PConv convolution with a convolution kernel size of 3×3, and CS represents the channel reordering operation;

[0050] Concatenate features x7, x8, and x9 along the channel dimension to obtain feature x 10 , and use convolution with a kernel size of 1×1 to process the feature x 10 Get the intermediate feature map x3:

[0051] x 10 =Concat(x7,x8,x9)

[0052] x3=Conv 1×1 (x 10 ).

[0053] Step (6) specifically refers to: the formula for calculating corn yield is:

[0054] Corn yield = number of ears × number of kernels per ear × thousand-kernel weight.

[0055] The depth-wise separable convolution block includes a depth-wise separable convolution with a convolution kernel size of 3×3, a batch normalization operation, and a relu activation function.

[0056] Another object of the present invention is to provide an electronic device, comprising:

[0057] processor; and

[0058] A memory having computer program instructions stored therein, which, when executed by the processor, cause the processor to execute the corn tassel counting and yield estimation method based on drone RGB imagery and improved YOLOv9 as described above.

[0059] The present invention also provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor executes the above-mentioned corn tassel counting and yield estimation method based on drone RGB imagery and improved YOLOv9.

[0060] It can be seen from the above technical solution that the beneficial effects of the present invention are: First, the improved YOLOv9 model proposed in the present invention can quickly and accurately detect the tassel target in the image and count the number of ears in the field plot corresponding to the image, thereby realizing effective counting of corn tassels in an actual field environment; Second, the adaptive spatial attention module proposed in the present invention can improve the model's ability to extract corn tassel features, enhance key spatial features, and thus improve the model's ability to learn the features of tassels; Third, the present invention uses the SIoU loss function, which is composed of angle loss, distance loss, shape loss, and IoU loss, which can promote the model to quickly and accurately locate and improve the detection effect; Fourth, the present invention can use the improved YOLOv9 model to automatically detect the number of corn ears in the field, realize efficient corn yield estimation, and has certain practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 is a flow chart of the method of the present invention;

[0062] Figure 2 This is a schematic diagram of the detection effect of the YOLOv9 model;

[0063] Figure 3 It is a schematic diagram of the detection effect of the present invention;

[0064] Figure 4 Schematic diagram of the ASA module in the present invention;

[0065] Figure 5 Schematic diagram of the PNCSPELAN module in the present invention;

[0066] Figure 6 for Figure 5 Schematic diagram of the PConvBlock module in

[15] ;

[0067] Figure 7 Schematic diagram of the improved YOLOv9 model in the present invention. DETAILED DESCRIPTION

[0068] like Figure 1 As shown in FIG, a method for counting corn tassels and estimating yield based on UAV RGB images and improved YOLOv9 is provided. The method includes the following steps in sequence:

[0069] (1) An unmanned aerial vehicle (UAV) equipped with an RGB sensor was used to obtain corn tassel images at the heading stage in a corn field and preprocessed them to construct a corn tassel detection dataset. The dataset was then divided into a training set, a validation set, and a test set.

[0070] (2) Improve the YOLOv9 model to obtain an improved YOLOv9 model, such as Figure 7 As shown in the figure, the adaptive spatial attention module is added to the backbone network of the YOLOv9 model. The lightweight feature extraction module, PNCSPELAN, replaces the RepNCSPELAN4 module in the backbone network of the YOLOv9 model. The CIoU loss function of the YOLOv9 model is replaced with the SIoU loss function. The CIoU loss function considers information such as the overlap rate, distance, and aspect ratio between the predicted and true boxes, but lacks the exploration of the orientation matching between the two, which can reduce the convergence speed during model training. The SIoU loss function accelerates training convergence and makes the positioning of the predicted boxes output by the model more accurate.

[0071] (3) Input the training set into the improved YOLOv9 model for training to obtain the trained YOLOv9 model;

[0072] (4) Evaluate the trained YOLOv9 model using the evaluation index on the validation set and select the corn tassel detection model with the optimal weight;

[0073] (5) Input the test set into the optimally weighted corn tassel detection model, detect the corn tassel target and count the number of corn tassels corresponding to each variety;

[0074] (6) Predict corn yield based on the number of corn ears.

[0075] In step (1), the pretreatment specifically includes the following steps:

[0076] (1a) The acquired corn tassel image at the heading stage is cropped, horizontally and vertically flipped, randomly color-changed, and random noise is added;

[0077] (1b) Use the annotation tool Make Sense to annotate each image, and save the annotation information in .txt format. In order to ensure that the network fully learns the characteristics of the tassel, the present invention uses a data enhancement strategy to expand the dataset.

[0078] like Figure 4 As shown in step (2), the adaptive spatial attention module, i.e., the ASA module, includes a depthwise separable convolution block, an average pooling layer, a convolution with a convolution kernel size of 1×1, and a Sigmoid function; the ASA module is added after each PNCSPELAN module in the backbone network of the YOLOv9 model; the ASA module can enhance the spatial correlation of feature maps and capture the long-range dependency between feature maps, thereby generating high-quality feature representation and improving the model's detection effect on corn tassels.

[0079] The input feature map is fed into the depthwise separable convolution block. The feature map output by the depthwise separable convolution block is element-wise multiplied with the input feature map to obtain the processed features. The processed features are average-pooled along the channel to obtain a feature map containing spatial information. The feature map containing spatial information is processed using a convolution kernel of size 1×1 to generate spatial attention weights. The spatial attention weights are normalized using the Sigmoid function to obtain normalized spatial attention weights. The normalized spatial attention weights are multiplied with the input feature map to obtain a weighted feature map. The specific formula is as follows:

[0080] Output=X*Sigmoid(Conv 1×1 (AvgPool(X*F DBR (X))))

[0081] F DBR =relu(BN(DWConv 3×3 (X)))

[0082]

[0083] Among them, F DBR represents a depth-wise separable convolutional block; X represents the input feature map, X∈R C×H×W ; AvgPool represents the pooling operation along the channel dimension; Conv 1×1Indicates a convolution with a convolution kernel size of 1×1; Output is the output of the ASA module, and the output size is C×H×W, where C is the number of channels, H is the height of the output, and W is the width of the output; DWConv 3×3 represents a depth-separable convolution with a convolution kernel size of 3×3; BN represents a batch normalization operation, and relu represents an activation function; e -x The Sigmoid function is the negative power of the natural exponential function, which limits the output to the range of 0 to 1.

[0084] In step (2), the SIoU loss function is composed of angle loss, distance loss, shape loss and IoU loss;

[0085] The calculation formula of the angle loss Λ is as follows:

[0086]

[0087] in, and are the horizontal and vertical coordinates of the center point of the real frame, and are the horizontal and vertical coordinates of the center point of the prediction box; x is the horizontal axis, y is the vertical axis, c h is the maximum value of the difference between the ordinates of the center points of the real frame and the predicted frame, σ is the distance between the center points of the real frame and the predicted frame, and α is the angle between the line connecting the center points of the real frame and the predicted frame and the horizontal axis;

[0088] Calculate the distance loss Δ based on the angle loss Λ:

[0089]

[0090]

[0091] γ=2-Λ

[0092]

[0093] in, Represents the control information of angle and distance, ρ x Represents the horizontal axis distance between the real box and the predicted box, ρ y Indicates the vertical distance between the real box and the predicted box, c w is the maximum value of the difference between the horizontal coordinates of the center points of the real box and the predicted box, γ contains angle information; t is the coordinate axis variable;

[0094] The calculation formula of the shape loss Ω is as follows:

[0095]

[0096] Among them, w gt and h gt Represent the width and height of the real box respectively, w and h represent the width and height of the predicted box respectively, and θ represents the proportion of control shape loss; Represents aspect ratio information, ω w Represents the width ratio of the real box to the predicted box, ω h Represents the ratio of the height of the real box to the predicted box;

[0097] Finally, add the IoU loss and combine the angle loss Λ, distance loss Δ, and shape loss Ω to get the final SIoU loss, i.e., L box , the formula is as follows:

[0098]

[0099]

[0100] Among them, L box is the bounding box loss function, B GT represents the area of the true box, and B represents the area of the predicted box.

[0101] like Figure 5 As shown, in step (2), the PNCSPELAN module includes a convolution with a convolution kernel size of 3×3, a splitting operation, two PConvBlock modules, a connection operation along the channel dimension, and a convolution with a convolution kernel size of 1×1; first, the input feature map is sent to the convolution block with a convolution kernel size of 3×3 for feature extraction, and a splitting operation along the channel is performed. A part of the features are sent to the PConvBlock module for deep feature extraction. Finally, the features that have not been processed by the PConvBlock module and the features that have been processed by PConvBlock twice are connected along the channel dimension, and finally a convolution operation with a convolution kernel size of 1×1 is performed to obtain the output:

[0102] x1,x2=SiLU(BN(Conv 3×3 (x0)))

[0103] x3=PConvBlockk(x2)

[0104] x4=PConvBlockk(x3)

[0105] x5=Concat(x1,x2,x3,x4)

[0106] x6=Conv 1×1 (x5)

[0107] Among them, x0 is the input feature map, x1, x2, x3, x4, x5 are all intermediate feature maps, x6 is the output of the PNCSPELAN module; BN is the batch normalization operation, SiLU is the activation function, Concat represents the connection operation along the channel dimension, Conv 3×3 Convolution kernel size is 3×3, Conv 1×1 It is a convolution with a convolution kernel size of 1×1;

[0108] like Figure 6 As shown in the figure, the PConvBlock module includes a split operation, PConv convolution, channel rearrangement operation, Concat operation and convolution with a convolution kernel size of 1×1; the input features are first split along the channel and divided into two parts, one part of the features performs a PConv convolution operation, and then a channel rearrangement operation is performed, and then the features after the channel rearrangement operation are connected with the other part of the features along the channel, and finally the convolution kernel size of 1×1 is used to process the connected features to obtain the output features;

[0109] First, the input feature, the intermediate feature map x2, is split along the channel to obtain features x7 and x9:

[0110] x7,x9=split(x2)

[0111] In the formula, split is the split operation;

[0112] The feature x7 is passed through the PConv convolution block with a convolution kernel size of 3×3 and the channel rearrangement operation is performed to obtain the feature x8:

[0113] x8=CS(PConv 3×3 (x7))

[0114] Among them, PConv 3×3 represents PConv convolution with a convolution kernel size of 3×3, and CS represents the channel reordering operation;

[0115] Concatenate features x7, x8, and x9 along the channel dimension to obtain feature x 10 , and use convolution with a kernel size of 1×1 to process the feature x 10 Get the intermediate feature map x3:

[0116] x 10 =Concat(x7,x8,x9)

[0117] x3=Conv 1×1 (x 10 ).

[0118] Step (6) specifically refers to: the formula for calculating corn yield is:

[0119] Corn yield = number of ears × number of kernels per ear × thousand-kernel weight.

[0120] The number of grains per ear and 1000-grain weight are known attribute data of the variety.

[0121] The depth-wise separable convolution block includes a depth-wise separable convolution with a convolution kernel size of 3×3, a batch normalization operation, and a relu activation function.

[0122] An unmanned aerial vehicle (UAV) equipped with an RGB sensor was used to obtain RGB images of corn tassels at the tasseling stage in a corn field to construct a preliminary corn tassel detection dataset. The data were collected at the Fengle Seed Industry Corn Research Institute in Changfeng County, Hefei City, Anhui Province. The UAV flew at an altitude of 10 m and captured a total of 1722 original images. Each original image was cropped into four images with a resolution of 2736 × 1824 pixels. Data augmentation methods such as random rotation and scaling were used to further expand the dataset. The tassel images were annotated using the MakeSense tool. The annotated corn tassel detection dataset was randomly divided into a training set, a validation set, and a test set. In this embodiment, the training set consisted of 3950 images, the validation set consisted of 526 images, and the test set consisted of 526 images.

[0123] like Figure 2 As shown, Figure 2 The detection effect of the YOLOv9 model is shown. Figure 2 The black circles in the middle mark the detection errors of the model. The YOLOv9 model Figure 2 There were 5 detection errors.

[0124] like Figure 3 As shown, Figure 3 Demonstrates the detection effect of the present invention, and Figure 2 In comparison, the present invention reduces the occurrence of missed detection and improves detection accuracy.

[0125] The above shows and describes the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions merely illustrate the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the invention as claimed. The scope of protection claimed by the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for corn tassel counting and yield estimation based on drone RGB images and improved YOLOv9, characterized by: The method comprises the following steps in sequence: (1) An unmanned aerial vehicle (UAV) equipped with an RGB sensor was used to obtain corn tassel images at the heading stage in a corn field and preprocessed them to construct a corn tassel detection dataset. The dataset was then divided into a training set, a validation set, and a test set. (2) Improve the YOLOv9 model to obtain an improved YOLOv9 model: add the adaptive spatial attention module to the backbone network of the YOLOv9 model, use the lightweight feature extraction module, namely the PNCSPELAN module, to replace the RepNCSPELAN4 module in the backbone network of the YOLOv9 model, and replace the CIoU loss function of the YOLOv9 model with the SIoU loss function; (3) Input the training set into the improved YOLOv9 model for training to obtain the trained YOLOv9 model; (4) Evaluate the trained YOLOv9 model using the evaluation index on the validation set and select the corn tassel detection model with the optimal weight; (5) Input the test set into the optimally weighted corn tassel detection model, detect the corn tassel target and count the number of corn tassels corresponding to each variety; (6) Predict corn yield based on the number of corn ears.

2. The corn tassel counting and yield estimation method based on drone RGB images and improved YOLOv9 according to claim 1 is characterized by: In step (1), the pretreatment specifically includes the following steps: (1a) The acquired corn tassel image at the heading stage is cropped, horizontally and vertically flipped, randomly color-changed, and random noise is added; (1b) Use the annotation tool Make Sense to annotate each image and save the annotation information in .txt format.

3. The corn tassel counting and yield estimation method based on drone RGB images and improved YOLOv9 according to claim 1 is characterized by: In step (2), the adaptive spatial attention module, i.e., the ASA module, includes a depthwise separable convolution block, an average pooling layer, a convolution with a kernel size of 1×1, and a sigmoid function; the ASA module is added after each PNCSPELAN module in the backbone network of the YOLOv9 model; The input feature map is fed into the depthwise separable convolution block. The feature map output by the depthwise separable convolution block is element-wise multiplied with the input feature map to obtain the processed features. The processed features are average-pooled along the channel to obtain a feature map containing spatial information. The feature map containing spatial information is processed using a convolution kernel of size 1×1 to generate spatial attention weights. The spatial attention weights are normalized using the Sigmoid function to obtain normalized spatial attention weights. The normalized spatial attention weights are multiplied with the input feature map to obtain a weighted feature map. The specific formula is as follows: Output=X*Sigmoid(Conv 1×1 (AvgPool(X*F DBR (X)))) F DBR =relu(BN(DWConv 3×3 (X))) Among them, F DBR represents a depth-wise separable convolutional block; X represents the input feature map, X∈R C×H×W ; AvgPool represents the pooling operation along the channel dimension; Conv 1×1 Indicates a convolution with a convolution kernel size of 1×1; Output is the output of the ASA module, and the output size is C×H×W, where C is the number of channels, H is the height of the output, and W is the width of the output; DWConv 3×3 represents a depth-separable convolution with a convolution kernel size of 3×3; BN represents a batch normalization operation, and relu represents an activation function; e -x The Sigmoid function is the negative power of the natural exponential function, which limits the output to the range of 0 to 1.

4. The corn tassel counting and yield estimation method based on drone RGB images and improved YOLOv9 according to claim 1 is characterized by: In step (2), the SIoU loss function is composed of angle loss, distance loss, shape loss and IoU loss; The calculation formula of the angle loss Λ is as follows: in, and are the horizontal and vertical coordinates of the center point of the real frame, and are the horizontal and vertical coordinates of the center point of the prediction box; x is the horizontal axis, y is the vertical axis, c h is the maximum value of the difference between the ordinates of the center points of the real frame and the predicted frame, σ is the distance between the center points of the real frame and the predicted frame, and α is the angle between the line connecting the center points of the real frame and the predicted frame and the horizontal axis; Calculate the distance loss Δ based on the angle loss Λ: γ=2-Λ in, Represents the control information of angle and distance, ρ x Represents the horizontal axis distance between the real box and the predicted box, ρ y Indicates the vertical distance between the real box and the predicted box, c w is the maximum value of the difference between the horizontal coordinates of the center points of the real box and the predicted box, γ contains angle information; t is the coordinate axis variable; The calculation formula of the shape loss Ω is as follows: Among them, w gt and h gt Represent the width and height of the real box respectively, w and h represent the width and height of the predicted box respectively, and θ represents the proportion of control shape loss; Represents aspect ratio information, ω w Represents the width ratio of the real box to the predicted box, ω h Represents the ratio of the height of the real box to the predicted box; Finally, add the IoU loss and combine the angle loss Λ, distance loss Δ, and shape loss Ω to get the final SIoU loss, i.e., L box , the formula is as follows: Among them, L box is the bounding box loss function, B GT represents the area of the true box, and B represents the area of the predicted box.

5. The corn tassel counting and yield estimation method based on drone RGB images and improved YOLOv9 according to claim 1, characterized in that: In step (2), the PNCSPELAN module includes a convolution with a convolution kernel size of 3×3, a split operation, two PConvBlock modules, a connection operation along the channel dimension, and a convolution with a convolution kernel size of 1×1; first, the input feature map is sent to the convolution block with a convolution kernel size of 3×3 for feature extraction, a split operation along the channel is performed, and a part of the features are sent to the PConvBlock module for deep feature extraction. Finally, the features not processed by the PConvBlock module and the features processed by the PConvBlock module twice are connected along the channel dimension, and finally a convolution operation with a convolution kernel size of 1×1 is performed to obtain the output: x1,x2=SiLU(BN(Conv 3×3 (x0))) x3=PConvBlock(x2) x4=PConvBlock(x3) x5=Concat(x1,x2,x3,x4) x6=Conv 1×1 (x5) Among them, x0 is the input feature map, x1, x2, x3, x4, x5 are all intermediate feature maps, x6 is the output of the PNCSPELAN module; BN is the batch normalization operation, SiLU is the activation function, Concat represents the connection operation along the channel dimension, Conv 3×3 Convolution kernel size is 3×3, Conv 1×1 It is a convolution with a convolution kernel size of 1×1; The PConvBlock module includes a split operation, PConv convolution, channel rearrangement operation, Concat operation and convolution with a convolution kernel size of 1×1; the input features are first split along the channel into two parts, one part of the features performs a PConv convolution operation, and then a channel rearrangement operation is performed. The features after the channel rearrangement operation are then connected with the other part of the features along the channel, and finally the connected features are processed using a convolution kernel size of 1×1 to obtain the output features; First, the input feature, the intermediate feature map x2, is split along the channel to obtain features x7 and x9: x7,x9=split(x2) In the formula, split represents the split operation; The feature x7 is convolved with a convolution kernel size of 3×3 and the channel is rearranged to obtain the feature x8: x8=CS(PConv 3×3 (x7)) Among them, PConv 3×3 represents PConv convolution with a convolution kernel size of 3×3, and CS represents the channel reordering operation; Concatenate features x7, x8, and x9 along the channel dimension to obtain feature x 10 , and use convolution with a kernel size of 1×1 to process the feature x 10 Get the intermediate feature map x3: x 10 =Concat(x7,x8,x9) x3=Conv 1×1 (x 10 )。 6. The corn tassel counting and yield estimation method based on drone RGB images and improved YOLOv9 according to claim 1, characterized in that: Step (6) specifically refers to: the formula for calculating corn yield is: Corn yield = number of ears × number of kernels per ear × thousand-kernel weight.

7. The corn tassel counting and yield estimation method based on drone RGB images and improved YOLOv9 according to claim 3 is characterized by: The depth-wise separable convolution block includes a depth-wise separable convolution with a convolution kernel size of 3×3, a batch normalization operation, and a relu activation function.

8. An electronic device comprising: processor; as well as A memory having computer program instructions stored therein, wherein the computer program instructions, when executed by the processor, cause the processor to execute the corn tassel counting and yield estimation method based on drone RGB imagery and improved YOLOv9 as described in any one of claims 1 to 7.

9. A computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, cause the processor to execute the corn tassel counting and yield estimation method based on drone RGB imagery and improved YOLOv9 as described in any one of claims 1 to 7.