Coder Social home page Coder Social logo

setup-racing-car-ubuntu's Introduction

setup-racing-car-ubuntu

this setup support Ubuntu 18.04

Contents

  1. Install Prerequisites
  2. Setup NVIDIA Driver for your GPU
  3. Install CUDA
  4. Install cuDNN
  5. Install TensorRT
  6. Python and Other Dependencies
  7. Deep Learning Frameworks
  8. ROS Melodic

1. Install Prerequisites

Before installing anything, let us first update the information about the packages stored on the computer and upgrade the already installed packages to their latest versions.

sudo apt-get update
sudo apt-get upgrade

Next, we will install some basic packages which we might need during the installation process as well in future.

sudo apt-get install -y build-essential cmake gfortran git pkg-config 

2. Setup NVIDIA Driver for your GPU

follow this video and src

3. Install CUDA

You can also install CUDA directly from the offline installer, but this is a little easier.

sudo apt update
sudo apt upgrade -y

mkdir install ; cd install
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda-10-2

4. Install cuDNN

Download CuDNN here (BOTH the runtime and dev, deb) from: drive link 1 drive link 2 or nvidia source

sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb

Verify installation

This method of installation installs cuda in /usr/include and /usr/lib/cuda/lib64, hence the file you need to look at is in /usr/include/cudnn.h.

cat /usr/include/x86_64-linux-gnu/cudnn_v*.h | grep CUDNN_MAJOR -A 2                                                         

5. Install TensorRT

Download TensorRT drive link or nvidia source. Use version 7.0.

sudo dpkg -i nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.0.0.11-ga-20191216_1-1_amd64.deb
sudo apt update
sudo apt install tensorrt libnvinfer7

Add to .bashrc for TensorRT cuDNN CUDA - (important)

sudo gedit ~/.bashrc # open bashrc and copy lines below
export CUDA_HOME=/usr/local/cuda
export DYLD_LIBRARY_PATH=$CUDA_HOME/lib64:$DYLD_LIBRARY_PATH
export PATH=$CUDA_HOME/bin:$PATH
export C_INCLUDE_PATH=$CUDA_HOME/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=$CUDA_HOME/include:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export LD_RUN_PATH=$CUDA_HOME/lib64:$LD_RUN_PATH

save gedit and write command:

source ~/.bashrc

6. Python and Other Dependencies

Install dependencies of deep learning frameworks:

sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libopencv-dev

Next, we install Python 2 and 3 along with other important packages like boost, lmdb, glog, blas etc.

sudo apt-get install -y --no-install-recommends libboost-all-dev doxygen
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev libblas-dev 
sudo apt-get install -y libatlas-base-dev libopenblas-dev libgphoto2-dev libeigen3-dev libhdf5-dev 
 
sudo apt-get install -y python-dev python-pip python-nose python-numpy python-scipy python-wheel python-six
sudo apt-get install -y python3-dev python3-pip python3-nose python3-numpy python3-scipy python3-wheel python3-six

NOTE: If you want to use Python2, replace the following pip commands with pip2.

Before we use pip, make sure you have the latest version of pip.

pip3 install --upgrade pip

Now, we can install all the required python packages for deep learning frameworks:

pip3 install numpy matplotlib ipython protobuf jupyter mock
pip3 install scipy scikit-image scikit-learn
pip3 install opencv-python==4.5.3 opencv-contrib-python==4.5.3

Upgrade numpy to the latest version:

sudo pip3 install --upgrade numpy

7. Install Deep Learning Frameworks

PyTorch

You can run the commands for installing pip packages torch and torchvision from the Quick Start section here.

pip install torch==1.6.0 torchvision==0.7.0

TensorFlow

Quick Install (Not Recommended)

A quick way to install TensorFlow using pip without building is as follows. However this is not recomended as we have several specific versions of GPU libraries to improve performance, which may not be available with the pip builds.

sudo pip3 install tensorflow-gpu

Darknet for YOLO

First clone the Darknet git repository.

git clone https://github.com/AlexeyAB/darknet.git

Now, to compile Darknet with CUDA, CuDNN and OpenCV support, open the Makefile from the darknet folder and make the changes as following in the beginning of this file. Also make sure to select the right architecture based on your GPU's compute capibility. For Volta, Xavier, Turing and higher architecture you may want to use this version of Darknet by AlexeyAB and compile with the CUDNN_HALF=1 flag for 3x speed improvement. Chage Makefile

GPU=1 
CUDNN=1
OPENCV=1
LIBSO=1 

Check Nvidia Compute Capability your card and change lines

Once done, just run make from the darknet folder.

cd darknet
make

Refer here for more details on running YOLO and training the network.

8. ROS Melodic

wget https://github.com/tonhathuy/setup-racing-car-ubuntu/blob/main/src/setup-ros.sh
sudo chmod +x ./setup-ros.sh
./setup-ros.sh

setup-racing-car-ubuntu's People

Contributors

tonhathuy avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.