Beispiel #1
0
    net.push(Conv2d(5, 5, 3, 20))  # 3x32 -> 10x28
    net.push(Relu())
    net.push(BatchNorm())
    net.push(Maxpooling(4, 4))  # 10x28 -> 10x7
    net.push(Reshape((980)))
    net.push(Linear(980, 200))
    net.push(Relu())
    net.push(BatchNorm())
    net.push(Softmax(200, 10))

    # Data
    data = DataProvider()
    data.train_input(x, y)
    data.test_input(xt, yt)
    data.batch_size(32)
    data.batch_size_test(1000)

    lr = 1e-3
    gamma = 1
    beta_1 = 0.9
    beta_2 = 0.999
    total_epoch = 100

    loss_cache = 10
    for epoch in xrange(1, total_epoch + 1):
        print 'Epoch: {}/{}'.format(epoch, total_epoch)

        # Training (Mini-batch)
        now = time.time()
        data.shuffle()
        bar = Bar(max_value=n)