Getting YOLOv8 to 30 fps on a Jetson Orin Nano

The model was never the slow part. A walk through the export, the camera path and the threading that got a detector to real time on a small board.

The first time I ran a YOLOv8 detector on a Jetson Orin Nano, it managed around ten frames a second. The board is advertised with far more compute than that, so something in my pipeline was wasting it. It took an afternoon of measuring to find out that the network itself was only part of the problem.

This post is the checklist I now run through every time. The numbers come from one bench setup (YOLOv8s at 640 × 640, a CSI camera, JetPack 6), so treat them as directional rather than a benchmark.

Measure the whole loop, not the model

The figure most tutorials quote is model latency: one tensor in, one tensor out. What a product cares about is the end-to-end loop: grab a frame, resize it, run inference, run NMS, draw or send the result. I time each stage separately before changing anything.

python
import time
t = {}
t0 = time.perf_counter(); frame = cam.read();          t['capture'] = time.perf_counter() - t0
t0 = time.perf_counter(); res = model(frame, imgsz=640); t['infer'] = time.perf_counter() - t0
t0 = time.perf_counter(); out = postprocess(res);        t['post'] = time.perf_counter() - t0
print({k: f"{v*1000:.1f} ms" for k, v in t.items()})

On my first run, capture and colour conversion alone took almost as long as inference. That changes where you spend the afternoon.

Step 1: max out the board

A fresh Jetson often runs in a power-saving mode. Before measuring anything, set the highest power mode and lock the clocks:

bash
sudo nvpmodel -m 0      # highest power mode on this module
sudo jetson_clocks      # pin CPU, GPU and memory clocks

This is not a trick. It just stops you from optimising against a throttled board and getting confused when the numbers move.

Step 2: export to TensorRT in FP16

Running the PyTorch weights directly works, but it leaves most of the GPU on the table. Ultralytics can build a TensorRT engine for you. Build it on the Jetson itself, because engines are tied to the GPU and TensorRT version they were built with.

bash
yolo export model=yolov8s.pt format=engine half=True imgsz=640 device=0

FP16 roughly halves memory traffic, and on detection tasks I have not seen a meaningful accuracy drop. INT8 is faster again, but it needs a calibration set that looks like your real images. Skip it until FP16 is not enough.

Watch out

If you change the input size, rebuild the engine. A 640 engine fed 480 frames will either fail or quietly letterbox them, and you will measure the wrong thing.

Step 3: fix the camera path

This was my biggest single win. cv2.VideoCapture(0) decodes and converts frames on the CPU. The Jetson has hardware for this, and GStreamer can use it:

python
pipeline = (
  "nvarguscamerasrc ! video/x-raw(memory:NVMM),width=1280,height=720,framerate=60/1 ! "
  "nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! "
  "appsink drop=true max-buffers=1"
)
cam = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)

drop=true max-buffers=1 matters as much as the hardware path. Without it, frames queue up and your "live" view slowly falls seconds behind reality.

Step 4: stop doing everything in one thread

A single loop that captures, infers and then draws means the GPU sits idle while the CPU works, and the other way round. I split the work into three stages connected by queues of size one:

  1. Capture thread: always holds the newest frame and throws older ones away.
  2. Inference thread: takes the newest frame, runs the engine, hands raw output on.
  3. Output thread: NMS, tracking, drawing, network or serial messages.

Python threads are fine here, because the heavy work happens in native code that releases the GIL.

captureinferoutputPipelined stages: while frame 3 is being captured, frame 2 is on the GPU and frame 1 is being post-processed.

Where it ended up

ChangeEnd-to-end, my setup
PyTorch FP32, OpenCV capture, one loop~10 fps
+ max power mode, TensorRT FP16~22 fps
+ GStreamer capture with frame dropping~27 fps
+ three-stage pipeline~31 fps

Your numbers will differ with the model size, the camera and what you do with the detections. The order of the steps is the part I would keep.

What I would do differently next time

  • Pick the input size from the smallest object you need to detect, not from the default. Dropping from 640 to 512 is often free accuracy-wise and gives a large speed-up.
  • Log per-stage timings in production too. When a field unit gets slower, you want to know which stage changed.
  • Check thermals. A board in a sealed enclosure will throttle in a way it never did on an open bench.
The model is usually the part you optimise first and the part that matters least. Measure the loop.
Shakaut Hossain

AIoT engineer and tech lead in Dhaka. I build edge AI, firmware and LLM products, and teach robotics and AI for free.

More about me →
KEEP READING · related

More from the bench

All posts →
NEWSLETTER · monthly

Get the next one in your inbox.

New posts and lectures, once a month. Unsubscribe in one click.

Thanks, you’re on the list.