Oriented Bounding Boxes Object Detection | YOLOv8 OBB detection

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is arohi and welcome to my channel so guys in my today's video we will learn how to perform object detection using oriented bounding boxes so whenever we perform object detection we get these kind of bounding boxes and with each detected object we get their class name and the confidence score here you can see that the bounding boxes are straight rectangle boxes fixed on the objects but with the help of oriented bounding boxes we can rotate these rectangle boxes as per the orientation of the object present in the image so that it can fit the object more properly so bounding boxes and oriented bounding boxes both are used in computer vision for object detection tasks and the only difference between them is that using bounding boxes you may not accurately represent the orientation of the object that are rotated or have some irregular shapes but when you use obb we can achieve that however Computing obbs can be more complex and computationally expensive as compared to the bounding boxes now the question is which one should we use for our applications bounding boxes or oriented bounding boxes so let's discuss this bounding boxes are simple and efficient but you may not accurately represent the rotated or irregular object with the help of obbs we can achieve this but at the cost of increased complexity in computation why obbs are more complex and computationally expensive because obbs need to determine the orientation of the object carefully accurately and this involves more calculation so so the choice between bounding boxes and oriented bounding boxes depends upon the specific requirement of the appc application let's see the implementation now first we are going to use the YOLO V8 pre-trained model which is trained for this obb task oriented object detection task and here we are using the N model in the same way there are other variants of this model you can see here n small m l and X okay so these are the different variants of this obb models and all the models which are ending with this obb so these are the models which these are the pre-trained models which are trained for this oriented object detection task okay so my today's tutorial we are testing this obb model to run this obb model you need to have the ultral litics package because this YOLO v8n obb is present in the ultral litics package so the version of ultral litics which I'm using is 8.1.9 you can install ultral litics package by simply writing pip install ultral litics once you have the ultral litics package so your environment is ready now you can run this model you can test this model so first we are importing the YOLO model from ultral litic then we are loading the pre-trained YOLO V8 n obb model and this is the test image on which I want to perform the testing my imag is in test images folder and I want to perform the prediction now and just hit enter here you can see the results are saved in predict five folder let's go to the folder this is my runs folder obb folder predict 5 folder and let's open the image so this is the image this is the image we are getting with the help of obb here you can see that the bounding boxes are not straight rectangles they are as per the orientation of our objects okay now let me uh show you the example where we will perform the object detection using ulo V8 and let's compare both the images so to run the object detection model just copy the same code paste it over here but this time instead of this obb model we are loading the object detection model which which puts bounding boxes on the detected object and we are testing it in the same image and let's run it the results are stored in runs detect and predict two let's go to the code let's open this image first the first one okay and under runs we have a detect folder predict two and this image so so guys this is the output given by your object detection model now let me open the output of obb model and this is the output of of obb model here you can see that in this picture we have the bounding boxes according to the orientation of the objects and here we are just having the straight bounding boxes so this this is the difference between the bounding boxes and the oriented bounding boxes now let's uh now we have tested the pre-trained Yol loate OB model let's learn how to train and test the model for obb task for that we will use the DOTA data set DOTA is a large scale data set for object detection in aial images and DOTA 1.0 has 15 classes and some of the classes are plane helicopter swimming pool ship okay and this is the entire list and we will download this data set and and then we will train our model and then we will test the model so guys before before training our model let me tell you one thing that this YOLO V8 obb this model is trained on DOTA data set only okay so when we so this is a pre-trained model so pre-trained model means it is trained on some kind of data set so the data set which is used to train this obb YOLO pre-trained obb model so they have used the DotA data set so for our today's tutorial we will download the DOTA data set only and we will follow all the steps like how to train the model and then how to test the model so why we are using this same data set because whenever we want to train any algorithm we first need to prepare the annotations and annotations should be in the format which that particular model accepts so when we used to work with object detection models which put bounding boxes on the images so for that we always needed the class name and the four coordinates bounding box coordinates right now we want to have a object detection model which should put oriented bounding boxes on the object so that means we need some kind of annotations for that also so let me show you the data set and The annotation file and then we'll come to this code okay when you'll execute this cell you will get the the data set downloaded in your folder okay so what we have done over here we are just importing the Yolo from ultral litics we are using the pre-trained YOLO V8 obb model and then we want to train our model so whenever we want to train a model we provide one data. yl file to our algorithm remember in um normal object detection also we uh we provide this data. yml file in which we we we tell that where our images are how many number of classes we are having and what are the name of those classes okay so let me open this file the data. yml file and show you what all things are here so this is the this is the doav V1 yml file and here you can see the path of images training images path validation images path test images path and these are the name of the classes which we are using so you can find this file from here inside the tics GitHub repo under the CFG and then data sets you can get this file over here so we are using that file and now you know the number of classes and what are the name of those classes in this DOTA data set these are the different classes we have and we are going to train our model for these classes so that we have and we want to train a model for 100 ook and here we have given the image size now before before executing this cell let's see the data set now let me show you the data set you don't need to create any folder once you will run that cell which I've just shown you after running that cell you will get this data set folder inside that you will get this folder DOTA V1 V1 means version one and open it inside that you will have two folder images and label and inside images you will have train validation and test folder open the train folder and here you can see the images let's open few images and see so this kind of images you have so these all are aial images so and inside labels you will see two kind of label one is original label and one is like this so the one this one is the label which is converted in the format which we want and these were the original labels so let's open the original labels and see okay so for single file we have this kind of data okay for single file we have this kind of data and one line means one object and after converting this data into the YOLO format let's see here this and this is the YOLO format so this is the uh annotations of training file in Yolo format and this this is the validation annotation files in Yolo format now let's open it and see here so this is The annotation of the first object which is there in the first image and this is for second object and guys here you can see this is the class name and then we have these many different coordinates over here but when we use to work with bounding boxes we only used to have the four coordinates but this this time we have these extra four coordinates now what are they let's see so for that on this ultral litics page just scroll down and under this data set format click on the data set guide and this is the format of the annotations which we want if we want to perform oriented object detection using yate so what is the format class index then first two coordinates are X1 and y1 this one X1 and y1 and then we have X2 and Y2 X3 and Y3 X4 and y4 so that's why we have eight different values here okay so what are these values X1 y1 X2 Y2 X3 Y3 and X3 X4 y4 so these kind of different annotations you have now so annotation file is different in object detection and oriented object detection and if you want to use your custom data set then you need to have your annotations in this format then only you can perform this oriented object detection using YOLO V8 okay so so the reason why we use this data set only because they have the data set in this format and today we are just testing how to use the how to perform the oriented object detection on the data set so here you will provide the path of the yml file this yml file I've already shown you and then the data set format is different and then I trained it for 100 EPO so once the training get finished let me scroll down so I've trained this model for 100 EPO and after that results got stored in this folder now let's open this folder and see the training results runs obb train and let's open the confusion Matrix so this is a confusion matric here you can see the class names which we have in this data set and in the same way you can see the results and the weights you will get in this weights folder you will use the best. PT weight to make predictions now let's use this best. PT we to make the predictions here so we are importing the YOLO model and then you will give the path of the trained model and this is the folder in which I have the images on which I want to perform the testing save true will save the output and when you'll run it you will see the output in predict 6 folder now let's open the predict six folder in obb and see the output so this is the output we have the oriented bounding boxes on our objects so guys this is how you can perform uh object detection this oriented object detection so I have given the link of this code in description section you can try this and I hope this video is helpful so guys if you like my video please like share and subscribe my channel thank you for watching
Info
Channel: Code With Aarohi
Views: 1,176
Rating: undefined out of 5
Keywords: obb, yolov8, yolo, computervision, orientedobjectdetection, objectdetection
Id: KpwgPOPgX1M
Channel Id: undefined
Length: 14min 21sec (861 seconds)
Published: Wed Feb 28 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.