def _make_network(self): self.front_conv = bb.ConvBlock(nn.Conv2d, self.input_nc, self.base_nc, kernel_size=7, norm_layer=self.norm_layer, stride=1, acti_layer=nn.ReLU, padding=3) self.pooling = nn.MaxPool2d(3, 2, padding=1) self._make_resnet_layers() self._set_hand_interm_convs()
def __init__(self, input_nc, output_nc, img_shape, norm_layer): super().__init__() self.upconv = bb.up_conv4x4(input_nc, output_nc, norm_layer) self.scale_conv = bb.ConvBlock(nn.Conv2d, output_nc, output_nc, kernel_size=1, norm_layer=None, stride=1, padding=0, acti_layer=nn.Tanh, bias=True) self.upscale = nn.Upsample(size=img_shape, mode="bilinear")
def _make_end_conv(self): last_layer = self._get_last_layer() conv = bb.ConvBlock(nn.Conv2d, last_layer.output_nc, self.output_nc, kernel_size=1, norm_layer=None, stride=1, padding=0, acti_layer=nn.Tanh, bias=True) upsample = nn.Upsample(size=self.img_shape) return nn.Sequential(conv, upsample)
def __init__(self, input_nc, num_joints, img_shape, norm_layer): super().__init__() self.input_nc = input_nc self.output_nc = num_joints deconv = bb.up_conv4x4(input_nc, num_joints, norm_layer, stride = 2) conv1 = bb.ConvBlock(nn.Conv2d, num_joints, num_joints, kernel_size = 1, stride = 1, padding = 0, bias = True, norm_layer = None, acti_layer = nn.Sigmoid) upsample = nn.Upsample(size = img_shape, mode = 'bilinear') blocks = [deconv, conv1, upsample] self.net = nn.Sequential(*blocks)
def _make_network(self): norm_layer = self.norm_layer conv1 = bb.down_conv3x3(self.input_nc, int(self.input_nc / 4), norm_layer) deconv1 = bb.up_conv4x4(int(self.input_nc / 4), self.deconv_nc, norm_layer, stride = 2) blocks = [conv1, deconv1] deconv_input_nc = deconv1.output_nc for _ in range(self.n_deconv - 1): deconv = bb.up_conv4x4(self.deconv_nc, self.deconv_nc, norm_layer, stride = 2) blocks.append(deconv) final_conv = bb.ConvBlock(nn.Conv2d, self.deconv_nc, self.output_nc, kernel_size = 1, stride = 1, padding = 0, bias = True, norm_layer = None, acti_layer = nn.Sigmoid) blocks.append(final_conv) return nn.Sequential(*blocks)