【时间】2019.12.21
【题目】CIFAR-10 dataset 的下载与使用、转图片
cifar10与cifar100下载地址:http://www.cs.toronto.edu/~kriz/cifar.html
一、cifar10介绍及转换图片
具体参考:CIFAR-10 dataset 的下载与使用、转图片.
解压源文件的函数:
import cv2
import numpy as np
import pickle
import os
# 解压缩,返回解压后的字典
def unpickle(file):
fo = open(file, 'rb')
dict = pickle.load(fo, encoding='latin1')
fo.close()
return dict
cifar10转图片 :
def cifar10_to_images():
tar_dir='../data/cifar-10-batches-py/' #原始数据库目录
train_root_dir='../data/cifar10/train/' #图片保存目录
test_root_dir='../data/cifar10/test/'
if not os.path.exists(train_root