Practical session on Deep-Learning with Convolutional Neural Network

Pr. Fabien MOUTARDE and Guillaume DEVINEAU (PhD student)- Centre de Robotique (CAOR) - MINES ParisTech - PSL Université Paris

1. Jupyter notebooks: introduction

Jupyter is an interactive environment for programming and executing programs, mainly in python language. A notebook is a document produced by jupyter and stored as a file whose extension is .ipynb

A notebook can contain rich content (such as text, images, links, HTML content, ...) but also python code that can be modified and executed directly in the notebook page. The results of code execution (printed text, plots, images, etc...) are automatically displayed just below the executed code.

This environment, as well as the tensorflow and keras libraries are now very commonly used in the Deep-Learning (DL) community.

2. Jupyter install

Jupyter and the other libraries are already installed on the DSI Linux machines of MINES ParisTech (rooms L.117, L.119, L.120, L.027, L.022).

If you are working on a desktop machine in of these MINES ParisTech practical session rooms, nothing needs to be installed. You only need to boot in Linux. Skip to the next section.

If you work somewhere else or on your own laptop, install python and all the required libraries. The easiest way to install all you need, including jupyter and tensorflow, is to install the anaconda python distribution, which is a large "all in one" package, available with any major OS (Windows, MacOS, and Linux). Once you have installed it, run the following commands in a terminal:

# Only if you use your own laptop/desktop
conda install keras
conda install tensorflow

The easiest way to ensure that all necesary python packages are installed in Anaconda is by first downloading the correct package-list envML2020_tf2.yml, and then "import" this environment: in the Anaconda Navigator, click on the "Environments" button (in left column), then click on the "Import" button (bottom of 2nd column) and choose envML2020_tf2.yml as 'Specification File' + give a name (for example DL-course) for the new environment (this will launch download of all correct version of required packages, which may take a while...). After this, there should be in the start menu an extra version of jupyter-notebook, tagged with the name given to the new environment. This new jupyter-notebook variant should then be used for executing the notebook, because it shall launch python with the specific set of required packages defined in the envML2020_tf2.yml file.

In all cases, you may also want to rather execute the notebook on Google cloud computing system named COLAB: this avoids you to install anything on your machine, and even allows to run on GPUs of Google, so potentially faster than locally if your machine does NOT have an Nvidia GPU.
For this, you just need to use a browser and go to https://colab.research.google.com/notebooks/welcome.ipynb). Then connect with your Google ID, import in Colab the notebook you want to execute, and then execute and modify it nearly as if you were using jupyter-notebook locally.

3. Starting the practical session

On your laptop or on a desktop machine in MINES ParisTech practical session rooms, launch a terminal window and enter the following commands:

# Only on the DSI machines
export PATH=/opt/anaconda3/bin:$PATH
export HTTP_PROXY=proxy.ensmp.fr:8080
export HTTPS_PROXY=proxy.ensmp.fr:8080
export ALL_PROXY=proxy.ensmp.fr:8080

# Get the notebook
wget http://perso.mines-paristech.fr/fabien.moutarde/ES_MachineLearning/Practical_deepLearning-convNets/convnet-notebook.ipynb

# Start jupyter
jupyter-notebook

Find the notebook in the webpage that appears, and click on it. You can now start the practical session.


If you prefer to execute distantly on GoogleCOLAB, you can just open the link below which points to the notebook version stored on GoogleDrive: https://drive.google.com/file/d/1IZPUwaNeE5HpI-xn2PqOwnLLp-U3e9FL/view?usp=sharing
and then choose "Open with Google Colaboratory" (Note that you will need to connect to your Google account).

4. Assignments of the practical session

They are described directly in the notebook: you shall read them after opening it with Jupyter. However, you can also view them in HTML (non-interactive format) if you wish.