Tensorflow Neural Network Quantization
This is a school project for the Advanced Computer Architectures class @PoliMi, 2017-2018.
Be careful, the repository contains also the datasets and all the model files.
You can see the main results of MNIST models evaluation looking at these notebooks: Model (a), Model (b)
The evaluation of CIFAR-10 models is also available: Model (c), Model (d)
Tensorflow is an open source framework for machine learning applications such as neural networks. We use official python API. The project is developed using:
- Ubuntu 16.04 LTS
- Python 2.7
- Tensorflow 1.8 version with CPU only support
We used a desktop pc assempled with:
To install Tensorflow with CPU only support and jupyter notebook run:
pip install tensorflow
pip install jupyter
Then navigate to your code directory and start jupyter
cd path/to/repo
jupyter notebook
As mentioned in the project description we are not interested in the training phase. However, we had to train some models. In order to speed up the training phase we used a Docker image with Nvidia GPU support, officially provided by Tensorflow.
To setup docker and train your model on GPU:
- Install proprietary Nvidia driver
- Install docker
- Install nvidia-docker
Then pull the latest GPU docker image:
sudo nvidia-docker pull tensorflow/tensorflow:latest-gpu
Create the container with port and data binding
sudo nvidia-docker run -it --name tensorflow_docker -d -p 8888:8888 -p 6006:6006 -v ~/tensorflow:/notebooks tensorflow/tensorflow:latest-gpu
To start the container:
sudo nvidia-docker container start tensorflow_docker
To stop the container:
sudo nvidia-docker container stop tensorflow_docker
To access Tensorflow docker container bash:
sudo nvidia-docker exec -it tensorflow_docker /bin/bash
To start Tensorboard (in container bash):
tensorboard --logdir /notebooks/logdir
To access jupyter notebook navigate to http://localhost:8888/tree
To access Tensorboard navigate to http://localhost:6006