MCPcopy Create free account
hub / github.com/ChunmingHe/WS-SAM / CALayer

Class CALayer

lib/Modules.py:666–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664 return f1, f2, f3, f4
665
666class CALayer(nn.Module):
667 def __init__(self, channel, reduction=16):
668 super(CALayer, self).__init__()
669 # global average pooling: feature --> point
670 self.avg_pool = nn.AdaptiveAvgPool2d(1)
671 # feature channel downscale and upscale --> channel weight
672 self.conv_du = nn.Sequential(
673 nn.Conv2d(channel, channel // reduction, 1, padding=0, bias=True),
674 nn.ReLU(inplace=True),
675 nn.Conv2d(channel // reduction, channel, 1, padding=0, bias=True),
676 nn.Sigmoid()
677 )
678
679 def forward(self, x):
680 y = self.avg_pool(x)
681 y = self.conv_du(y)
682 return x * y
683
684
685class RCAB(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected