YOLOv8 on Jetson Nano

YOLOv8

This article explains how to run YOLOv8 on the Jetson Nano. Pre-built PyTorch and TorchVision packages are used.

Install Jetpack 4.6 (L4T 32.6.1) on Jetson Nano in advance.

Install the required packages.

sudo apt update
sudo apt install -y python3.8 python3.8-venv python3.8-dev python3-pip \
libopenmpi-dev libomp-dev libopenblas-dev libblas-dev libeigen3-dev libcublas-devCode language: Bash (bash)

Clone the YOLOv8 repository.

git clone https://github.com/ultralytics/ultralytics
cd ultralyticsCode language: Bash (bash)

Create a Python 3.8 virtual environment using venv.

python3.8 -m venv venv
source venv/bin/activateCode language: Bash (bash)

Update Python packages not specified in YOLOv8.

pip install -U pip wheel gdownCode language: Bash (bash)

Download and install the pre-built PyTorch, TorchVision package. This package was built using the method described in this article. This article also uses the pre-built package.

# pytorch 1.11.0
gdown https://drive.google.com/uc?id=1hs9HM0XJ2LPFghcn7ZMOs5qu5HexPXwM
# torchvision 0.12.0
gdown https://drive.google.com/uc?id=1m0d8ruUY8RvCP9eVjZw4Nc8LAwM8yuGV
python3.8 -m pip install torch-*.whl torchvision-*.whlCode language: Bash (bash)

Install the Python package for YOLOv8.

pip install .Code language: Bash (bash)

Execute object detection.

yolo task=detect mode=predict model=yolov8n.pt source=0 show=True
yolo task=segment mode=predict model=yolov8n-seg.pt source=0 show=TrueCode language: Bash (bash)

Note that for object detection, tasks=detect displays bounding boxes, and tasks=segment displays bounding boxes and segmentation.

YOLOv8 has several models (yolov8n, yolov8s, yolov8m, yolov8l, yolov8x), and the following are the actual FPS when running on Jetson Nano.

detectsegment
yolov8n6.14.2
yolov8s3.12.2
yolov8m1.30.96
yolov8l0.770.61
yolov8x0.480.38
YoloV8 FPS on Jetson Nano
YOLOv8 on Jetson Nano

Thank you for reading! If you found this article valuable and would like to support it, consider becoming a sponsor through GitHub Sponsors. Your support will help me continue to produce high-quality articles like this one. Every little bit truly helps and is greatly appreciated. Thank you in advance for considering to sponsor my work.