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

Method forward

lib/Modules.py:961–972  ·  view source on GitHub ↗
(self, f4, prior_cam)

Source from the content-addressed store, hash-verified

959 self.out_s = nn.Conv2d(in_channels, 1, kernel_size=3, padding=1)
960
961 def forward(self, f4, prior_cam):
962 prior_cam = F.interpolate(prior_cam, size=f4.size()[2:], mode='bilinear', align_corners=True) # 2,1,12,12->2,1,48,48
963 r_prior_cam = 1 - torch.sigmoid(prior_cam)
964 prior_cam = torch.sigmoid(prior_cam)
965 f4_a = f4 * r_prior_cam.expand(-1, f4.size()[1], -1, -1) + f4
966 f4_b = f4 * prior_cam.expand(-1, f4.size()[1], -1, -1) + f4
967 f4_s = self.conv3x3(torch.cat([f4_a, f4_b], 1))
968 p4_s = self.out_s(f4_s)
969 f4_e = self.crb(f4)
970 p4_e = self.out_e(f4_e)
971
972 return f4_s, f4_e, p4_s, p4_e
973
974class Decoder_noRCAB(nn.Module):
975 def __init__(self, in_channels):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected