A wheat ear target detection and counting method based on oriented frame

By using a wheat ear target detection method based on an oriented frame, combined with a multi-scale feature fusion pyramid network and an improved Rotated Faster RCNN model, the problem of the detection frame not being able to fit the target in wheat ear detection is solved, achieving more efficient wheat ear target detection and counting.

CN116740576BActive Publication Date: 2025-09-23HENAN UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310923739.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-26
Publication Date
2025-09-23
Estimated Expiration
2043-07-26

AI Technical Summary

Technical Problem

The traditional horizontal frame-based object detection model cannot fit the target in wheat ear detection because the wheat ears are distributed in arbitrary directions, and there is a large amount of background, which affects the detection effect.

Method used

A wheat ear target detection method based on oriented frames is adopted, and the multi-scale feature fusion pyramid network and the improved Rotated Faster RCNN target detection network are utilized. Through oriented frame annotation and the improved non-maximum suppression algorithm, the feature learning ability and detection accuracy are improved.

Benefits of technology

It significantly improves the accuracy and efficiency of wheat ear target detection, reduces the probability of missed detection and false detection, and can more accurately detect wheat ear targets in field environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740576B_ABST
    Figure CN116740576B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting and counting wheat ears based on an oriented frame. The method comprises the following steps: Step S100, using the roLabelImg annotation tool to annotate wheat ears with oriented frames; Step S200, improving the backbone network, neck network, and non-maximum suppression algorithm of the Rotated Faster RCNN object detection network to obtain a more robust rotated object detection model; Step S300, training the improved Rotated Faster RCNN object detection network model based on an oriented frame; and Step S400, using the trained Rotated Faster RCNN object detection network model to detect wheat ears in a test set, obtaining an image of wheat ears detected with a rotating frame, and displaying the model's count of the number of wheat ears in the image in the upper left corner of the image. This method can effectively improve the accuracy of wheat ear detection, is applicable to field environments, and has good robustness. Furthermore, compared with the horizontal frame-based object detection method, the oriented frame-based wheat ear detection method can effectively reduce the impact of problems such as mutual occlusion of wheat ears and excessive background in the target frame on the final detection effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of agricultural information technology applications, relates to the fields of image processing and computer vision technology, and specifically relates to a wheat ear target detection and counting method based on an oriented frame. Background Art

[0002] With the continuous development of deep learning and artificial intelligence technologies, the field of computer vision has gradually emerged and is widely used in agriculture and industry. Wheat is one of the three major food crops that humans rely on for survival, and computer vision technology has made significant progress in wheat ear detection and counting.

[0003] Counting wheat ears is a significant challenge in agriculture. Traditional manual counting methods are time-consuming, labor-intensive, and error-prone. The application of machine learning to wheat counting can improve counting accuracy and efficiency and reduce the workload of manual counting. However, machine learning methods require experienced experts to extract wheat ear features from images. These features include information such as the shape, color, and texture of the wheat. Common feature extraction methods include edge detection, color histograms, and texture feature extraction. Computer vision is a field that applies deep learning. Deep learning uses multi-layer neural network models to learn data representation and feature extraction, and can automatically learn complex patterns and associations from large amounts of data. Computer vision utilizes deep learning methods to address the understanding, analysis, and processing of image and video data.

[0004] However, the traditional target detection model based on horizontal frames still has certain problems in the actual application of wheat ear detection. When wheat ear photos are collected in a natural environment, the wheat ears are affected by factors such as the shooting angle and the environment and are distributed in arbitrary directions. Therefore, the horizontal detection frame cannot fit the wheat ear target well, resulting in a large amount of background in the prediction frame, which seriously affects the wheat ear target detection effect. Summary of the Invention

[0005] (1) Problems to be solved

[0006] In order to overcome the shortcomings of the above-mentioned traditional target detection based on horizontal frames in wheat ear detection applications, the present invention provides a wheat ear target detection and counting method based on oriented frames, and utilizes a multi-scale feature fusion pyramid network to enrich the semantics and target position information contained in the feature map, thereby improving the model's feature learning ability, so that the model can more accurately predict wheat ear targets in images taken in field environments. See the following description for details.

[0007] (2) Technical solution

[0008] A method for detecting and counting wheat ears based on an oriented frame, the method comprising the following steps:

[0009] Step S100, using the roLabelImg annotation tool to perform directional box annotation on the wheat ear image;

[0010] Step S200, improving the backbone network, neck network, and non-maximum suppression algorithm of the Rotated Faster RCNN object detection network to obtain a more robust rotated object detection model;

[0011] In step S300, the improved Rotated Faster RCNN target detection network model based on the oriented frame is trained. In step S400, the wheat ear images in the test set are detected using the trained Rotated Faster RCNN target detection network model based on the oriented frame, and the wheat ear detection result image marked with a rotating frame is obtained. The model's statistics on the number of wheat ear targets in the image are displayed in the upper left corner of the image.

[0012] More specifically, in step S200, the Rotated Faster RCNN target detection network model is improved to use the ResNeXt network as the backbone network for feature extraction of wheat ear images; the neck network is improved to enhance its fusion of feature maps of different scales; the RPN network is used to generate target suggestion boxes in the feature map, and the feature map processed by the Soft-NMS algorithm enters the ROIPooling layer; the feature matrix is ​​scaled by the ROIPooling layer, and then the feature matrix is ​​flattened using the fully connected layer. Finally, a detection head is constructed to classify and regress the targets and count the number of wheat ears in the image.

[0013] More specifically, step S200 includes the following steps:

[0014] Step S210: Define the angle and direction of the oriented frame, with the x-axis parallel to the horizontal axis of the image and the y-axis parallel to the vertical edge of the image. The oriented frame can be represented by the following five parameters: the coordinates of the center point of the rotation frame (x, y), the width and height of the oriented frame (w, h), and the rotation angle θ. During the model loading and pre-training process, the long side definition method le90° is used as the oriented frame information loading format, as specified below: And width>height, θ is the angle between the long side (width) of the rotation box and the x-axis.

[0015] In step S210, the ResNeXt network is used as the model backbone network for image feature extraction. In the residual structure of ResNeXt, the number of input channels is first reduced to 4 channels, and then a 3x3 convolution is performed without changing the number of channels, and finally the number of channels is restored to 256. The output tensors of the 32 branches are then summed, and finally the input is added to the result using cross-layer connections. The formula can be expressed as follows:

[0016]

[0017] In step S220, a dual-channel feature fusion network PANet is used in the neck network to fuse adjacent feature maps of different scales and a hole convolution module is used to generate the last layer of feature maps to improve the model's ability to detect multi-scale targets. On this basis, the BFP module is used to reduce the loss of semantic information caused by the fusion of adjacent feature maps, and further enrich the semantics and target position information contained in the feature maps.

[0018] More specifically, step S220 includes the following steps:

[0019] In step S221, PANet is used to fuse adjacent feature maps of different scales. Traditional feature pyramid networks use a top-down feature fusion pathway, passing down higher-level features. However, lower-level features cannot influence higher-level features. PANet introduces a bottom-up pathway, making it easier to pass lower-level information to the top of higher levels. This dual top-down and bottom-up feature fusion pathway enriches the semantics and object location information contained in each layer of feature maps.

[0020] In step S222, ASPP essentially consists of a 1×1 convolution, a pooling pyramid, and ASPP Pooling. The dilation factors of each pooling pyramid layer are defined as 6, 12, 18, and 24, respectively. The input feature map is sampled in parallel using dilated convolutions with different dilation factors. The outputs of each sampling branch are then concatenated to expand the number of channels in the feature map. Finally, a 1×1 convolution layer further extracts and reduces the dimensionality of the features obtained in the previous step. This expands the network's receptive field without changing the size of the feature map (i.e., without downsampling), thereby enhancing the model's ability to capture multi-scale context.

[0021] In step S223, in order to integrate the multi-level feature layers while preserving their respective semantic levels, the multi-level features {C2, C3, C4, C5} are first adjusted to an intermediate size (Integrate), that is, the same size as C4, and interpolation and maximum pooling are used respectively. Pooling is performed on small-scale feature maps, while bilinear interpolation is used on large-scale feature maps. Balanced semantic features are obtained by averaging, as shown in the following formula:

[0022]

[0023] Among them, the level with the predicted feature layer l is defined as C l , the total number of predicted feature layers is L, where the highest and lowest layers are defined as l max With l min .

[0024] The acquired features are then rescaled using the same but inverse process to enhance the original features. During this process, each predicted feature layer receives the same information from the other predicted feature layers, and the balanced semantic features can be further refined to make them more discriminative. Using embedded Gaussian non-local attention as the refinement step significantly enhances the integration properties, allowing features from low-level to high-level to be aggregated simultaneously.

[0025] In step S230, the Soft-NMS algorithm is used to filter the prediction boxes to reduce the probability of false detection and missed detection.

[0026] More specifically, S230 uses the Soft-NMS algorithm to filter the prediction boxes.

[0027] When filtering the prediction boxes, instead of directly setting the score of the box whose IOU with the box with the largest score is greater than a certain threshold to zero, a slightly lower score is used to replace the original score. The formula is as follows:

[0028]

[0029]

[0030] Among them, s i represents the set of confidence scores corresponding to the prediction box, b i Represents the i-th prediction box. M represents the prediction box with the largest confidence score, N t It is a custom IoU threshold.

[0031] More specifically, in step S300, the Rotated Faster RCNN target detection network model based on the oriented frame is trained according to the following steps:

[0032] Step S310, collecting wheat ear images;

[0033] Step S320, using the roLabelImg tool to manually label the wheat ear images to create a wheat ear dataset;

[0034] In step S330, the training set and validation set images are input into the oriented frame-based Rotated Faster RCNN object detection network model for 30 rounds of training, where the initial learning rate of training is 0.001. The learning rate is reduced between the 8th and 11th rounds of training. The image size is uniformly adjusted to 1024×1024 during image preprocessing.

[0035] (3) Beneficial effects

[0036] Compared with the existing technology, the wheat ear target detection and counting method based on oriented frame provided by the present invention has significant positive technical effects, which are specifically manifested in the following aspects:

[0037] (1) This invention aims to address the obvious shortcomings of the current horizontal frame-based target detection method in wheat ear detection, such as the presence of a large amount of background within the detection frame and the inability of the horizontal frame to represent the target direction. This method proposes introducing an oriented frame into the wheat ear target detection process to accurately represent the direction of the wheat ear head, thereby more accurately locating the wheat ear position.

[0038] (2) The present invention can enrich the semantics and target position information contained in the feature map. It not only fuses the feature maps of adjacent scales, but also integrates and refines them so that features from low-level to high-level are simultaneously aggregated, significantly improving the model's ability to learn wheat ear features.

[0039] (3) The present invention uses an improved non-maximum suppression algorithm to filter detection frames based on the problems of overlapping and dense wheat ears in actual field environments, which significantly reduces the probability of missed detection and false detection during model prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 Flowchart of the method proposed in the present invention

[0041] Figure 2 Schematic diagram of the overall network structure of the present invention

[0042] Figure 3 Schematic diagram of the rotation frame definition used in the present invention

[0043] Figure 4 Schematic diagram of the feature fusion pyramid module proposed in this invention

[0044] Figure 5 Schematic diagram of the improved non-maximum suppression algorithm used in the present invention

[0045] Figure 6 Detection effect diagram of the method proposed by the present invention DETAILED DESCRIPTION

[0046] In order to fully illustrate the purpose, technical solutions and advantages of the present invention, the present invention is further described below with reference to the accompanying drawings and implementation cases. Figure 1 The workflow diagram of the present invention is shown, which is divided into three steps: the first step is to obtain the current image to be detected; the second step is to input the image to be detected into a pre-trained wheat ear detection and counting model, and then go through the backbone network, neck network, classification and regression operations; the third step is to obtain the wheat ear detection and counting result diagram.

[0047] Example 1

[0048] In order to overcome the shortcomings of the above-mentioned traditional target detection based on horizontal frames in wheat ear detection applications, the present invention provides a wheat ear target detection and counting method based on oriented frames, and utilizes a multi-scale feature fusion pyramid network to enrich the semantics and target position information contained in the feature map, thereby improving the feature learning ability of the model, so that the model can more accurately predict wheat ear targets in images taken in a field environment. The method is characterized in that the method comprises the following steps:

[0049] Step S100, using the roLabelImg annotation tool to perform directional box annotation on the wheat ear image;

[0050] Step S200, improving the backbone network, neck network, and non-maximum suppression algorithm of the Rotated Faster RCNN object detection network to obtain a more robust rotated object detection model;

[0051] In step S300, the improved Rotated Faster RCNN target detection network model based on the oriented frame is trained. In step S400, the wheat ear images in the test set are detected using the trained Rotated Faster RCNN target detection network model based on the oriented frame, and the wheat ear detection result image marked with a rotating frame is obtained. The model's statistics on the number of wheat ear targets in the image are displayed in the upper left corner of the image.

[0052] Example 2

[0053] The steps in Example 1 are further introduced below, as described below:

[0054] More specifically, in step S200, the Rotated Faster RCNN target detection network model is improved to use the ResNeXt network as the backbone network for feature extraction of wheat ear images; the neck network is improved to enhance its fusion of feature maps of different scales; the RPN network is used to generate target proposal boxes in the feature map, and the feature map processed by the Soft-NMS algorithm enters the ROIPooling layer; the feature matrix is ​​scaled by the ROIPooling layer, and then the feature matrix is ​​flattened using the fully connected layer. Finally, a detection head is constructed to classify and regress the target and count the number of wheat ears in the image, as shown in FIG. Figure 2 shown.

[0055] More specifically, step S200 includes the following steps:

[0056] Step S210: Define the angle and direction of the oriented frame, with the x-axis parallel to the horizontal axis of the image and the y-axis parallel to the vertical edge of the image. The oriented frame can be represented by the following five parameters: the coordinates of the center point of the rotation frame (x, y), the width and height of the oriented frame (w, h), and the rotation angle θ. During the model loading and pre-training process, the long side definition method le90° is used as the oriented frame information loading format, as specified below: And width>height, θ is the angle between the long side (width) of the rotation box and the x-axis, such as Figure 3 shown.

[0057] In step S210, the ResNeXt network is used as the model backbone network for image feature extraction. In the residual structure of ResNeXt, the number of input channels is first reduced to 4 channels, and then a 3x3 convolution is performed without changing the number of channels, and finally the number of channels is restored to 256. The output tensors of the 32 branches are then summed, and finally the input is added to the result using cross-layer connections. The formula can be expressed as follows:

[0058]

[0059] In step S220, the dual-channel feature fusion network PANet is used in the neck network to fuse adjacent feature maps of different scales and the hole convolution module is used to generate the last layer of feature maps to improve the model's detection ability for multi-scale targets. On this basis, the BFP module is used to reduce the problem of semantic information loss caused by the fusion of adjacent feature maps, and further enrich the semantics and target position information contained in the feature map. Figure 4 shown.

[0060] More specifically, step S220 includes the following steps:

[0061] In step S221, PANet is used to fuse adjacent feature maps of different scales. Traditional feature pyramid networks use a top-down feature fusion pathway, passing down higher-level features. However, lower-level features cannot influence higher-level features. PANet introduces a bottom-up pathway, making it easier to pass lower-level information to the top of higher levels. This dual top-down and bottom-up feature fusion pathway enriches the semantics and object location information contained in each layer of feature maps.

[0062] In step S222, ASPP essentially consists of a 1×1 convolution, a pooling pyramid, and ASPP Pooling. The dilation factors of each pooling pyramid layer are defined as 6, 12, 18, and 24, respectively. The input feature map is sampled in parallel using dilated convolutions with different dilation factors. The outputs of each sampling branch are then concatenated to expand the number of channels in the feature map. Finally, a 1×1 convolution layer further extracts and reduces the dimensionality of the features obtained in the previous step. This expands the network's receptive field without changing the size of the feature map (i.e., without downsampling), thereby enhancing the model's ability to capture multi-scale context.

[0063] In step S223, in order to integrate the multi-level feature layers while preserving their respective semantic levels, the multi-level features {C2, C3, C4, C5} are first adjusted to an intermediate size (Integrate), that is, the same size as C4, and interpolation and maximum pooling are used respectively. Pooling is performed on small-scale feature maps, while bilinear interpolation is used on large-scale feature maps. Balanced semantic features are obtained by averaging, as shown in the following formula:

[0064]

[0065] Among them, the level with the predicted feature layer l is defined as C l , the total number of predicted feature layers is L, where the highest and lowest layers are defined as l max With l min .

[0066] The acquired features are then rescaled using the same but inverse process to enhance the original features. During this process, each predicted feature layer receives the same information from the other predicted feature layers, and the balanced semantic features can be further refined to make them more discriminative. Using embedded Gaussian non-local attention as the refinement step significantly enhances the integration properties, allowing features from low-level to high-level to be aggregated simultaneously.

[0067] In step S230, the Soft-NMS algorithm is used to filter the prediction boxes to reduce the probability of false detection and missed detection.

[0068] More specifically, S230 uses the Soft-NMS algorithm to filter the prediction boxes.

[0069] When filtering the prediction boxes, instead of directly setting the scores of the boxes whose IOU with the box with the largest score is greater than a certain threshold to zero, such as Figure 5 Instead of using the original score as shown, a slightly lower score is used instead. The formula is as follows:

[0070]

[0071]

[0072] Among them, s i represents the set of confidence scores corresponding to the prediction box, b i Represents the i-th prediction box. M represents the prediction box with the largest confidence score, N t It is a custom IoU threshold.

[0073] More specifically, in step S300, the Rotated Faster RCNN target detection network model based on the oriented frame is trained according to the following steps:

[0074] Step S310, collecting wheat ear images;

[0075] Step S320, using the roLabelImg tool to manually label the wheat ear images to create a wheat ear dataset;

[0076] In step S330, the training set and validation set images are input into the oriented frame-based Rotated Faster RCNN object detection network model for 30 rounds of training, where the initial learning rate of training is 0.001. The learning rate is reduced between the 8th and 11th rounds of training. The image size is uniformly adjusted to 1024×1024 during image preprocessing.

[0077] Finally, the trained wheat ear target detection and counting model based on the oriented frame is used to detect the collected wheat ear images, and the wheat ear detection result image at the rotated frame is obtained, such as Figure 6 shown.

[0078] Example 3

[0079] Capturing wheat ear images using drones enables efficient and rapid crop monitoring and assessment, helping farmers and agricultural experts make more accurate decisions and improve crop yield and quality. Traditional target detection methods can have difficulties detecting rotating targets because they typically rely on fixed object appearance features. This invention achieves accurate detection and location of rotating wheat ear targets in drone images, specifically comprising the following steps:

[0080] Step S100: Start the drone and fly it along the pre-planned route. The drone should fly at an appropriate altitude and speed to ensure the clarity and coverage of the captured wheat ear images.

[0081] Step S200: The collected wheat ear image is transferred to a computer or cloud for subsequent processing and analysis. This may involve steps such as image correction, denoising, image enhancement, and image registration to obtain high-quality image data. The wheat ear image is then annotated with directional boxes using the roLabelImg annotation tool.

[0082] In step S300, the improved Rotated Faster RCNN target detection network model based on the oriented frame is trained. In step S400, the wheat ear images in the test set are detected using the trained Rotated Faster RCNN target detection network model based on the oriented frame, and the wheat ear detection result image marked with a rotating frame is obtained. The model's statistics on the number of wheat ear targets in the image are displayed in the upper left corner of the image.

[0083] The analysis results of wheat ear images can be used to support crop management decisions. For example, the number and health of wheat ears can be used to assess crop growth and take appropriate measures, such as fertilization, irrigation, or pest control.

[0084] Those skilled in the art will understand that the accompanying drawings are only a schematic diagram of a preferred embodiment, and the serial numbers of the embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0085] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A wheat ear target detection and counting method based on an oriented frame, characterized in that: The following steps are included: Step S100, using the roLabelImg annotation tool to perform directional box annotation on the wheat ear image; Step S200, improving the Rotated Faster RCNN object detection network, including: using the ResNeXt network as the backbone network for feature extraction; improving the neck network, using the dual-channel feature fusion network PANet to fuse adjacent feature maps of different scales, and using the hole convolution module ASPP to generate the last layer of feature maps, and using the balanced feature pyramid BFP module to reduce the loss of semantic information caused by the fusion of adjacent feature maps; using the Soft-NMS algorithm to improve the non-maximum suppression process to obtain a more robust rotated object detection model; Step S300, training the improved Rotated Faster RCNN object detection network model based on the oriented frame; Step S400: Detect the wheat ear images in the test set using the trained Rotated Faster RCNN object detection network model based on oriented frames, obtain a wheat ear detection result image marked with a rotating frame, and display the model's statistics on the number of wheat ear targets in the image in the upper left corner of the image; The step S200 includes: using a ResNeXt network as a backbone network to extract features from wheat ear images; realizing multi-scale feature fusion by improving the neck network, including using a path aggregation network PANet for bidirectional feature fusion and an ASPP module to enhance the receptive field; using a dual-channel feature fusion network PANet in the neck network to fuse adjacent feature maps of different scales, using a void convolution module to generate a last layer of feature maps to improve the model's detection capability for multi-scale targets, and using a BFP module to reduce the loss of semantic information caused by the fusion of adjacent feature maps; using a region generation network RPN to generate a target proposal box on the feature map, and the feature map processed by the Soft-NMS algorithm enters the ROIPooling layer; scaling the feature matrix through the ROIPooling layer, and then flattening the feature matrix using a fully connected layer; and finally constructing a detection head to classify and regress the targets and count the number of wheat ears in the image.

2. The wheat ear target detection and counting method based on an oriented frame according to claim 1, characterized in that: The step S200 includes the following sub-steps: Step S210: Define the angle and direction of the oriented frame, with the x-axis parallel to the horizontal axis of the image and the y-axis parallel to the vertical edge of the image. The oriented frame is represented by the following five parameters: the coordinates of the center point of the rotation frame (x, y), the width and height of the oriented frame (w, h), and the rotation angle θ. During the model loading and pre-training process, the long side definition method le90° is used as the oriented frame information loading format, as specified below: And width>height, θ is the angle between the long side of the rotation box and the x-axis; Step S210: Use the ResNeXt network as the model backbone network to extract image features. The number of input channels is reduced to 4 in the residual structure of ResNeXt. A 3x3 convolution is performed without changing the number of channels to restore the number of channels to 256. The output tensors of the 32 branches are summed, and the input is added to the result using cross-layer connections. Step S220: In the neck network, a dual-channel feature fusion network PANet is used to fuse adjacent feature maps of different scales, and a dilated convolution module is used to generate the final feature map layer to improve the model's ability to detect multi-scale targets. The BFP module is used to reduce the loss of semantic information caused by the fusion of adjacent feature maps, thereby enriching the semantics and target position information contained in the feature map. In step S230, the Soft-NMS algorithm is used to filter the prediction boxes to reduce the probability of false detection and missed detection.

3. The wheat ear target detection and counting method based on an oriented frame according to claim 2, characterized in that: The improvement of the model neck network in step S220 includes: PANet is used to fuse adjacent feature maps of different scales. PANet introduces a bottom-up path, making it easier for low-level information to be transmitted to the top of the high-level layer. Through the top-down and bottom-up dual feature fusion pathways, the semantic and target location information contained in each layer of feature map is enriched. The ASPP module consists of a 1×1 convolutional layer, a pooling pyramid, and ASPP Pooling. The dilation factors of each pooling pyramid layer are defined as 6, 12, 18, and 24, respectively. The input feature map is sampled in parallel using dilated convolutions with different dilation factors. The output results of each sampling branch are concatenated to expand the number of channels in the feature map. A 1×1 convolutional layer further extracts and reduces the dimensionality of the features obtained in the previous step, expanding the network's receptive field without changing the size of the feature map (i.e., without downsampling), thereby enhancing the model's ability to capture multi-scale context. In order to integrate the multi-level feature layers and retain their respective semantic levels, the multi-level features {C2, C3, C4, C5, C6} are adjusted to the intermediate size Integrate, and interpolation and maximum pooling are used respectively. Pooling is performed on the small-sized feature maps, and bilinear interpolation is used for the large-scale feature maps. Balanced semantic features are obtained by averaging, as shown in the following formula: Among them, the level with the predicted feature layer l is defined as C l , the total number of predicted feature layers is L, where the highest and lowest feature layers are defined as l max With l min ; The acquired features are rescaled to enhance the original features; each prediction feature layer obtains the same information from other prediction feature layers, and the balanced semantic features are further refined; using embedded Gaussian non-local attention as the refinement step can significantly enhance the integration characteristics, so that features from low-level to high-level are aggregated simultaneously.

4. The wheat ear target detection and counting method based on an oriented frame according to claim 2, characterized in that: The step S230 uses the Soft-NMS algorithm to filter the prediction box, specifically including: When screening prediction boxes, instead of directly setting the score of the prediction box whose IOU with the box with the largest score is greater than a certain threshold to zero, a slightly lower score is used to replace the original score. The formula is as follows: Among them, s i Indicates the confidence score corresponding to the prediction box, b i represents the i-th prediction box, M represents the prediction box with the largest confidence score, and N t It is a custom IoU threshold.

5. The wheat ear target detection and counting method based on an oriented frame according to claim 1, characterized in that: In step S300, the Rotated Faster RCNN target detection network model based on the oriented frame is trained as follows: Step S310, collecting wheat ear images; Step S320, using the roLabelImg tool to manually label the wheat ear images to create a wheat ear dataset; Step S330 , the training set and validation set images are fed into a Rotated Faster RCNN object detection network model based on oriented frames for 30 training rounds, wherein the initial learning rate for training is 0.001 and the learning rate is reduced between the 8th and 11th rounds of training. The image size is uniformly adjusted to 1024×1024 during image preprocessing; Step S340: After the training is completed, the weight parameters are saved.