制作自己的python版本的类CIFAR10数据集
2017-05-07 19:32
1311 查看
本系列文章由 @yhl_leo 出品,转载请注明出处。
文章链接: http://blog.csdn.net/yhl_leo/article/details/71357097
之前发布的仿照CIFAR10数据集格式,制作自己的数据集 (C++版本),得到一些网友的关注,并且不断有网友在评论区或者私信里询问,怎样制作python版本的。趁着下午有点闲时间,把制作方法整理发布在这里,希望对大家有所帮助。
源码地址GitHub: yhlleo/cifar10Dataset
关于python 版本的CIFAR10的数据格式,官网上已经介绍:
data – a 10000x3072 numpy array of uint8s. Each row of the array stores a 32x32 colour image. The first 1024 entries contain the red channel values, the next 1024 the green, and the final 1024 the blue. The image is stored in row-major order, so that the first 32 entries of the array are the red channel values of the first row of the image.
labels – a list of 10000 numbers in the range 0-9. The number at index i indicates the label of the ith image in the array data.
因此,想要制作自己的数据集,只需要把
很明显,python版本存储成了一个
详细的代码内容,可以查看实现代码,另外
跟官方数据的输出格式一致,虽然没有训练测试,但是理论上应该没问题,大家在测试的过程中,如果遇到问题,欢迎指出。
文章链接: http://blog.csdn.net/yhl_leo/article/details/71357097
之前发布的仿照CIFAR10数据集格式,制作自己的数据集 (C++版本),得到一些网友的关注,并且不断有网友在评论区或者私信里询问,怎样制作python版本的。趁着下午有点闲时间,把制作方法整理发布在这里,希望对大家有所帮助。
源码地址GitHub: yhlleo/cifar10Dataset
关于python 版本的CIFAR10的数据格式,官网上已经介绍:
data – a 10000x3072 numpy array of uint8s. Each row of the array stores a 32x32 colour image. The first 1024 entries contain the red channel values, the next 1024 the green, and the final 1024 the blue. The image is stored in row-major order, so that the first 32 entries of the array are the red channel values of the first row of the image.
labels – a list of 10000 numbers in the range 0-9. The number at index i indicates the label of the ith image in the array data.
因此,想要制作自己的数据集,只需要把
data,
label准备好就可以,另外,我们可以读取
cifar10存储好的文件,查看其数据格式,以
data_batch_1为例(可以通过
cifar10_read.py读取):
{'data': array([[ 59, 43, 50, ..., 140, 84, 72], [154, 126, 105, ..., 139, 142, 144], [255, 253, 253, ..., 83, 83, 84], ..., [ 71, 60, 74, ..., 68, 69, 68], [250, 254, 211, ..., 215, 255, 254], [ 62, 61, 60, ..., 130, 130, 131]], dtype=uint8), 'labels': [6, 9, 9, 4, 1, 1, 2, 7, 8, 3, 4, 7, 7, 2, 9, 9, 9, 3, 2, 6, 4, 3, 6, 6, 2, 6, 3, 5, 4, 0, 0, 9, 1, 3, 4, 0, 3, 7, 3, 3, 5, 2, 2, 7, 1, 1, 1, 2, 2, 0, 9, 5, 7, 9, 2, 2, 5, 2, 4, 3, 1, 1, 8, 2, 1, 1, 4, 9, 7, 8, 5, 9, 6, 7, 3, 1, 9, 0, 3, 1, 3, 5, 4, 5, 7, 7, ... , 9, 8, 9, 4, 4, 7, 1, 0, 4, 3, 6, 3, 9, 8, 3, 6, 8, 3, 6, 6, 2, 6, 7, 3, 0, 0, 0, 2, 5, 1, 2, 9, 2, 2, 1, 6, 3, 9, 1, 1, 5], 'batch_label': 'training batch 1 of 5', 'filenames': ['leptodactylus_pentadactylus_s_000004.png', 'camion_s_000148.png', 'tipper_truck_s_001250.png', ... , 'truck_s_000036.png', 'car_s_002296.png', 'estate_car_s_001433.png', 'cur_s_000170.png']}
很明显,python版本存储成了一个
dict,其中
key包括:
data, 存放图像数据文件,是一个
nx3072的数组;
labels, 存放图像对应的
label,是一个
nx1的数组;
batch_label, 说明信息;
filenames, 文件名列表。
详细的代码内容,可以查看实现代码,另外
demo.py中提供了测试数据,这里把读取的文件结果输出:
{'data': array([[255, 255, 255, ..., 255, 255, 255], [255, 255, 255, ..., 255, 255, 255]], dtype=uint8), 'label': [0, 1], 'batch_label': 'training batch 0 of 1', 'filenames': ['a.png', 'b.png']}
跟官方数据的输出格式一致,虽然没有训练测试,但是理论上应该没问题,大家在测试的过程中,如果遇到问题,欢迎指出。
相关文章推荐
- Faster RCNN 训练自己的数据集(Matlab,python版本)及制作VOC2007格式数据集
- 用自己的数据,制作python版本的cifar10数据集
- 制作自己的数据集之1 python3 实现cifar10数据集的可视化 --- 减少数据集6万张图片为100张图片
- 制作python版本的类CIFAR10数据集.Tensorflow
- Tensorflow 用自己图片制作数据集 仿cifar10(二)
- 深度学习-CAFFE利用CIFAR10网络模型训练自己的图像数据获得模型-1.制作自己的数据集
- R-FCN+ResNet-50训练自己的数据集模型(python版本)
- 制作自己的数据集 打标签bounding box 之 Windows 10 下python环境安装(PyQt4)
- python制作自己的数据集
- caffe学习笔记(四)--制作自己的数据集train.txt和val.txt,生成LMDB文件
- 自发行python版本制作(一)
- 自发行python版本制作(二)编译
- R-FCN+ResNet-50用自己的数据集训练模型(python版本)
- Faster-RCNN+ZF用自己的数据集训练模型(Python版本)
- Faster-RCNN+ZF用自己的数据集训练模型(Python版本)
- python开发_tkinter_窗口控件_自己制作的Python IDEL_博主推荐(二)
- Faster-RCNN+ZF用自己的数据集训练模型(Python版本)
- cifar10数据集的读取Python/Tensorflow
- 编写Python脚本抓取网络小说来制作自己的阅读器
- 仿照CIFAR-10数据集格式,制作自己的数据集