A terahertz image super-resolution reconstruction method based on dual-domain self-attention
Patent Information
- Application Number
- CN202611075105.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-10-30
AI Technical Summary
[0008]本发明目的在于提供一种基于双域自注意力的太赫兹图像超分辨率重建方法,解决现有技术无法建模长程全局依赖、池化门控注意力特征判别能力弱、均匀采样造成纹理欠拟合、损失函数高频约束缺失的技术缺陷,实现太赫兹图像高频细节与锐利边缘高质量恢复,抑制背景伪影,且在多套不同成像系统下均可保持高保真稳定重建效果
[0025](1)本发明采用空间自注意力块、通道自注意力块交替堆叠构成的自注意力主干替代传统卷积残差主干,通过查询-键-值配对运算建立图像特征元素间长程全局依赖,完整建模太赫兹图像“中心强信号-周边弱信号-边缘伪影”全局分布特征,有效抑制衍射条纹与背景伪影;依托自注意力全局建模特性,本发明适配不同点扩散函数、波束形态、噪声强度的成像设备,无需针对单套系统单独调参,跨系统重建鲁棒性更强。
Smart Images

Figure CN123015269A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of terahertz image reconstruction technology, and particularly relates to a terahertz image super-resolution reconstruction method based on dual-domain self-attention. Background Technology
[0002] In recent years, deep learning technology has been widely applied in the field of terahertz image super-resolution reconstruction. Current mainstream technologies fall into three categories: convolutional neural networks, residual networks, and encoder-decoder networks. Compared to traditional methods such as optical hardware upgrades and interpolation numerical enhancement, deep learning reconstruction offers some improvement. However, existing technologies still suffer from four core shortcomings:
[0003] First, existing networks mostly use convolutional residual networks as the backbone for feature extraction. Convolution only has a local receptive field and cannot establish a long-range dependency on the global gray-level distribution of "strong signal in the center of the sample, weak signal in the periphery, and edge artifacts" in terahertz images. The model has difficulty distinguishing between effective target signals and background diffraction artifacts.
[0004] Second, the attention mechanisms in existing solutions are mostly global pooling gating structures (SE, CBAM, etc.), which can only give weight enhancement to channels and spatial pixels, and cannot build paired long-range dependencies between any two feature elements. They are not capable of recognizing and reconstructing diffraction stripes and weak edges with low contrast.
[0005] Third, existing training strategies all use global uniform cropping of image patches, while terahertz images have a very high proportion of smooth background regions and a scarcity of samples that are difficult to reconstruct, such as edges and textures. As a result, the model is very prone to underfitting of texture regions, and the reconstructed image edges are blurry and unclear.
[0006] Fourth, existing loss functions generally use pixel domain MSE loss or image pre-trained network perception loss, which lacks constraints on high-frequency information and cannot effectively constrain high-frequency structures such as sharp edges and fine textures, resulting in over-smoothing problems in reconstructed images.
[0007] In addition, different terahertz imaging devices have significant differences in point spread function, beam shape, detector response, and noise intensity. Existing reconstruction algorithms have weak generalization ability and poor stability in reconstruction across imaging systems. Summary of the Invention
[0008] The purpose of this invention is to provide a terahertz image super-resolution reconstruction method based on dual-domain self-attention, which solves the technical defects of existing technologies such as inability to model long-range global dependencies, weak discrimination ability of pooling-gated attention features, underfitting of textures caused by uniform sampling, and lack of high-frequency constraints in the loss function. This method achieves high-quality restoration of high-frequency details and sharp edges in terahertz images, suppresses background artifacts, and maintains high-fidelity and stable reconstruction results under multiple different imaging systems.
[0009] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: a terahertz image super-resolution reconstruction method based on dual-domain self-attention, characterized by comprising the following steps:
[0010] The terahertz image to be reconstructed is input into the reconstruction model to obtain a super-resolution terahertz image at the target scale; where,
[0011] The reconstruction model includes:
[0012] The shallow feature extraction module is used to extract features from the input terahertz image to obtain a shallow feature map;
[0013] The self-attention backbone consists of several cascaded attention groups. The feature map formed after the cascaded processing of the attention groups is convolved and then added to the shallow feature map input to the self-attention backbone through a global residual connection to output an enhanced feature map. The attention group consists of several cascaded attention units, and each attention unit includes a spatial self-attention block and a channel self-attention block. The feature map formed after the cascaded processing of the attention units is convolved and then added to the feature map input to the attention group through an intra-group residual connection to output the enhanced feature map.
[0014] The upsampling reconstruction unit is used to upsample the enhanced feature map to the target scale and perform convolutional reconstruction to form a super-resolution terahertz image.
[0015] Furthermore, within the self-attention backbone, spatial self-attention blocks and channel self-attention blocks are alternately arranged in each attention unit.
[0016] Furthermore, both the spatial self-attention block and the channel self-attention block are built based on a unified self-attention block structure. The self-attention block structure is sequentially connected in series with the first LN layer, the self-attention module, the second LN layer, and the gated feedforward network. The output feature of the self-attention module is added to the residual of the original input feature of the self-attention block to obtain the first-level fusion feature. The first-level fusion feature is input to the gated feedforward network, and the output feature of the gated feedforward network is added to the residual of the first-level fusion feature again to serve as the overall output of the self-attention block.
[0017] Furthermore, the self-attention module adopts a unified self-attention module architecture, which includes parallel self-attention branches and deep convolution branches; the output features of the self-attention branches and the output features of the deep convolution branches are input into the adaptive interaction module to complete the fusion and output the overall features of the self-attention module.
[0018] Furthermore, the spatial self-attention block has a built-in spatial self-attention module; the spatial self-attention module divides the input feature map into several non-overlapping local operation windows and completes the self-attention operation within a single window.
[0019] Furthermore, the spatial self-attention modules at different levels adopt a differentiated window partitioning strategy, alternating between horizontal and vertical strip windows to segment the feature maps.
[0020] Furthermore, the local operation windows of adjacent spatial self-attention modules adopt a staggered division method; adjacent pixels belonging to different windows in the previous layer can be divided into the same local operation window in the spatial self-attention module of the next layer.
[0021] Furthermore, the channel self-attention block has a built-in channel self-attention module; the channel self-attention module performs a dimensional transpose of the input feature map along the channel dimension, and performs self-attention calculation based on the transposed feature map.
[0022] Furthermore, the training steps of the reconstruction model are as follows: acquire a terahertz high-resolution image dataset, perform image degradation processing on each high-resolution terahertz image to generate a one-to-one low-resolution-high-resolution image sample pair; crop all low-resolution images and matching high-resolution images into image blocks of uniform fixed size; calculate sampling weights based on at least one of the local gradient magnitude and edge density of the image block, perform sampling processing on the texture and edge region image blocks based on the sampling weights, and select training image blocks; iteratively train the reconstruction model using a composite loss function that includes a frequency domain loss term; the frequency domain loss term is used to constrain the frequency domain feature differences between the reconstructed super-resolution image and the real high-resolution image.
[0023] Furthermore, the composite loss function is a weighted sum of the spatial domain loss term and the frequency domain loss term; the frequency domain loss term is calculated by performing Fourier transform or high-pass filtering on the reconstructed super-resolution image and the corresponding real high-resolution image respectively, and taking the error between the two sets of transform / filter components as the frequency domain difference measure.
[0024] Compared with the prior art, the above-described technical solution of this invention has the following advantages:
[0025] (1) This invention uses a self-attention backbone composed of alternating stacks of spatial self-attention blocks and channel self-attention blocks to replace the traditional convolutional residual backbone. It establishes long-range global dependencies between image feature elements through query-key-value pairing operations, and fully models the global distribution characteristics of "strong signal in the center - weak signal in the periphery - edge artifacts" of terahertz images, effectively suppressing diffraction fringes and background artifacts. Relying on the global modeling characteristics of self-attention, this invention is compatible with imaging devices with different point spread functions, beam shapes and noise intensities. It does not require separate parameter tuning for a single system and has stronger cross-system reconstruction robustness.
[0026] (2) The present invention deploys self-attention computation alternately in two dimensions of space and channel, and captures local texture and channel semantic features of the image simultaneously. Compared with the lightweight attention scheme with only single-dimensional pooling gating, the present invention has stronger feature discrimination ability and better reconstruction effect of small details.
[0027] (3) During the model training phase, a gradient and edge density-driven non-uniform sampling mechanism is introduced to increase the sampling frequency of image blocks that are difficult to reconstruct from edges and textures, improve the underfitting defects of texture regions caused by uniform sampling, and make the reconstructed image edge contours sharper and clearer.
[0028] (4) An independent frequency domain constraint term is added to the loss function to apply explicit loss constraints to the high-frequency components of the image, which greatly alleviates the over-smoothing defects that are common in super-resolution images and significantly improves the recovery quality of high-frequency details such as fine textures and sharp edges. Attached Figure Description
[0029] Figure 1 is a schematic diagram of the overall structure of the reconstruction model of the present invention;
[0030] Figure 2 is a schematic diagram of the self-attention block structure of the reconstruction model space of the present invention;
[0031] Figure 3 is a schematic diagram of the channel self-attention block structure of the reconstruction model of the present invention;
[0032] Figure 4 is a schematic diagram of the built-in spatial self-attention module structure of the reconstruction model of the present invention;
[0033] Figure 5 is a schematic diagram of the built-in channel self-attention module structure of the reconstruction model of the present invention;
[0034] Figure 6 is a schematic diagram of the spatial gated feedforward network structure of the reconstruction model of the present invention;
[0035] Figure 7 is a schematic diagram of the reconstruction model training process of the present invention;
[0036] Figure 8 is a schematic diagram of the reasoning process of the reconstruction model of the present invention. Detailed Implementation
[0037] The present invention will now be described in detail with reference to specific embodiments. It should be understood that the embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention; equivalent variations and modifications made by those skilled in the art based on the concept of the present invention after reading the description of the present invention all fall within the protection scope defined by the claims of this application.
[0038] This embodiment discloses a terahertz image super-resolution reconstruction method based on dual-domain self-attention, combined with... Figure 1As shown, the process includes the following steps: The terahertz image to be reconstructed is input into a preset reconstruction model, which outputs a target-scale super-resolution terahertz image. The reconstruction model includes a shallow feature extraction module, a self-attention backbone, and an upsampling reconstruction unit. The shallow feature extraction module extracts features from the input terahertz image and outputs a shallow feature map. The self-attention backbone contains multiple cascaded attention groups (referred to as residual groups in the attached diagram). The multiple attention groups process the data sequentially to obtain intermediate feature maps. After convolution, the intermediate feature maps are added pixel-by-pixel to the shallow feature map input to the self-attention backbone via global residual connections to output an enhanced feature map. A single attention group consists of several cascaded attention units. Each attention unit is connected in series with a set of spatial self-attention blocks and a set of channel self-attention blocks. All attention units sequentially operate on the output feature map, which is then convolved and added to the original feature map input to the attention group via intra-group residual connections to serve as the output feature of that group. The upsampling reconstruction unit upsamples the enhanced feature map to a preset target scale and completes image reconstruction through convolutional layers, outputting the final super-resolution terahertz image.
[0039] Within the self-attention backbone, spatial self-attention blocks and channel self-attention blocks are arranged alternately in each attention unit. Specifically, the spatial self-attention block relies on the internal spatial self-attention module to perform QKV self-attention operations in the feature map space dimension, modeling the correlation and dependency between all spatial pixel positions; the channel self-attention block relies on the internal channel self-attention module to perform QKV self-attention operations in the feature map channel dimension, modeling the correlation and dependency between each feature channel.
[0040] In a preferred embodiment, the spatial self-attention block relies on its internal spatial self-attention module to perform self-attention calculations using a local computation window as the smallest unit; adjacent spatial self-attention blocks are divided using staggered windows, or by alternating between horizontal and vertical strip windows. The channel self-attention block has a built-in channel self-attention module that performs self-attention calculations on the feature map after transposing along the channel dimension.
[0041] Specifically, both spatial and channel self-attention blocks are built on a unified self-attention block architecture. The architecture sequentially connects the first LN layer, the self-attention module, the second LN layer, and the gated feedforward network. The output features of the self-attention module are added to the original input features of the self-attention block using residuals to obtain a first-level fusion feature. This first-level fusion feature is then input to the gated feedforward network, and the output features of the gated feedforward network are again added to the residuals of the first-level fusion feature to obtain the complete self-attention block output. The hierarchical structures of the spatial and channel self-attention blocks are shown in Figures 2 and 3, respectively.
[0042] Among them, the spatial self-attention block has a built-in spatial self-attention module, and the channel self-attention block has a built-in channel self-attention module. The two types of self-attention modules adopt a unified self-attention module architecture, and the self-attention module architecture sets up self-attention branches and depth convolution branches in parallel. The output features of the self-attention branches and the output features of the depth convolution branches are jointly fed into the adaptive interaction module to complete feature fusion, which serves as the overall output of the self-attention module.
[0043] Referring to Figure 4, the spatial self-attention module adopts a dual-branch parallel structure with an input feature map size of H×W×C. The spatial window self-attention branch divides the input feature map into multiple non-overlapping local computation windows, mapping all spatial pixels within each window to independent tokens. Through linear projection, query Q, key K, and value V are generated. The QKV self-attention operation is performed only within a single window, modeling the global dependency of spatial pixels within the window and outputting spatial attention features.
[0044] The local calculation window can be either a standard square window or a long rectangular window.
[0045] If a square window is used, the spatial self-attention modules of adjacent layers adopt a window offset partitioning method to achieve cross-window information interaction. For example, the starting coordinates of the upper-layer spatial self-attention module window are (0,0), and the lower-layer module window is offset by half the window size (the offset coordinates are (4,4) when the window size w=8), so that the windows of the two layers intersect and are misaligned. Adjacent pixels belonging to different windows in the previous layer are assigned to the same window in the next layer. Cross-window information flow can be achieved without global attention calculation, which is equivalent to expanding the receptive field of the model.
[0046] If a long rectangular window is selected, the odd-level spatial self-attention module can be set to use a horizontal long rectangular window, and the even-level module can use a vertical long rectangular window. After alternating stacking, the global dependencies of the entire feature map can be completely covered.
[0047] The parallel deep convolution branch performs 3×3 deep convolution (DW-Conv) on the input features to extract local spatial texture features of the image, complementing the global modeling capability of the self-attention branch. The output features of the two branches are input into the AIM adaptive interaction module, where they undergo cross-modulation weighted fusion and are then fed into the subsequent spatially gated feedforward network (SGFN).
[0048] Referring to Figure 5, the channel self-attention module also adopts a dual-branch parallel architecture. The channel-dimensional self-attention branch flattens the spatial dimensions of the H×W×C input feature map, performs dimensional transpose along the channel dimensions, treats each complete feature channel as an independent token, linearly projects to generate Q, K, and V, and calculates self-attention, modeling the global dependencies between all channels. The parallel depthwise convolution branch uses 3×3 depthwise convolution to extract local spatial details, compensating for the deficiency of channel self-attention in ignoring spatial texture. The outputs of the two branches are fed into the AIM adaptive interaction module for cross-fusion, and the output features are fed into the subsequent SGFN layer.
[0049] The spatially gated feedforward network incorporates a deep convolutional gating mechanism. The specific structure is shown in Figure 6, which consists of an input linear layer, a GELU activation layer, a feature splitting branch, a deep convolutional layer, an element-wise multiplication gating (circles in the illustration), and an output linear layer. The element-wise multiplication gating outputs a spatial weight map from the deep convolutional layer and performs a pixel-wise Hadamard product with the original features from the splitting branch to achieve spatial adaptive gating. This enhances the features of edge and texture regions and suppresses invalid features in smooth backgrounds and diffraction artifact regions.
[0050] Referring to Figure 7, the specific training process of the reconstruction model is as follows: A terahertz high-definition image dataset is collected, and all high-definition images undergo degradation processing to generate one-to-one low-resolution-high-resolution image sample pairs; sampling weights are calculated based on the local gradient magnitude and edge density of image patches, and image patches with rich edges and textures are oversampled according to the weights to generate training image patches (i.e., texture edge-aware non-uniform sampling); the reconstruction model is iteratively trained using a composite loss function that includes a frequency domain loss term; the frequency domain loss term is used to constrain the frequency domain feature differences between the network-reconstructed image and the real high-definition image.
[0051] Image patches are the standard training units for deep learning super-resolution tasks. They refer to small, fixed-size sub-regions of an image cropped from complete high- and low-resolution images and are the smallest input units for model training. Training samples consist of paired high- and low-resolution images, with corresponding cropped image patches paired one-to-one for the same pixels. The local gradient magnitude (higher gradient values indicate richer edge and texture information, and higher reconstruction difficulty) or edge density (higher proportion of edge pixels within a patch, and higher reconstruction difficulty) of a single image patch is calculated, normalized, and used as the sampling weight for that image patch. During the sampling phase, image patches are randomly selected according to their weights. Patches with rich edges and textures that are difficult to reconstruct have higher weights and a greater sampling probability. Paired LR-HR image patches are selected to form training batches input into the network.
[0052] The loss function is a weighted sum of spatial domain loss and frequency domain loss. The frequency domain loss is calculated by performing a two-dimensional Fourier transform or high-pass filtering on the network output super-resolution image and the corresponding real high-resolution image, and taking the error between the two sets of transform components as the frequency domain difference measure.
[0053] After the reconstructed model is deployed, the inference process is shown in Figure 8.
[0054] The following examples, with reference to different target super-resolution ratios, further illustrate this implementation method.
[0055] Example 1 (×2 Super-resolution Reconstruction)
[0056] The terahertz imaging acquisition system used in this embodiment includes: a 4.3THz operating frequency (corresponding to a wavelength of approximately 70μm) terahertz quantum cascade laser, a terahertz focusing lens, a sample stage, a vanadium oxide-based focal plane array detector (exemplary specifications: 384×288 pixels, pixel size 17μm, frame rate 25Hz), and a cooling device, used to acquire raw low-resolution terahertz images as model input.
[0057] Referring to Figure 1, the reconstruction model in this embodiment consists of a shallow feature extraction module, a self-attention backbone, and an upsampling reconstruction unit connected in series. The shallow feature extraction module uses a single-layer 3×3 convolution to map the single-channel input image into a shallow feature map F0 with C=180 channels.
[0058] The self-attention backbone consists of N1=6 cascaded attention groups; each attention group contains N2=6 alternating spatial and channel self-attention blocks (3 spatial and 3 channel self-attention blocks stacked alternately); each attention group ends with a convolutional layer, and the convolutional output is added to the residual of the input feature of the group; a convolutional layer is added at the end of the backbone as a whole, and the convolutional output is added to the shallow feature F0 to complete the global residual, and the enhanced feature map is output.
[0059] Referring to Figures 4 and 5, the spatial self-attention block incorporates a spatial self-attention module, dividing the feature map into 8×8 or 16×16 local windows. All spatial pixels within a window are mapped to tokens, and Q / K / V are generated through linear projection. The spatial attention output is obtained by weighted summation based on normalized QK similarity. Adjacent-level spatial self-attention modules are partitioned using window misalignment to achieve cross-window information interaction. The number of multi-head attention heads is set to an example of 6. The channel self-attention block incorporates a channel self-attention module. After transposing the feature map along the channel dimension, self-attention is calculated using a single channel as a token, modeling global channel dependencies.
[0060] Referring to Figures 2 to 6, in this embodiment, both the spatial self-attention module and the channel self-attention module are configured with parallel 3×3 depthwise convolutional branches; the outputs of the two branches are summed after cross-modulation by the adaptive interaction module; the back end of the self-attention module is connected to a spatial gated feedforward network, which consists of linear layers, GELU activation, depthwise convolution, and pixel gated multiplication structures, and is used for feature aggregation and detail enhancement.
[0061] The upsampling reconstruction unit uses subpixel convolution (pixel rearrangement) to upsample the backbone output feature map to a ×2 target scale, and the final single-layer convolution outputs the final super-resolution terahertz image.
[0062] The model training process is shown in Figure 7: The open-source high-definition dataset DIV2K is selected, which contains 900 high-definition images, 800 of which are used for training and 100 for validation testing. The high-definition images are subjected to simulated terahertz imaging degradation processing. The degradation process is as follows: point spread function convolution, image downsampling, and Gaussian noise superposition, generating pairs of low-resolution and high-resolution training samples.
[0063] In the training image patch construction stage, texture edge-aware non-uniform sampling is adopted: calculate the local gradient magnitude or edge density of candidate image patches, normalize to obtain sampling weights, improve the sampling probability of image patches with difficult edge texture reconstruction, and balance the data distribution bias caused by the excessive proportion of smooth background samples in the dataset.
[0064] In this embodiment, the total loss function is a weighted sum of spatial domain loss terms and frequency domain loss terms. The spatial domain loss uses the pixel-domain L1 loss between the reconstructed image and the high-resolution image. The frequency domain loss calculates the difference between their two-dimensional Fourier transform amplitude spectra (or high-pass filtered high-frequency components) as constraints. The total loss expression is as follows:
[0065]
[0066] The weighting coefficient λ is exemplarily set to 0.1; the frequency domain loss separately constrains the high-frequency information of the image, enhancing the reconstruction effect of edges and fine textures.
[0067] Example training hyperparameter settings: ADAM optimizer, β1=0.9, β2=0.999, ε=10⁻ 8 Initial learning rate 5×10⁻ 4 The image patch size was 192×192, and the batch size was 32. During the model testing phase, the images were converted to the YCbCr color space, and the PSNR and SSIM quantization reconstruction effects were calculated only in the luminance Y channel. Multiple terahertz devices with different optical configurations were used to acquire images to form a general test set to verify the robustness of the model across imaging systems.
[0068] Example 2
[0069] This embodiment shares the same core network framework as Embodiment 1, differing only in the implementation of the self-attention module and the super-resolution ratio. It serves to illustrate alternative technical solutions of the present invention.
[0070] (1) The spatial self-attention module can be implemented in two ways: hierarchical alternating horizontal / vertical strip window self-attention and staggered square window self-attention. Both can expand the effective receptive field with low computational cost. The ratio of spatial self-attention block and channel self-attention block in a single attention group can be flexibly adjusted, and can be 1:1, 1:2, or 2:1.
[0071] (2) The model supports multiple super-resolution ratios of ×2, ×3 and ×4; optional pre-training transfer strategy: first train the ×2 model until convergence, and optionally, transfer the weights to initialize the ×3 and ×4 networks to accelerate the convergence of high-resolution models.
[0072] (3) The frequency domain loss term can be replaced by wavelet domain loss and high-pass filter feature L1 / L2 loss; in addition to gradient and edge density, non-uniform sampling weights can also be calculated based on feature variance and attention response map.
[0073] (4) The method of the present invention can be compiled into a computer program and deployed on various electronic devices to complete offline / real-time acquisition of terahertz image super-resolution reconstruction. Application scenarios include security inspection non-destructive testing, material edge defect detection, biological tissue region segmentation, etc.
[0074] The above embodiments describe all specific parameters, network structures, and training strategies, which are complete supporting implementation examples of the technical features defined in the claims of this invention.
Claims
1. A terahertz image super-resolution reconstruction method based on dual-domain self-attention, characterized in that, The process includes the following steps: inputting the terahertz image to be reconstructed into a preset reconstruction model, and outputting a super-resolution terahertz image at the target scale; the reconstruction model includes a shallow feature extraction module, a self-attention backbone, and an upsampling reconstruction unit; the shallow feature extraction module is used to extract features from the input terahertz image and output a shallow feature map; the self-attention backbone includes multiple cascaded attention groups, each attention group sequentially processes to obtain intermediate feature maps, the intermediate feature maps are convolved and then added element-wise to the shallow feature map input to the self-attention backbone through a global residual connection to output an enhanced feature map; a single attention group is composed of several cascaded attention units; the feature map output by each attention unit is convolved and then added to the feature map input to that attention group through an intra-group residual connection to complete the feature output of that group; each attention unit is configured with a spatial self-attention block and a channel self-attention block in series; the upsampling reconstruction unit is used to upsample the enhanced feature map to the target scale and generate the final super-resolution terahertz image through convolutional reconstruction.
2. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 1, characterized in that, Within the self-attention backbone, spatial self-attention blocks and channel self-attention blocks are arranged alternately in each attention unit.
3. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 1, characterized in that, The spatial self-attention block and the channel self-attention block are constructed using a unified self-attention block architecture. The self-attention block architecture is sequentially connected in series with the first normalization layer (LN), the self-attention module, the second normalization layer (LN), and the gated feedforward network. The output features of the self-attention module are added to the input features of the self-attention block to obtain the first fused feature. The first fused feature is input to the gated feedforward network, and the output features of the gated feedforward network are added to the residual of the first fused feature to obtain the overall output of the self-attention block.
4. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 3, characterized in that, The self-attention module includes parallel self-attention branches and deep convolution branches; the features output by the self-attention branches and the features output by the deep convolution branches are input into the adaptive interaction module to complete feature fusion, and the final output of the self-attention module is obtained.
5. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 3, characterized in that, The self-attention module built into the spatial self-attention block is a spatial self-attention module; the spatial self-attention module divides the input feature map into several non-overlapping local operation windows and completes the self-attention calculation only within a single local window.
6. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 5, characterized in that, Different levels of spatial self-attention modules employ a differentiated window partitioning strategy, alternating between horizontal and vertical strip windows to segment feature maps.
7. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 5, characterized in that, The local operation windows of adjacent spatial self-attention modules are divided in a staggered manner; adjacent pixels belonging to different windows in the previous layer can be divided into the same local operation window in the spatial self-attention module of the next layer.
8. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 1, characterized in that, The channel self-attention block has a built-in channel self-attention module; the channel self-attention module performs a dimensional transpose of the input feature map along the channel dimension, and performs self-attention calculation based on the transposed feature map.
9. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 1, characterized in that, The specific training steps of the reconstruction model are as follows: construct a terahertz high-definition image dataset, perform image degradation processing on each high-definition terahertz image to generate one-to-one low-resolution-high-resolution image sample pairs; crop all low-resolution images and matching high-resolution images into image blocks of uniform fixed size; calculate sampling weights based on at least one of the local gradient magnitude and edge density of the image block, perform sampling processing on texture and edge region image blocks based on the sampling weights, and select training image blocks; iteratively train the reconstruction model using a composite loss function that includes a frequency domain loss term; the frequency domain loss term is used to constrain the frequency domain feature differences between the reconstructed super-resolution image and the real high-definition image.
10. The terahertz image super-resolution reconstruction method based on dual-domain self-attention according to claim 9, characterized in that, The composite loss function is a weighted sum of the spatial domain loss term and the frequency domain loss term; the frequency domain loss term is calculated by performing Fourier transform or high-pass filtering on the reconstructed super-resolution image and the corresponding real high-resolution image respectively, and taking the error between the two sets of transform / filter components as the frequency domain difference measure.
