Now you can see over here, I have opened the pigeon, so I will just click over here, file, click
on new project from here.
Okay.
So I will just now redirect towards the directory where I am just created a folder so it's inside the.
Okay, so now I'm inside the directory and here I can see the folder by the name YOLO V8 Crash course.
So this is the folder I just created for this tutorial.
So just click over here.
Okay.
Then I'm just creating a new environment.
You can see over here I'm just creating a new virtual environment over here and this is my base interpreter.
Python dot exe.
Okay, so just click over here.
So this is my base interpreter and then click on Create New project.
As I click on Create, it will ask me.
Projects can either be open a new window or replace the project.
So just click on this window from here.
Okay, so now it's creating a new virtual environment.
You can see over here and this is our directory name, YOLO V8 Crash course, which you can see over
here.
Now we can see that the virtual environment is being created, so this might take few minutes as it's
updating the interpreter paths and everything.
Okay, so now you can see that we have created a new project over here and here we have the main.py
file.
So if you just click over here, just right click over here and then just go to.
From here.
Sorry.
Just click over here.
Fine.
And then click on from here.
Just click on settings from here and then just click on over here.
Project Yolo V eight Crash Course is the name of our project, and then then select click on Python
Interpreter.
So now you can see that these three packages are already installed.
So now you can see that we have downloaded Python 3.10, so we can see Python 3.10 over here and YOLO
V8 crash course.
And so just install to install any new package, just click over plus and just write here.
For example, if I just want to install numpy, I will just type numpy and just select numpy and click
on install package.
Okay.
So it will install the package.
So in this way you can just write all the packages name over here and just install all those packages
like you can see over here.
If I just want to install Cv2 package Cv2 package I will just write OpenCV python.
So that's right OpenCV Python So you can see that here we have the dot package.
So if you just click over here and you can install the Cv2 OpenCV Python package as well.
But this process takes very much time.
Like in this way you just need to write every single package name over here in the search bar and install
that package.
There is another, another way will be also to install the package.
So let me just tell you.
So now you can see that as I install the numpy package, we can see that numpy package appears over
here and now we have the four packages installed.
In this way you can just click over here plus and install any of the package which you require.
If so, just going back from here.
So in order to install the packages of your choice, you just need to click over here, file and create
a file by the name requirements dot txt.
Okay, so in this file you can write all the packages which you want to install.
So if I just want to install ultralytics, I will just write ultralight 8.0.26.
Okay.
So this is a version.
Okay.
In this way if you want to install numpy package, although I've just already installed, you can just
write numpy and if you just want to install matplotlib you can just write the name of package over here.
So now here you can see over here.
Package requirement Ultralytics Matplotlib are not satisfied.
So if you just click on install requirements.
So now it will just install all these two packages and just click on install from here.
So now you can see that just go below down over here, you can see that installing package.
So it's installing the Ultralytics package and after this it will install the Matplotlib package, although
numpy package is already installed.
Okay.
So.
But just let's run the Main.py file and see what output do we get from here.
So if I just click on Main.py file and just click on Run Main and just open the terminal so you can
see that it's giving me the output.
Hi pi job.
So that's fine.
In the meanwhile that alter prefix package get installed.
And let me tell you in this video tutorial I will be using YOLO V8 for the object detection.
So alternate.
So to implement YOLO a8 we just need to install the ultralytics package which I'm just installing over
here.
So YOLO eight is the latest release of the YOLO version.
So YOLO V8 outperforms all the other YOLO version in terms of accuracy and speed and the mean average
precision of 56 7.6 have has been marked with YOLO V8.
So if I just show you the YOLO V8 GitHub repository.
So let me just show you.
So if you just click over here and just write YOLO V8 it up, Okay, So and just click on this first
link.
So Ultralytics has released YOLO V8 Ultralytics has also released YOLO V5 and YOLO V3 so you'll be eight
is the only version of YOLO which has its own package.
So you just need to install PIP, install ultralytics and you can just run YOLO V8.
So YOLO V8 is the only version of YOLO which has its own package that you can see over here.
Pip install Ultralytics will just install the YOLO V8 on your.
System and you just need to write YOLO predict and you can just run YOLO V8.
Okay, so prior versions of YOLO had don't have their own package, but YOLO V8 had its own package
which is ultra, which is PIP install already.
So using PIP install ultralytics you can just install YOLO v8.
You can also, if you want to make any change in the detection or training script, you can just clone
the repo as well.
Okay.
So in our case we are just installing the YOLO V8 package by just writing ultralytics and its version.
Okay.
In the requirements.txt file.
So if I just go back over here now you can see over here in the requirements.txt file I'm just installing
YOLO V8 by just writing Ultralytics and its version.
So in this way we can install the YOLO V8.
So now we can see that package is successfully installed.
Packages ultralytics and Matplotlib package has been successfully installed.
You can see in the node over here we go down like the package is installed successfully, which includes
Ultralytics and Matplotlib package and you can see that we are using Python 3.10, which you can see
over in the top in the bottom right corner, Python 3.10, which we are using, which we have just downloaded
the python 3.10 version from python.org.
Okay.
So now we will just run YOLO V8.
So first of all I will just go over here and click on new and create a directory by the name run YOLO
by running YOLO.
Be it.
Okay, so this is our directory.
Running YOLO V8.
And here I will just create a file by the name.
Your law.
death.py.
Okay.
So now you can see that as we have installed the AllPolitics package.
So I will just write from Ultralytics.
Import yolo.
Okay, so it will import yolo v8 from you by using from ultralytics import yolo.
It will automatically import the yolo V8.
Okay.
Yolo v8 package from ultralytics.
So in the next step I'll just write.
Import cv2.
Or let's just skip it and just write.
Model is equal to.
Then we just need to write YOLO.
And just right.
So in case of Angola, we have different.
Evidence available.
So let me just show you.
So now if I just go below down here.
So now you can see that we have five different weights, Yolo V eight and or Nano is the smallest and
it is it is the smallest in size and it is the fastest as well.
But it is less accurate while yolo V8X is the is the more accurate, but it is less fast or it is slow
as compared to other YOLO V8 versions.
So simply yolo v eight and is less accurate, but it is the fastest but yolo V8X is more accurate than
other all other yolo v eight.
But it is less fast.
Okay.
So just go back from here and just write your logo.
B a n dot p t, Okay.
So I'm just writing the name of the weight file over here so the weight will be automatically downloaded.
Okay.
So just need to we don't need to manually download the weight and just place in this folder.
The weights will be automatically downloaded.
You just need to write the name of the weights which you want to use.
Just need to write the name of the weights.
Pre-trained weights over here.
Okay.
And then after this, just write results is equal to model and just pass the input image path over here.
Okay.
So let me just.
Okay.
So let me just add some image over here.
So have already have some downloaded some images from, uh, Google.
So I will just add these images over here.
So let me just go back and just let me some add some new images.
Okay?
So just just give me a minute.
I'm just going back and just adding some new images.
Okay.
So let me just show you as well.
Well, if I just go over here in this folder.
So now in the images folder, you can see over here, I have just placed these four images.
Okay, So let me just test out on these images and see what results do we get.
Okay.
So I'm just going back to our stock code and just I will just write down, down.
So I will.
Now I just want to go to the images folder and just write the name of the image or the image.
I just need to add the image path.
So I will just write, uh, dot dot, which means go backward, like go outside this running Yolo V
folder and then just go to images folder and just write, uh, the three dot PNG, the name of the image
on which I just want to perform the detection.
Okay.
And just write show is equal to true.
Okay, so now just click on over here.
yolo-test.py.
So just click over here and just run YOLO dash test this script.
So I'm just running this YOLO test.py script.
Okay, so this might take few seconds.
Now you can see that the output just appeared and it just flows because we don't have added any delay.
Okay.
So that's why we cannot see the output.
It just appeared and went away.
So because we don't have added we because we haven't added any delay.
So let's add the delay.
So to add the delay, I will just import cv2.
Import cv2 and I will just write.
CV to dot Wait key.
So I'm just adding that delay now and just write zero over here.
And now let's run this script again.
So now hopefully we will have the output in front of us.
Okay.
The USB.
We can't see the output because we don't have any added any delay.
So.
So now you can see that we have the output in front of us.
Like you can see that this is the input image I have just passed.
And here we have the detection results using YOLO V8.
So now you can see that the model is able to detect motorcycles.
Like you can see that we have multiple motorcycles plus in the back side of the image we have the cars.
So the model is able to detect cars as well as the motorcycle.
So the detection results are quite fine.
And let's test on some other images and well and see what results do we get.
Okay, so just write the name.
So I'm just passing two dot PNG and see what results do we get.
So just click over here and just run YOLO test and okay, just forgot to stop the previous.
So I will just click over here and stop the previous running script and just run this again now.
So run YOLO test.
Okay.
Okay, so let's see.
What results do we get in this case from here?
Okay, so let me just share my screen now.
So now you can see over here, like you can see over here, we have detected the card.
This is a wrong detection.
This is not a bus.
This is also a card file.
You can see that the YOLO V8 model is detecting cards and these are very impressive results.
Currently we are using nano, but I have already told you that YOLO is the largest among the YOLO V8
model and it is more accurate.
So you can use also use the YOLO V8 weights and in that if you use the YOLO V8 weights, the detection
results will be more backward because YOLO, A10 Nano is also the fastest, but it is less accurate
while YOLO V8 is less fast but is more accurate.
Okay, so the detection results are fine.
So let me just go back.
Okay, so now what we can do is.
You can test on some other images as well.
But I I've already tested on two images two dot PNG and three dot PNG already.