preprocess.py 文件源码

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

项目:notmnist 作者: aidiary 项目源码 文件源码
def draw_images(root_dir):
    """Draw sample images for each class"""
    assert len(root_dir) == num_classes  # A to J
    num_cols = 10
    pos = 1
    for i in range(num_classes):
        target_dir = root_dir[i]
        for j in range(num_cols):
            plt.subplot(num_classes, num_cols, pos)
            random_file = random.choice(os.listdir(target_dir))
            image = misc.imread(os.path.join(target_dir, random_file))
            plt.imshow(image, cmap=plt.get_cmap('gray'))
            plt.axis('off')
            pos += 1
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号