Skip to content

citiususc/ho-mnist

Repository files navigation

HO-MNIST

Hardware Oriented CNN for MNIST recognition.

HO-MNIST experiment setup

Online demo

You can try an online simulation of our CIM macro! Binder Google Colab GitHub Codespaces

Creation of the Hardware Oriented model

Train model

python3 ./train.py --output-path=./models/mnist_base.pth

Quantize model

python3 ./quantize.py --model-path=./models/mnist_base.pth --output-path=./models/mnist_quantized.pth

Convert model to int8 and store scales

python3 ./convert.py --model-path=./models/mnist_quantized.pth --output-path=./models/mnist_quantized_converted.pth

Visualization of the 5-bit kernels

python3 ./display_weights.py --model-path=./models/mnist_quantized_converted.pth --chip-format

Testing of the model

python3 ./test.py --test-base --model-path=./models/mnist_base.pth  # Accuracy: 97.56%
python3 ./test.py --model-path=./models/mnist_quantized_converted.pth  # Accuracy: 90.57%
python3 ./test.py --test-hardware --model-path=./models/mnist_hacc --serial-port=/dev/ttyUSB2  # Accuracy: 91.89%

Live demo

python3 ./demo.py --model-path=./models/mnist_quantized_converted.pth --live
python3 ./demo.py --hardware --model-path=./models/mnist_hacc --serial-port=/dev/ttyUSB2 --live

About

Hardware Oriented CNN for MNIST recognition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published