Convert, Export, and Optimize YOLOv8 Model with OpenVINO for Lightning-Fast Speed

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's tutorial I will teach you how to  convert your YOLO V8 model or YOLO V8 pre-train   model to open voo format so the question here  now is why should I convert my yate model or a   pre-train model I have into opv format that's  a right question honestly but there are some   numerous advantages of converting a PR TR model  to open v no format you don't want to miss the   first Advantage I will talk about here is higher  influence speed so um we all know Yul V8 models   have extremely higher influence speed already  but the fact is converting them to opv format   takes you one step ahead it makes these models  extremely fast and running inference become   very fast in addition to that um open V helps  you to do model compression th it helps you to   apply quantization which helps you to reduce  your requirement ments you need to run this   model another advantage that I love the most is  the cross platform compatibility so uh when you   convert your model to op V op V supports various  platforms such as Windows macw lineup and so on so   you have this advantage of running your model on  any operating system at all op also have a large   community support so in case something goes wrong  you know who to talk to you know where to get   some from all these benefits one more benefit I'll  add to is is easy deployment deploying your model   becomes easy because it supports many platforms  so we are going to start from scratch where we   take a pre-train model or our custom model and  convert this model from Yo V8 format to op Vino format so on my desktop I create a new folder  and I'll name this folder open V okay so for   testing purpose I have this image right here  image of a card so we have four cards in this   image and I'll just drag and drop this image  into our folder and I'll open Visual Studio   code with this folder okay so right here we have  the image of the card we drag in and you can see   the folder name is open venue we are going to  create a new file and we call this file Main right so I can go Ahad and close this and the   first thing I do right here  is to create a new virtual environment okay so the virtual  environment is done next thing   we'll do is to activate this virtual  environment and that is it so um in   order to perform this TXS we need to  install some dependencies and uh I think   it's only one dependency we need that the  orales library so I'll just right install orales all right guys so the installation is done  I'll go ahead and close the terminal and then from   neutralities I'm going to import y okay so um the  model we'll be using today is a pre-train model we   are going to be using a trade model from orales  but when you follow the same step with your own   custom model is going to work so um I say our  mod is equal to Yow and inside the parenthesis   here you have to type the model you want to use  so orales have many pre-trained models today we   are going to use a small version of their models  so you just have to type it right there for that   I'm going to type YOLO V8 x. PT so this is for  the smallest model you can use the number one   as well by just replacing the s there with n you  can use the medium L you can also use the large   by gu writing L there but we are going to use  a smaller one so when I run this code it to go   ahead and download this particular pre train model  in my working directory so let's give it a try by   running this code you can see the downloading have  started and it's downloading this TR mod to write   in my working directory and you can see it right  here so you can see we have the smaller version   of the YOLO v83 TR model before we convert this  model to the op V format the first thing I would   like us to do is to test this model on the image  so I have four cards in a single image and I'll   just send this into the model for some prediction  this to validate that the model is working or not   and in here I'll just type the name of the image  which is the cats. JP that's it so I'll give it a run okay so guys here's the result right here you  can see four cards has been detected and it has   taken 12 9.8 millisecs to perform these steps so  the thing is after converting this model to op V   we are expecting that we have a higher influence  speed so we are expecting a lesser number than   this you can see it has used two milliseconds for  pre-processing that's use 12 29.8 milliseconds for   inference and 3 milliseconds for postprocessing  per image of this particular shape okay so the   next step is to convert the model to P window  format I'll comment the testing code right here   and to convert this model is very easy so um  we call this model V model and this is equal   to our model export and right here you just have  to specify your formats you want this model to   be converted in so you can say our format is  equal to not our format is equal to open V so   that's all you need to do to convert this model  open format so if I run this code this go ahead   and convert our model so let's run this and  let's see how the conversion is done so first   it to convert this model to a py touch format  then further convert this to ons format before   it converts finally to our open window format  so you can see we have o nns here then it will   further go ahead and Export it from on to our  open window format so this will take some time   the conversion take some time but it's just some  few minutes let's see some couple of minutes I'll say so finally our model has been exported to open  V format and U you can get the save model here so   it is saved to this directory which is our working  directory so right here in the working directory   you can see we have the open window model so the  name is Yolo V8s open window model when I open   it so normally open window model comes with two  files so we have the bin file and the XML file so   that's the format for open V models we have it  right here so we just have to specify the path   to this particular name and we can load in our  model so now that we've exported this model no   need for this line of we can comment it we can  now go ahead and lo this model so I'll still   call this my window model is equal to yellow and  right here we just have to type the name there   you can see the name right here you v s open  window model so I'm just going to type this right all right so this is the model and we  can go ahead and run inference on this model   and Al see how it perform so I'll call this  V result is equal to our V model and in here   we can give it our image so we call this  image cs. JPEG which I'll copy right from here so I comment this so that we  can compare the speed or first let's   just run the open window one and  see how it performs on the image okay guys so here is it so it has used 100.9  milliseconds for running this influence and   you can see uh the speed it has used for  preprocessing has used 100.9 millisecond   for inference and 2.8 milliseconds for post  processing so now we can go ahead and compare   these two model by running influence using the  original y pre-ra model and the open V model so   that we can ude which one runs faster for that  I will un comment this right here so first we'll   get the result for the prra model and then in the  second part we'll get a result for the open window model so you can see the difference right  here guys so you can see um the Y V8 model   have detected four cards which is true and  I use 126.2 millisecond in doing that whil   the open window model in the other hand use 115.0  millisecond so you can see the difference in speed   you can see um the open window format or the open  window model format is very fast and it's faster   than that of the YOLO V8 model so converting your  model to open V offers numerous Advantage for you   gives you higher influence speed and then uh makes  everything faster and right here to you can see it   has maintained the accuracy it has also detected  for cuts by using a lesser time so this is how   easy it is to convert your model from y V8 format  any model at all this can be your custom model it   doesn't necessarily means it should be a pre TR  model from orales you can train your custom model   and then convert this model using the same step  all you need to do is to use the name of your   model right here and then you convert this model  to open window format we are done then you can   use the open window format for your daily tax so  that's how it works you can see clearly the speed   it offers is faster than that of the raw model  from utral that's all for today love this tutorial   make sure you give me a thumbs up subscribe to the  channel and also share my content so that we build   a learning community together thanks for watching  and I'll see you right in the next tutorial
Info
Channel: Tech Watt
Views: 360
Rating: undefined out of 5
Keywords: yolov8, image classfication, custom dataset, ai, machine learning, computer vision, deep learning, pytorch, openvino, model optimization, yolov8 to openvino
Id: sAjR2dlhVfM
Channel Id: undefined
Length: 11min 26sec (686 seconds)
Published: Thu Feb 08 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.