PythOps

compile deeplearning libraries for jetson nano

Last update: 02 April 2020

OpenCV

Install the dependencies
$ dependencies=(build-essential
              cmake
              pkg-config
              libavcodec-dev
              libavformat-dev
              libswscale-dev
              libv4l-dev
              libxvidcore-dev
              libavresample-dev
              python3-dev
              libtbb2
              libtbb-dev
              libtiff-dev
              libjpeg-dev
              libpng-dev
              libtiff-dev
              libdc1394-22-dev
              libgtk-3-dev
              libcanberra-gtk3-module
              libatlas-base-dev
              gfortran
              wget
              unzip)

$ sudo apt install -y ${dependencies[@]}
Download the OpenCV source code
$ wget https://github.com/opencv/opencv/archive/4.5.2.zip -O opencv-4.5.2.zip
$ wget https://github.com/opencv/opencv_contrib/archive/4.5.2.zip -O opencv_contrib-4.5.2.zip
$ unzip opencv-4.5.2.zip
$ unzip opencv_contrib-4.5.2.zip
$ mkdir opencv-4.5.2/build
$ cd opencv-4.5.2/build
Configure the build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D WITH_CUDA=ON \
      -D CUDA_ARCH_PTX="" \
      -D CUDA_ARCH_BIN="5.3,6.2,7.2" \
      -D WITH_CUBLAS=ON \
      -D WITH_LIBV4L=ON \
      -D BUILD_opencv_python3=ON \
      -D BUILD_opencv_python2=OFF \
      -D BUILD_opencv_java=OFF \
      -D WITH_GSTREAMER=OFF \
      -D WITH_GTK=ON \
      -D BUILD_TESTS=OFF \
      -D BUILD_PERF_TESTS=OFF \
      -D BUILD_EXAMPLES=OFF \
      -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.2/modules \
      ..
Build the package
$ make -j4
Install the package
$ sudo make install
Verification
$ python3 -c "import cv2; print(cv2.__version__)"
4.2.0


TensorFlow 2

NVIDIA provides the python wheels for Tensorflow. Check this link for more information.

PyTorch

NVIDIA provides the python wheels for PyTorch. Check this link for more information.

Dlib

Download the latest stable version

$ wget https://github.com/davisking/dlib/archive/refs/tags/v19.22.zip
$ unzip v19.22.zip

Build and install the package

$ cd dlib-19.22
$ python3 setup.py install --user