21. YOLO#

You Only Look Once object detection

21.1. Pre-reading#

21.1.1. Objectives#

  • Run YOLO on the Jetson

21.2. Howto#

This is the YOLOv8 model architectureā€¦ itā€™s really complex!

YOLOv8 model architecture

So, letā€™s be honest, thereā€™s a lot going on there that we donā€™t understand. Fortunately, Ultralytics, who sponsors YOLOv8 builds a Docker image: ultralytics | Docker Hub

21.2.1. Steps#

First, plug in a USB web cam.

Next, pull the image

docker pull ultralytics/ultralytics:latest-jetson

cd into a dedicated directory

Run the container

docker run -it --rm --runtime nvidia -v ./yolov5:/yolov5 --device /dev/video0:/dev/video0:mrw -e DISPLAY=:0 -v /tmp/.X11-unix/:/tmp/.X11-unix ultralytics/ultralytics:latest-jetson /bin/bash

Inside the container:

cd /yolov5/standard

Run the object detection. Source 0 refers to your webcam, which the OS is calling video0 (hopefully). Conf 0.5 sets confidence threshold to 0.5; you can raise or lower it depending on your needs.

This will take a while to load. Then it will print detections to the screen.

Exit with Ctrl+C and wait for the video to save into the volume you provided.

python3 detect.py --source 0 --conf 0.5

How could you improve upon this?