In this tutorial, we will setup the environment for Deep Learning and Computer Vision in Linux. This tutorial assumes that you have knowledge about using Linux Environment such as Ubuntu and basic knowledge of Linux commands.
Update: If you use Windows, I would suggest you to download Virtual Box (which is open-source) and install Ubuntu in it (which is also open-source). But if you really want to work in a Windows machine, then check out this post for setting up Deep Learning environment in Windows 10.
Install python (high-level programming language)
The first step is to download and install Python from this website. Download Python 2.7 version as it is the most stable release of Python. Python 3.0 and above versions are good to download, but there are some backwards-incompatible changes which might produce some errors. So, better use Python 2.7 version.
Install pip (python package manager)
sudo python get-pip.py
- Install all the other necessary packages.
sudo pip install numpy
sudo pip install scipy
sudo apt-get install python-tk
sudo pip install seaborn
sudo pip install matplotlib
sudo pip install pandas
sudo pip install librosa
sudo pip install scikit-learn
sudo pip install tensorflow
sudo pip install theano
sudo pip install keras
Dependencies for Computer Vision
sudo apt-get install build-essential cmake git pkg-config
sudo apt-get install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev
sudo apt-get install libgtk2.0-dev
- Accessing frames and video processing
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
- Optimize routines in OpenCV
sudo apt-get install libatlas-base-dev gfortran
git clone https://github.com/Itseez/opencv.git
git checkout 3.1.0
- Install OpenCV contrib 3.1
git clone https://github.com/Itseez/opencv_contrib.git
git checkout 3.1.0
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D BUILD_EXAMPLES=ON ..
sudo make install
Note: If you install librosa in Windows, you will need FFmpeg which could be downloaded here. Extract the .zip file and add bin folder of FFmpeg to PATH in system environment variables.
After installing all these libraries, open up a terminal and type python. After that, import all the packages using import (package-name) (for example, import numpy) and verfiy the version of each package. In case if you get any error, uninstall that package using sudo pip uninstall (package-name), and then reinstall that package again with pip. Sometimes I faced this issue and solved it using this simple method.
In case if you found something useful to add to this article or you found a bug in the code or would like to improve some points mentioned, feel free to write it down in the comments. Hope you found something useful here.