Skip to content

Instantly share code, notes, and snippets.

@IamTechknow
Created July 3, 2018 00:22
Show Gist options
  • Save IamTechknow/48ed6cd92324e4bdded8fba27047c207 to your computer and use it in GitHub Desktop.
Save IamTechknow/48ed6cd92324e4bdded8fba27047c207 to your computer and use it in GitHub Desktop.
Jetson Machine learning notes
DetectNet is a TensorRT CNN model and may be run on the Jetson TX1/2.
Let's figure out how to run this on Ubuntu 18.04:
0) Download qt4-default libglew-dev libgstreamermm-1.0-dev package
1) Add symlink to glibconfig.h: "sudo ln -s /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h glibconfig.h"
2) Add symlinks for tensorRT libraries:
sudo ln -s /usr/local/TensorRT-3.0.4/lib/libnvinfer.so libnvinfer.so
sudo ln -s /usr/local/TensorRT-3.0.4/lib/libnvcaffe_parser.so libnvcaffe_parser.so
3) To test with a webcam, go into detectnet-camera.cpp and change CAMERA from -1 to 0.
4) Build Jetson-Inference project with CMake: "cmake -DCMAKE_CXX_FLAGS=-isystem\ /usr/local/TensorRT-3.0.4/include" then "make -j8"
5) Download the ped-100 model and deploy prototext, then run ./detectnet-camera
My webcam does not quite work with the program (camera is init to an unsupported resolution), it is a Logitech C160 so it is quite old.
At this point we can figure out how to get the video stream working. Here's a possible command to create a stream to a X window:
v4l2-ctl -d /dev/video0
gst-launch-1.0 -v v4l2src device=/dev/video0 ! xvimagesink
Jetson TX1 uses Jetpack 3.2, which includes CUDA 9.0 and TensorRT 3.0.4.
Note that TensorRT 3.0.4 (and 4.0.1) only works with Python 3.5 (not 3.6)
Installing TensorRT 3.0 on Ubuntu 18.04 (using run file):
1) Install NVIDIA drivers, make sure secure boot is disabled first. Also install libboost-dev-all package
2) Install CUDA 9.0 with the run file. Install cudnn with dpkg -i
2a) Add a CPATH export variable and put the default and cuda include paths, then source ~/.bashrc to apply
3) Download the TensorRT 3.0.4 tar file, extract to /usr/local/, put lib and bin on path
4) Add deadsnake python PPA and install Python 3.5:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.5 python3.5-dev
5) Install PyCUDA for Python 3.5: follow https://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu (don't use pip)
(use this command to configure:
./configure.py --python-exe=/usr/bin/python3.5 --cuda-root=/usr/local/cuda --cudadrv-lib-dir=/usr/lib/x86_64-linux-gnu --boost-inc-dir=/usr/include --boost-lib-dir=/usr/lib --boost-python-libname=boost_python3 --boost-thread-libname=boost_thread --no-use-shipped-boost )
6) Install the wheel file: sudo python3.5 -m pip install <wheel file for 3.5>
7) Install the Python UFF package at the uff folder (same way as 6))
8) Verify the samples work: Go to a sample in <TensorRT dir>/samples, then run make -j8 CUDA_INSTALL_DIR=/usr/local/cuda
9) Install numpy for Python 3.5: sudo python3.5 -m pip install numpy. Now ensure tensorrt works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment