先双线性上采样,再并行执行局部空间卷积与可插值复数频谱滤波;拼接融合后加上学习型跳连。该主类无需输入显著性掩码。
低分辨特征 2×4×5×7上采样输出 2×4×10×144,616 个参数 · in_channels=4,scale=2,float32;显著目标或分割解码上采样。CPU 实跑,按 sum(p.numel() for p in model.parameters()) 统计。forward() 数据流顺序拆解 · 点击任意子模块方块可同步查看对应源码切片先双线性上采样,再并行执行局部空间卷积与可插值复数频谱滤波;拼接融合后加上学习型跳连。该主类无需输入显著性掩码。
29 def __init__(self, in_channels, scale=2): 31 self.scale = scale32 self.in_channels = in_channels 44 def forward(self, x):45 x_up = F.interpolate(x, scale_factor=self.scale, mode='bilinear', align_corners=False) 46 x_spatial = self.spatial_process(x_up)47 x_up_32 = x_up.float() 48 x_fft = torch.fft.rfft2(x_up_32, norm='backward')50 weight_in = self.spectral_weight.to(dtype=torch.float32) 51 weight_permuted = weight_in.permute(0, 4, 1, 2, 3).reshape(1, 2 * C, self.base_freq_h, self.base_freq_w)52 current_filter = F.interpolate(weight_permuted, size=(H, W_freq), mode='bilinear', align_corners=False) 53 current_filter = current_filter.view(1, 2, C, H, W_freq).permute(0, 2, 3, 4, 1)
x 为 float32 的 2×4×5×7;输出 2×4×10×14。FFT 路径按源码转为 float32,并在重建后转换到空间支路类型。
from LFNetSpectralSpatialUpsample import SaliencyGuidedUpsample upsample = SaliencyGuidedUpsample(in_channels=4, scale=2) y = upsample(x)
Method 动机参考:在上采样中结合局部细节与全局频率信息,输出维度可直接供下一层解码器使用。
| 消融变体 | 结构配置 | 验证目的 |
|---|---|---|
| 双线性 | 仅插值 | 建立无参数基线 |
| 空间支路 | 只保留卷积与跳连 | 隔离频谱补充作用 |
| 完整双域 | 复数滤波加空间卷积 | 比较显著性或分割边界指标 |