denoise_autoencoder.py 文件源码

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

项目:road-segmentation 作者: paramoecium 项目源码 文件源码
def reconstruction(img_data, size):
    """
    Reconstruct single image from flattened array.
    IMPORTANT: overlapping patches are averaged, not replaced like in recontrustion()
    Args:
        img_data: flattened image array
        type: size of the image (rescaled)
    Returns:
        recontructed image
    """
    patches_per_dim = size - conf.patch_size + 1
    reconstruction = np.zeros((size,size))
    n = np.zeros((size,size))
    idx = 0
    for i in range(patches_per_dim):
        for j in range(patches_per_dim):
            reconstruction[i:(i+conf.patch_size),j:(j+conf.patch_size)] += img_data[idx,:].reshape(conf.patch_size, conf.patch_size)
            n[i:(i+conf.patch_size),j:(j+conf.patch_size)] += 1
            idx += 1
    return np.divide(reconstruction, n)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号