输入经共享 1×1×1 卷积与 GELU,再用平均池化和最大池化生成通道权重;深度 3×3×3 卷积产生空间调制信号,最后再次调用同一个逐点卷积。
[1×16×8×16×16]1×16×8×16×16CPCABlock3D(16, 16, channelAttention_reduce=4);CPU / evalforward() 数据流顺序拆解 · 点击任意子模块方块可同步查看对应源码切片输入经共享 1×1×1 卷积与 GELU,再用平均池化和最大池化生成通道权重;深度 3×3×3 卷积产生空间调制信号,最后再次调用同一个逐点卷积。 本页使用 CPCABlock3D(16, 16, channelAttention_reduce=4);CPU / float32 / eval,forward_hook 记录子层输入输出,函数式运算的形状由同次前向局部张量读取。
46 def forward(self, inputs): 47 inputs = self.conv(inputs)48 inputs = self.act(inputs)49 50 channel_att_vec = self.ca(inputs)51 inputs = channel_att_vec * inputs52 53 x = self.dconv3_3_3(inputs)54 spatial_att = self.conv(x)55 out = spatial_att * inputs56 out = self.conv(out)57 return out
输入是 BCDHW。示例通道为 16、体网格为 8×16×16;必须满足 in_channels == out_channels。
from CPCA3d import CPCABlock3D model = CPCABlock3D(16, 16, channelAttention_reduce=4).eval() y = model(x)
Method 动机参考:把通道统计与三维局部邻域结合到体数据特征中;本地实现只使用一个 3×3×3 深度卷积。
| 消融变体 | 结构配置 | 验证目的 |
|---|---|---|
| 逐点投影 | 仅同宽 1×1×1 | 建立体特征混合基准 |
| 通道调制 | 保留 ca,移除空间乘法 | 检验三维邻域调制 |
| 完整本地实现 | 通道 + 单尺度三维空间调制 | 比较分割精度与显存 |
CPCABlock3D(16, 16, channelAttention_reduce=4),输入为 torch.randn(1,16,8,16,16)。使用 PyTorch 2.6.0+cu124,CPU / float32 / eval;参数量为 868,通过 sum(p.numel() for p in model.parameters()) 计算。测试使用随机输入,消融表是待开展的实验设计。