MNist using NNTool’s Python APIs (Pytorch)

In this example it is shown how to train a Neural Network on PyTorch for MNist (Training.ipynb).

The trained model is then exported to ONNX and processed in NNTool for deployment on GAP devices (NNTool.ipynb). This notebook quantizes the graph and test the accuracy in a subset of the original testing dataset. It also contains automatic code generation for a template project that is run from NNTool’s Python APIs to collect on-device performance.

The same code generation procedure mentioned before has been used to generate the gap9_project folder. That template has then been expanded to automate the Autotiler Model code generation (nntool_generate_model.py and CMakeLists.txt), read images from files and check the predicted class (mnist.c).

NOTE: if targeting GAP8 processor, remember to disable the use_ne16 option in the quantization of the graph