MNIST
MNIST是LeCun的手写数字图像库,有四个文件,移步这里下载:http://yann.lecun.com/exdb/mnist/。文件格式该页有详细介绍。
Python-mnist
Sorki写了一个python的package,https://github.com/sorki/python-mnist ,我把他核心部分抄在这里。
这个是标签文件的读取方法:
import struct
from array import array
with open("train-labels-idx1-ubyte", "rb") as f:
magic, size = struct.unpack(">II", f.read(8))
labels = array(&