先以参考特征调制窗口 Value,再通过空间引导与丰度通道注意力细化输入;两类交互均保留残差。
(2,8,8,16) / (2,8,8,16);x/ref 同尺寸;H/W 为8的倍数(2,8,8,16);保留输入通道与网格3,958 个总参数;其中 3,958 个可训练。dim=8、dim_head=4、heads=2、num_blocks=1、网格8×16;高光谱参考丰度细化forward() 数据流顺序拆解 · 点击任意子模块方块可同步查看对应源码切片CrossCAB 把 BCHW 转为 BHWC,内部 CrossSSM_AB 先增强参考,再执行常规与移位窗口交互、空间引导乘法和通道注意力;位置卷积分支相加后,外层前馈残差返回 BCHW。 本页使用 dim=8、dim_head=4、heads=2、num_blocks=1、网格8×16,以真实模块 forward_hook 记录子层输入输出,并追踪本文件执行行上的张量形状。
307 if x.shape != ref.shape or x.shape[-2:] != self.input_resolution:308 raise ValueError('x and ref must share the configured BCHW shape.')309 x = x.permute(0, 2, 3, 1)310 for attn, ff in self.blocks:311 x = attn(x, ref, ref.permute(0, 2, 3, 1)) + x312 x = ff(x) + x313 out = x.permute(0, 3, 1, 2)314 return out
参考与待细化特征必须同形状,并在构造时指定实际网格尺寸。
from UAFLAbundanceCrossAttention import CrossCAB block = CrossCAB(8, dim_head=4, heads=2, input_resolution=(8,16)) y = block(x, ref)
Method 动机参考:在未配准高光谱超分辨的丰度表示中,让参考内容参与特征选择,同时结合局部窗口与通道关联。
| 消融变体 | 结构配置 | 验证目的 |
|---|---|---|
| 参考调制 | 对比 attention_type=base 与 full | 同时影响窗口路径与值调制,需说明范围 |
| 窗口布局 | 禁用 SWA 分支 | 比较跨窗口信息交换 |
| 参考对应 | 匹配参考与打乱参考 | 检查模型是否使用样本对应关系 |