Open hccho2 opened 5 years ago
Please explain _init_kernel of the SubPixelConvolution
def _init_kernel(self, kernel_size, strides, filters): '''Nearest Neighbor Upsample (Checkerboard free) init kernel size ''' overlap = kernel_size[1] // strides[1] init_kernel = np.zeros(kernel_size, dtype=np.float32) i = kernel_size[0] // 2 j = [kernel_size[1] // 2 - 1, kernel_size[1] // 2] if kernel_size[1] % 2 == 0 else [kernel_size[1] // 2] for j_i in j: init_kernel[i, j_i] = 1. / max(overlap, 1.) if kernel_size[1] % 2 == 0 else 1. init_kernel = np.tile(np.expand_dims(init_kernel, 3), [1, 1, 1, filters]) return init_kernel * (self.NN_scaler)**(1/self.up_layers)
Please explain _init_kernel of the SubPixelConvolution