Skip to content

Instantly share code, notes, and snippets.

@wastu01
Last active November 8, 2020 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wastu01/d1faa11b3ef594d14a7bbb9b239154df to your computer and use it in GitHub Desktop.
Save wastu01/d1faa11b3ef594d14a7bbb9b239154df to your computer and use it in GitHub Desktop.
人工智慧深度學習

參考文章:

https://ithelp.ithome.com.tw/articles/10232315

import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
from keras.datasets import mnist
(train_feature, train_label), (test_feature, test_label) = mnist.load_data()

查看訓練資料

print(train_feature.shape)
print(train_label.shape)
(60000, 28, 28)
(60000,)

訓練資料共有60000筆

train_feature = 記錄數字圖像 每張圖片大小 = 28像素x28像素

train_label則是圖像的標記,記錄說每張圖片的數字是多少

(train_feature, train_label), (test_feature, test_label) = mnist.load_data()

plt.gcf().set_size_inches(2, 2)
plt.imshow(train_feature[0], cmap='binary')
plt.show()

#### plt.imshow ... 顯示訓練資料的第一張圖片 跟文字雲一樣的
#### cmap='binary表示以黑白圖片顯示
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment