mnist_cnn_3layers_vis.py 文件源码

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

项目:dlcv05 作者: telecombcn-dl 项目源码 文件源码
def make_mosaic(imgs, nrows, ncols, border=1):
    """
    Given a set of images with all the same shape, makes a
    mosaic with nrows and ncols
    """
    nimgs = imgs.shape[0]
    imshape = imgs.shape[1:]

    mosaic = ma.masked_all((nrows * imshape[0] + (nrows - 1) * border,
                            ncols * imshape[1] + (ncols - 1) * border),
                            dtype=np.float32)

    paddedh = imshape[0] + border
    paddedw = imshape[1] + border
    for i in xrange(nimgs):
        row = int(np.floor(i / ncols))
        col = i % ncols

        mosaic[row * paddedh:row * paddedh + imshape[0],
               col * paddedw:col * paddedw + imshape[1]] = imgs[i]
    return mosaic

# Data Loading and Preprocessing

# The data, shuffled and split between train and test sets
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号