MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __init__

Method __init__

tests/integration/test_integration_stn.py:33–50  ·  view source on GitHub ↗
(self, is_ref=True, reverse_indexing=False)

Source from the content-addressed store, hash-verified

31 """
32
33 def __init__(self, is_ref=True, reverse_indexing=False):
34 super().__init__()
35 self.is_ref = is_ref
36 self.localization = nn.Sequential(
37 nn.Conv2d(1, 8, kernel_size=7),
38 nn.MaxPool2d(2, stride=2),
39 nn.ReLU(True),
40 nn.Conv2d(8, 10, kernel_size=5),
41 nn.MaxPool2d(2, stride=2),
42 nn.ReLU(True),
43 )
44 # Regressor for the 3 * 2 affine matrix
45 self.fc_loc = nn.Sequential(nn.Linear(10 * 3 * 3, 32), nn.ReLU(True), nn.Linear(32, 3 * 2))
46 # Initialize the weights/bias with identity transformation
47 self.fc_loc[2].weight.data.zero_()
48 self.fc_loc[2].bias.data.copy_(torch.tensor([1, 0, 0, 0, 1, 0], dtype=torch.float))
49 if not self.is_ref:
50 self.xform = AffineTransform(align_corners=False, normalized=True, reverse_indexing=reverse_indexing)
51
52 # Spatial transformer network forward function
53 def stn_ref(self, x):

Callers

nothing calls this directly

Calls 1

AffineTransformClass · 0.90

Tested by

no test coverage detected