sage.architecture.backend.resnet2d_cbam
Filename : resnet2d_cbam.py Description : Short description of the file
Created on 2026-03-06 13:29:06
__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
2D ResNet backbone with CBAM attention in every residual block. |
Functions
|
Constructs a ResNet-18 model. |
|
Constructs a ResNet-34 model. |
|
Constructs a ResNet-50 model. |
|
Constructs a ResNet-101 model. |
|
Constructs a ResNet-152 model. |
Module Contents
- class ResNet(block, layers, num_classes=512, in_channels=2, dropout=0.0)[source]
Bases:
torch.nn.Module2D ResNet backbone with CBAM attention in every residual block.
Adapted from the standard torchvision ResNet to: 1. Accept multi-channel gravitational-wave inputs (default
in_channels=2for H1/L1 detector pair).
Insert
ChannelAttentionandSpatialAttentiongates inside everyBasicBlockandBottleneck.Output a flat feature vector of size
num_classes(default 512) via global average pooling + a linear projection.
The model is used as the backend of the Sage detection network, receiving 2D feature maps produced by the per-detector 1D CNN frontend.
- Parameters:
block (type) – Residual block class —
BasicBlock(ResNet-18/34) orBottleneck(ResNet-50/101/152).layers (list[int]) – Number of blocks per stage, e.g.
[3, 4, 6, 3]for ResNet-50.num_classes (int) – Output feature dimension (default 512).
in_channels (int) – Number of input channels (default 2 for dual-detector).
state (Initialize internal Module)
ScriptModule. (shared by both nn.Module and)
- 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