def __init__(self, ratio=2, kernlen=5, **kwargs):
# I imagine the idea could be aplied to a bigger ratio
assert ratio == 2
# the kernel is stripped from opencv, need a function that output such a sharp gauss kern
assert kernlen == 5
self.ratio = ratio
#kernel = T.as_tensor_variable(gkern(kernlen))
#self.kernel = kernel.dimshuffle('x','x',0,1)
kernel = np.asarray([[1,4,6,4,1],
[4,16,26,16,4],
[6,26,64,26,6],
[1,4,6,4,1],
[4,16,26,16,4]])
kernel = kernel[None,None,:,:] / 64.
self.kernel = T.as_tensor_variable(kernel.astype(np.float32))
super(GaussianKernelUpsampling, self).__init__(**kwargs)
评论列表
文章目录