Code Monkey home page Code Monkey logo

ajou_mnist_classification_in_c's Introduction

MNIST Classification in C

This tool allows the training and testing of a simple MLP (Multilayer Perceptron) network. The specific network is trained, using the MNIST dataset, to be able to classify hand-written digits.

Compilation

$ make

Usage

The dataset folder is required to run the program. This folder contains all the MNIST images and has to be placed into the root folder of the project:

.
├── dataset
│   ├── training
│   │   ├── 0
│   │   ├── 1
│   │   ├── 2
│   │   ├── 3
│   │   ├── 4
│   │   ├── 5
│   │   ├── 6
│   │   ├── 7
│   │   ├── 8
│   │   └── 9
│   └── testing
│       ├── 0
│       ├── 1
│       ├── 2
│       ├── 3
│       ├── 4
│       ├── 5
│       ├── 6
│       ├── 7
│       ├── 8
│       └── 9
├── main.c
├── images_handler.h
├── images_handler.c
├── neural_network_handler.h
├── neural_network_handler.c
├── stb_image.h
└── Makefile

Run the program with:

$ ./MNIST_classification_in_C -l 1 -n 64 -e 10 -lr 0.001

where:

  • The -l argument sets the number of hidden layers.
  • The -n argument sets the number of neurons of each hidden layer.
  • The -e argument sets the number of training epochs.
  • The -lr argument sets the specific learning rate used during training.

Output

Reading ./dataset/training/0/ files.
Reading ./dataset/training/1/ files.
Reading ./dataset/training/2/ files.
Reading ./dataset/training/3/ files.
Reading ./dataset/training/4/ files.
Reading ./dataset/training/5/ files.
Reading ./dataset/training/6/ files.
Reading ./dataset/training/7/ files.
Reading ./dataset/training/8/ files.
Reading ./dataset/training/9/ files.
Reading ./dataset/testing/0/ files.
Reading ./dataset/testing/1/ files.
Reading ./dataset/testing/2/ files.
Reading ./dataset/testing/3/ files.
Reading ./dataset/testing/4/ files.
Reading ./dataset/testing/5/ files.
Reading ./dataset/testing/6/ files.
Reading ./dataset/testing/7/ files.
Reading ./dataset/testing/8/ files.
Reading ./dataset/testing/9/ files.
Shuffling samples.
Training.
Epoch: 1/10, accuracy: 0.759783, loss: 1.746183
Epoch: 2/10, accuracy: 0.861150, loss: 0.689133
Epoch: 3/10, accuracy: 0.883467, loss: 0.566282
Epoch: 4/10, accuracy: 0.896183, loss: 0.498846
Epoch: 5/10, accuracy: 0.905183, loss: 0.453839
Epoch: 6/10, accuracy: 0.912250, loss: 0.420292
Epoch: 7/10, accuracy: 0.917500, loss: 0.393635
Epoch: 8/10, accuracy: 0.922050, loss: 0.371836
Epoch: 9/10, accuracy: 0.925733, loss: 0.353492
Epoch: 10/10, accuracy: 0.929567, loss: 0.337611
Testing.
Accuracy: 0.926500, loss: 0.354491

ajou_mnist_classification_in_c's People

Contributors

matteodonati avatar honeycoding avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.