sage.architecture.backend.resnet3d_cbam

Filename : resnet3d_cbam.py Description : Short description of the file

Created on 2026-03-05 13:52:22

__author__ = Narenraju Nagarajan __copyright__ = Copyright 2026, Sage __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __affiliation__ = N/A __email__ = N/A __status__ = [‘inProgress’, ‘Archived’, ‘inUsage’, ‘Debugging’]

GitHub Repository: NULL

Documentation: NULL

Classes

ResNet

3D ResNet backbone with CBAM + detector-aware attention modules.

Functions

resnet18_cbam([pretrained])

Constructs a ResNet-18 model.

resnet34_cbam([pretrained])

Constructs a ResNet-34 model.

resnet50_cbam([pretrained])

Constructs a ResNet-50 model.

resnet101_cbam([pretrained])

Constructs a ResNet-101 model.

resnet152_cbam([pretrained])

Constructs a ResNet-152 model.

Module Contents

class ResNet(block, layers, num_classes=512, in_channels=1)[source]

Bases: torch.nn.Module

3D ResNet backbone with CBAM + detector-aware attention modules.

An extension of the standard 2D ResNet that processes detector feature volumes of shape (B, 1, D=2, H, W) with 3D convolutions. In addition to the per-block CBAM gates, the backbone integrates:

  • DetectorAttention in every residual block to weight each detector’s contribution channel-wise.

  • DetectorFusion after layer 2 to mix H1/L1 features.

  • CoherenceAttention after layer 2 to gate on inter-detector agreement.

  • TemporalTransformer after layer 4 for long-range context over the frequency axis.

  • Learned detector embedding added to the stem output for positional discrimination of the two detector channels.

Parameters:
  • block (type) – Residual block class — BasicBlock or Bottleneck.

  • layers (list[int]) – Number of blocks in each of the four stages.

  • num_classes (int) – Output feature dimension of the final FC layer (default 512).

  • in_channels (int) – Number of input channels (default 1 for single-channel 3D volume).

  • state (Initialize internal Module)

  • ScriptModule. (shared by both nn.Module and)

inplanes = 64[source]
conv1[source]
detector_embed[source]
bn1[source]
relu[source]
maxpool[source]
layer1[source]
layer2[source]
detector_fusion[source]
coherence_attention[source]
layer3[source]
layer4[source]
temporal_transformer[source]
avgpool[source]
fc[source]
forward(x)[source]
resnet18_cbam(pretrained=False, **kwargs)[source]

Constructs a ResNet-18 model.

Parameters:

pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet34_cbam(pretrained=False, **kwargs)[source]

Constructs a ResNet-34 model.

Parameters:

pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet50_cbam(pretrained=False, **kwargs)[source]

Constructs a ResNet-50 model.

Parameters:

pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet101_cbam(pretrained=False, **kwargs)[source]

Constructs a ResNet-101 model.

Parameters:

pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet152_cbam(pretrained=False, **kwargs)[source]

Constructs a ResNet-152 model.

Parameters:

pretrained (bool) – If True, returns a model pre-trained on ImageNet