Projects / Real-time object detection on Jetson Orin Nano

Real-time object detection on Jetson Orin Nano

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANONANOSSD256

    Flash JetPack

    Install JetPack 6 on the NVMe SSD or a 64 GB microSD with NVIDIA's SDK Manager or the SD card image, and finish the first-boot setup.

  2. NANONANO

    Fit the camera

    Power off, open the CAM0 latch, insert the IMX219 ribbon and close the latch.

  3. NANONANO

    Test the camera

    Run nvgstcapture-1.0 and check you see the picture. Close it.

  4. NANONANO

    Start the container

    Clone jetson-inference and run docker/run.sh. It downloads the right container for your JetPack.

  5. NANONANO

    Run detection

    Save the script as detect_count.py in the mounted folder and run it. Point the camera at a cup, a phone and a person.

  6. NANONANO

    Use full power

    Run sudo nvpmodel -m 0 (MAXN or MAXN SUPER on the Super kit) and sudo jetson_clocks outside the container for the best FPS.

In short

How do you build a real-time object detection on Jetson Orin Nano?

A Jetson Orin Nano runs a pre-trained SSD-MobileNet model on a CSI camera and draws boxes around 90 kinds of everyday objects in real time. You need NVIDIA Jetson Orin Nano Super Developer Kit, IMX219 camera for Jetson Nano and Orin, NVMe SSD 256 GB (M.2 2230/2242) and Ethernet cable Cat6 (3 m). It takes 6 steps and about 120 minutes.

Level
Intermediate
Time
About 120 min
Parts
4

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
IMX219 camera ribbonJetson CAM0 connectorContacts facing the heatsink side as printed
NVMe SSDM.2 Key M slot under the moduleStorage for JetPack and models
HDMI / DisplayPort monitor, keyboard, mouseJetson portsDesktop
EthernetRouterDownloads the container and models

Code

JetPack 6 on the Jetson. The jetson-inference Docker container has all the libraries; the first run downloads the model and builds a TensorRT engine, which takes a few minutes once.

# Inside the jetson-inference container:
#   git clone --recursive --depth=1 https://github.com/dusty-nv/jetson-inference
#   cd jetson-inference && docker/run.sh
#   python3 detect_count.py
from jetson_inference import detectNet
from jetson_utils import videoSource, videoOutput

net = detectNet("ssd-mobilenet-v2", threshold=0.5)
camera = videoSource("csi://0")          # use /dev/video0 for a USB webcam
display = videoOutput("display://0")

while display.IsStreaming():
    img = camera.Capture()
    if img is None:                       # capture timeout
        continue
    found = net.Detect(img)
    names = [net.GetClassDesc(d.ClassID) for d in found]
    if names:
        print(", ".join(f"{n} x{names.count(n)}" for n in sorted(set(names))))
    display.Render(img)
    display.SetStatus(f"Detection | {net.GetNetworkFPS():.0f} FPS")

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
nvgstcapture-1.0Live camera picture
First run"building TensorRT engine" messages, then a window with boxes
Cup and phone in viewBoxes labelled cup and cell phone, and the terminal prints "cell phone x1, cup x1"
Frame rate at full powerWell above 30 FPS for SSD-MobileNet-v2 at 720p

If it does not work

"failed to create videoSource"

The camera is not detected. Reseat the ribbon with the power off and check nvgstcapture first.

Very low FPS

The first run is building the engine. Later runs start fast. Set the power mode with nvpmodel.

No window over SSH

Use videoOutput("rtp://<laptop-ip>:1234") or "webrtc://@:8554/output" and view it on your laptop.

Gets hot

Keep the fan connected and the heatsink clear. See the Jetson power and thermal lesson.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the real-time object detection on Jetson Orin Nano?

NVIDIA Jetson Orin Nano Super Developer Kit, IMX219 camera for Jetson Nano and Orin, NVMe SSD 256 GB (M.2 2230/2242) and Ethernet cable Cat6 (3 m). NVIDIA Jetson Orin Nano Super Developer Kit: Includes the power adapter. NVMe SSD 256 GB (M.2 2230/2242): Or a 64 GB or larger microSD.

How long does the real-time object detection on Jetson Orin Nano take to build?

About 120 minutes for a intermediate maker, in 6 steps.

How do I know the real-time object detection on Jetson Orin Nano works?

nvgstcapture-1.0: Live camera picture. First run: "building TensorRT engine" messages, then a window with boxes. Cup and phone in view: Boxes labelled cup and cell phone, and the terminal prints "cell phone x1, cup x1".

failed to create videoSource: what should I check?

The camera is not detected. Reseat the ribbon with the power off and check nvgstcapture first.

Very low FPS: what should I check?

The first run is building the engine. Later runs start fast. Set the power mode with nvpmodel.

No window over SSH: what should I check?

Use videoOutput("rtp://<laptop-ip>:1234") or "webrtc://@:8554/output" and view it on your laptop.

Gets hot: what should I check?

Keep the fan connected and the heatsink clear. See the Jetson power and thermal lesson.