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

Method forward

lib/VIT/decoder/decoder_p.py:180–192  ·  view source on GitHub ↗
(self,x,side_x,mask)

Source from the content-addressed store, hash-verified

178 self.Fuse2 = nn.Sequential(nn.Conv2d(dim, dim, kernel_size=1), nn.Conv2d(dim, dim, kernel_size=3, padding=1), nn.BatchNorm2d(dim), nn.ReLU(inplace=True))
179
180 def forward(self,x,side_x,mask):
181 N,C,H,W = x.shape
182 mask = F.interpolate(mask,size=x.size()[2:],mode='bilinear')
183 mask_d = mask.detach()
184 mask_d = torch.sigmoid(mask_d)
185 xf = self.F_TA(x,mask_d)
186 xb = self.B_TA(x,1-mask_d)
187 x = self.TA(x)
188 x = torch.cat((xb,xf,x),1)
189 x = x.view(N,3*C,H,W)
190 x = self.Fuse(x)
191 D = self.Fuse2(side_x+side_x*x)
192 return D
193
194 def initialize(self):
195 weight_init(self)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected