Advertisement

使用numpy加载MNIST数据集

阅读量:

读取并分析如下四个文件

‘train-images-idx3-ubyte’

‘train-labels-idx1-ubyte’

‘t10k-images-idx3-ubyte’

‘t10k-labels-idx1-ubyte’

复制代码
    #_*_coding:utf-8_*_
    import numpy as np
    import os
    class Mnist(object):
    
    def __init__(self):
    
        self.dataname = "Mnist"
        self.dims = 28*28
        self.shape = [28 , 28 , 1]
        self.image_size = 28
        self.data, self.data_y = self.load_mnist()
    
    def load_mnist(self):
    
        data_dir = os.path.join("./data", "mnist")
        fd = open(os.path.join(data_dir, 'train-images-idx3-ubyte')

全部评论 (0)

还没有任何评论哟~