An aerial target detection method and device based on an attention mechanism and a medium
By unifying the resolution, correcting distortion, and normalizing the brightness of aerial video frames, statistically analyzing texture density and edge density, and generating scale prior vectors, combined with a single-stage detection network and attention mechanism, the problems of inaccurate scale prior and inaccurate multi-scale target detection in existing aerial target detection methods are solved, improving detection accuracy and recall, and reducing false negatives and false merging rates.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING TECH UNIV
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-23
Smart Images

Figure CN122265875A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and in particular to an aerial target detection method, device and medium based on an attention mechanism. Background Technology
[0002] In recent years, with the popularization of low-altitude remote sensing platforms and the improvement of high-performance computing capabilities, intelligent sensing technology based on aerial video has been widely used in smart cities, emergency rescue, traffic monitoring, and agricultural telemetry. Image detection, as a core component, aims to accurately identify and locate specific categories of target objects from high-resolution, wide-field-of-view aerial images. Aerial images are characterized by scale variations, target sparsity, complex background interference, and uneven illumination. To address these challenges, researchers have gradually introduced deep learning architectures, especially single-stage detectors, to balance detection efficiency and accuracy.
[0003] However, existing aerial target detection methods still have limitations in two key dimensions. First, most methods lack explicit modeling of the underlying statistical characteristics of images (such as texture density and edge density), resulting in coarse acquisition of scale prior information and difficulty in accurately guiding subsequent detection networks to focus on potential target regions. Second, in the process of multi-scale feature fusion, static or global attention strategies are usually adopted, failing to dynamically arrange attention routes according to the pixel scale range of candidate targets. This leads to small targets being easily ignored, large target boundaries being blurred, and dense targets in clustered areas being prone to missed detection or false merging. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides an aerial target detection method based on an attention mechanism to solve the problems of inaccurate scale prior and inaccurate multi-scale target detection.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, the present invention provides an aerial target detection method based on an attention mechanism, comprising: acquiring aerial video frames, performing resolution unification, distortion correction, and brightness normalization, and statistically analyzing texture density and edge density, while extracting candidate target pixel scale ranges to generate scale prior vectors; progressively pushing the scale prior vectors through a single-stage detection network to obtain a multi-scale candidate box set, and selecting high-confidence candidate boxes based on the candidate target pixel scale ranges; extracting center coordinate sequences from the high-confidence candidate boxes, performing density aggregation to obtain clustered region boxes, and performing boundary expansion and center filling scale scaling to generate clustered cropped frames; constructing multi-scale features based on the clustered cropped frames and corresponding aerial video frames, and performing scale prior-driven attention routing orchestration based on the candidate target pixel scale ranges to generate cross-stream gating weights and attention features; fusing the clustered region boxes and cross-stream gating weights through attention features to obtain real-time detection boxes, and performing overlap conflict resolution and non-maximum suppression to generate an aerial target detection result set.
[0007] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the steps of acquiring aerial video frames and performing resolution unification, distortion correction, and brightness normalization are as follows: Aerial video frames are captured and frame numbers are added. A pixel-raster mapping relationship is established by unifying the resolution. Simultaneously, distortion correction is performed and written to the boundary of the effective distortion correction area to generate a geometrically corrected frame sequence. Luminance normalization is performed on the geometrically corrected frame sequence, and luminance normalization parameter tags and luminance histogram summaries are written to generate a luminance normalized frame sequence.
[0008] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the steps for generating the scale prior vector are as follows: The brightness-normalized frame sequence is divided into grids, local texture response and edge response are extracted, and texture density statistics set and edge density statistics set are generated. The texture density statistics set and the edge density statistics set are combined according to the pixel raster mapping relationship, and the scale range of candidate target pixels is extracted to generate a scale prior vector.
[0009] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the step of progressively pushing the scale prior vector through a single-stage detection network to obtain a multi-scale candidate box set is as follows: The aerial video frames are located based on the frame number in the scale prior vector, and effective region cropping and edge filling are performed. At the same time, scale levels are divided and a detection input arrangement list is generated. Based on the detection input orchestration list, aerial video frames are pushed one by one through a single-stage detection network, and the candidate box positions, candidate box sizes and candidate box confidence scores are aggregated to generate a multi-scale candidate box set.
[0010] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the step of filtering high-confidence candidate boxes by combining the pixel scale range of candidate targets includes the following steps: Perform interval consistency checks on the multi-scale candidate box set and the pixel scale range of the candidate targets, and perform segmented threshold determination and local alignment verification on the confidence of the candidate boxes to generate candidate shortlisted boxes; The candidate shortlist is merged for duplicate candidate boxes and competition retention is performed for overlapping candidate boxes. A list of candidate box entries is obtained and backfilled for scale consistency to generate highly reliable candidate boxes.
[0011] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the steps for generating clustered cropped frames are as follows: The high-confidence candidate boxes are deduplicated by removing the center coordinates of the candidate boxes and merging their neighborhoods. The center coordinate sequence is generated by writing the scale level marker according to the frame number. Density clustering is performed on the center coordinate sequence to obtain the target cluster, and outlier center point removal verification is performed within the target cluster to generate the cluster region bounding box; Perform boundary expansion and center fill scaling on the clustered region box to obtain the clipping window, and perform out-of-bounds back and minimum clipping size padding, while clipping it into a clustered clipping frame.
[0012] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the steps for generating cross-flow gating weights and attention features are as follows: Locate aerial video frames within the aggregated cropping frames, convert the cropping window coordinates to the aerial video frame coordinate system, and establish cross-stream alignment mapping entries. We perform shared weight feature extraction and multi-scale feature construction on aggregated cropped frames and aerial video frames, and combine cross-stream alignment mapping entries to establish cross-stream index pairs at each scale level, generating cross-stream multi-scale alignment features. The cross-stream multi-scale alignment features are combined with the pixel scale range of candidate targets, and the scale level is dynamically divided to obtain the attention route orchestration list and the lightweight attention orchestration list. Based on the attention routing orchestration list and the lightweight attention orchestration list, scale-level cross-stream attention enhancement is performed to generate cross-stream gating weights and attention features.
[0013] As a preferred embodiment of the aerial target detection method based on the attention mechanism described in this invention, the steps for generating the aerial target detection result set are as follows: The coverage area of the clustered region is located based on the cross-flow gating weights and attention features, and mapped to each scale level to obtain the clustered region mask. The cross-flow gating weights are then expanded into a gating fusion constraint list. Based on the gating fusion constraint list, gating fusion is dynamically performed at mask-covered and non-covered locations in the clustered area to generate a real-time detection box candidate list; The candidate entries table of real-time detection boxes is sorted into bins of the same type to obtain a list of candidate boxes by category. Overlapping conflict resolution and non-maximum suppression are then performed to generate an aerial target detection result set.
[0014] In a second aspect, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, wherein when the computer program is executed by the processor, it implements any step of the aerial target detection method based on the attention mechanism as described in the first aspect of the present invention.
[0015] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the aerial target detection method based on the attention mechanism as described in the first aspect of the present invention.
[0016] The beneficial effects of this invention are as follows: by using scale prior vectors, quantitative modeling of texture and edge density is achieved, which is used to guide scale selection in image detection and improve the multi-scale target recall rate; by using scale prior-driven attention routing orchestration, cross-stream gating feature fusion is achieved, which is used to enhance the image detection sensitivity of clustered regions, reduce the false negative rate and suppress the false merging of dense targets. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of an aerial target detection method based on an attention mechanism.
[0019] Figure 2 Select the accuracy heatmap for the scale under the combination of texture density and edge density.
[0020] Figure 3This is a scatter plot showing the correlation between the mean of cross-flow gating weights and the decrease in accuracy of clustered regions.
[0021] Figure 4 A comparison chart showing the change in the false merging rate of dense targets with the minimum spacing. Detailed Implementation
[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0023] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0024] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0025] Reference Figures 1-4 This is one embodiment of the present invention, which provides an aerial target detection method based on an attention mechanism, comprising the following steps: S1: Acquire aerial video frames, perform resolution unification, distortion correction and brightness normalization, and statistically analyze texture density and edge density. At the same time, extract the pixel scale range of candidate targets and generate scale prior vectors. S1.1: Acquire aerial video frames, add frame numbers, perform resolution unification to establish pixel-raster mapping relationship, and simultaneously perform distortion correction and write the distortion correction effective area boundary to generate a geometric correction frame sequence. Specifically, aerial video frames are acquired and assigned frame numbers. These frame numbers are then organized into consecutive frame segments in chronological order, and resolution unification is performed frame by frame. The aerial video frame pixel raster is resampled to the output resolution (e.g., 1920×1080). During the resolution unification process, a pixel raster mapping relationship is established to record the one-to-one correspondence between the aerial video frame pixel coordinates and the resampled pixel coordinates. Distortion correction is performed based on the pixel raster mapping relationship. Distortion correction mapping rules are applied to the resampled pixel raster, and out-of-bounds pixel clipping and edge completion are completed. The area range that still maintains continuous and effective imaging after distortion correction and the boundary of the distortion correction effective area are extracted. The resolution unification result, pixel raster mapping relationship, and distortion correction effective area boundary are encapsulated according to the frame number to generate a geometrically corrected frame sequence.
[0026] It should be noted that the pixel-raster mapping relationship is used to describe the coordinate alignment relationship between the source aerial video frame pixel coordinates and the output pixel raster coordinates during the resolution unification and distortion correction process.
[0027] The distortion correction mapping rule is determined by the distortion parameters and intrinsic parameter matrix obtained from camera calibration. The coordinates of each pixel in the resampled pixel grid are mapped to the imaging coordinate system of the aerial video frame according to the coordinate transformation relationship of radial and tangential distortion. The boundary constraints of the effective distortion correction area are used to back off and fill in the edges.
[0028] The effective boundary of the distortion correction region refers to the outer contour range of the usable image area that can still maintain continuous and effective imaging after distortion correction and does not include out-of-bounds padding or invalid fill pixels.
[0029] S1.2: Perform luminance normalization on the geometrically corrected frame sequence, and write luminance normalization parameter tags and luminance histogram summaries to generate a luminance normalized frame sequence; Furthermore, the geometrically corrected frame sequence is subjected to brightness normalization frame by frame according to the frame number. The pixel brightness of the geometrically corrected frame sequence within the boundary of the distortion correction effective region is mapped to the brightness dynamic range (e.g., the brightness range is linearly scaled to 0-255 according to the original bit depth or clipped to the percentile and then linearly scaled). Overexposed and underexposed pixels are truncated and compressed, and low-light noise segments are smoothed and suppressed to maintain the continuity of brightness changes. The mapping configuration used for brightness normalization is encapsulated as brightness normalization parameter tags, and the brightness histogram summary is statistically generated from the normalized pixel brightness distribution to describe the brightness distribution pattern and contrast level. The brightness normalization parameter tags and brightness histogram summaries are bound to the corresponding frames according to the frame number to generate a brightness normalized frame sequence.
[0030] S1.3: Perform grid division on the brightness-normalized frame sequence, extract local texture response and edge response, and generate texture density statistics set and edge density statistics set; Specifically, the brightness-normalized frame sequence is divided into grids frame by frame according to the frame number. The brightness-normalized frame sequence is divided into regular grid blocks (e.g., 32×32 pixel grid blocks) within the boundary of the distortion correction effective area. For each grid block, the local grayscale change amplitude and direction consistency are calculated to form a local texture response. Gradient amplitude aggregation and direction distribution statistics are performed on each grid block to form an edge response. The local texture response is aggregated according to the grid block dimension to obtain the texture density statistics, and the edge response is aggregated according to the grid block dimension to obtain the edge density statistics. The texture density statistics and edge density statistics are associated and organized with the corresponding frame number to generate texture density statistics set and edge density statistics set.
[0031] It should be noted that local texture response is a quantitative representation of the strength of the spatial fluctuations of gray levels within a regular grid block and the degree of consistency with the dominant direction. It is used to characterize whether there are fine textures, speckled textures, or striped textures within the regular grid block, as well as whether the texture direction is concentrated.
[0032] Edge response is a quantitative representation of the aggregated value of gray-level gradient intensity and the distribution pattern of gradient direction within a regular grid block. It is used to characterize whether there are clear boundaries within the regular grid block, whether the contour direction is clear, and whether the edge direction is concentrated or multi-directional.
[0033] The formula for calculating the amplitude of local grayscale changes is: The formula for calculating directional consistency is: ; in, Represents grid blocks The local grayscale change amplitude is defined as the average gradient amplitude within the grid block; Represents grid blocks Number of pixels within; Indicates the pixel index; Represents pixels exist Gradient components obtained by gray-scale difference in the axial direction; Represents pixels exist Gradient components obtained by gray-scale difference in the axial direction; Represents grid blocks The directional consistency is defined as the normalized length of the synthesized unit vector of the gradient direction of each pixel within the grid block.
[0034] S1.4: Combine the texture density statistics set and the edge density statistics set according to the pixel raster mapping relationship, extract the scale range of candidate target pixels, and generate the scale prior vector.
[0035] Specifically, the texture density statistics set and the edge density statistics set are aligned by frame number, and the texture density statistics results and edge density statistics results at the same spatial location are located by grid block coordinates. Joint filtering is performed to lock high-response grid blocks and form candidate region distributions. Based on the pixel-raster mapping relationship, the candidate region distributions are converted from grid block scale to pixel scale. The connectivity range and span corresponding to the candidate region distributions are statistically analyzed and converted into candidate target pixel scale intervals. The upper and lower bounds of the candidate target pixel scale intervals are encapsulated as interval boundary markers, and the interval boundary markers are associated and encapsulated with the frame number to generate a scale prior vector.
[0036] It should be noted that the joint screening retains grid blocks that simultaneously meet the consistency condition of "texture density statistics being higher than the same frame quantile and edge density statistics being higher than the same frame quantile" (for example, the top 20% quantiles in the same frame are taken, and only grid blocks that fall into the top 20% are marked as high-response grid blocks, while the remaining grid blocks are removed). The candidate region distribution is formed by the aggregation of the retained grid blocks.
[0037] The scale prior vector consists of several scale prior entries. Each scale prior entry records the frame number, the texture density statistics of the candidate target pixel scale interval, and the edge density statistics.
[0038] Figure 2 This diagram illustrates the guiding role of the "scale prior vector" in scale selection and verifies that quantitative modeling of texture density and edge density can improve multi-scale target recall. The horizontal axis represents edge density intensity (Eden), the vertical axis represents texture density intensity (Tden), and the color bars represent scale selection accuracy. This indicates the consistency between the scale level selected in the input orchestration list and the true scale range of the target after extracting candidate target pixel scale intervals based on texture density and edge density statistical sets and generating scale prior vectors under different combinations of texture / edge statistical characteristics. Different color blocks in the diagram reflect the change in scale selection accuracy from low to high: when Eden and Tden are in a combination interval more conducive to target discernibility, the scale selection accuracy is higher, indicating that the scale prior vector can convert underlying statistical characteristics into usable scale constraints, reducing the missed detection of small targets and the blurring of large target boundaries caused by scale level mismatches; when Eden or Tden is in an unfavorable interval, the decrease in accuracy also intuitively reflects the problem that "lack of explicit modeling leads to coarse scale priors," thus highlighting the necessity of quantitative modeling in this invention.
[0039] S2: The scale prior vector is pushed step by step through a single-stage detection network to obtain a set of candidate boxes with multiple scales, and high-confidence candidate boxes are selected by combining the pixel scale range of the candidate target. S2.1: Locate aerial video frames based on frame numbers in the scale prior vector, perform effective region cropping and edge padding, and simultaneously divide scale levels to generate a detection input arrangement list; Specifically, the aerial video frame is located based on the frame number in the scale prior vector. The aerial video frame is then cropped according to the effective region boundary of the distortion correction region to remove invalid padding. The cropped aerial video frame is then padded with edge fill to restore the input size and maintain pixel grid continuity. The scale level boundary is matched with the candidate target pixel scale range in the scale prior vector. The aerial video frames are then marked and arranged according to the matched scale level. At the same time, the frame number, scale level mark, and cropping and padding configuration are encapsulated and organized to generate a detection input arrangement list.
[0040] It should be noted that the scale level is divided into hierarchical boundaries according to the mapping of the candidate target pixel scale range to the multi-scale feature level; the detection input catalog records at least the frame number, scale level mark and corresponding input scaling parameters.
[0041] S2.2: Based on the detection input orchestration list, the aerial video frames are pushed one by one through a single-stage detection network, and the candidate box positions, candidate box sizes and candidate box confidence scores are aggregated to generate a multi-scale candidate box set; Specifically, based on the detection input orchestration list, the order of aerial video frames is organized by frame number and scale level label. Aerial video frames corresponding to the same frame number are scale aligned according to scale level label and encapsulated into single-stage detection network input entries. Input entries are fed into the single-stage detection network for forward inference and return results are obtained. The return results are aligned and checked by frame number and scale level label. The candidate box position, candidate box size and candidate box confidence in the return results are organized by candidate box entry number and missing field entries are removed to form candidate box entry groups for the same frame number under different scale levels. Cross-scale level merging is performed on the candidate box entry groups. The candidate box entry groups are summarized by frame number and the source scale information of the candidate boxes is retained according to scale level label to generate a multi-scale candidate box set.
[0042] It should be noted that the single-stage detection network takes the scale alignment results of aerial video frames as input, performs multi-layer convolutional downsampling and semantic aggregation on the aerial video frames in the shared backbone feature extraction layer, and outputs a basic feature map that combines local edge texture and global structural information. The multi-scale feature layer establishes top-down and bottom-up fusion pathways between the feature maps of different resolutions output by the shared backbone feature extraction layer, so that the fine-grained texture response of small targets and the semantic response of large target contours can be accessed simultaneously within the same scale level, and generates a corresponding detection feature map for each scale level. The detection output layer generates the regression values of candidate box position and candidate box size on the detection feature map of each scale level in a dense prediction manner, and simultaneously outputs the candidate box confidence to measure the consistency between the candidate box and the target appearance. Then, the candidate box entries of each scale level are back-transmitted according to the frame number and scale level to support the subsequent interval consistency check and duplicate candidate box merging.
[0043] The candidate box size is the size of the target bounding area within the candidate box in the aerial video frame. It is used to characterize the width and height scale of the area covered by the candidate box and to match the pixel scale range of the candidate target.
[0044] Candidate box confidence is a score given by a single-stage detection network on the probability that the target corresponding to the candidate box exists. It is used to perform strong pass screening and pending review screening of candidate boxes.
[0045] S2.3: Perform interval consistency check on the multi-scale candidate box set and the pixel scale range of the candidate target, and perform segmented threshold judgment and local alignment review on the confidence of the candidate box to generate candidate shortlisted boxes; Furthermore, the multi-scale candidate box set is traversed one by one and the candidate box size is read. The candidate box size and the candidate target pixel scale range are checked for interval consistency. Candidate boxes outside the interval are eliminated and the candidate boxes within the interval retain the scale consistency status. For the retained candidate boxes, a segmented threshold is determined according to the candidate box confidence. Candidate boxes whose confidence falls into the strong pass zone are directly entered into the pass queue. Candidate boxes whose confidence falls into the waiting review zone are entered into the local alignment review queue. Multiple sets of micro-displacement review windows are generated around the candidate box position for the local alignment review queue, and the scale level is consistent for re-push and back. The review window back results are compared for consistency to confirm the stability of the candidate box position and the stability of the candidate box confidence. The candidate boxes that pass the local alignment review and the candidate boxes in the strong pass zone are merged and sorted to generate the shortlisted candidate boxes.
[0046] It should be noted that the example range of the segmented threshold is 0.30–0.60. The lower limit is determined based on the background false alarm noise level and acceptable false alarm rate of the aerial video frame within the candidate target pixel scale range, and the upper limit is determined based on the stable backhaul consistency and acceptable false alarm rate required for the candidate bounding box.
[0047] S2.4: Perform duplicate candidate box merging and overlapping candidate box competition retention on the candidate shortlisted boxes, obtain the candidate box entry list, and perform scale level consistency backfilling to generate highly reliable candidate boxes.
[0048] Specifically, candidate bounding boxes are grouped by frame number, and duplicate candidate boxes within the same frame number are identified based on their positional similarity and size similarity, converging them into a single candidate box entry. For candidate bounding boxes with overlapping coverage within the same frame number, overlapping candidate box competition retention is performed. Overlapping candidate box competition retention is triggered based on an overlap ratio threshold, and candidate box entries with higher confidence and larger sizes that better fit the target pixel scale range are prioritized within the competition set. The retained candidate box entries are then summarized into a candidate box entry list by frame number. The scale level markers of the candidate box entry list are rechecked against the target pixel scale range, and inconsistent entries are backfilled with scale level consistency to generate highly reliable candidate boxes.
[0049] It should be noted that the example range of the overlap ratio threshold is 0.40–0.70. The lower limit is determined based on the density of candidate boxes in the candidate target pixel scale range of the aerial video frame and the number of allowed duplicate candidate boxes, while the upper limit is determined based on the coverage consistency of candidate boxes at multiple scales of the same target and the acceptable target merging risk.
[0050] S3: Extract the center coordinate sequence from the high-confidence candidate boxes, perform density clustering to obtain clustered region boxes, and perform boundary expansion and center filling scale scaling to generate clustered cropped frames; S3.1: Deduplicate the center coordinates of the high-confidence candidate boxes and merge their neighborhoods, and write the scale level markers according to the frame number to generate a center coordinate sequence; Specifically, high-confidence candidate boxes are grouped by frame number, and within each frame number, the candidate box position is converted into candidate box center coordinates. The candidate box center coordinates are deduplicated, and duplicate center points are determined by the spatial proximity of the center points, retaining the center points with higher confidence in the candidate boxes. Neighborhood merging is performed on the deduplicated candidate box center coordinates, aggregating center points falling in the same spatial neighborhood into a single representative center point, and determining the position of the representative center point by weighting the candidate box size within the neighborhood, while retaining the scale level mark corresponding to the representative center point. The representative center points are arranged in order of frame number and scale level mark is added to form center coordinate entries, and the center coordinate entries are summarized by frame number to generate a center coordinate sequence.
[0051] It should be noted that the spatial proximity of the center point is determined by the pixel plane distance between the center coordinates of the candidate boxes. When the center coordinates of the candidate boxes fall into the same neighborhood range, they are judged as duplicate center points, and only the center coordinates of the candidate boxes with higher confidence are retained.
[0052] S3.2: Perform density aggregation on the center coordinate sequence to obtain the target cluster, and perform outlier center point removal verification within the target cluster to generate the cluster region bounding box; Specifically, the center coordinate sequence is traversed by frame number, and center coordinate entries in adjacent frames at the same time are aggregated according to the spatial proximity of the center points. Interconnected center coordinate entries are merged into target clusters, and the center range and number of points of the target clusters are counted. Outlier center point removal verification is performed within the target clusters. Center coordinate entries that deviate from the center range of the target cluster and cannot form a connection with most center coordinate entries are removed, and the minimum bounding range of the target cluster is extracted from the retained center coordinate entries. The minimum bounding range of the target cluster is converted into a rectangular boundary and a frame number association key is attached to generate the clustered region box.
[0053] It should be noted that the target cluster center range is the boundary area used to characterize the spatial distribution coverage of all center coordinate entries within the target cluster in the aerial video frame coordinate system.
[0054] S3.3: Perform boundary expansion and center fill scaling on the clustered region box, obtain the clipping window, and perform out-of-bounds backoff and minimum clipping size padding, while clipping it into a clustered clipping frame.
[0055] Specifically, the boundaries of the clustered region box are expanded according to the frame number. The four sides of the clustered region box are expanded outward according to the target scale margin given by the candidate target pixel scale range to cover the outer edge of the dense small targets adjacent to the clustered region box. Center filling scale scaling is performed at the center position of the clustered region box. The cropping ratio of the clustered region box is adjusted (e.g., example 1:1 or 4:3) and a center buffer band is reserved in the cropping area to form a cropping window. The cropping window is backed up to the effective area boundary of the distortion correction area. At the same time, the minimum cropping size is padded to meet the input size constraint (e.g., not less than 256×256 in the example). The clustered cropped frame is obtained by cropping according to the frame number and the range of the cropping window in the aerial video frame coordinate system.
[0056] S4: Based on the aggregated cropped frames and the corresponding aerial video frames, construct multi-scale features, and combine them with the pixel scale range of candidate targets to perform scale-prior-driven attention routing and orchestration, generating cross-stream gating weights and attention features. S4.1: Locate the aerial video frame in the aggregated cropping frame, convert the cropping window coordinates to the aerial video frame coordinate system, and establish cross-stream alignment mapping entries; Specifically, in the aggregated cropping frame, the corresponding aerial video frame is located based on the frame sequence number association key. The pixel coordinates of the cropping window in the coordinate system of the aggregated cropping frame are then converted according to the positional relationship of the cropping window in the coordinate system of the aerial video frame. The coordinate conversion includes backfilling the offset of the upper left corner of the cropping window and backfilling the cropping scaling factor, so that any pixel position in the aggregated cropping frame can be mapped to the corresponding pixel position in the aerial video frame. The effective pixel range within the boundary of the distortion correction effective area is marked for both the aggregated cropping frame and the aerial video frame. Effective pixel constraint cropping is performed on the out-of-bounds mapping positions to form a one-to-one correspondence between the pixel positions of the aggregated cropping frame and the pixel positions of the aerial video frame. The pixel correspondence and the frame sequence number association key are encapsulated and organized to establish cross-stream alignment mapping entries.
[0057] S4.2: Perform shared weight feature extraction and multi-scale feature construction on the aggregated cropped frames and aerial video frames, and combine cross-stream alignment mapping entries to establish cross-stream index pairs at each scale level to generate cross-stream multi-scale alignment features; Specifically, shared weights are used for feature extraction and multi-scale feature construction of aggregated cropped frames and aerial video frames. The aggregated cropped frames and aerial video frames are respectively fed into the same parameter-configured convolutional feature extraction path to output basic feature maps. Downsampling and cross-layer fusion are performed on the basic feature maps according to the scale level to form multi-scale features. According to the cross-stream alignment mapping entries, the correspondence between the pixel positions of the aggregated cropped frames and the pixel positions of the aerial video frames is mapped to each scale level. The pixel coordinates are converted into feature coordinates according to the stride ratio of the scale level, and cross-stream index pairs are established for each scale level. The corresponding positions of the multi-scale features of the aggregated cropped frames and the multi-scale features of the aerial video frames are read according to the cross-stream index pairs. The corresponding position features are paired and organized according to the scale level and frame sequence association keys are added to generate cross-stream multi-scale aligned features.
[0058] It should be noted that shared weights refer to the use of the same set of learnable parameters in the feature extraction and multi-scale feature construction process of aggregated cropped frames and aerial video frames, so that the two output features are in a consistent feature representation space, which facilitates cross-stream alignment.
[0059] Scale level refers to the feature resolution level divided in multi-scale feature construction, which is used to express the spatial details of large and small objects simultaneously (e.g., 1 / 4, 1 / 8, and 1 / 16 resolution levels).
[0060] The cross-stream multi-scale alignment features include aggregated cropped frame multi-scale features and aerial video frame multi-scale features organized by frame sequence association keys and paired one-to-one by cross-stream index pairs at each scale level, as well as scale level markers and cross-stream index pair positioning information used to identify the pairing source.
[0061] S4.3: Combine cross-stream multi-scale alignment features with the pixel scale range of candidate targets, and perform dynamic scale-level partitioning to obtain an attention route orchestration list and a lightweight attention orchestration list; Specifically, the cross-stream multi-scale alignment features are expanded by frame number and scale level, and the feature resolution corresponding to the scale level is converted into a pixel scale reference table, so that each scale level can be mapped to the pixel scale range of the aerial video frame. The candidate target pixel scale interval is matched with the pixel scale reference table, and the matching result is used for dynamic division of scale levels. The scale level with higher overlap with the candidate target pixel scale interval is divided into the primary attention scale level, and the scale level with lower overlap with the candidate target pixel scale interval but can provide context is divided into the secondary attention scale level. Cross-stream indexes are registered layer by layer according to the primary attention scale level to generate an attention routing orchestration list for the range and cross-stream multi-scale alignment feature entries. Cross-stream indexes are registered according to the secondary attention scale level to generate a lightweight attention orchestration list for the range and cross-stream multi-scale alignment feature entries.
[0062] It should be noted that the scale level is dynamically divided based on the interval matching results between the candidate target pixel scale interval and the pixel scale reference table. The scale level with higher overlap with the candidate target pixel scale interval is divided into the primary scale level, and the scale level with lower overlap but can provide context is divided into the secondary scale level.
[0063] S4.4: Based on the attention routing orchestration list and the lightweight attention orchestration list, perform scale-level cross-stream attention enhancement to generate cross-stream gating weights and attention features.
[0064] Specifically, the cross-stream index pair range of the cross-stream multi-scale alignment feature is located layer by layer according to the primary attention scale level. The similarity response between the aggregated cropped frame features and the aerial video frame features within the cross-stream index pair range is obtained and an attention weight distribution is formed. The attention weight distribution is applied to the cross-stream multi-scale alignment feature to enhance the fine-grained response corresponding to the scale range of the candidate target pixels and suppress the scale mismatch response. According to the lightweight attention orchestration list, the cross-stream index pair range is located according to the secondary attention scale level. The attention weight distribution transformation of the cross-stream multi-scale alignment feature at sparse positions is performed and the cross-stream attention enhancement is completed to supplement the context consistency. The attention weight distributions of the primary attention scale level and the secondary attention scale level are converged according to the scale level and converted into cross-stream gating weights (for example, the example assigns a higher gating ratio at the primary attention scale level). The cross-stream multi-scale alignment feature after cross-stream attention enhancement is converged according to the scale level into attention features, generating cross-stream gating weights and attention features.
[0065] It should be noted that the similarity response is defined as the normalized inner product similarity between the clustered cropped frame feature vector and the aerial video frame feature vector at the same spatial corresponding position within the cross-stream index pair range, under the same feature channel aperture. It is used to characterize the matching strength of the two types of features at that position (e.g., the example is normalized to 0.00–1.00).
[0066] S5: The clustered region bounding box and the cross-flow gating weights are fused using attention features to obtain real-time detection bounding boxes. Overlapping conflict resolution and non-maximum suppression are then performed to generate an aerial target detection result set.
[0067] S5.1: Locate the coverage area of the clustered region box based on the cross-flow gating weights and attention features, map it to each scale level, obtain the clustered region mask, and expand the cross-flow gating weights into a gating fusion constraint list; Specifically, the pixel boundaries of the clustered region bounding box are determined by the coverage area of the clustered region bounding box in the coordinate system of the aerial video frame. The coverage area of the clustered region bounding box is converted into feature coordinate boundaries according to the stride ratio of each scale level. The covered and uncovered positions are marked at each scale level of the attention feature to form a consistent clustered region mask at each scale level. The cross-stream gating weights are expanded according to the scale level. The value range and effective position of the cross-stream gating weights at the primary and secondary attention scale levels are associated with the covered and uncovered positions of the clustered region mask. The gating constraints are organized by frame number into a gating fusion constraint list that can directly constrain the fusion ratio.
[0068] It should be noted that the gating fusion constraint list records at least the scale level, gating ratio, gating weight, and clustering region mask index. The scale level that the scale prior vector falls into is mapped to a multi-scale level. The falling level is the primary focus scale level, the adjacent level is the secondary focus level, and the others are low response levels.
[0069] S5.2: Based on the gating fusion constraint list, dynamically perform gating fusion at mask-covered and non-covered locations in the clustered area to generate a real-time detection box candidate list; Specifically, based on the gating fusion constraint list, the clustering region mask is used to distinguish between the covered and uncovered locations. At the covered locations, the attention features are combined using the cross-stream gating weights specified in the gating fusion constraint list to increase the proportion of clustered cropped frame features. At the uncovered locations, the attention features are combined using the cross-stream gating weights specified in the gating fusion constraint list to increase the proportion of aerial video frame features. The fusion results are then aggregated into cross-stream fusion features at different scale levels. These cross-stream fusion features are input into the detection head for candidate box regression and candidate box confidence prediction, outputting real-time detection box candidate entries. The candidate box positions, sizes, and confidence scores in these real-time detection box candidate entries are then organized by frame number to form a real-time detection box candidate entry table.
[0070] Figure 3This graph is used to characterize the correlation between "cross-stream gating weights" and the improvement in clustered region detection performance, supporting the beneficial effect of "scale-prior-driven attention routing orchestration to achieve cross-stream gating feature fusion". The horizontal axis represents the mean cross-stream gating weight in the coverage area, reflecting the intensity of the adjustment of the cross-stream gating weight on the fusion ratio of clustered cropped frame features and aerial video frame features within the mask coverage position of the clustered region. The vertical axis represents the decrease in accuracy in the clustered region (A0B0−A1B1), indicating the magnitude of the accuracy difference between the comparison method and the target method in the clustered region. The larger the value, the more significantly the target method suppresses the "accuracy loss caused by missed detection / false merging" in the clustered region. Each scatter point in the graph corresponds to the statistical results of a set of test samples, and the solid line represents the linear trend, used to show the overall consistency between the change in gating weights and the improvement in accuracy difference. As can be seen from the scatter point distribution and trend line, when the mean cross-stream gating weight in the coverage area increases, the improvement in accuracy difference in the clustered region increases overall, indicating that the cross-stream gating weight can effectively enhance the sensitivity of clustered region detection and suppress false merging of dense targets.
[0071] S5.3: Perform binning on the candidate entries table of real-time detection boxes, obtain a list of candidate boxes by category, and perform overlapping conflict resolution and non-maximum suppression to generate an aerial target detection result set.
[0072] Furthermore, the real-time detection box candidate list is traversed by frame number and binned according to category identifier. Real-time detection box candidate entries corresponding to the same category identifier are aggregated into a category-binded candidate box list, and the candidate box position, candidate box size, and candidate box confidence are retained for subsequent conflict resolution sorting. Within the category-binded candidate box list, the candidate boxes are sorted by confidence, and overlapping conflict resolution is performed on candidate boxes with overlapping positions. The retained results of overlapping conflict resolution are used as non-maximum suppression input entries, and non-maximum suppression is performed on each candidate box of the same category to remove redundant candidate boxes. The retained candidate boxes of each category after non-maximum suppression are summarized by frame number and encapsulated into detection output entries to generate an aerial target detection result set.
[0073] It should be noted that overlap conflict resolution involves determining the overlap ratio of candidate box positions pairwise within the same category and retaining the candidate boxes with the highest confidence scores from highest to lowest. The remaining candidate boxes whose overlap ratio with the retained candidate boxes exceeds the overlap determination criteria are marked as conflict rejections. The retention result refers to the set of candidate box entries remaining after conflict rejection and is used as non-maximum suppression input entries.
[0074] Figure 4This diagram illustrates the impact of changes in the minimum spacing (dmin) of dense targets (in pixels) on the false merging rate of dense targets in dense target scenarios, and compares the trends of different method combinations (A0B0, A1B0, A0B1, A1B1). The horizontal axis represents the minimum spacing (dmin) of dense targets, and the vertical axis represents the false merging rate, reflecting the probability change of "merging multiple real targets into one detection box" during the candidate box competition retention, overlap conflict resolution, and non-maximum suppression processes for adjacent targets within the clustered region. The main image uses a red dashed rectangle to mark the key window in the middle, and a double-headed arrow to indicate the window range; the enlarged local image below provides a proportional comparison of the curves within the window, with a dashed line marking the point where the feature point dmin=8 and the Δ value of the point of maximum difference (example Δ=0.008) to visually show the degree of separation of false merging rates of different methods within the dense spacing range. The overall trend shows that when dmin is in the dense range, the differences between methods are more sensitive and can be used to quantify the improvement effect of "suppressing false merging of dense targets," indicating that: The red dashed rectangle in the main image represents the magnified window, with double-headed arrows indicating the window's range. The image below shows a magnified comparison of the window area, with dashed lines marking feature points. Dashed lines with arrowheads indicate the points of greatest difference between the two curves, and the A value is labeled.
[0075] This embodiment also provides a computer device applicable to the aerial target detection method based on the attention mechanism, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the aerial target detection method based on the attention mechanism proposed in the above embodiment.
[0076] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0077] This embodiment also provides a storage medium storing a computer program, which, when executed by a processor, implements the aerial target detection method based on the attention mechanism proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0078] In summary, this invention achieves quantitative modeling of texture and edge density through scale prior vectors, which guides scale selection in image detection and improves the recall rate of multi-scale targets; and achieves cross-stream gating feature fusion through scale prior-driven attention routing orchestration, which enhances the image detection sensitivity of clustered regions, reduces the false negative rate, and suppresses the false merging of dense targets.
[0079] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. An aerial target detection method based on an attention mechanism, characterized in that: include, Aerial video frames are acquired, and resolution is unified, distortion is corrected, and brightness is normalized. Texture density and edge density are statistically analyzed. At the same time, the pixel scale range of candidate targets is extracted, and scale prior vectors are generated. A single-stage detection network is used to push the scale prior vector level by level to obtain a multi-scale candidate box set, and high-confidence candidate boxes are selected by combining the pixel scale range of the candidate target. Extract the center coordinate sequence from the high-confidence candidate box, perform density clustering to obtain the clustered region box, and perform boundary expansion and center filling scale scaling to generate clustered cropped frames; Based on the aggregated cropped frames and the corresponding aerial video frames, multi-scale features are constructed, and combined with the pixel scale range of candidate targets, scale-prior-driven attention routing is performed to generate cross-stream gating weights and attention features. The clustered region bounding boxes and cross-flow gating weights are fused using attention features to obtain real-time detection boxes. Overlap and conflict resolution and non-maximum suppression are then performed to generate an aerial target detection result set.
2. The aerial target detection method based on attention mechanism as described in claim 1, characterized in that: The steps for acquiring aerial video frames and performing resolution unification, distortion correction, and brightness normalization are as follows. Aerial video frames are captured and frame numbers are added. A pixel-raster mapping relationship is established by unifying the resolution. Simultaneously, distortion correction is performed and written to the boundary of the effective distortion correction area to generate a geometrically corrected frame sequence. Luminance normalization is performed on the geometrically corrected frame sequence, and luminance normalization parameter tags and luminance histogram summaries are written to generate a luminance normalized frame sequence.
3. The aerial target detection method based on attention mechanism as described in claim 2, characterized in that: The steps for generating the scale prior vector are as follows: The brightness-normalized frame sequence is divided into grids, local texture response and edge response are extracted, and texture density statistics set and edge density statistics set are generated. The texture density statistics set and the edge density statistics set are combined according to the pixel raster mapping relationship, and the scale range of candidate target pixels is extracted to generate a scale prior vector.
4. The aerial target detection method based on attention mechanism as described in claim 3, characterized in that: The step of using a single-stage detection network to progressively push the scale prior vector to obtain a multi-scale candidate box set is as follows: The aerial video frames are located based on the frame number in the scale prior vector, and effective region cropping and edge filling are performed. At the same time, scale levels are divided and a detection input arrangement list is generated. Based on the detection input orchestration list, aerial video frames are pushed one by one through a single-stage detection network, and the candidate box positions, candidate box sizes and candidate box confidence scores are aggregated to generate a multi-scale candidate box set.
5. The aerial target detection method based on attention mechanism as described in claim 4, characterized in that: The steps for selecting highly reliable candidate boxes by combining the pixel scale range of candidate targets are as follows: Perform interval consistency checks on the multi-scale candidate box set and the pixel scale range of the candidate targets, and perform segmented threshold determination and local alignment verification on the confidence of the candidate boxes to generate candidate shortlisted boxes; The candidate shortlist is merged for duplicate candidate boxes and competition retention is performed for overlapping candidate boxes. A list of candidate box entries is obtained and backfilled for scale consistency to generate highly reliable candidate boxes.
6. The aerial target detection method based on attention mechanism as described in claim 5, characterized in that: The steps for generating the aggregated cropped frame are as follows. The high-confidence candidate boxes are deduplicated by removing the center coordinates of the candidate boxes and merging their neighborhoods. The center coordinate sequence is generated by writing the scale level marker according to the frame number. Density clustering is performed on the center coordinate sequence to obtain the target cluster, and outlier center point removal verification is performed within the target cluster to generate the cluster region bounding box; Perform boundary expansion and center fill scaling on the clustered region box to obtain the clipping window, and perform out-of-bounds back and minimum clipping size padding, while clipping it into a clustered clipping frame.
7. The aerial target detection method based on attention mechanism as described in claim 6, characterized in that: The steps for generating cross-stream gating weights and attention features are as follows: Locate aerial video frames within the aggregated cropping frames, convert the cropping window coordinates to the aerial video frame coordinate system, and establish cross-stream alignment mapping entries. We perform shared weight feature extraction and multi-scale feature construction on aggregated cropped frames and aerial video frames, and combine cross-stream alignment mapping entries to establish cross-stream index pairs at each scale level, generating cross-stream multi-scale alignment features. The cross-stream multi-scale alignment features are combined with the pixel scale range of candidate targets, and the scale level is dynamically divided to obtain the attention route orchestration list and the lightweight attention orchestration list. Based on the attention routing orchestration list and the lightweight attention orchestration list, scale-level cross-stream attention enhancement is performed to generate cross-stream gating weights and attention features.
8. The aerial target detection method based on attention mechanism as described in claim 7, characterized in that: The steps for generating the aerial target detection result set are as follows: The coverage area of the clustered region is located based on the cross-flow gating weights and attention features, and mapped to each scale level to obtain the clustered region mask. The cross-flow gating weights are then expanded into a gating fusion constraint list. Based on the gating fusion constraint list, gating fusion is dynamically performed at mask-covered and non-covered locations in the clustered area to generate a real-time detection box candidate list; The candidate entries table of real-time detection boxes is sorted into bins of the same type to obtain a list of candidate boxes by category. Overlapping conflict resolution and non-maximum suppression are then performed to generate an aerial target detection result set.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the aerial target detection method based on the attention mechanism as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the aerial target detection method based on the attention mechanism as described in any one of claims 1 to 8.