def LoadData(mode):
    mdr = MnistImageDataReader(train_x, train_y, test_x, test_y, mode)
    mdr.ReadData()
    mdr.NormalizeX()
    mdr.NormalizeY(NetType.MultipleClassifier, base=0)
    mdr.Shuffle()
    mdr.GenerateValidationSet(k=12)
    return mdr
Esempio n. 2
0
def LoadData(num_output):
    mdr = MnistImageDataReader("image")
    mdr.ReadData()
    mdr.NormalizeX()
    mdr.NormalizeY(NetType.MultipleClassifier, base=0)
    mdr.Shuffle()
    mdr.GenerateValidationSet(k=12)
    return mdr
Esempio n. 3
0
def load_data():
    dataReader = MnistImageDataReader(mode="timestep")
    dataReader.ReadLessData(10000)
    dataReader.NormalizeX()
    dataReader.NormalizeY(NetType.MultipleClassifier, base=0)
    dataReader.Shuffle()
    dataReader.GenerateValidationSet(k=12)
    return dataReader
def GenerateDataSet(subfolder, count=10):
    isExists = os.path.exists(subfolder)
    if not isExists:
        os.makedirs(subfolder)

    mdr = MnistImageDataReader("vector")
    mdr.ReadLessData(1000)

    for i in range(count):
        X = np.zeros_like(mdr.XTrainRaw)
        Y = np.zeros_like(mdr.YTrainRaw)
        list = np.random.choice(1000, 1000)
        k = 0
        for j in list:
            X[k] = mdr.XTrainRaw[j]
            Y[k] = mdr.YTrainRaw[j]
            k = k + 1
        # end for
        np.savez(subfolder + "/" + str(i) + ".npz", data=X, label=Y)
def LoadData():
    mdr = MnistImageDataReader("vector")
    mdr.ReadLessData(1000)
    mdr.NormalizeX()
    mdr.NormalizeY(NetType.MultipleClassifier, base=0)
    mdr.GenerateValidationSet(k=10)
    return mdr
def LoadData():
    print("reading data...")
    dr = MnistImageDataReader(mode="vector")
    dr.ReadData()
    dr.NormalizeX()
    dr.NormalizeY(NetType.MultipleClassifier)
    dr.GenerateValidationSet(k=20)
    print(dr.num_validation, dr.num_example, dr.num_test, dr.num_train)
    return dr
Esempio n. 7
0
def LoadData():
    #读取时最好上锁
    lock.acquire()
    print("reading MNIST data...")
    dr = MnistImageDataReader(mode="vector")
    dr.ReadData()
    dr.NormalizeX()
    dr.NormalizeY(NetType.MultipleClassifier)
    dr.GenerateValidationSet(k=20)
    print(dr.num_validation, dr.num_example, dr.num_test, dr.num_train)
    #释放锁
    lock.release()
    return dr
def load_data():
    dataReader = MnistImageDataReader(mode="timestep")
    dataReader.ReadData()
    dataReader.NormalizeX()
    dataReader.NormalizeY(NetType.MultipleClassifier, base=0)
    dataReader.Shuffle()
    dataReader.GenerateValidationSet(k=12)
    x_train, y_train = dataReader.XTrain, dataReader.YTrain
    x_test, y_test = dataReader.XTest, dataReader.YTest
    x_val, y_val = dataReader.XDev, dataReader.YDev
    x_train = x_train.squeeze()
    x_test = x_test.squeeze()
    x_val = x_val.squeeze()

    x_test_raw = dataReader.XTestRaw[0:64]
    y_test_raw = dataReader.YTestRaw[0:64]

    return x_train, y_train, x_test, y_test, x_val, y_val, x_test_raw, y_test_raw
Esempio n. 9
0
def load_data():
    dataReader = MnistImageDataReader(mode="vector")
    dataReader.ReadData()
    dataReader.NormalizeX()
    dataReader.NormalizeY(NetType.MultipleClassifier)
    dataReader.GenerateValidationSet(k=20)

    x_train, y_train = dataReader.XTrain, dataReader.YTrain
    x_test, y_test = dataReader.XTest, dataReader.YTest
    x_val, y_val = dataReader.XDev, dataReader.YDev

    x_train = x_train.reshape(x_train.shape[0], 28 * 28)
    x_test = x_test.reshape(x_test.shape[0], 28 * 28)
    x_val = x_val.reshape(x_val.shape[0], 28 * 28)

    return x_train, y_train, x_test, y_test, x_val, y_val
def LoadData():
    mdr = MnistImageDataReader("image")
    mdr.ReadLessData(1000)
    mdr.NormalizeX()
    return mdr