upsampling.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:DeepMonster 作者: olimastro 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号