A target detection method based on a multi-branch global-local attention network

CN122906352APending Publication Date: 2026-10-13WUXI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611382236.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-08
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0013]发明目的:针对现有目标检测方法在复杂成像环境下普遍存在的方向建模能力不足、注意力机制受噪声干扰、浅层高分辨率细节流失以及高精度模型参数量大难以工程部署等共性问题,本发明提出一种基于多分支全局-局部注意力网络的目标检测方法

Benefits of technology

[0054]有益效果:(1)显著提升复杂场景下的检测精度与鲁棒性。本发明在主干特征提取网络中设置轻量化局部-全局注意力模块,通过点注意力、局部注意力、中程注意力和分阶段注意力机制四路并行分支实现层次化协同特征建模,各阶段根据特征图分辨率差异自适应选用不同复杂度的注意力算子。以SAR船舰检测为例,该网络能有效抑制相干斑噪声背景响应,增强对微弱小目标的上下文感知能力;推广至其他具有弱特征、强噪声特点的检测任务(如航拍车辆、无人机、行人等),同样预期可获得特征增强收益。在编码器特征融合网络中设计了轻量化各向异性增强型层聚合模块(LAE-ELAN),融合廉价特征生成、结构重参数化卷积与各向异性条形卷积,增强对任意朝向细长目标的方向感知能力。在编码器特征融合网络前端设计了浅层增益路径(SDAP),将高分辨率浅层特征直接注入第一融合尺度,通过通道间竞争机制隐式抑制噪声冗余响应。在SAR船舰检测这一典型应用场景下,本发明在HRSID公开数据集上AP0.5-0.95、APS和AP0.75分别达到71.6%、72.6%和81.7%,较基线模型分别提升2.73%、2.69%和2.77%;在SSDD数据集上AP0.5和AP0.75分别达到96.6%和89.0%,核心指标均优于RT-DETR、D-FINE、YOLOv11等主流模型。在近岸复杂背景和目标密集两类典型工程场景的专项测试中,本发明的漏检率与误检率显著低于对比方法,特征响应热力图也表明本发明对目标的聚焦能力更强、背景抑制效果更优。上述性能优势可预期迁移至其他复杂背景下的目标检测任务。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122906352A_ABST
    Figure CN122906352A_ABST
Patent Text Reader

Abstract

The application provides a target detection method based on a multi-branch global-local attention network, comprising the following steps: step 1, acquiring and preprocessing an image dataset, and dividing the image dataset into a training set, a verification set and a test set; step 2, building the network, including a backbone feature extraction network, an encoder feature fusion network, a shallow gain path and a decoding detection head; the shallow gain path aligns P2 / 4 features to P3 / 8 and splices the P3 / 8 features with stage 2 backbone features, and the encoder feature fusion network sends the multi-scale features after fusion into the decoding detection head; step 3, training the model by using the training set and updating parameters; and step 4, inputting the test set and outputting a detection result; in the application, the miss detection rate and the false detection rate are significantly reduced in a near-shore complex background and a dense target scene, the feature focusing and background suppression capability is strong, and the application is suitable for various complex background detection tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image target detection technology, and in particular to a target detection method based on a multi-branch global-local attention network. Background Technology

[0002] Object detection aims to automatically identify predefined categories of target instances in images or videos and determine their spatial locations. It is a fundamental supporting technology for many applications such as autonomous driving, intelligent security, remote sensing interpretation, and industrial quality inspection. In recent years, deep learning architectures, represented by convolutional neural networks and Transformers, have driven continuous improvements in detection performance: two-stage detectors achieve high accuracy through a cascaded strategy of region candidate and fine classification; single-stage detectors balance speed and accuracy with an end-to-end dense prediction paradigm. Among them, the YOLO series and DETR and its variants represent the latest advancements in the CNN and Transformer approaches, respectively. However, when target imaging conditions degrade to extreme scenarios such as strong noise, low contrast, small targets, and variable shapes, the detection accuracy and robustness of existing methods still have significant shortcomings.

[0003] Synthetic Aperture Radar (SAR) target detection is a typical example of the aforementioned extreme conditions. SAR transmits electromagnetic pulses to the ground and receives the scattered echoes through a radar system mounted on a high-altitude platform. It utilizes the platform's motion to synthesize an equivalent large-aperture antenna to achieve high-resolution imaging, unaffected by illumination or cloud cover, giving it irreplaceable advantages in fields such as marine monitoring, maritime traffic control, and military reconnaissance. However, the inherent superposition effect of scattered fields in the SAR coherent imaging mechanism inevitably introduces speckle noise. In addition, the dynamic changes in the marine environment cause continuous shifts in the statistical characteristics of background clutter, and the target scattering characteristics are easily submerged by strong clutter in complex near-shore scenes. Therefore, high-precision target detection using SAR images still faces significant challenges.

[0004] In SAR image target detection, speckle noise and target echoes are highly superimposed in the spectral domain. Traditional spatial domain filtering, while suppressing noise, blurs target edges, further degrading the scattering characteristics of small targets. The angular reflection structures of port shorelines, breakwaters, and near-shore buildings can generate false responses with intensity comparable to or even stronger than the target, leading to a high degree of overlap between the statistical distribution of background clutter and target scattering, increasing the false alarm rate. Small targets typically occupy a very low percentage of pixels in an image; after multiple downsampling by deep feature extraction networks, their spatial response tends to disappear. Existing multi-scale detection frameworks have systematic deficiencies in recall and localization accuracy for such targets. The aforementioned speckle noise, complex near-shore backgrounds, and weak scattering characteristics of small targets collectively constitute the core challenges that distinguish SAR image target detection from optical image detection, and are also the main technical challenges that this invention aims to overcome. This scenario vividly illustrates the core challenges of "weak features, strong noise, and multi-scale" in general target detection.

[0005] Traditional SAR target detection methods largely rely on statistical modeling and threshold decision-making, among which Constant False Alarm Rate (CFAR) and its improved methods are widely used due to their simplicity, ease of implementation, and strong interpretability. However, changes in the marine environment can lead to deviations in clutter statistical characteristics, significantly affecting CFAR detection performance. To enhance the adaptability of traditional methods in complex backgrounds, researchers have proposed improved methods such as the Copula-based multi-feature fusion CFAR framework, which can improve robustness, but still cannot fundamentally solve the problems of weak features and high false alarm rates for small-scale targets.

[0006] In recent years, deep learning methods have been introduced into the field of SAR target detection. Two-stage methods, represented by R-CNN and Faster R-CNN, divide the detection process into two stages: candidate region generation and classification regression. They have high detection accuracy but large inference latency. Single-stage methods, represented by SSD and YOLO series, perform dense regression prediction directly on the feature map, which significantly reduces inference latency while maintaining good detection accuracy. In the end-to-end Transformer detector field, DETR achieved anchorless end-to-end detection under the ensemble prediction paradigm for the first time, but the high computational complexity and slow convergence of global attention limited its engineering practicality. Deformable DETR reduced the complexity to linear order of magnitude with sparse deformable attention and naturally supports multi-scale joint modeling. RT-DETR achieved real-time inference speed comparable to the YOLO series for the first time through efficient hybrid encoders and uncertainty-minimum query selection. D-FINE redefined bounding box regression as probability distribution modeling with a fine-grained distribution refinement strategy, further improving localization accuracy. DEIM systematically improved the training sample matching mechanism with a dense one-to-one matching strategy and matching-aware loss, achieving state-of-the-art performance on multiple real-time detection benchmarks, especially in small targets and dense scenes.

[0007] Despite the significant progress made by the aforementioned methods, existing detection frameworks still suffer from the following systemic algorithmic bottlenecks in object detection tasks under complex scenarios. These problems are also prevalent in harsh scenarios for general object detection:

[0008] (1) The fixed local receptive field of the convolutional kernel limits the ability to model long-range dependencies and sense orientation. CNN methods are difficult to effectively model long-range dependencies. In SAR images, the aspect ratio of ship hulls is usually between 3:1 and 10:1 and the orientation is arbitrary. Square convolutional kernels have inherent limitations in extracting rotation-invariant features and need to indirectly capture orientation features through multi-layer stacking, resulting in low parameter utilization efficiency. Similarly, in scenarios such as aerial remote sensing and security monitoring, slender targets with arbitrary orientations also face the problem of insufficient orientation modeling.

[0009] (2) Noise interferes with the discriminative ability of the global attention mechanism. Speckle noise is randomly distributed in space, which interferes with the global calculation of multi-head self-attention and weakens the discriminative power of attention weights; during the multi-scale feature fusion process, the competition between noise and effective signals leads to a decrease in fusion quality. Similarly, in low-quality images such as haze, underwater, and night vision, background noise and interference also restrict the effectiveness of the attention mechanism.

[0010] (3) Multiple downsampling leads to the loss of shallow high-resolution details. After multiple downsampling by the backbone feature extraction network, the shallow high-resolution spatial response tends to disappear, and the fine edge response of small targets is significantly attenuated. Existing multi-scale detection frameworks usually use P3 / 8 as the shallowest input scale of the encoder. High-resolution shallow features must be downsampled multiple times before entering the network. This process leads to a significant attenuation of the fine edge response of small targets, resulting in insufficient utilization efficiency of shallow details. This problem also exists widely in scenarios such as aerial photography of small targets and remote sensing of weak targets.

[0011] (4) High precision and lightweight are difficult to achieve simultaneously. Some high-precision models rely on complex module stacking, resulting in a large number of parameters and high computational overhead. This makes it difficult to achieve real-time detection on resource-constrained edge devices (such as spaceborne, airborne, and mobile terminals), and fails to meet the requirements of engineering deployment efficiency.

[0012] In summary, existing target detection methods face common problems in complex imaging environments, including insufficient orientation modeling capabilities, noise interference affecting attention discrimination, loss of shallow details, and poor balance between accuracy and efficiency. Therefore, a general target detection method is needed that can effectively enhance orientation awareness, improve the robustness of the attention mechanism, fully utilize high-resolution shallow details, and possess lightweight characteristics. This method should be particularly suitable for domains with similar challenges, such as SAR images, aerial images, and underwater images. Summary of the Invention

[0013] Purpose of the invention: To address the common problems of existing target detection methods in complex imaging environments, such as insufficient directional modeling capabilities, noise interference with attention mechanisms, loss of shallow high-resolution details, and large number of parameters in high-precision models that make them difficult to deploy in engineering, this invention proposes a target detection method based on a multi-branch global-local attention network.

[0014] The purpose of this invention is:

[0015] (1) By constructing a lightweight local-global attention multi-branch network as the backbone feature extraction network, hierarchical collaborative feature modeling is achieved at four receptive field levels: point-level, local, mid-range, and global. At each stage, attention operators of different complexities are adaptively selected according to the differences in feature map resolution. While maintaining a balance between perception range and computational overhead, a short-circuit gradient backpropagation path is constructed using a multi-branch parallel structure to alleviate the gradient vanishing problem of deep networks, effectively suppressing background clutter response and enhancing the contextual awareness of weak and small targets. This method is particularly suitable for ship target detection in SAR images, but is not limited to this.

[0016] (2) By proposing a lightweight anisotropic enhanced layer aggregation module, which integrates inexpensive feature generation, structural reparameterized convolution and independent weight anisotropic strip convolution, the module enhances the ability to perceive direction and express features of arbitrarily oriented slender target structures while reducing redundant computation, thereby achieving synergistic optimization of accuracy and lightweight.

[0017] (3) By proposing a shallow gain path, a parallel lightweight bypass enhancement branch is constructed at the front end of the encoder feature fusion network. High-resolution shallow features are directly injected into the first feature fusion scale after scale alignment. By modeling the inter-channel dependency through convolution, noise interference is suppressed and weak target response is enhanced, effectively making up for the problem of shallow detail loss in traditional multi-scale frameworks.

[0018] (4) Achieving an organic unity between detection accuracy and model lightweighting, this invention has the characteristics of low parameter quantity and low computational overhead while maintaining high detection performance, meeting the real-time detection needs of resource-constrained edge platforms such as spaceborne, airborne, and mobile terminals, and providing efficient and reliable technical support for practical engineering scenarios such as maritime supervision, port intelligent monitoring, and security inspection.

[0019] The method includes the following steps:

[0020] Step 1: Obtain the image dataset, which contains the original images and their corresponding target labels; after preprocessing, the image dataset is divided into a training set, a validation set, and a test set according to a set ratio.

[0021] Step 2: Construct a Multi-branch Global-LocalAttention Network (MGLA-Net). The MGLA-Net includes a backbone feature extraction network, an encoder feature fusion network, a Shallow Detail Amplification Path (SDAP), and a decoding detection head. The backbone feature extraction network includes a Lightweight Local-Global Attention Module (LLGAM), and the encoder feature fusion network includes a Lightweight Anisotropic Enhanced ELAN (LAE-ELAN).

[0022] Step 3: Input the training set into the multi-branch global-local attention network MGLA-Net built in Step 2 for training, calculate the loss function and perform backpropagation, update the network parameters, and obtain the optimal parameter model;

[0023] Step 4: Input the test set into the optimal parameter model trained in Step 3, and output the accurate detection result map of the object detection.

[0024] Step 2 includes:

[0025] Step 2.1: Construct the backbone feature extraction network; the backbone feature extraction network includes a lightweight local-global attention module LLGAM, a downsampling convolution CBS, and an attention-based intra-scale feature interaction module (AIFI) for intra-scale enhancement of P5 / 32 deep features; when used for downsampling, the stride of the 1×1 convolution is 2, and the stride is 1 in other cases.

[0026] The lightweight local-global attention module LLGAM has four components.

[0027] The backbone feature extraction network adopts a four-level feature extraction structure: stage 1 is located at the P2 / 4 scale, stage 2 is located at the P3 / 8 scale, stage 3 is located at the P4 / 16 scale, and stage 4 is located at the P5 / 32 scale; stages 1 to 4 represent the first to fourth level feature extraction stages, respectively.

[0028] Step 2.2: Construct the encoder feature fusion network; The encoder feature fusion network performs multi-level fusion of P3 / 8, P4 / 16, and P5 / 32 three-scale features through a lightweight anisotropic enhancement layer aggregation module; The P5 / 32 deep features are first enhanced intra-scale by the attention-based intra-scale feature interaction module AIFI, and then aggregated step by step through a bidirectional feature pyramid path from top to bottom and from bottom to top, so as to achieve efficient flow of cross-scale information and enhanced direction perception;

[0029] Step 2.3: Construct a shallow gain path (SDAP); the shallow gain path (SDAP) is a lightweight parallel bypass of the encoder feature fusion network front end;

[0030] The shallow gain path takes the P2 / 4 shallow features after initial downsampling by the backbone feature extraction network as input, aligns them to P3 / 8 through a 3×3 depthwise convolution with a stride of 2, concatenates them with the backbone features of stage 2, and then forms the first fusion scale of the encoder feature fusion network through a 1×1 convolution. The encoder feature fusion network then fuses the P3 / 8, P4 / 16, and P5 / 32 features through a lightweight anisotropic enhancement layer aggregation module before sending them to the decoding detection head. P2 / 4, P3 / 8, P4 / 16, and P5 / 32 represent feature scales with strides of 4, 8, 16, and 32 relative to the input space, respectively, and the height and width of the feature maps are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the input, respectively.

[0031] The shallow gain path constructs a lightweight parallel bypass enhancement branch at the front end of the encoder feature fusion network. By modeling the inter-channel dependencies through convolution, it adaptively enhances the discriminative shallow feature channels while suppressing redundant channel responses introduced by speckle noise.

[0032] In this invention, "Stage 2 backbone features" specifically refers to the P3 / 8 scale features output by Stage 2 of the backbone feature extraction network; Stage 3 backbone features and Stage 4 backbone features refer to the P4 / 16 scale features and P5 / 32 scale features output by the corresponding stages, respectively.

[0033] Step 2.4: Construct the decoding detection head; The decoding detection head adopts an end-to-end Transformer decoder. The multi-scale fusion features finally output by the encoder feature fusion network are sent to the Transformer decoder after being selected by the least uncertainty query, and the classification and localization of the target are completed by combining the dense one-to-one matching strategy.

[0034] Step 2.1 includes the following forward propagation process of the backbone feature extraction network: An image of size 640×640×3 is input, first undergoes two stages of downsampling convolution (CBS) to achieve initial downsampling, resulting in a P2 / 4 scale feature map; the P2 / 4 scale feature map is processed by the lightweight local-global attention module LLGAM in stage 1, then adjusted to the P3 / 8 scale by downsampling convolution (CBS), and further processed by the lightweight local-global attention module LLGAM in stage 2 to obtain the P3 / 8 scale output; the P3 / 8 scale output is adjusted to the P4 / 16 scale by downsampling convolution (CBS), and further processed by the lightweight local-global attention module LLGAM in stage 3 to obtain the P4 / 16 scale output; the P4 / 16 scale output is adjusted to the P5 / 32 scale by downsampling convolution (CBS), and further processed by the lightweight local-global attention module LLGAM and the attention-based intra-scale feature interaction module AIFI in stage 4 to obtain the P5 / 32 scale output.

[0035] In step 2.1, the lightweight local-global attention module LLGAM is specifically implemented as follows: the input features of the lightweight local-global attention module LLGAM are transformed into intermediate features through 1×1 convolution, and based on the intermediate features, 1×1 convolutional paths, depthwise separable convolutional paths, direct paths, and cascaded local-global attention unit paths are formed, with the outputs of each path participating in subsequent fusion; wherein, the cascaded local-global attention unit (LLGA) is a component of the lightweight local-global attention module LLGAM;

[0036] Inside the lightweight local-global attention module LLGAM, the cascaded local-global attention unit divides the input feature channel into four subsets, which are processed independently through four parallel branches: point attention, local attention, mid-range attention, and phased attention mechanism, to achieve hierarchical collaborative feature modeling from point level to local to global.

[0037] The cascaded local-global attention unit also includes a multilayer perceptron branch. In the multilayer perceptron branch, the input channel is divided into a 1 / 4 channel computation subset and a 3 / 4 channel identity mapping subset through partial convolution. Convolution operation is performed only on the computation subset, and then the 1 / 4 channel and the 3 / 4 channel are concatenated to reduce the amount of computation while maintaining information transmission.

[0038] The input feature map is expanded to 2C channels through 1×1 convolution, forming four fixed paths: a 1×1 convolution path, a depthwise separable convolution path, a direct path, and a cascaded local-global attention unit path. The 1×1 convolution path performs channel compression through 1×1 convolution. The depthwise separable convolution path is processed by 1×1 convolution, depthwise convolution, and 1×1 convolution in sequence. The direct path and the cascaded local-global attention unit path are obtained by evenly dividing the 2C channel features along the channel dimension, and local-global attention units are cascaded on the cascaded local-global attention unit path.

[0039] The depthwise separable convolution path achieves lightweight local feature extraction through a depthwise separable convolution structure: the 1×1 convolution first performs linear recombination of information between channels, the depthwise convolution then performs spatial convolution on each channel of the input feature of the path to capture local structural texture, and finally the 1×1 convolution completes feature integration and dimensionality adjustment.

[0040] The cascaded local-global attention unit path employs a staged attention mechanism, progressively modeling different receptive field ranges to achieve hierarchical fusion of multi-scale contextual information. The output feature maps from four parallel branches—point attention, local attention, mid-range attention, and staged attention—are concatenated by channels and then fed into partial convolutions to selectively perform convolutions on a subset of 1 / 4 of the channels. These are followed by random discarding and batch normalization, and residual connections are used to obtain the locally-global collaboratively enhanced feature output. Finally, a 1×1 convolution path, a depthwise separable convolution path, a direct path, and a cascaded local-global attention unit are combined. The output of the metapath is concatenated through channels and then fused and restored in dimension by a 1×1 convolution. The result is added to the original input as a residual to obtain an enhanced feature map. The 1×1 convolution uses a 1×1 kernel to form intermediate features, perform channel transformation within the path, fuse features, and restore dimension. C is the number of channels in each fixed path, and 2C is the number of channels in the intermediate features. All 1×1 convolutions are set inside the lightweight local-global attention module (LLGAM). The depthwise separable convolutional paths and cascaded local-global attention unit paths are both components of the lightweight local-global attention module (LLGAM).

[0041] Step 2.2 includes: The specific implementation of the lightweight anisotropic enhancement layer aggregation module is as follows: the input features are formed into intermediate features through 1×1 convolution, and the intermediate features are evenly divided into direct path features and computation path features along the channel dimension, and the direct path features are directly retained; the structure reparameterization convolution adopts a 3×3 depthwise convolution branch, a 1×1 depthwise convolution branch and an identity mapping branch for parallel computation during the training phase, and the parameters of the three branches are equivalently merged into a single 3×3 depthwise convolution kernel during the inference phase; the computation path features are processed sequentially by structure reparameterization convolution, the first layer anisotropic strip convolution and the second layer anisotropic strip convolution; the first layer anisotropic strip convolution and the second layer anisotropic strip convolution are both processed by horizontal strips. Edge responses are extracted using horizontal and vertical bar convolution branches. The horizontal bar convolution branch uses a 1×k bar convolution kernel to extract horizontal edge responses, while the vertical bar convolution branch uses a k×1 bar convolution kernel to extract vertical edge responses. The outputs of the structure-reparameterized convolution, the first-layer anisotropic bar convolution, and the second-layer anisotropic bar convolution are used as features to be concatenated. The output of the second-layer anisotropic bar convolution is further processed by a 1×1 convolution to form end-refined features. The direct path features, the features to be concatenated, and the end-refined features are concatenated along the channel dimension and then fused and dimensionally adjusted by a 1×1 convolution to obtain the output features of the lightweight anisotropic enhanced layer aggregation module.

[0042] The input channels with a total number of channels, C, are divided into a direct path and a computation path, with the direct path being retained. Channel, Calculated path reception The channels; in the computation path, the outputs of the structure-reparameterized convolution and the outputs of the first and second anisotropic strip convolutions are: aisle;

[0043] The input feature map is first subjected to a 1×1 convolution to adjust the number of channels to the target number of channels, and then it is divided into a direct path and a computation path along the channel dimension. The direct path retains half of the channel features and directly participates in the subsequent aggregation.

[0044] In the computational path, features first undergo structurally reparameterized convolution. During the inference phase, the parameters of the 3×3 depthwise convolution branch, the 1×1 depthwise convolution branch, and the identity mapping branch are equivalently merged into a single 3×3 depthwise convolution kernel. Subsequently, features flow sequentially through the first and second layers of anisotropic strip convolution to achieve anisotropic modeling. The anisotropic strip convolution uses parallel deployment of horizontal and vertical strip convolution kernels to specifically extract slender structural information in the horizontal and vertical directions, respectively, and outputs the multi-directional responses after fusion. Finally, the through-path features, structurally reparameterized convolution output, the first and second layer anisotropic strip convolution outputs, and the final 1×1 convolution output are concatenated through channels, and then the 1×1 convolution completes information integration and dimensionality restoration. The enhanced feature map is output. In this embodiment, n=3, and the computation path is set up with two layers of anisotropic bar convolutions in sequence according to n-1. The two layers of anisotropic bar convolutions are the first layer of anisotropic bar convolution and the second layer of anisotropic bar convolution. The output of the first layer of anisotropic bar convolution, the output of the second layer of anisotropic bar convolution, the output of the structure reparameterization convolution, and the direct path feature are retained as features to be spliced. The second layer of anisotropic bar convolution is the last layer of the serial structure, and its output is also subjected to 1×1 convolution to form the end refined feature. The features to be spliced ​​and the end refined feature are spliced ​​together by channels and then restored to the target number of channels by 1×1 convolution. The anisotropic bar convolution is a component of the computation path of the lightweight anisotropic enhanced layer aggregation module.

[0045] In step 2.3, the shallow gain path SDAP specifically performs the following operations: In this embodiment, the P2 / 4 signal source of the shallow gain path is 32 channels, which is increased to 256 channels by 1×1 convolution, and then aligned with the P3 / 8 scale by 3×3 depth convolution with a stride of 2; after being concatenated with the stage 2 backbone features (i.e., the 128-channel P3 / 8 scale features output by stage 2) to form 384 channels, it is compressed to 256 channels by 1×1 convolution;

[0046] Scale-aligned downsampling: P2 / 4 shallow features are sequentially integrated and downsampled through convolution and 3×3 depth convolution;

[0047] Cross-layer feature stitching: The shallow alignment features obtained by downsampling are directly stitched with the stage 2 backbone features at the P3 / 8 scale in the channel dimension;

[0048] Convolutional Channel Fusion: The spliced ​​features are subjected to 1×1 convolution and batch normalization. The inter-channel dependency between shallow paths and trunk paths is modeled by cross-channel linear weighting, and the number of channels is adaptively compressed to a unified encoder feature dimension.

[0049] Step 3 includes: inputting the training set into the multi-branch global-local attention network MGLA-Net built in Step 2, adopting the training strategy of the detection Transformer framework with improved matching strategy DEIM (DETR with Improved Matching), and the loss function includes bounding box regression loss, classification loss and dense matching perception loss; after each round of training, the model performance is evaluated on the validation set, and the optimal model parameters on the validation set are saved as the best parameter model.

[0050] Step 4 includes: inputting the test set into the optimal parameter model trained in Step 3; the model performs forward inference to output predicted bounding boxes and confidence scores; and after post-processing, finally outputs the accurate detection result map of the object detection. Evaluation metrics include precision, recall, and AP. 0.5-0.95 AP 0.5 AP 0.75 and AP under different target areas S AP M AP L Where TP represents true positives, FP represents false positives, FN represents false negatives, and AP is the average precision for each class. 0.5-0.95 This represents the average precision across 10 thresholds, from 0.50 to 0.95, with a step size of 0.05; AP 0.5 and AP 0.75 These represent the average precision (AP) when the IoU thresholds are 0.50 and 0.75, respectively. S AP M and AP L These represent the average accuracy of small, medium, and large targets, respectively.

[0051] The present invention also provides an electronic device, including a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method.

[0052] The present invention also provides a storage medium storing a computer program or instructions that, when the computer program or instructions are run on a computer, execute the steps of the method described.

[0053] The method described can be applied to various image modalities, including visible light, infrared, and synthetic aperture radar (SAR), and is particularly suitable for challenging scenarios with strong noise, complex backgrounds, small-scale targets, and variable target orientations. The following detailed explanation uses SAR image ship detection as a typical application example, but the scope of protection of this invention is not limited thereto.

[0054] Beneficial effects: (1) Significantly improves detection accuracy and robustness in complex scenarios. In this invention, a lightweight local-global attention module is set in the backbone feature extraction network. Hierarchical collaborative feature modeling is achieved through four parallel branches: point attention, local attention, mid-range attention, and phased attention mechanism. At each stage, attention operators of different complexities are adaptively selected according to the difference in feature map resolution. Taking SAR ship detection as an example, this network can effectively suppress speckle noise background response and enhance the context perception ability of weak and small targets. When extended to other detection tasks with weak features and strong noise characteristics (such as aerial vehicles, drones, pedestrians, etc.), feature enhancement benefits are also expected. A lightweight anisotropic enhanced layer aggregation module (LAE-ELAN) is designed in the encoder feature fusion network. It integrates inexpensive feature generation, structure reparameterized convolution and anisotropic strip convolution to enhance the directional perception ability of slender targets with arbitrary orientation. A shallow gain path (SDAP) is designed at the front end of the encoder feature fusion network to directly inject high-resolution shallow features into the first fusion scale and implicitly suppress noise redundancy response through inter-channel competition mechanism. In the typical application scenario of SAR ship detection, this invention achieves AP0.5-0.95, APS, and AP0.75 of 71.6%, 72.6%, and 81.7%, respectively, on the HRSID public dataset, representing improvements of 2.73%, 2.69%, and 2.77% compared to the baseline model. On the SSDD dataset, AP0.5 and AP0.75 reach 96.6% and 89.0%, respectively, with core metrics outperforming mainstream models such as RT-DETR, D-FINE, and YOLOv11. In specialized tests on two typical engineering scenarios—complex nearshore backgrounds and dense target environments—the false negative and false positive rates of this invention are significantly lower than the comparative methods. The feature response heatmap also indicates that this invention has stronger target focusing ability and better background suppression. These performance advantages can be expected to be transferred to target detection tasks in other complex backgrounds.

[0055] (2) Achieving a balance between lightweight model and high accuracy. This invention utilizes lightweight strategies such as inexpensive feature generation, structural reparameterization, and partial convolution in the lightweight anisotropic enhanced layer aggregation module to effectively control the model size while maintaining high detection accuracy. The overall network parameter count is only 11.1M, and the computational cost is 25.3G, achieving an optimal comprehensive balance between parameter count, computational cost, and detection accuracy. Compared with D-FINE, which has a similar parameter count, this invention improves AP by 0.5-0.95 by 2.6 percentage points while increasing computational cost by only about 0.5G; compared with RT-DETR-R18, AP improves by 0.5-0.95 by 1.0 percentage point, while the parameter count and computational cost are only 56% and 42% of RT-DETR-R18, respectively. This lightweight characteristic is independent of specific application scenarios, giving the method of this invention good potential for cross-task deployment.

[0056] (3) Good engineering practicality and scenario adaptability. The method of this invention exhibits stable detection performance in a variety of complex scenarios. In the typical application of SAR ship detection, for challenging sub-scenarios such as complex near-shore backgrounds and dense target distribution, this invention has the ability to accurately identify and locate ship targets of multiple scales and arbitrary orientations. This invention has been deployed and verified on the NVIDIA Jetson Xavier NX embedded platform. After TensorRT acceleration and INT8 quantization optimization, it has real-time inference capabilities, meeting the real-time detection requirements of edge devices.

[0057] The technical basis for the feasibility of embedded deployment lies in the following: the reparameterized convolutions in the lightweight anisotropic enhancement layer aggregation module can be equivalently merged into a single 3×3 depthwise convolution kernel during the inference phase, eliminating the additional inference overhead caused by the parallelism of three branches during training; the bar convolution kernels (1×k and k×1) of the anisotropic bar convolution have fewer parameters and lower computational complexity compared to square convolution kernels of the same size; the inexpensive feature generation operation expands features through linear transformation, avoiding additional convolution operations. These designs make the computational graph structure of MGLA-Net simple during the inference phase, suitable for operator fusion and INT8 quantization optimization by inference engines such as TensorRT.

[0058] The application of this invention is not limited to the maritime field, but can also be extended to engineering scenarios that require high-precision and lightweight target detection, such as security monitoring, traffic supervision, drone inspection, and remote sensing target survey, providing efficient and reliable technical support for various edge computing platforms. Attached Figure Description

[0059] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.

[0060] Figure 1 This is a schematic diagram of the target detection method based on a multi-branch global-local attention network provided in the embodiment.

[0061] Figure 2 The overall structure diagram of the multi-branch global-local attention network provided for the embodiment.

[0062] Figure 3 The lightweight local-global attention module and its local-global attention unit structure diagram are provided for the embodiment.

[0063] Figure 4 The diagram shows the structure of a lightweight anisotropic enhanced layered polymerization module provided in this embodiment.

[0064] Figure 5 A shallow gain path structure diagram provided for an embodiment.

[0065] Figure 6 The heatmap comparison of feature extraction results provided in the example is shown.

[0066] Figure 7 This is a graph showing the detection results using the baseline method.

[0067] Figure 8 This is a diagram showing the detection results of the method in this embodiment.

[0068] Figure 9 This is a diagram illustrating the actual values.

[0069] Figure 10 The image shows the detection results of RT-DETR-R18 on the HRSID dataset.

[0070] Figure 11 This is a graph showing the detection results of D-FINE on the HRSID dataset.

[0071] Figure 12 This is a diagram showing the detection results of the method in this embodiment on the HRSID dataset.

[0072] Figure 13 The image shows the detection results of the baseline method in a complex background scene near the shore where ships are located.

[0073] Figure 14 This is a D-FINE detection result image of a ship in a complex near-shore background scene.

[0074] Figure 15 The image shows the RT-DETR-R18 detection results in a complex near-shore background scene of ships.

[0075] Figure 16 The image shows the detection results of the method in this embodiment in a complex background scene near the shore where ships are located.

[0076] Figure 17 The image shows the detection results of the baseline method in a dense target scene.

[0077] Figure 18 The image shows the D-FINE detection results in a dense target scene.

[0078] Figure 19 The image shows the RT-DETR-R18 detection results in a dense target scene.

[0079] Figure 20 The image shows the detection results of the method in this embodiment in a dense target scene. Detailed Implementation

[0080] like Figure 1 As shown, this embodiment of the invention provides a target detection method based on a multi-branch global-local attention network. This embodiment takes SAR ship detection as an example and includes the following steps: Figure 1 The steps, as shown by the arrows, are: acquiring a synthetic aperture radar (SAR) ship image dataset, building a multi-branch global-local attention network architecture, training the network using the preprocessed dataset and saving the optimal training model parameters, and loading the optimal weight model, inputting the image to be detected, and outputting the detection result.

[0081] Step 1: Obtain the image dataset and preprocess it to divide it into training, validation, and test sets. In this embodiment, the obtained dataset is a SAR ship image dataset, as follows:

[0082] This embodiment uses the publicly available SAR ship detection datasets SSDD and HRSID. The SSDD dataset contains 1160 SAR images with a total of 2456 ship instances; the HRSID dataset contains 5604 SAR images (800×800 pixels) with a total of 16951 ship instances. Small, medium, and large ship targets account for 54.5%, 43.5%, and 2% of the total, respectively. All images are labeled with horizontal bounding boxes.

[0083] The input images were augmented using Mosaic data and then uniformly adjusted to 640×640 pixels. To improve the model's generalization ability, various image enhancement techniques were employed, including random flipping, translation, scaling, cropping, and brightness / contrast adjustment. The SSDD and HRSID datasets were randomly divided into training, validation, and test sets in a 7:2:1 ratio.

[0084] Step 2: Build MGLA-Net. For example... Figure 2 As shown, the MGLA-Net constructed in this embodiment comprises four parts: a backbone feature extraction network, an encoder feature fusion network, a shallow gain path (SDAP), and a decoding detection head. This network structure is independent of specific image input modalities; the forward propagation is explained below using an input SAR image as an example.

[0085] like Figure 2 As shown in the figure, the "backbone feature extraction network" is a four-stage feature extraction network composed of lightweight local-global attention modules, the "encoder feature fusion network" is a multi-scale feature fusion region, and the "decoder" refers to the Transformer decoder in the decoding detection head; the symbol "+" indicates element-wise addition. Figures 2 to 4 The symbol "C" inside the circle indicates channel splicing along the channel dimension. Figure 2 The symbol "F" inside the circle indicates the flattening operation. Figure 2 The symbol “n” in the text represents the total number of decoder layers; P2, P3, P4 and P5 represent the 2nd to 5th feature levels, respectively, and correspond to the P2 / 4, P3 / 8, P4 / 16 and P5 / 32 scales in the text. Figure 2The "convolution module" marked in the text corresponds to the 1×1 convolution module CBS, which consists of 1×1 convolution, batch normalization, and the Sigmoid Linear Unit (SiLU) activation function in sequence; the CBS convolution stride used for downsampling is 2. Figure 2 The stride of the remaining CBS convolutions is 1. Figure 2 The convolutional module CBS is located before the attention body of the attention-based intra-scale feature interaction module AIFI. The AIFI attention body sequentially includes multi-head self-attention, element-wise addition, normalization, multilayer perceptron, element-wise addition, and normalization. The two element-wise additions form residual connections for the attention sublayer and the multilayer perceptron sublayer, respectively. The P3 / 8, P4 / 16, and P5 / 32 features output by the encoder feature fusion network are flattened and fed into the Transformer decoder, which consists of multiple cascaded decoding layers. The decoder outputs bounding box prediction results and score prediction results, where the score prediction is a classification score prediction. Figure 2 The purple loop arrows in the diagram indicate self-distillation connections between adjacent decoder layers; the C, F, n, and P2 to P5 symbols retained in the diagram are operation, quantity, or feature level symbols and are not used as English module names.

[0086] Step 2.1: Construct the backbone feature extraction network. For example... Figure 2 As shown on the left, the backbone feature extraction network mainly consists of four lightweight local-global attention modules, a downsampled convolutional module (CBS), and an attention-based intra-scale feature interaction module (AIFI). The backbone feature extraction network adopts a four-stage feature extraction structure: stage 1 is located at the P2 / 4 scale (H / 4×W / 4, 64 output channels), stage 2 is located at the P3 / 8 scale (H / 8×W / 8, 128 output channels), stage 3 is located at the P4 / 16 scale (H / 16×W / 16, 256 output channels), and stage 4 is located at the P5 / 32 scale (H / 32×W / 32, 512 output channels).

[0087] The forward propagation process of the backbone feature extraction network is as follows: An input SAR image of size 640×640×3 is first downsampled using two stages of CBS (Convolutional Backpropagation) to obtain a shallow feature map at scale P2 / 4 (160×160, 32 channels). This P2 / 4 shallow feature map is then processed by the lightweight local-global attention module in stage 1 to form a backbone feature map at scale P2 / 4 (160×160, 64 channels). This backbone feature map is then adjusted to scale P3 / 8 by CBS and processed by the lightweight local-global attention module in stage 2 to obtain the P3 / 8 scale. The P3 / 8 scale feature map is adjusted to the P4 / 16 scale by downsampling convolutional CBS, and then processed by the lightweight local-global attention module in stage 3 to obtain the P4 / 16 scale feature map (40×40, 256 channels). The P4 / 16 scale output is adjusted to the P5 / 32 scale by downsampling convolutional CBS, and then processed by the lightweight local-global attention module and the attention-based intra-scale feature interaction module AIFI in stage 4 to obtain the P5 / 32 scale feature map (20×20, 512 channels). Thus, the backbone feature extraction network outputs feature maps at four scales.

[0088] The specific implementation of the lightweight local-global attention module is as follows (e.g.) Figure 3As shown): The lightweight local-global attention module borrows the offloading approach of cross-stage local connectivity (CSP), processing features separately through 1×1 convolutional paths, depthwise separable convolutional paths, direct paths, and cascaded local-global attention unit paths before channel concatenation, reducing redundant computation and maintaining gradient propagation. Within the lightweight local-global attention module, the local-global attention unit divides the input feature channels into four subsets, which are processed independently through four parallel branches: point attention, local attention, mid-range attention, and staged attention mechanisms. Each stage adaptively selects feature modeling operators of different complexities based on the feature map resolution differences: stages 1 and 2 use 3×3 depthwise convolution; stage 3 uses downsampling global attention; and stage 4 uses global multi-head self-attention to achieve deep long-range dependency modeling. In the multilayer perceptron branch of the local-global attention unit, partial convolution divides the input channels into a computation subset (1 / 4 of the total channels) and an identity mapping subset (3 / 4 of the total channels). Convolution operations are performed only on the computation subset, while the identity mapping subset is directly propagated. The output feature maps from the four branches of point attention, local attention, mid-range attention, and staged attention mechanisms are concatenated through channels and then fed into partial convolutions. The input channels are divided into a computation subset (1 / 4 of the total channels) and an identity mapping subset (3 / 4 of the total channels). Convolution is performed only on the computation subset, followed by random discarding and batch normalization. The enhanced feature output is then obtained through residual connections. Finally, the outputs of each level of the 1×1 convolution path, depthwise separable convolution path, direct path, and cascaded local-global attention unit path are concatenated through channels, and feature fusion and dimensionality restoration are achieved through 1×1 convolutions. The residuals are then added to the original input to obtain the final output of the lightweight local-global attention module. Figure 3 The four sub-flows shown include point attention, local attention, mid-range attention, and phased attention mechanisms; among which the phased attention mechanism uses 3×3 depth convolution in phase 1 / phase 2, downsampled global attention in phase 3, and global multi-head self-attention in phase 4. Figure 3 In this context, 'n' represents the number of local-global attention units cascaded within the lightweight local-global attention module.

[0089] Step 2.2: Construct the encoder feature fusion network. For example... Figure 2 As shown in the middle section, the encoder feature fusion network uses a lightweight anisotropic enhancement layer aggregation module as its core to perform multi-level fusion of features at three scales: P3 / 8, P4 / 16, and P5 / 32. The deep features of P5 / 32 are first enhanced intra-scale by the attention-based intra-scale feature interaction module AIFI, and then aggregated step by step through a bidirectional feature pyramid path from top to bottom and bottom to top.

[0090] The specific implementation method of the lightweight anisotropic enhanced layer aggregation module is as follows (e.g.) Figure 4 As shown): The input feature map is first adjusted to the target number of channels using a 1×1 convolution, and then divided into two parts along the channel dimension: a direct path and a computational path. The direct path retains half of the channel count and directly participates in subsequent aggregation. In the computational path, the features first pass through a structure-reparameterized convolution. During the training phase, a 3×3 depthwise convolution branch, a 1×1 depthwise convolution branch, and an identity mapping branch are used in parallel. During the inference phase, the three parameters are equivalently merged into a single 3×3 depthwise convolution kernel. Subsequently, the features flow through two layers of anisotropic strip convolutions. By deploying horizontal strip convolution kernels (1×k) and vertical strip convolution kernels (k×1) in parallel, the edge responses in the horizontal and vertical directions are extracted, respectively. After multi-directional response fusion, the network is endowed with anisotropic perception capabilities. Finally, the direct path features, the structure-reparameterized convolution output, the first and second layer anisotropic strip convolution outputs, and the final 1×1 convolution output are concatenated by channels, and then the 1×1 convolution completes information integration and dimension restoration, outputting an enhanced feature map. Each lightweight anisotropic enhancement layer aggregation module stacks two layers of anisotropic strip convolutions. For example... Figure 4 As shown, the input channels with a total number of channels, C, are divided into a direct path and a computation path. The direct path is retained. Channel, Calculated path reception In the computation path, the outputs of the structure-reparameterized convolution and the anisotropic strip convolutions of the first and second layers are respectively: Channel, when n=3, two layers of anisotropic strip convolutions are stacked sequentially, and the concatenated layers are... The channel is restored to C by a 1×1 convolution. The anisotropic strip convolution belongs to the computation path of the lightweight anisotropic enhanced layer aggregation module; "anisotropic" means that different directions are modeled using horizontal and vertical strip convolution kernels.

[0091] Figure 4 In the diagram, "reparameterized convolution" refers to structurally reparameterized convolution. During training, this convolution includes a 3×3 depthwise convolution branch, a 1×1 depthwise convolution branch, and an identity mapping branch. The three outputs are summed element-wise and then sequentially passed through a compression activation and a convolutional feedforward network. The convolutional feedforward network consists of a first convolution, an activation, and a second convolution connected sequentially. Its output is summed element-wise with the input of the convolutional feedforward network to form a residual connection. During inference, the parameters of the 3×3 depthwise convolution branch, the 1×1 depthwise convolution branch, and the identity mapping branch are equivalently fused into a single 3×3 depthwise convolution, and then the compression activation and convolutional feedforward network are executed. In the diagram, "reparameterized convolution (inference stage)" represents the inference structure after equivalent parameter fusion, and n-1 represents the number of cascaded anisotropic strip convolutional layers. Figure 4 The terms "direct path", "reparameterized convolution", "anisotropic strip convolution", "compressed excitation", and "convolutional feedforward network" are all structural names within the lightweight anisotropic enhanced layer aggregation module.

[0092] Step 2.3: Construct the Shallow Gain Path (SDAP). For example... Figure 5 As shown, the shallow gain path constructs a lightweight parallel bypass enhancement branch at the front end of the encoder feature fusion network. The implementation process of the shallow gain path consists of three steps:

[0093] Step 1: Scale-aligned downsampling. The P2 / 4 shallow features (32 channels) after initial downsampling of the backbone feature extraction network are sequentially processed by convolution (increasing the number of channels to 256) and 3×3 depth convolution (with a stride of 2) to integrate and downsample the channel features, so that the output features are precisely aligned with the backbone features of stage 2 in terms of spatial size.

[0094] Step 2: Cross-layer feature concatenation. At the P3 / 8 scale, the shallow alignment features (256 channels) obtained by downsampling are directly concatenated with the stage 2 backbone features (128 channels) in the channel dimension to obtain a concatenated feature of 384 channels, which simultaneously carries the spatial details of the shallow high-resolution path and the semantic information of the deep backbone path.

[0095] Step 3: Convolutional Channel Fusion. The 384-channel concatenated features are subjected to 1×1 convolution and batch normalization. Through cross-channel linear weighting, the number of channels is adaptively compressed to a unified encoder feature dimension of 256 channels. This output serves as the input feature for the encoder feature fusion network at the P3 / 8 scale, and together with the stage 3 backbone features (P4 / 16 scale) and stage 4 backbone features (P5 / 32 scale), constitutes the three-scale input of the encoder feature fusion network.

[0096] like Figure 5 As shown in the figure, the "scale-aligned downsampling" includes a 1×1 convolution and a 3×3 depthwise convolution with a stride of 2. The P2 / 4 shallow features after initial downsampling by the backbone feature extraction network are then subjected to the scale-aligned downsampling and first-batch normalization, and then concatenated with the stage 2 backbone features (P3 / 8 scale). The concatenated features are then subjected to a 1×1 convolution and a second batch of normalization to form the P3 / 8 scale input of the encoder feature fusion network. This input, together with the stage 3 backbone features (P4 / 16 scale) and the stage 4 backbone features (P5 / 32 scale), constitutes the three-scale input of the encoder feature fusion network. P2, P3, P4, and P5 in the figure are feature level identifiers, corresponding to P2 / 4, P3 / 8, P4 / 16, and P5 / 32 in the text. Figure 5 The “P2 feature map of the backbone feature extraction network” specifically refers to the P2 / 4 shallow features formed by the initial downsampling of the backbone feature extraction network, not the output of stage 1; the “P3 feature map of the backbone feature extraction network” specifically refers to the P3 / 8 backbone features output by stage 2.

[0097] Step 2.4: Construct the decoding detection head. The decoding detection head uses an end-to-end Transformer decoder. The multi-scale fused features output by the encoder feature fusion network are selected by the least-uncertainty query and then fed into the Transformer decoder. Combined with a dense one-to-one matching strategy, the target is classified and located.

[0098] Step 2.5: The overall network forward propagation process is as follows Figure 2 As shown by the arrow, an input 640×640×3 image is processed by the backbone feature extraction network to extract feature maps at four scales, P2 / 4 to P5 / 32. The shallow gain path is used to input the shallow features at P2 / 4 in parallel, and after scale alignment, they are injected into the encoder feature fusion network at the first fusion scale. The encoder feature fusion network uses a lightweight anisotropic enhancement layer aggregation module as its core to perform bidirectional pyramid fusion. The fused features are then processed by the Transformer decoder to output the target classification and localization results.

[0099] Step 3: Train the network. Input the training set images obtained in Step 1 into MGLA-Net, and use the DEIM framework training strategy. The loss function includes bounding box regression loss, classification loss, and dense matching perceptual loss. After each round of training, evaluate the model performance on the validation set, and save the optimal model parameters on the validation set as the best parameter model.

[0100] Step 4: Test the network. Input the preprocessed test set images from Step 1 into the optimal parameter model trained in Step 3. The model performs forward inference, outputting predicted bounding boxes and confidence scores. After post-processing, the final output is an accurate detection result map of the SAR ship image. Evaluation metrics include precision, recall, and AP. 0.5-0.95 AP 0.5 AP 0.75 and AP S AP M AP L Where TP represents true positives, FP represents false positives, FN represents false negatives, and AP is the average precision for each class.

[0101] To verify the target detection method based on a multi-branch global-local attention network provided in this embodiment, an experiment was conducted on a SAR ship detection task. Figures 6 to 10 The results presented include feature extraction performance, detection results of our method and baseline methods in a scene, detection results of different algorithms on the HRSID dataset, and detection results of different methods in a nearshore complex background scene and a target-dense scene, respectively.

[0102] like Figure 6As shown, the heatmap comparison of feature extraction results shows the original image, the baseline model heatmap, and the MGLA-Net heatmap, respectively. The high response areas of MGLA-Net are more concentrated on ship targets, while the redundant responses of near-shore buildings and wave clutter areas are suppressed.

[0103] like Figure 7 , Figure 8 The image shows a comparison of the detection results of this embodiment and the baseline method in a scene, used to compare the integrity of the bounding boxes and the number of missed and false detections. The English label "ship" in the image refers to a ship.

[0104] like Figure 9 , Figure 10 , Figure 11 , Figure 12 The image shows a comparison of detection results for different algorithms on the HRSID dataset, including ground truth values, RT-DETR-R18, D-FINE, and MGLA-Net results, used to compare the detection performance of multiple algorithms. RT-DETR stands for Real-Time Detection Transformer, R18 indicates the use of the ResNet-18 backbone feature extraction network; D-FINE stands for Redefine Regression Task in DETRs as Fine-Grained Distribution Refinement; and MGLA-Net stands for Multi-branch Global-Local Attention Network.

[0105] like Figure 13 , Figure 14 , Figure 15 , Figure 16 The image shows a comparison of the detection results of different methods on the same set of images in a complex near-shore background scene of ships. The red boxes indicate missed targets and the blue boxes indicate false targets, which is used to demonstrate the detection performance of different methods under the interference of shoreline buildings and strong scattering clutter.

[0106] like Figure 17 , Figure 18 , Figure 19 , Figure 20 The image shows a comparison of the detection results of different methods on the same set of images in a scene with dense targets. It is used to demonstrate the detection performance of different methods in cases of adjacent small targets, target adhesion, and bounding box overlap.

[0107] This invention provides a target detection method based on a multi-branch global-local attention network. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.

Claims

1. A target detection method based on a multi-branch global-local attention network, characterized in that, Includes the following steps: Step 1: Obtain the image dataset, which contains the original images and their corresponding target labels; After preprocessing, the image dataset is divided into training, validation, and test sets according to a set ratio. Step 2: Construct a multi-branch global-local attention network MGLA-Net, which includes a backbone feature extraction network, an encoder feature fusion network, a shallow gain path (SDAP), and a decoding detection head; wherein the backbone feature extraction network includes a lightweight local-global attention module LLGAM, and the encoder feature fusion network includes a lightweight anisotropic enhancement layer aggregation module LAE-ELAN. Step 3: Input the training set into the multi-branch global-local attention network MGLA-Net built in Step 2 for training, calculate the loss function and perform backpropagation, update the network parameters, and obtain the optimal parameter model; Step 4: Input the test set into the optimal parameter model trained in Step 3, and output the accurate detection result map of the object detection.

2. The method according to claim 1, characterized in that, Step 2 includes: Step 2.1: Construct the backbone feature extraction network; the backbone feature extraction network includes a lightweight local-global attention module LLGAM, a downsampling convolution CBS, and an attention-based intra-scale feature interaction module AIFI, which is used for intra-scale enhancement of P5 / 32 deep features; The lightweight local-global attention module LLGAM has four components. The backbone feature extraction network adopts a four-level feature extraction structure: stage 1 is located at the P2 / 4 scale, stage 2 is located at the P3 / 8 scale, stage 3 is located at the P4 / 16 scale, and stage 4 is located at the P5 / 32 scale; stages 1 to 4 represent the first to fourth level feature extraction stages, respectively. Step 2.2: Construct the encoder feature fusion network; the encoder feature fusion network performs multi-level fusion of P3 / 8, P4 / 16, and P5 / 32 three-scale features through a lightweight anisotropic enhancement layer aggregation module; the P5 / 32 deep features are first enhanced intra-scale by the attention-based intra-scale feature interaction module AIFI, and then aggregated step by step through a bidirectional feature pyramid path from top to bottom and from bottom to top; Step 2.3: Construct a shallow gain path (SDAP); the shallow gain path (SDAP) is a lightweight parallel bypass of the encoder feature fusion network front end; The shallow gain path takes the P2 / 4 shallow features after initial downsampling by the backbone feature extraction network as input, aligns them to P3 / 8 through a 3×3 depthwise convolution with a stride of 2, concatenates them with the stage 2 backbone features, and then forms the first fusion scale of the encoder feature fusion network through a 1×1 convolution. The encoder feature fusion network then fuses the P3 / 8, P4 / 16, and P5 / 32 features through a lightweight anisotropic enhancement layer aggregation module before sending them to the decoding detection head. P2 / 4, P3 / 8, P4 / 16, and P5 / 32 represent feature scales with strides of 4, 8, 16, and 32 relative to the input space, respectively. The shallow gain path constructs a lightweight parallel bypass enhancement branch at the front end of the encoder feature fusion network. By modeling the inter-channel dependencies through convolution, it adaptively enhances the discriminative shallow feature channels while suppressing redundant channel responses introduced by speckle noise. Step 2.4: Construct the decoding detection head; The decoding detection head adopts an end-to-end Transformer decoder. The multi-scale fusion features finally output by the encoder feature fusion network are sent to the Transformer decoder after being selected by the least uncertainty query, and the classification and localization of the target are completed by combining the dense one-to-one matching strategy.

3. The method according to claim 2, characterized in that, Step 2.1 includes the following forward propagation process of the backbone feature extraction network: An image of size 640×640×3 is input, first undergoes two stages of downsampling convolution (CBS) to achieve initial downsampling, resulting in a P2 / 4 scale feature map; the P2 / 4 scale feature map is processed by the lightweight local-global attention module LLGAM in stage 1, then adjusted to the P3 / 8 scale by downsampling convolution (CBS), and further processed by the lightweight local-global attention module LLGAM in stage 2 to obtain the P3 / 8 scale output; the P3 / 8 scale output is adjusted to the P4 / 16 scale by downsampling convolution (CBS), and further processed by the lightweight local-global attention module LLGAM in stage 3 to obtain the P4 / 16 scale output; the P4 / 16 scale output is adjusted to the P5 / 32 scale by downsampling convolution (CBS), and further processed by the lightweight local-global attention module LLGAM and the attention-based intra-scale feature interaction module AIFI in stage 4 to obtain the P5 / 32 scale output.

4. The method according to claim 3, characterized in that, In step 2.1, the lightweight local-global attention module LLGAM is specifically implemented as follows: the input features of the lightweight local-global attention module LLGAM are transformed into intermediate features through 1×1 convolution, and based on the intermediate features, 1×1 convolution paths, depthwise separable convolution paths, direct paths, and cascaded local-global attention unit paths are formed, with the outputs of each path participating in subsequent fusion; wherein, the cascaded local-global attention unit LLGA is a component of the lightweight local-global attention module LLGAM; Inside the lightweight local-global attention module LLGAM, the cascaded local-global attention unit divides the input feature channel into four subsets, which are processed independently through four parallel branches: point attention, local attention, mid-range attention, and phased attention mechanism, to achieve hierarchical collaborative feature modeling from point level to local to global. The cascaded local-global attention unit also includes a multilayer perceptron branch. In the multilayer perceptron branch, the input channel is divided into a 1 / 4 channel computation subset and a 3 / 4 channel identity mapping subset through partial convolution. Convolution operation is performed only on the computation subset, and then the 1 / 4 channel and the 3 / 4 channel are concatenated. The input feature map is expanded to 2C channels through 1×1 convolution, forming four fixed paths: a 1×1 convolution path, a depthwise separable convolution path, a direct path, and a cascaded local-global attention unit path. The 1×1 convolution path performs channel compression through 1×1 convolution. The depthwise separable convolution path is processed by 1×1 convolution, depthwise convolution, and 1×1 convolution in sequence. The direct path and the cascaded local-global attention unit path are obtained by evenly dividing the 2C channel features along the channel dimension, and local-global attention units are cascaded on the cascaded local-global attention unit path. The depthwise separable convolution path achieves lightweight local feature extraction through a depthwise separable convolution structure: the 1×1 convolution first performs linear recombination of information between channels, the depthwise convolution then performs spatial convolution on each channel of the input feature of the path to capture local structural texture, and finally the 1×1 convolution completes feature integration and dimensionality adjustment. The cascaded local-global attention unit path employs a phased attention mechanism, progressively modeling different receptive field ranges to achieve hierarchical fusion of multi-scale contextual information. The output feature maps from four parallel branches—point attention, local attention, mid-range attention, and the phased attention mechanism—are concatenated via channels and then fed into a partial convolution to selectively perform convolution on a subset of 1 / 4 of the channels. These are subsequently subjected to random discarding and batch normalization, and residual connections are used to obtain the locally-globally enhanced feature output. Finally, the outputs from the 1×1 convolution path, the depthwise separable convolution path, the direct path, and the cascaded local-global attention unit path are concatenated via channels and then fused and dimension-restored via a 1×1 convolution. The residual is added to the original input to obtain the enhanced feature map. The 1×1 convolution uses a 1×1 kernel to form intermediate features, perform intra-path channel transformation, feature fusion, and dimension restoration. C represents the number of channels in each fixed path, and 2C represents the number of channels in the intermediate features.

5. The method according to claim 4, characterized in that, Step 2.2 includes: The specific implementation of the lightweight anisotropic enhancement layer aggregation module is as follows: the input features are formed into intermediate features through 1×1 convolution, and the intermediate features are evenly divided into direct path features and computation path features along the channel dimension, and the direct path features are directly retained; the structure reparameterization convolution adopts a 3×3 depthwise convolution branch, a 1×1 depthwise convolution branch and an identity mapping branch for parallel computation during the training phase, and the parameters of the three branches are equivalently merged into a single 3×3 depthwise convolution kernel during the inference phase; the computation path features are processed sequentially by structure reparameterization convolution, the first layer anisotropic strip convolution and the second layer anisotropic strip convolution; the first layer anisotropic strip convolution and the second layer anisotropic strip convolution are both processed by horizontal strips. Edge responses are extracted using horizontal and vertical bar convolution branches. The horizontal bar convolution branch uses a 1×k bar convolution kernel to extract the horizontal edge response, and the vertical bar convolution branch uses a k×1 bar convolution kernel to extract the vertical edge response. The outputs of the structure reparameterized convolution, the first layer anisotropic bar convolution, and the second layer anisotropic bar convolution are used as features to be concatenated. The output of the second layer anisotropic bar convolution is further processed by a 1×1 convolution to form the end-refined feature. The direct path features, the features to be concatenated, and the end-refined features are concatenated along the channel dimension and then processed by a 1×1 convolution to complete feature fusion and dimension adjustment, resulting in the output features of the lightweight anisotropic enhanced layer aggregation module.

6. The method according to claim 5, characterized in that, In step 2.3, the shallow gain path (SDAP) specifically performs the following operations: The P2 / 4 signal source of the shallow gain path has 32 channels, which is upsized to 256 channels by 1×1 convolution, and then aligned with the P3 / 8 scale by 3×3 depth convolution with a stride of 2. After being concatenated with the main features of stage 2 to form 384 channels, it is compressed to 256 channels by 1×1 convolution; Scale-aligned downsampling: P2 / 4 shallow features are sequentially integrated and downsampled through convolution and 3×3 depth convolution; Cross-layer feature stitching: The shallow alignment features obtained by downsampling are directly stitched with the stage 2 backbone features at the P3 / 8 scale in the channel dimension; Convolutional Channel Fusion: The spliced ​​features are subjected to 1×1 convolution and batch normalization. The inter-channel dependency between shallow paths and trunk paths is modeled by cross-channel linear weighting, and the number of channels is adaptively compressed to a unified encoder feature dimension.

7. The method according to claim 6, characterized in that, Step 3 includes: inputting the training set into the multi-branch global-local attention network MGLA-Net built in Step 2, adopting the training strategy of the detection Transformer framework of the improved matching strategy DEIM, and the loss function includes bounding box regression loss, classification loss and dense matching perception loss; after each round of training, evaluating the model performance on the validation set, and saving the optimal model parameters on the validation set as the best parameter model.

8. The method according to claim 7, characterized in that, Step 4 includes: inputting the test set into the optimal parameter model trained in Step 3, the model forward inferences to output the predicted bounding box and confidence score, and finally outputting the accurate detection result map of the target detection after post-processing.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 8.

10. A storage medium, characterized in that, It stores a computer program or instructions that, when run on a computer, perform the steps of the method as described in any one of claims 1 to 8.