您的位置:首页 > 其它

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

2016-07-23 18:56 393 查看
学习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副图片

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  深度学习