YouTube2Text

How to Export Ultralytics YOLO26 in different formats for Deployment | ONNX, TensorRT, CoreML πŸš€ β€” Transcript

by Ultralytics Β· 1,516 words Β· 212 segments Β· language en Β· Watch on YouTube

Full transcript

  1. 0:00In the last video, we went through how
  2. 0:01we can train the new YOLO 26 model end
  3. 0:05to end on our own custom data set. In
  4. 0:07this video here, we're going to see how
  5. 0:08we can export into different
  6. 0:10optimization frameworks and format so it
  7. 0:12can run significantly faster on both
  8. 0:14CPU, GPU, whatever hardware that you're
  9. 0:17using and for what framework. So, let's
  10. 0:20just jump straight into it. We're going
  11. 0:21to start here in the Altitics
  12. 0:23documentation. If we go inside the docs
  13. 0:26over here on the left side, we went over
  14. 0:28our training mode. You can use the
  15. 0:30alternate framework in the exact same
  16. 0:32way with all the models. But if we go
  17. 0:34inside our export tab, first of all, all
  18. 0:38we have to do is pretty much just figure
  19. 0:39out what hardware we're going to run the
  20. 0:41model on. This is the step that we do
  21. 0:43after training. We have we have a final
  22. 0:45model that we want to get into
  23. 0:46production and run where we want to get
  24. 0:49increase in our inference speed without
  25. 0:51really losing any accuracy at all.
  26. 0:54So, one thing that we can do is convert
  27. 0:56it into ONX or Open VO. We can get up to
  28. 0:583x CPU speed up as we can see here. And
  29. 1:01if you're running it on Nvidia GPUs, you
  30. 1:03can use Tensor RT to get up to 5x GPU
  31. 1:06speed up. And this is without losing any
  32. 1:08accuracy at all. So, this is very
  33. 1:10important to know, understand, and also
  34. 1:13just know how to use and export when you
  35. 1:16build computer vision models that need
  36. 1:18to go into production and the real
  37. 1:20world.
  38. 1:21So, Alix, they set up everything here.
  39. 1:23We pretty much just have to call the
  40. 1:25export command. And the good thing about
  41. 1:27the YOLO 26 model, as we went through in
  42. 1:30the previous video, make sure to check
  43. 1:32that one out. But it's pretty much just
  44. 1:33the key features. We don't have this
  45. 1:35non-maximus suppression at the end,
  46. 1:37which is a pretty CPU heavy operation.
  47. 1:40So, the new model is significantly
  48. 1:42faster on CPU. So, it's pretty cool to
  49. 1:45check out on ONX and also open Veno. All
  50. 1:49we have to do is pretty much just grab
  51. 1:50the model and export it. Right now, I'm
  52. 1:52just going to open up a new terminal. If
  53. 1:55you run into any problems, it's most
  54. 1:57likely because you haven't pave
  55. 1:58installed the newest Ultralytics. So,
  56. 2:01make sure you have pave installics.
  57. 2:04And then you can also upgrade it.
  58. 2:07There we go. Now, I've upgraded my altit
  59. 2:09package locally and we're good to go.
  60. 2:12First of all, we're going to export it
  61. 2:14with the onx format. So all I have to do
  62. 2:17is pretty much just copy paste this
  63. 2:19path. You can also do it in Python once
  64. 2:21your model is done training. And you can
  65. 2:22specify all the arguments that we have
  66. 2:24below. If you have your own custom
  67. 2:27model, the only thing that you need to
  68. 2:28swap out is just the path to it. As I
  69. 2:30showed you in the last video, we just
  70. 2:32get the best.pt PT weight. You just swap
  71. 2:34out the path here and you're good to go.
  72. 2:37A lot of cases when we do the export and
  73. 2:39optimizations to the different
  74. 2:40frameworks, make sure you do it on the
  75. 2:42actual like hardware where you need to
  76. 2:44run it, especially if you run the tensor
  77. 2:46RT optimizations, but also open VO and
  78. 2:48so on. The format, image size, optimize,
  79. 2:53half precision. If you want to use
  80. 2:54floating point 16 instead of floating
  81. 2:57point 32, this is pretty much a
  82. 2:58no-brainer. we won't really lose any
  83. 3:00accuracy and we pretty much just half
  84. 3:02the size of the model at least the
  85. 3:06floating point values that we need to
  86. 3:08use for every single weight. So instead
  87. 3:09of having 32 bits per weight we have 16.
  88. 3:13You can also do in 8 that requires a
  89. 3:15calibration on your data set as well. So
  90. 3:17this is going to be a post training
  91. 3:20quantization when using the tens RT. So
  92. 3:22it will both use the data set do in8
  93. 3:25called quantization and we get it down
  94. 3:27to int 8. Here you can even get more
  95. 3:29speed ups, but you will probably start
  96. 3:31to lose some accuracy if you do like
  97. 3:33pretty hard in eight quantization
  98. 3:35especially on smaller models or if you
  99. 3:37lower use lower resolution dynamic for
  100. 3:40input sizes. So you can just take any
  101. 3:42input size and throw it into it exactly
  102. 3:44as if you're using the ultralytics
  103. 3:46framework to just run the predictions.
  104. 3:48So this is all we need to do. Let's go
  105. 3:49in open up our terminal. Now we can see
  106. 3:51that we have upgraded Ultralytics. So
  107. 3:53what we can do now we can run this
  108. 3:55export command and we just choose the
  109. 3:57yolo26.pt.
  110. 3:59We're going to export into the onx
  111. 4:01format.
  112. 4:03This is all the arguments that you can
  113. 4:04run. And if you want to have a table
  114. 4:06view over different format supported
  115. 4:09this is all the ones that we have. So we
  116. 4:10have pytor torch script onx open vino
  117. 4:13tens. This is for Intel hardware. This
  118. 4:16is just general CPU. We can also run a
  119. 4:18DPU with O and X core ML. If you start
  120. 4:20to get into
  121. 4:22um if you start to get into the Apple
  122. 4:24hardware, TensorFlow light for edge
  123. 4:26devices, MCNN, all these ones here, the
  124. 4:29auto setup, ultral will handle
  125. 4:32everything.
  126. 4:33So now we can see we pretty much just
  127. 4:34have this export done. So we have export
  128. 4:36this model. It is saved as yolo 26 in
  129. 4:40onx and then we can run that with our
  130. 4:42optimization.
  131. 4:44So a lot of the model frameworks they
  132. 4:46actually convert it into ONX first and
  133. 4:48then they convert it even further. We
  134. 4:50can just try one more. So instead of ONX
  135. 4:52we just call core ML.
  136. 4:58So now we can see that this requirement
  137. 5:00has not been found on my computer. So
  138. 5:02it's just going to auto update it. And
  139. 5:03this is going to be the exact same thing
  140. 5:05on all the other different formats that
  141. 5:08you're running it on. So depending on
  142. 5:10where you run it, we will also open up a
  143. 5:12Google Collab
  144. 5:14notebook and we can do the exact same
  145. 5:16thing in here, but this is going to run
  146. 5:17on GPU. So we create a new note
  147. 5:20notebook. We have free GPU resources
  148. 5:22available in here that you can use as
  149. 5:25well.
  150. 5:26So while it's doing that now, we can see
  151. 5:28down here we have our KCO YL file. We
  152. 5:30have export our model with the ML
  153. 5:33package. So now we can start use this
  154. 5:35with the core ML framework. So you'll
  155. 5:37use the other frameworks to run the
  156. 5:38inference. If you run it with autoytics,
  157. 5:40it will also support running inference
  158. 5:42with these exported files. So to see how
  159. 5:45we can do it with for example,
  160. 5:48let's just go with the T4. I think this
  161. 5:50is the free GPU available from Google
  162. 5:52Collab. Again, all we have to do pave
  163. 5:56install Ultralytics.
  164. 6:03Let's go and grab the command again.
  165. 6:06Let's do Python instead.
  166. 6:10Let's go back. Just going to use this
  167. 6:13model out the box again. Now we're going
  168. 6:15to use half precision.
  169. 6:19So we set that to true. Instead of on X,
  170. 6:22we can specify engine.
  171. 6:26And we can pretty much just run it here
  172. 6:28now.
  173. 6:30All is good inside the terminal. We have
  174. 6:32exported model to the two different
  175. 6:33frameworks. Tensor RT optimization is
  176. 6:35going to take a bit longer. It could
  177. 6:37probably take 20 30 minutes depending on
  178. 6:39your hardware, your CPU, GPU, and all of
  179. 6:42that. And I'll do it again. It will just
  180. 6:44pre-install everything. This is pretty
  181. 6:47cool. Like if you run Tensor RT
  182. 6:48optimizations, you can get up to 5x
  183. 6:51inference speed increases. And again, if
  184. 6:53you want to run the predictions, you
  185. 6:55just go in and run the predict method as
  186. 6:57we have in the other videos. We have
  187. 7:00full guides going over in detail tensor
  188. 7:03RT separately even on Nvidia edge
  189. 7:05devices like the Jetson nano. We also
  190. 7:07have core ML running on Mac hardware
  191. 7:10Intel hardware for the open veno
  192. 7:12framework where we cover all the details
  193. 7:14all the specifications and what is
  194. 7:16exactly for this framework. So this
  195. 7:19pretty cool export on X still running
  196. 7:22here. So this will take a bit of time.
  197. 7:24Like if you're running it on just a
  198. 7:25nano, it can take all the way up to 45
  199. 7:27minutes. But it's definitely worth it
  200. 7:29because you will get up to 5x inference
  201. 7:32speed, not losing any accuracy at all.
  202. 7:34So this is one of the most important
  203. 7:36things to take into account when you
  204. 7:37want to take your computer vision models
  205. 7:39from your development environment into
  206. 7:41your production ready environment. This
  207. 7:44is pretty cool. Also, Dick takes care of
  208. 7:45everything. We can also run
  209. 7:46benchmarking. We're going to cover that
  210. 7:48in a future video. I hope you learned a
  211. 7:50ton. Hopes you guys in one of the
  212. 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.