-
Notifications
You must be signed in to change notification settings - Fork 1
Installing Anaconda for SLAM
Simultaneous Localization and Mapping involves the use of the quintessential Computer Vision library - OpenCV, to extract features and process them. It also requires TensorFlow and Keras which will be useful for running neural nets. This tutorial covers the installation of these three libraries.
Use the following link to download and install Anaconda Navigator. Select the 64-bit graphical installer for Python 3.7.
https://www.anaconda.com/download/
Note: If you're on a 32-bit system, choose the 32-bit installer.
During installation, you'll get a prompt: whether you want to add Anaconda to your PATH variable. The installer recommends you don't but it's very useful to do so, since we'll use a lot of command prompt instructions to download libraries later. Go ahead and complete the installation. Open Spyder and Jupyter Notebook and run a Hello World program to make sure they're working fine.
Next up, we'll proceed with the TensorFlow (tf) and Keras installation. When you installed anaconda, all the libraries required for python are inside what's called the 'base' or the 'root' environment. For many reasons, it's always recommended that you install the tf and keras packages in a virtual environment but mainly because tf only has libraries that support Python 3.6 but as seen above, we've installed Python 3.7. This will mess up some of the already installed libraries in the root environment.
So, let's get going. Open up a command prompt.
Create a virtual environment:
conda create -n myenv python=3.6 anaconda
Replace myenv with any name you prefer.
Activate the environment:
activate myenv
Now, to start installing packages. We'll be doing this in the same command prompt. After activating your virtual environment, run the following lines of code in the same order.
Let's start with iPython and Jupyter, because we'll need to work with Jupyter Notebooks:
conda install ipython
conda install jupyter
Next, Pandas which contains a ton of tools for data preprocessing:
conda install pandas
Then comes scipy, which is a dependency of Keras (used for scientific computing):
conda install scipy
And numpy, (duh):
conda install -c anaconda numpy
Then, we'll need scikit-learn which contains a diverse range of machine learning models (again, duh):
conda install scikit-learn
Matplotlib is useful for visualizing data:
conda install -c conda-forge matplotlib
Let's install OpenCV, a computer vision library used extensively in image processing:
conda install -c conda-forge opencv
Note: This installs the basic version of openCV which works fine but some of the patented algorithms and feature extractors like SIFT,SURF are moved to opencv-contrib. To install that (specific to Ubuntu 16.04 and Anaconda), there's a lot of packages and dependencies to be installed which is explained in detail here: http://machinelearninguru.com/computer_vision/installation/opencv/opencv.html
Alright, now the last two libraries - TensorFlow and Keras. They're only available in pip (a package management system to install python libraries), not on conda.
Install TensorFlow by writing:
pip install --upgrade insert_link
Replace insert_link with one of the links on this web page: https://www.tensorflow.org/install/pip
- Only choose between the Python 3.6 variants.
- Choose Windows/Linux/Mac based on your machine's OS.
- Make sure you choose the GPU-support version if your machine has got one.
And finally, install Keras:
pip install --upgrade keras
Again, simply open Jupyter notebook by opening your command prompt and activating your virtual environment (shown above) and then typing
jupyter notebook
Now, try to import keras and tensorflow by typing
import keras
import tensorflow
If this code runs, your Keras-TensorFlow installation was successful!