Deep Learning With PyTorch: Object Classification - Filliat Et Al
Deep Learning With PyTorch: Object Classification - Filliat Et Al
1 Introduction
In this practical course we will study different structures of deep convolutional neural networks to work
on image classification using the PyTorch 1 Python library. Material can be downloaded from :
http://perso.ensta-paristech.fr/~filliat/Courses/index.html
Due to the limitation of the machines power (specially the lack of dedicated GPUs), we will work with
a smaller network that is partially representative of real applications in order to test the capacity of deep
learning techniques. The main objective is to understand the structure of convolutional networks and the
influence of their parameters over the learning process.
You can then run the notebook by executing, in the main project folder :
The notebook will guide you through the use of the CIFAR10 database (Figure 1) with ten categories
of objects and the construction of an artificial neural network to classify them. Each image is 32x32 pixels
and examples of categories are planes, cars, birds, etc.
The data can be downloaded automatically by the notebook, or manually from https://drive.
google.com/file/d/1LrmhnOvuilYyJ_Gto_r0xjXlNFq8PYPM/view (put the data/ folder as a subfol-
der of the one containing cifar10_tutorial.ipynb.
3 Reporting
Send a pdf report to natalia.diaz@ensta-paristech.fr latest on 2nd Feb. detailing what you have
done in part III : explain what neural networks and hyper parameters configurations you tested, and the
resulting performances. Most importantly, report the accuracy on the image test set) and plot of losses. The
best performance will be used for a leader board. All used parameters must be reported (at least learning
rates, batch size, nr of epochs).
You can try to modify :
1. http://pytorch.org/tutorials/index.html
2. On some computers, you may need to add the –ip option : jupyter notebook -ip=127.0.0.1 cifar10_tutorial.ipynb
1
F IGURE 1 – Sample images from CIFAR 10 Database
— The neural network structure (kernel size, number of feature maps, number of convolutional layers,
size of fully connected layers, ...
— The size of the training set/validation set
— Batch size, number of epochs, learning rates
4 Installation
Everything should be installed on the school computers. If you want to use your own computer, here are
the installation instructions. The notebooks are tested in Python 3 but they should be Python 2 compatible
(if you go with Python 3, substitute all pip instructions with pip3) :
4.1 Windows
1. Download and install Anaconda (it includes Jupyter notebook)
https://www.anaconda.com/download/#download
2. Install PyTorch : run in Anaconda Prompt :
conda install -c peterjc123 pytorch
pip install torchvision
2
4.2.2 Pip users (advanced)
1. Make sure Jupyter Notebook is installed
pip install -upgrade pip
pip install jupyter
2. Go to http://pytorch.org/ and select your configuration to get the installation command line.
For example, with Linux and python 3.5 :
pip3 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp35-cp35m-manylinux1_
x86_64.whl
3. Install torchvision :
pip install torchvision
Acknowledgement
This short practical is strongly based on the courses :
— Coursera DeepLearning.ai by Andrew Ng
https://www.coursera.org/learn/convolutional-neural-networks
More complete tutorials and courses can be found at :
— Python Numpy http://cs231n.github.io/python-numpy-tutorial/ and IPython tutorials
http://cs231n.github.io/ipython-tutorial/
— Andrej Karpathy course CS231n Convolutional Neural Networks for Visual Recognition http:
//cs231n.github.io/
— MILA tutorials https://github.com/mila-udem/welcome_tutorials/tree/master/pytorch
— PyTorch’s excellent tutorials : http://pytorch.org/tutorials/beginner/blitz/cifar10_
tutorial.html
— Applications with PyTorch : https://twitter.com/pytorch
— Learn PyTorch with no Deep Learning background with Sung Kim’s PyTorchZeroToAll
https://github.com/hunkim/PyTorchZeroToAll
— A guide to convolution arithmetic for deep learning, V. Dumoulin and Francesco Visin https:
//github.com/vdumoulin/conv_arithmetic.
— Deep Learning. I. Goodfellow, Y. Bengio and A. Courville, MIT Press, http://www.deeplearningbook.
org, 2016.
— Deep Learning with Python, Francois Chollet, Manning Publications. 2017, https://github.
com/fchollet/deep-learning-with-python-notebooks