This is a repository for my master thesis on AI hardware accelerators developed @ Politecnico di Milano.
- Advisor: Prof. Christian Pilato
- Co-Advisor: Ing. Mattia Tibaldi
In this repository there is the material used in the master thesis and stored on the server in DEIB. For the synthesis and implementation of CNNs on hardware are used two frameworks: HLS4ML and Vitis-AI. In the thesis there is a focus on the comparison between the two tools trying to figure out which one is better to use in different possible scenarios. With hls4ml, the xclbin is generated each time starting from the model that is given to it as input. Usually the generation of this bitstream takes about 3 hours. While in Vitis-AI an already existing bitstream is used and the model is compiled as if it were micro-code. For more details on how the tools work, go to the relative folders (HLS4ML, Vitis-AI) .
The dataset used for training and evaluation of the neural network is the MNIST (https://en.wikipedia.org/wiki/MNIST_database).
The neural network used in the thesis is a Convolutional Neural Network and it has the following structure:
Model: "mnist_cnn_model"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) [(None, 28, 28, 1)] 0
_________________________________________________________________
conv2d (Conv2D) (None, 26, 26, 12) 120
_________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 13, 13, 12) 0
_________________________________________________________________
flatten (Flatten) (None, 2028) 0
_________________________________________________________________
dense (Dense) (None, 10) 20290
=================================================================
Total params: 20,410
Trainable params: 20,410
Non-trainable params: 0
_________________________________________________________________
Training time: 43,2 seconds
Size of the Keras model: 0.233736 MB
Keras test Accuracy: 98,05 %
TOOL | Total images [Images] | Test Accuracy [%] | Throughput [Images\s] | timg [μs] |
---|---|---|---|---|
HLS4ML | 10000 | 97.66 | 60519.5 | 251.92 |
Vitis-AI | 10000 | 98.07 | 3969.52 | 16.5 |
NAME | PERSON CODE | STUDENT ID | |
---|---|---|---|
Davide Carini | [email protected] | 10568649 | 976571 |
For the development of this thesis I relied on these very useful repositories:
- https://github.com/selwyn96/Alveo-tutorial/blob/main/training/MNIST_Test/MNIST_train.ipynb
- https://github.com/selwyn96/hls4ml
- https://github.com/lobster1989/Mnist-classification-Vitis-AI-1.3-TensorFlow2
Contributions and discovery of any bug are always welcome!