MCPcopy Create free account
hub / github.com/chenhaoxing/HDNet / __init__

Method __init__

models/normalize.py:6–15  ·  view source on GitHub ↗

Compute the instance normalization within only the background region, in which the mean and standard variance are measured from the features in background region.

(self, dims_in, eps=1e-5)

Source from the content-addressed store, hash-verified

4
5class RAIN(nn.Module):
6 def __init__(self, dims_in, eps=1e-5):
7 '''Compute the instance normalization within only the background region, in which
8 the mean and standard variance are measured from the features in background region.
9 '''
10 super(RAIN, self).__init__()
11 self.foreground_gamma = nn.Parameter(torch.zeros(dims_in), requires_grad=True)
12 self.foreground_beta = nn.Parameter(torch.zeros(dims_in), requires_grad=True)
13 self.background_gamma = nn.Parameter(torch.zeros(dims_in), requires_grad=True)
14 self.background_beta = nn.Parameter(torch.zeros(dims_in), requires_grad=True)
15 self.eps = eps
16
17 def forward(self, x, mask):
18 mask = F.interpolate(mask.detach(), size=x.size()[2:], mode='nearest')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected