JetsonNano setup - Utagoe-robotics/Wiki GitHub Wiki

Jetson Nano Setup

Getting Started

Gettig Started With Jetson Nano Developer Kit

You can setup Jetson Nano following the above Getting Started guide.

Power Supply

There are two options for power supply:

  • micro USB (5V/2A) (default)
  • DC (5V/4A)

Micro USB power supply is a default power supply.

To switch the power supply to DC, shorten these pins with a jumper pin.

PWM Fan

sudo sh -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'

WiFi

Jetson Nano doesn't have any wireless module including WiFi and Bluetooth. You need to prepare WiFi module if you connect to wifi.

You have two options for wifi modules:

Jetson Nano supports many common USB wifi adapters. Here we use tp-link Archer T2U as a wifi USB dongle.

Install WiFi Driver

How to install tp-link Archer T2U on Ubuntu

To install wifi driver of tp-link Archer T2U, clone this repository and run a shell scpript.

$ sudo apt install dkms
$ git clone https://github.com/aircrack-ng/rtl8812au.git
$ cd rtl8812au
$ sudo make dkms_install
$ sudo reboot

OpenCV

darknet_ros for ROS Melodic needs OpenCV version before 3.4.0. OpenCV 4.X.X is initially installed in Jetson Nano Developer Kit, so you need to replace 4.X.X to 3.4.0(or before). Here we show how to replace OpenCV v4.X.X to v3.4.0 in Jetson Nano.

References

Check The OpenCV version

Check the current OpenCV verions by this command.

pkg-config --modversion opencv

Install OpenCV 3.4.0

$ git clone https://github.com/jkjung-avt/jetson_nano.git
$ cd jetson_nano

You can see install_opencv-3.4.6.sh in the directory. Copy the file and rename it to install_opencv-3.4.0.sh.

$ cp install_opencv-3.4.6.sh install_opencv-3.4.0.sh

You have to replace all 3.4.6 to 3.4.0 in install_opencv-3.4.0.sh. Then, run the installation script after enhancing Jetson Nano.

$ sudo nvpmodel -m 0
$ sudo jetson_clocks
$ chmod +x install_opencv-3.4.0.sh
$ sudo ./install_opencv-3.4.0.sh
$ sudo ln -s /usr/local/include/opencv /usr/include/opencv
$ sudo ln -s /usr/local/include/opencv2 /usr/include/opencv2

(Deprecated) Install OpenCV 3.4.0 and Remove 4.X.X

  1. Create install_opencv_3.4.0.sh and copy and paste following script to it.
  2. Then, run this script.
$ sudo chmod +x install_opencv_3.4.0.sh
$ sudo ./install_opencv_3.4.0.sh
  1. Link to /usr/include:
    • sudo ln -s /usr/local/include/opencv /usr/include/opencv
    • sudo ln -s /usr/local/include/opencv2 /usr/include/opencv2
  2. Remove OpenCV 4.X.X packages.
    • sudo rm -rf /usr/include/opencv4
    • sudo rm -rf /usr/local/lib/cmake/opencv4

darknet_ros

https://github.com/leggedrobotics/darknet_ros

Dependencies

$ sudo apt install ros-melodic-cv-bridge
$ sudo apt install ros-melodic-uvc-camera

Firstly, you have to

References

YOLO (Original)

【物体検出】vol.2 :YOLOv3をNVIDIA Jetson Nanoで動かす

Download

First, clone the repository and download weights.

# Clone the repository
$ git clone https://github.com/AlexeyAB/darknet
$ cd darknet

# Download weights
$ wget https://pjreddie.com/media/files/yolov3.weights
$ wget https://pjreddie.com/media/files/yolov3-tiny.weights

Modify Makefile

Modify Makefile to enable GPU, CUDA and OpenCV. Set the value:

GPU=1
CUDNN=1
OPENCV=1

Activate Tegra X1 (GPU of Jetson Nano) by uncommenting:

ARCH= -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=[sm_50,compute_50] \
-gencode arch=compute_52,code=[sm_52,compute_52] \
# -gencode arch=compute_61,code=[sm_61,compute_61] 


# For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment:
ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

Export PATH

$ export PATH=/usr/local/cuda/bin:${PATH}
$ export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}

Make

$ make

Demo

$ ./darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights -c 0

Memo

$ nvgstcapture $ ./darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights "'nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1920, height=1080, format=(string)NV12, framerate=(fraction)30/1 ! nvtee ! nvvidconv flip-method=2 ! video/x-raw, width=(int)1280, height=(int)720, format=(string)BGRx ! videoconvert ! appsink'"

PyTorch-YOLOv3

pytorch-yolo-v3

Install PyTorch

PyTorch for Jetson Nano

The JetPack 4.4 production release (L4T R32.4.3) only supports PyTorch 1.6.0 or newer, due to updates in cuDNN.

Python 3.6

$ wget https://nvidia.box.com/shared/static/9eptse6jyly1ggt9axbja2yrmj6pbarc.whl -O torch-1.6.0-cp36-cp36m-linux_aarch64.whl
$ sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
$ pip3 install Cython
$ pip3 install numpy torch-1.6.0-cp36-cp36m-linux_aarch64.whl

torchvision

$ sudo apt-get install libjpeg-dev zlib1g-dev
$ git clone --branch <version> https://github.com/pytorch/vision torchvision   # see below for version of torchvision to download
$ cd torchvision
$ sudo python setup.py install    # use python3 if installing for Python 3.6
$ cd ../  # attempting to load torchvision from build dir will result in import error
$ pip install 'pillow<7' # always needed for Python 2.7, not needed torchvision v0.5.0+ with Python 3.6
⚠️ **GitHub.com Fallback** ⚠️