Object Detection with Pretrained Models on Jetson: the short answer
NVIDIA's open-source jetson-inference project is the fastest way to see real AI on a Jetson. It packages pretrained models, TensorRT optimisation and camera handling.
- Level
- Intermediate
- Time
- About 6 min
- Topic
- NVIDIA Jetson
Run a pretrained detector on a live camera with jetson-inference and act on what it sees.
Before this: Camera Pipelines on Jetson
NVIDIA's open-source jetson-inference project is the fastest way to see real AI on a Jetson. It packages pretrained models, TensorRT optimisation and camera handling. Clone it from GitHub (dusty-nv/jetson-inference) and start its ready-made container with docker/run.sh, which matches the libraries to your JetPack version. Then detectnet csi://0 (or detectnet /dev/video0 for USB) shows live boxes from SSD-Mobilenet-v2, a model trained on the 91 everyday object classes of the COCO data set.
The first run of any model takes a few minutes, because TensorRT builds an engine optimised for your exact GPU and saves it. Later runs load the saved engine in seconds. This is normal, and it is why you should not judge speed on the first run.
In Python the whole loop is short: from jetson_inference import detectNet; from jetson_utils import videoSource, videoOutput; net = detectNet('ssd-mobilenet-v2', threshold=0.5); cam = videoSource('csi://0'); out = videoOutput('display://0'); then, while out.IsStreaming(), capture an image, call net.Detect(img), and read each detection's ClassID, Confidence and box. Turn detections into actions the same way as any sensor reading: filter by class, require a score threshold and a few consecutive frames, and add a cooldown so one event does not trigger a hundred alerts.
Understand what a detection gives you
A detector returns, for each object, a class, a bounding box and a confidence score. A confidence threshold decides what you keep. A low threshold finds more objects but adds false alarms; a high one is cleaner but misses some. Choose it by testing on your own scene, not by taking the default.
Overlapping boxes for one object are merged by non-maximum suppression, which has its own overlap threshold.
Pretrained means trained on someone else's world
A model trained on a common dataset knows its listed classes, such as person, car and cup. It may do badly on your camera angle, your lighting or objects it never saw. Test it on frames from your real camera at the real distance before building anything on top.
Smaller models run faster and larger ones are more accurate. Measure the frames per second on your Jetson with your model and your input size.
Using the result
Turn detections into actions with some care. Require an object to appear for several frames before reacting, and use a counting line or zone to count people or vehicles. For anything that affects safety or privacy, think about what a false detection or a missed one would cause.
- Using the default confidence threshold without testing on your own scene.
- Assuming a pretrained model will work on a different camera view.
- Reacting to a single frame instead of several.
Practise this lesson with Maker
The explanation above is free for everyone. The practice for Intermediate lessons in every domain are part of the Maker plan at ₹499 a month, and Pro includes them too.
With Maker you also get: a worked example, a hands-on task, a 3-question check.
