import tensorflow as tf
import numpy as np
import os
file1 = '/content/drive/Colab Notebooks/cifar-10-batches-py/data_batch_3'#文件的路径
def unpickle(file):#CIFAR-10官方给出的使用方法
import pickle
with open(file, 'rb') as fo:
dict = pickle.load(fo, encoding='iso-8859-1')
return dict
dict_train_batch1 = unpickle(file1) # 将data_batch文件读入到数据结构(字典)中
data_train_batch1 = dict_train_batch1.get('data') # 字典中取data
labels = dict_train_batch1.get('labels') # 字典中取labels
#可使用print来观察导入的数据
print(data_train_batch1)
print(labels)
colab 运行 CIFAR-10 数据集
最新推荐文章于 2023-01-05 11:13:57 发布