Tutorial 1 — YOLOv8 Real-Time Object Detection on NVIDIA Jetson

Your first hands-on project. In under 30 minutes you will have a live camera feed running through YOLOv8 — detecting 80 everyday objects in real time at 55+ FPS on your Jetson, with no internet required.

What you will learn

  • How YOLO (You Only Look Once) works — single-pass neural network detection
  • How to load a pre-trained YOLOv8 TensorRT engine on Jetson
  • How to capture frames from a USB or CSI camera
  • How to draw bounding boxes and labels on live video
  • How to measure and display FPS in real time

Prerequisites

Your kit is pre-configured. All you need is your Jetson powered on, a camera connected, and a monitor or SSH connection. The model and code are already on the 256GB drive at ~/tutorials/01-object-detection/.

Step 1 — Navigate to the tutorial folder

cd ~/tutorials/01-object-detection
ls

You will see: detect.py, yolov8n.engine, and README.md.

Step 2 — Run the detector on a USB camera

python3 detect.py --source 0 --show

A window opens showing your live camera feed with coloured bounding boxes around every detected object and an FPS counter in the top-left corner. Press Q to quit.

Step 3 — Understanding the code

from ultralytics import YOLO
import cv2

model = YOLO("yolov8n.engine", task="detect")   # TensorRT engine — fast!
cap   = cv2.VideoCapture(0)                      # USB camera

while True:
    ret, frame = cap.read()
    if not ret: break

    results   = model(frame, verbose=False)      # run inference
    annotated = results[0].plot()                # draw boxes

    # Show FPS
    fps = 1 / results[0].speed['inference'] * 1000
    cv2.putText(annotated, f"FPS: {fps:.1f}", (10,30),
                cv2.FONT_HERSHEY_SIMPLEX, 1, (0,255,0), 2)

    cv2.imshow("YOLOv8 — Jetson", annotated)
    if cv2.waitKey(1) & 0xFF == ord('q'): break

Step 4 — Try different model sizes

The kit includes four pre-exported TensorRT engines. Try each one and notice the speed vs accuracy trade-off:

python3 detect.py --source 0 --model yolov8n.engine  # fastest ~55 FPS
python3 detect.py --source 0 --model yolov8s.engine  # balanced ~30 FPS
python3 detect.py --source 0 --model yolov8m.engine  # accurate ~16 FPS

Step 5 — Run on a video file instead of a camera

python3 detect.py --source ~/tutorials/01-object-detection/sample.mp4 --show

What the 80 detectable objects include

People, cars, trucks, bicycles, motorbikes, buses, trains, boats, traffic lights, fire hydrants, stop signs, parking meters, benches, birds, cats, dogs, horses, chairs, tables, TVs, laptops, phones, keyboards, scissors, bottles, cups, and many more — all from the COCO dataset.

Challenge exercises

  • Modify the code to only show detections above 80% confidence
  • Count and print the number of people detected per frame
  • Save the annotated video to a file using cv2.VideoWriter
  • Add an audio beep when a specific class (e.g. “person”) is detected

Next tutorial: Tutorial 2 — Train a Custom Defect Detection Model | Back to Jetson Kit

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
0

Subtotal