現在、ラズパイでDeep Learningの学習を行っています。使用している教材は『ゼロから作るDeep Learning』です。以下のプログラムを実行しようとしています。
python
1mport os 2os.chdir("/home/pi/download/deep-learning-from-scratch-master/ch03") 3import sys, os 4sys.path.append(os.pardir) 5import numpy as np 6from dataset.mnist import load_mnist 7from PIL import Image 8 9def img_show(img): 10 pil_img = Image.fromarray(np.uint8(img)) 11 pil_img.show() 12 13 14(x_train, t_train), (x_test, t_test) = \ 15 load_mnist(flatten=True, normalize=False) 16 17 18img = x_train[0] 19label = t_train[0] 20print(label) 21print(img.shape) 22img = img.reshape(28,28) 23print(img.shape) 24img_show(img) 25コード
変形した形状の画像サイズまでは問題なく動くのですが、最後の画像表示の部分でエラーが表示されてしまいます。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in img_show
NameError: name 'Imge' is not defined
解決方法を教えていただきたいです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/08 11:27