CIFAR-10数据集可视化Python版本
生活随笔
收集整理的這篇文章主要介紹了
CIFAR-10数据集可视化Python版本
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
CIFAR-10數據集有3個版本,分別是Python, Matlab, 二進制版本。
切記這里下載Python版本。
編輯代碼export_cifar10.py
import pickle from scipy.misc import imsave import numpy as npdef unpickle(file):f = open(file, 'rb')dict = pickle.load(f, encoding='iso-8859-1')f.close()return dictfilename = '/tmp/cifar10_data/cifar-10-batches-py/test_batch' dict_train_batch1 = unpickle(filename)print(dict_train_batch1.keys()) # 字典里有4組鍵值對images = dict_train_batch1['data'] print(images.shape)img = np.reshape(images[10], (3, 32, 32)) #只是測試,沒有采用循環導出全部圖像,這里導出第10幅圖 img = img.transpose(1, 2, 0)imsave("cifar.jpg", img)總結
以上是生活随笔為你收集整理的CIFAR-10数据集可视化Python版本的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: TensorFlow CIFAR-10数
- 下一篇: CIFAR-10数据集可视化二进制版本