Neural Networks and Deep Learning 学习笔记(十一)

学习Udacity上的DeepLearning视频,第一个assignment是tensorflow官方git上example里的1_notmnist


Problem 1

Let’s take a peek at some of the data to make sure it looks sensible. Each exemplar should be an image of a character A through J rendered in a different font. Display a sample of the images that we just downloaded. Hint: you can use the package IPython.display.


My Answer:

from IPython.display import Image
import random

def show_image(num_per_letter):
    root = 'notMNIST_large'
    for subroot in sorted(os.listdir(root)):
        fulldir = os.path.join(root,subroot)
        file = [os.path.join(fulldir,x) for x in random.sample(os.listdir(fulldir),3) 
                if os.path.isfile(os.path.join(fulldir,x))]
        print(subroot+':')
        for name in file:
            display(Image(name))

show_image(5)

结果为每个字母随机显示5副图片

运行结果图片

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值