Deploy YOLOv5 to Jetson Xavier NX at 30 FPS

Roboflow · Beginner ·👁️ Computer Vision ·5y ago

Key Takeaways

This video demonstrates how to deploy a custom YOLOv5 model to the Jetson Xavier NX and run inference in real-time at 30 FPS using the Nvidia Jetpack 4.4 PyTorch container and the detect.py script.

Full Transcript

hey guys this is jacob from roboflow here live from minnesota to give you a video about how to deploy yolo v5 to a jetson xavier nx at 30 fps this is really a huge capability to be able to run state-of-the-art object detection at this speed which is very important for edge ai devices to be able to run in real time so you can design systems that are making inference very quickly and and and essentially acting as if they're actually seeing things in front of them in real time at the same frame rate that the human eye can can process things in front of it um so now kind of talking a little bit about our setup here we're going to train a custom yolo v5s model and we're going to train that model and then we're going to take it and we're going to deploy it all the way to a jetson xavier nx um so here's a little bit of a picture of the setup here that i have uh upstairs uh you can see here i have my uh jetson xavier nx and i have a display connected into it um and so there this is where we're going to be uh doing our inference now a quick note on training your custom model we have a lot of great content at rebel flow on how to train yolo v5 i've linked it here in the blog post and i'll also put a link below in the video but the first step is to gather your images of what you want your computer to be seeing and then you're going to load these images into roboflow after annotation so you'll draw bounding boxes around the objects in the images that you want to detect and then after you've prepared a data set you can augment it and then you can send those images through training and then training will basically give you a model that will do inference afterwards and you can kind of smooth that all out beforehand i'm gonna kind of uh run forward with this video assuming that you've already done the training process and you're ready to simply deploy your model to an edge ai device um and so that's that's kind of where we're starting here so once you're done with training you'll have a dot pt model that pt model you're going to take and you want to put it somewhere on the cloud where you can access her on a usb stick and then once you have it on the usb stick you'll be able to transfer it onto your jetson nano or your jetson xavier nx device um so here's a picture of the jetson nx so uh it has various inputs and outputs that you can kind of be sending inputs and outputs through it so it kind of is the basic setup here for a computer that that you would be setting up but you want to be able to input in your mouse and keyboard you want to input in your ethernet for internet connection uh and although i don't think you actually need the ethernet it can connect to a wi-fi automatically and then also your hdmi display is important so you can uh visualize things and then you can also uh put a webcam port in there if you want to set up the device to be kind of inferencing uh live so there's uh the input input ports um for your jetson uh device and then the one important thing that you'll need to get it started is a microsd card this is what you're going to actually put the image on to be able to boot up install ubuntu and then um download the jetpack 4.4 um to actually get started with the underlying software to run your your jetson so in order to do that we'll uh go ahead and go over to uh the uh nvidia getting started with the jetson xavier nx website and then once you get over to that website um you can download the jetpack image put it on the sd card and then plug it into the uh jetson nx device and then this will boot up and you'll be able to log in there see ubuntu is there you'll have your terminal this is all very seamless process of india makes this a very easy process for us to to get started with now the next thing we're going to use is the nvidia jetpack 4.4 pi torch container and this this is a really important thing to be able to run yolo v5 because basically we could imagine a world in which we want to run yellow v5 by building pi torch from scratch on our on our nvidia and our nvidia jetson device that's going to be a really big problem because there's all sorts of different versions of pi torch and there's all sorts of other dependencies that you need to be building underneath here that you're going to have just a massive headache going through all these installs so thankfully there is the nvidia jetpoi jetpack 4.4 pi touch container that has already been installed and this is something that you can download from nvidia and um you just simply dock or pull this image down if you're not familiar with docker i do do remote i do recommend uh learning a little bit about it you can download this image then you have the image and you can um kind of start building on top of it so you can pull the image down and then do some installs on top of it you can um you can just kind of exec into that image and then start running your training jobs um and so uh so yeah so that's the pi torch container you go ahead and docker pull that down and then we'll be building from there um go ahead and get clone the yellow v5 repo and then once you have the yellow v5 repo uh you can install opencv and all the other requirements in the repo and then you can build that repository up and then once you have that you're pretty much ready for inference so now uh here's a little a bit of a peek into running inference on the nvidia jetson nx so once you have all of those environment installs setup you're going to be able to leverage the detect.pi script to get an idea and get a sense that basically you've successfully started running inference on your jetson nx so here i have a little bit of code where um you're invoking the python detector pi script and you're loading in your custom weights in place of the usual yellow v5s weights once you have those custom weights in there and then they're inferencing on video images or webcam whatever you choose to to expose to them and here i've have some printouts of the speed that i'm getting on the json nx with this kind of pristine pie torch build and it is roughly 30 fps so that's pretty exciting to see um and i would show you a video here but uh of a live screen but um unfortunately that that's pretty difficult to do on the device so i just have the the printouts here and you'll you'll have to just take my word for it and then i i have a little bit of some thoughts about making it run even faster so of course i'm not going to give away all of the keys to the kingdom here but i have a few suggestions if you really want to be working to make this run on the edge on the jetson even faster so one thought is you can actually shrink the model smaller than the olivia 5s is to even to even make the model even tinier than it is kind of in its pre-trained setting the second idea is to use tensor rt so there's some tensor rt implementations of yellow v3 and yolo v4 but these are all things that we can certainly um speak about with roboflow if you are working to kind of get your uh devices out there on the edge you just go ahead and reach out and so that's all for our video today hope you enjoyed um now you know how to deploy yolo v5 all the way to an edge device and then run it on a jetson xavier nx this is a very powerful skill to have especially given how customizable these models are to detect any object in the world so that's all for today thanks so much for watching watching go ahead and feel free to like and subscribe on the bottom and as always happy detecting

Original Description

Edge AI has never been hotter. In this video, we show how one can deploy a custom YOLO v5 model to the Jetson Xavier NX, and run inference in realtime at 30 FPS. Corresponding Blog: https://blog.roboflow.com/deploy-yolov5-to-jetson-nx-at-30fps/ Corresponding Training Guide: https://blog.roboflow.com/how-to-train-yolov5-on-a-custom-dataset/ As always, happy detecting.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Roboflow · Roboflow · 23 of 60

1 YOLOv3 PyTorch Notebook Tutorial
YOLOv3 PyTorch Notebook Tutorial
Roboflow
2 How to Train YOLOv4 on a Custom Dataset (PyTorch)
How to Train YOLOv4 on a Custom Dataset (PyTorch)
Roboflow
3 How to Train YOLOv5 on a Custom Dataset
How to Train YOLOv5 on a Custom Dataset
Roboflow
4 How to Use the Roboflow Dataset Health Check
How to Use the Roboflow Dataset Health Check
Roboflow
5 What is Mean Average Precision (mAP)?
What is Mean Average Precision (mAP)?
Roboflow
6 How to Use the Roboflow Model Library
How to Use the Roboflow Model Library
Roboflow
7 How to Train EfficientDet in TensorFlow 2 Object Detection
How to Train EfficientDet in TensorFlow 2 Object Detection
Roboflow
8 How to Train YOLO v4 Tiny (Darknet) on a Custom Dataset
How to Train YOLO v4 Tiny (Darknet) on a Custom Dataset
Roboflow
9 Ask the Roboflow Team Anything - Episode 1
Ask the Roboflow Team Anything - Episode 1
Roboflow
10 Exploring The COCO Dataset
Exploring The COCO Dataset
Roboflow
11 Community Spotlight: Improving Uno with Computer Vision
Community Spotlight: Improving Uno with Computer Vision
Roboflow
12 Mosaic Data Augmentation - Deep Dive
Mosaic Data Augmentation - Deep Dive
Roboflow
13 Hands on with the OAK-1
Hands on with the OAK-1
Roboflow
14 Glenn Jocher: What is New in YOLO v5?
Glenn Jocher: What is New in YOLO v5?
Roboflow
15 How to Use Amazon Rekognition Custom Labels and Roboflow to Build an Object Detection Model
How to Use Amazon Rekognition Custom Labels and Roboflow to Build an Object Detection Model
Roboflow
16 An Interview with Brandon Gilles, Luxonis Founder and OAK Chief Architect
An Interview with Brandon Gilles, Luxonis Founder and OAK Chief Architect
Roboflow
17 How to Train a Custom Mobile Object Detection Model (with YOLOv4 Tiny and TensorFlow Lite)
How to Train a Custom Mobile Object Detection Model (with YOLOv4 Tiny and TensorFlow Lite)
Roboflow
18 Tackling the Small Object Problem in Object Detection
Tackling the Small Object Problem in Object Detection
Roboflow
19 Fast.ai v2 Released - What's New?
Fast.ai v2 Released - What's New?
Roboflow
20 Teaser: Roboflow Train (1-Click Computer Vision AutoML)
Teaser: Roboflow Train (1-Click Computer Vision AutoML)
Roboflow
21 How to Train a Custom Resnet34 Image Classification Model
How to Train a Custom Resnet34 Image Classification Model
Roboflow
22 How to Label Images for Object Detection with CVAT
How to Label Images for Object Detection with CVAT
Roboflow
Deploy YOLOv5 to Jetson Xavier NX at 30 FPS
Deploy YOLOv5 to Jetson Xavier NX at 30 FPS
Roboflow
24 Elisha Odemakinde Hosts Roboflow ML Engineer, Jacob Solawetz
Elisha Odemakinde Hosts Roboflow ML Engineer, Jacob Solawetz
Roboflow
25 Getting Started with VoTT - Computer Vision Annotation
Getting Started with VoTT - Computer Vision Annotation
Roboflow
26 How to Manage Classes in Object Detection (Rename, Combine, Balance)
How to Manage Classes in Object Detection (Rename, Combine, Balance)
Roboflow
27 How to Train YOLOv4 on a Custom Dataset in Darknet
How to Train YOLOv4 on a Custom Dataset in Darknet
Roboflow
28 Is Grayscale a Preprocessing or Augmentation Step in Computer Vision?
Is Grayscale a Preprocessing or Augmentation Step in Computer Vision?
Roboflow
29 Getting Started with Image Data Augmentation
Getting Started with Image Data Augmentation
Roboflow
30 Glenn Jocher: Image Augmentation in YOLO v5 and Beyond
Glenn Jocher: Image Augmentation in YOLO v5 and Beyond
Roboflow
31 GA Hosts Roboflow - Healthcare and AI
GA Hosts Roboflow - Healthcare and AI
Roboflow
32 How do self driving cars know when to stop?
How do self driving cars know when to stop?
Roboflow
33 What is PASCAL VOC XML?
What is PASCAL VOC XML?
Roboflow
34 AutoML Showdown: Google vs Amazon vs Microsoft
AutoML Showdown: Google vs Amazon vs Microsoft
Roboflow
35 How is computer vision changing manufacturing?
How is computer vision changing manufacturing?
Roboflow
36 The Alphabet in American Sign Language
The Alphabet in American Sign Language
Roboflow
37 Luxonis OAK-D: Computer Vision on Device
Luxonis OAK-D: Computer Vision on Device
Roboflow
38 How to Train a Custom Faster R-CNN Model with Facebook AI's Detectron2 | Use Your Own Dataset
How to Train a Custom Faster R-CNN Model with Facebook AI's Detectron2 | Use Your Own Dataset
Roboflow
39 TensorFlow vs PyTorch: Fireside
TensorFlow vs PyTorch: Fireside
Roboflow
40 Occlusion Techniques in Computer Vision
Occlusion Techniques in Computer Vision
Roboflow
41 A Customizable Web Application for Your Computer Vision Model
A Customizable Web Application for Your Computer Vision Model
Roboflow
42 Model Tradeoffs and the Future of Computer Vision
Model Tradeoffs and the Future of Computer Vision
Roboflow
43 Designing an Augmented Reality Board Game App
Designing an Augmented Reality Board Game App
Roboflow
44 YOLOv4 - Advanced Tactics
YOLOv4 - Advanced Tactics
Roboflow
45 How to Use CreateML and Build a Computer Vision iPhone App | AR Object Detection
How to Use CreateML and Build a Computer Vision iPhone App | AR Object Detection
Roboflow
46 Fireside Chat: Computer Vision in Agriculture
Fireside Chat: Computer Vision in Agriculture
Roboflow
47 Scaled-YOLOv4 Tops EfficientDet: Research Rundown
Scaled-YOLOv4 Tops EfficientDet: Research Rundown
Roboflow
48 What is Image Preprocessing?
What is Image Preprocessing?
Roboflow
49 Building a Community of Creators with BlkArthouse and Von Deon
Building a Community of Creators with BlkArthouse and Von Deon
Roboflow
50 How to Train Scaled-YOLOv4 to Detect Custom Objects
How to Train Scaled-YOLOv4 to Detect Custom Objects
Roboflow
51 Intro to Computer Vision: Fireside
Intro to Computer Vision: Fireside
Roboflow
52 The Best Way to Annotate Images for Object Detection
The Best Way to Annotate Images for Object Detection
Roboflow
53 The Computer Vision Process: Fireside
The Computer Vision Process: Fireside
Roboflow
54 How to Annotate Images with Your Team Using Roboflow
How to Annotate Images with Your Team Using Roboflow
Roboflow
55 Introducing the Roboflow Object Count Histogram
Introducing the Roboflow Object Count Histogram
Roboflow
56 How Fast is the M1 at Machine Learning? Benchmarking Apple's M1 and Intel's Chips
How Fast is the M1 at Machine Learning? Benchmarking Apple's M1 and Intel's Chips
Roboflow
57 CLIP: OpenAI's amazing new zero-shot image classifier
CLIP: OpenAI's amazing new zero-shot image classifier
Roboflow
58 How I hacked my Nest camera to run custom models
How I hacked my Nest camera to run custom models
Roboflow
59 Getting Started with the Roboflow Inference API
Getting Started with the Roboflow Inference API
Roboflow
60 Transfer Learning in Computer Vision | What, How, Why
Transfer Learning in Computer Vision | What, How, Why
Roboflow

This video teaches how to deploy a custom YOLOv5 model to the Jetson Xavier NX and run real-time object detection at 30 FPS. The Nvidia Jetpack 4.4 PyTorch container and detect.py script are used to achieve this.

Key Takeaways
  1. Gather images for training
  2. Annotate images with bounding boxes
  3. Train custom YOLOv5 model
  4. Download Nvidia Jetpack 4.4 PyTorch container
  5. Pull PyTorch image using Docker
  6. Clone YOLOv5 repository
  7. Install OpenCV and requirements
  8. Build YOLOv5 repository
  9. Run detect.py script for inference
💡 Using the Nvidia Jetpack 4.4 PyTorch container simplifies the deployment process and allows for real-time inference on the Jetson Xavier NX.

Related AI Lessons

When the Camera Becomes an Exam Proctor: Building an AI-Powered Exam Monitoring System with…
Learn how to build an AI-powered exam monitoring system using Computer Vision and DeepFace to assist professional certification exams
Medium · Python
When the Camera Becomes an Exam Proctor: Building an AI-Powered Exam Monitoring System with…
Build an AI-powered exam monitoring system using Computer Vision and Deep Learning to enhance professional certification exams
Medium · Deep Learning
When the Camera Becomes an Exam Proctor: Building an AI-Powered Exam Monitoring System with…
Build an AI-powered exam monitoring system using Computer Vision and Deep Learning to enhance exam security and integrity
Medium · Cybersecurity
Your Face Is About to Become Your Phone Number
Indonesia's mandatory facial verification for SIM cards is a massive test for biometric identity verification at scale, with implications for developers in computer vision and biometrics
Dev.to AI
Up next
Marketing management for ugc net| Important topics of marketing management ugc net commerce dec 2023
Bhoomi Learning Centre~Dr. Muskan
Watch →