How to Export Ultralytics YOLO26 in different formats for Deployment | ONNX, TensorRT, CoreML π β Transcript
Full transcript
- 0:00In the last video, we went through how
- 0:01we can train the new YOLO 26 model end
- 0:05to end on our own custom data set. In
- 0:07this video here, we're going to see how
- 0:08we can export into different
- 0:10optimization frameworks and format so it
- 0:12can run significantly faster on both
- 0:14CPU, GPU, whatever hardware that you're
- 0:17using and for what framework. So, let's
- 0:20just jump straight into it. We're going
- 0:21to start here in the Altitics
- 0:23documentation. If we go inside the docs
- 0:26over here on the left side, we went over
- 0:28our training mode. You can use the
- 0:30alternate framework in the exact same
- 0:32way with all the models. But if we go
- 0:34inside our export tab, first of all, all
- 0:38we have to do is pretty much just figure
- 0:39out what hardware we're going to run the
- 0:41model on. This is the step that we do
- 0:43after training. We have we have a final
- 0:45model that we want to get into
- 0:46production and run where we want to get
- 0:49increase in our inference speed without
- 0:51really losing any accuracy at all.
- 0:54So, one thing that we can do is convert
- 0:56it into ONX or Open VO. We can get up to
- 0:583x CPU speed up as we can see here. And
- 1:01if you're running it on Nvidia GPUs, you
- 1:03can use Tensor RT to get up to 5x GPU
- 1:06speed up. And this is without losing any
- 1:08accuracy at all. So, this is very
- 1:10important to know, understand, and also
- 1:13just know how to use and export when you
- 1:16build computer vision models that need
- 1:18to go into production and the real
- 1:20world.
- 1:21So, Alix, they set up everything here.
- 1:23We pretty much just have to call the
- 1:25export command. And the good thing about
- 1:27the YOLO 26 model, as we went through in
- 1:30the previous video, make sure to check
- 1:32that one out. But it's pretty much just
- 1:33the key features. We don't have this
- 1:35non-maximus suppression at the end,
- 1:37which is a pretty CPU heavy operation.
- 1:40So, the new model is significantly
- 1:42faster on CPU. So, it's pretty cool to
- 1:45check out on ONX and also open Veno. All
- 1:49we have to do is pretty much just grab
- 1:50the model and export it. Right now, I'm
- 1:52just going to open up a new terminal. If
- 1:55you run into any problems, it's most
- 1:57likely because you haven't pave
- 1:58installed the newest Ultralytics. So,
- 2:01make sure you have pave installics.
- 2:04And then you can also upgrade it.
- 2:07There we go. Now, I've upgraded my altit
- 2:09package locally and we're good to go.
- 2:12First of all, we're going to export it
- 2:14with the onx format. So all I have to do
- 2:17is pretty much just copy paste this
- 2:19path. You can also do it in Python once
- 2:21your model is done training. And you can
- 2:22specify all the arguments that we have
- 2:24below. If you have your own custom
- 2:27model, the only thing that you need to
- 2:28swap out is just the path to it. As I
- 2:30showed you in the last video, we just
- 2:32get the best.pt PT weight. You just swap
- 2:34out the path here and you're good to go.
- 2:37A lot of cases when we do the export and
- 2:39optimizations to the different
- 2:40frameworks, make sure you do it on the
- 2:42actual like hardware where you need to
- 2:44run it, especially if you run the tensor
- 2:46RT optimizations, but also open VO and
- 2:48so on. The format, image size, optimize,
- 2:53half precision. If you want to use
- 2:54floating point 16 instead of floating
- 2:57point 32, this is pretty much a
- 2:58no-brainer. we won't really lose any
- 3:00accuracy and we pretty much just half
- 3:02the size of the model at least the
- 3:06floating point values that we need to
- 3:08use for every single weight. So instead
- 3:09of having 32 bits per weight we have 16.
- 3:13You can also do in 8 that requires a
- 3:15calibration on your data set as well. So
- 3:17this is going to be a post training
- 3:20quantization when using the tens RT. So
- 3:22it will both use the data set do in8
- 3:25called quantization and we get it down
- 3:27to int 8. Here you can even get more
- 3:29speed ups, but you will probably start
- 3:31to lose some accuracy if you do like
- 3:33pretty hard in eight quantization
- 3:35especially on smaller models or if you
- 3:37lower use lower resolution dynamic for
- 3:40input sizes. So you can just take any
- 3:42input size and throw it into it exactly
- 3:44as if you're using the ultralytics
- 3:46framework to just run the predictions.
- 3:48So this is all we need to do. Let's go
- 3:49in open up our terminal. Now we can see
- 3:51that we have upgraded Ultralytics. So
- 3:53what we can do now we can run this
- 3:55export command and we just choose the
- 3:57yolo26.pt.
- 3:59We're going to export into the onx
- 4:01format.
- 4:03This is all the arguments that you can
- 4:04run. And if you want to have a table
- 4:06view over different format supported
- 4:09this is all the ones that we have. So we
- 4:10have pytor torch script onx open vino
- 4:13tens. This is for Intel hardware. This
- 4:16is just general CPU. We can also run a
- 4:18DPU with O and X core ML. If you start
- 4:20to get into
- 4:22um if you start to get into the Apple
- 4:24hardware, TensorFlow light for edge
- 4:26devices, MCNN, all these ones here, the
- 4:29auto setup, ultral will handle
- 4:32everything.
- 4:33So now we can see we pretty much just
- 4:34have this export done. So we have export
- 4:36this model. It is saved as yolo 26 in
- 4:40onx and then we can run that with our
- 4:42optimization.
- 4:44So a lot of the model frameworks they
- 4:46actually convert it into ONX first and
- 4:48then they convert it even further. We
- 4:50can just try one more. So instead of ONX
- 4:52we just call core ML.
- 4:58So now we can see that this requirement
- 5:00has not been found on my computer. So
- 5:02it's just going to auto update it. And
- 5:03this is going to be the exact same thing
- 5:05on all the other different formats that
- 5:08you're running it on. So depending on
- 5:10where you run it, we will also open up a
- 5:12Google Collab
- 5:14notebook and we can do the exact same
- 5:16thing in here, but this is going to run
- 5:17on GPU. So we create a new note
- 5:20notebook. We have free GPU resources
- 5:22available in here that you can use as
- 5:25well.
- 5:26So while it's doing that now, we can see
- 5:28down here we have our KCO YL file. We
- 5:30have export our model with the ML
- 5:33package. So now we can start use this
- 5:35with the core ML framework. So you'll
- 5:37use the other frameworks to run the
- 5:38inference. If you run it with autoytics,
- 5:40it will also support running inference
- 5:42with these exported files. So to see how
- 5:45we can do it with for example,
- 5:48let's just go with the T4. I think this
- 5:50is the free GPU available from Google
- 5:52Collab. Again, all we have to do pave
- 5:56install Ultralytics.
- 6:03Let's go and grab the command again.
- 6:06Let's do Python instead.
- 6:10Let's go back. Just going to use this
- 6:13model out the box again. Now we're going
- 6:15to use half precision.
- 6:19So we set that to true. Instead of on X,
- 6:22we can specify engine.
- 6:26And we can pretty much just run it here
- 6:28now.
- 6:30All is good inside the terminal. We have
- 6:32exported model to the two different
- 6:33frameworks. Tensor RT optimization is
- 6:35going to take a bit longer. It could
- 6:37probably take 20 30 minutes depending on
- 6:39your hardware, your CPU, GPU, and all of
- 6:42that. And I'll do it again. It will just
- 6:44pre-install everything. This is pretty
- 6:47cool. Like if you run Tensor RT
- 6:48optimizations, you can get up to 5x
- 6:51inference speed increases. And again, if
- 6:53you want to run the predictions, you
- 6:55just go in and run the predict method as
- 6:57we have in the other videos. We have
- 7:00full guides going over in detail tensor
- 7:03RT separately even on Nvidia edge
- 7:05devices like the Jetson nano. We also
- 7:07have core ML running on Mac hardware
- 7:10Intel hardware for the open veno
- 7:12framework where we cover all the details
- 7:14all the specifications and what is
- 7:16exactly for this framework. So this
- 7:19pretty cool export on X still running
- 7:22here. So this will take a bit of time.
- 7:24Like if you're running it on just a
- 7:25nano, it can take all the way up to 45
- 7:27minutes. But it's definitely worth it
- 7:29because you will get up to 5x inference
- 7:32speed, not losing any accuracy at all.
- 7:34So this is one of the most important
- 7:36things to take into account when you
- 7:37want to take your computer vision models
- 7:39from your development environment into
- 7:41your production ready environment. This
- 7:44is pretty cool. Also, Dick takes care of
- 7:45everything. We can also run
- 7:46benchmarking. We're going to cover that
- 7:48in a future video. I hope you learned a
- 7:50ton. Hopes you guys in one of the
- 7:52upcoming videos.
About this transcript
This page contains the full transcript of How to Export Ultralytics YOLO26 in different formats for Deployment | ONNX, TensorRT, CoreML π by Ultralytics, generated from the public captions YouTube serves with the video. The transcript has 1,516 words across 212 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator β no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.