2 Unets for filling dead channels of collection view images and induction view images. Architectures 3 for the two models are the same but the padding is different as the views produce different sized images. 5 Architecture modelled on the submanifold sparse Unet (arXiv:1711.10275). Ideally this model would 6 make use of sparse convolutions but current software restrictions means it does not. 14 def __init__(self, in_channels=1, out_channels=1):
15 super(UnetInduction, self).
__init__()
53 conv4 = self.
convs4_R(torch.cat([conv_bottom, conv4], 1))
55 conv3 = self.
convs3_R(torch.cat([conv4, conv3], 1))
57 conv2 = self.
convs2_R(torch.cat([conv3, conv2], 1))
59 conv1 = self.
convs1_R(torch.cat([conv2, conv1], 1))
66 nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding))
72 nn.BatchNorm2d(in_channels),
74 nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding))
78 def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1,1),(1,1)]):
79 conv_block = nn.Sequential(
80 nn.BatchNorm2d(in_channels),
82 nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding[0]),
83 nn.BatchNorm2d(out_channels),
85 nn.Conv2d(out_channels, out_channels, kernel_size, padding=padding[1]))
89 def down_conv(self, in_channels, out_channels, kernel_size, stride):
90 down_conv = nn.Sequential(
91 nn.BatchNorm2d(in_channels),
93 nn.Conv2d(in_channels, out_channels, kernel_size, stride))
97 def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0):
98 up_conv = nn.Sequential(
99 nn.BatchNorm2d(in_channels),
101 nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride, output_padding=output_padding))
108 super(UnetCollection, self).
__init__()
146 conv4 = self.
convs4_R(torch.cat([conv_bottom, conv4], 1))
148 conv3 = self.
convs3_R(torch.cat([conv4, conv3], 1))
150 conv2 = self.
convs2_R(torch.cat([conv3, conv2], 1))
152 conv1 = self.
convs1_R(torch.cat([conv2, conv1], 1))
158 conv = nn.Sequential(
159 nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding))
164 conv = nn.Sequential(
165 nn.BatchNorm2d(in_channels),
167 nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding))
171 def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1,1),(1,1)]):
172 conv_block = nn.Sequential(
173 nn.BatchNorm2d(in_channels),
175 nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding[0]),
176 nn.BatchNorm2d(out_channels),
178 nn.Conv2d(out_channels, out_channels, kernel_size, padding=padding[1]))
182 def down_conv(self, in_channels, out_channels, kernel_size, stride):
183 down_conv = nn.Sequential(
184 nn.BatchNorm2d(in_channels),
186 nn.Conv2d(in_channels, out_channels, kernel_size, stride))
190 def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0):
191 up_conv = nn.Sequential(
192 nn.BatchNorm2d(in_channels),
194 nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride, output_padding=output_padding))
def down_conv(self, in_channels, out_channels, kernel_size, stride)
def single_conv_out(self, in_channels, out_channels, kernel_size, padding=1)
def down_conv(self, in_channels, out_channels, kernel_size, stride)
def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1, 1))
def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0)
def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1, 1))
def __init__(self, in_channels=1, out_channels=1)
def __init__(self, in_channels=1, out_channels=1)
def single_conv_in(self, in_channels, out_channels, kernel_size, padding=1)
def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0)
def single_conv_out(self, in_channels, out_channels, kernel_size, padding=1)
def single_conv_in(self, in_channels, out_channels, kernel_size, padding=1)