Mnist是个简单的手写0~9的数据集,一般是作为新手练习之用。该代码读取Mnist数据集,并输出jpg图片和label的txt文件。
import numpy as np
import struct
import matplotlib.pyplot as plt
from PIL import Image,ImageFont,ImageDraw
import cv
import scipy.misc
filename = 'DataSet/train-images-idx3-ubyte'
#filename = 'C:/Users/haoming/Desktop/train-images-idx3-ubyte'
filename1 = 'DataSet/train-labels-idx1-ubyte'
binfile = open(filename,'rb')#以二进