CIFAR-10数据集解析

import pickle
import  numpy as np
import os
CIFAR_DIR = "./"

print(os.listdir(CIFAR_DIR))


with open(os.path.join(CIFAR_DIR, 'data_batch_1'), 'rb') as f:
    data = pickle.load(f)
    #data = pickle.load(f, encoding='bytes') # python3
    
    print(type(data))   #
    print(data.keys())  #['data', 'labels', 'batch_label', 'filenames'] 

    print(type(data['data'])) #
    print(data['data'].shape) #(10000, 3072)

    print(data['data'][0:3])  #[[ 59  43  50 ..., 140  84  72]
 															#[154 126 105 ..., 139 142 144]
 															#[255 253 253 ...,  83  83  84]]
    
    print(type(data['labels']))#
    print(data['labels'][:3]) #[6, 9, 9]
    	
    print(type(data['labels']))#
    print(data['batch_label']) #training batch 1 of 5
    
    print(type(data['labels']))#
    print(data['filenames'][:3]) #['leptodactylus_pentadactylus_s_000004.png', 'camion_s_000148.png', 'tipper_truck_s_001250.png']

 

你可能感兴趣的:(人工智能,python)