Very simple convolutional neural network by Java
Download the MNIST or EMNIST dataset from here.
Change your path in trainFile and testFile.
public String trainFile = "/home/vietbt/java/mnist_digits_train.txt";
public String testFile = "/home/vietbt/java/mnist_digits_test.txt";
public double learningRate = 0.55;
public int batchSize = 50;
public int outputSize = 10;
You also can config the learningRate, batchSize or outputSize to match your dataset. More information about MNIST or EMNIST datasets is in here. After that, run this code with your Java IDE or by linux command line:
javac tinyCNN.java
java tinyCNN
This program runs with all CPUs (updated).
- Best test accuracy: 99.13% with learning rate = 0.55 after 142,500 steps
- Best test accuracy: 98.58% with learning rate = 0.87 after 60,200 steps
- Best test accuracy: 88.56% with learning rate = 0.6 after 63,100 steps
- Best test accuracy: 83.81% with learning rate = 0.6 after 117,300 steps
- Best train accuracy: 82.18% with learning rate = 0.85 after 191,300 steps
- Best test accuracy: 80.13% with learning rate = 0.85 after 160,000 steps
- Best train accuracy: 87.00% with learning rate = 0.85 after 206,900 steps
- Best test accuracy: 85.73% with learning rate = 0.85 after 210,000 steps
Bui The Viet - FPT University - [email protected]