Hello everyone.
In this video tutorial we will see what we can use.
YOLO V8 with Deepsort object tracking to do vehicle counting, we will count the number of vehicles
entering as well as the number of vehicles leaving the lane.
So in front of you you can see the output video demo over here.
So in your question might be in your mind like how we have implemented the object tracking.
So you can see that in object tracking, we assign a unique ID with each of the detected object like
you can see here.
Here we have the detected a car.
A unique ID 130 is assigned with the car.
Plus we also have the trails as well.
Now, here we also detected the car.
You can see the unique ID 125 with the car.
And you can see these trails as well.
You can see these are the trails.
And here you can see that we have detected the truck and we have assigned the unique ID 127 to the truck.
And here you can see the trails as well.
You can see the trails line as well, which you can see over here, the brown line.
These are the trails which we have drawn here in the you can see the light pink color.
These are the trails which we have drawn.
Okay.
So using object tracking, we have assigned a unique ID to each of the detected object.
Plus you can see these trails as well.
So let's go towards the in more detail and let me explain you what a bit more theoretical details then
we can go towards the export part.
Okay.
So let me share my screen and open the direction in Compass.
So in front of your screen you can see the Direction Compass.
So you all know that here we have the north direction, Here is the south direction, here is the east
direction and here is the west direction.
So please remember these direction compass in your mind and let's move towards the another image so
that I can explain you the remaining concept as well.
So if I open the other image, just give me a minute.
I'm just opening the other image.
So here in the image.
So now you can see the other another image on your screen.
So what we can say that if the vehicle is moving in this direction, like you can see over here, let
me just pick up the pencil over here.
So what we can say that if the vehicle is moving in this direction, we can say that this is the north
direction.
Okay.
So if the vehicle is moving in this direction, we can say that this is a north direction.
And if the vehicles moves in this direction, we can say that this is the south direction.
So we are just, uh, this is as per the direction compass which we have seen in the previous image.
So this is a north direction and this is the south direction.
So when the vehicles move in this north direction, we can say that this is a vehicle is entering.
And when the vehicle moves in this south direction over here, we can say that the vehicle is leaving.
So when the vehicle moves in the south direction, we can say the vehicles is leaving.
And when the vehicles move in the north direction, we can say the vehicle is entering.
Okay.
So how we can how does the model knows that the vehicle is moving in the north direction or the south
direction?
So what we do is you can see these trails over here.
You can see that these are the trails line, the light blue line.
These are the trails line over here.
So when this trails line so.
Model judges.
If the vehicle is moving in the north or the south direction by using this trails line.
Okay.
So when these trails line are moving in the north direction, when these trails are in the north direction.
Okay.
And so we can say that the vehicle is entering, the number of vehicles are entering.
And when these trails are in the south direction, we can say that the vehicles are leaving.
So when these trails, like these trails like intersect with this line, this is the green line which
I have drawn by myself.
So when this trails line intersect with this line, green line, we can we increment the count like
so as when this truck, for example, when this truck trail intersect with this green line over here,
green line over here, then we will increment the counter.
That truck is added and the count as well.
Or when the car when the car trails intersect with this line, green line, we can increment the car
count over here.
When the car when the truck intersect with when the truck trails intersect with this line, green line,
we can increment the truck count over here.
And when the car trails intersect with this line, we can increment the car count over here.
Similarly.
When this trails over here are moving in the south direction over here, south direction.
And when the trails intersect with this green line, then we can increment the car count.
For example, if the car trail is intersecting with this line, then we can increment the car, count
that the cars are leaving.
And if the truck trails intersect with this line, then we can increment the truck, count that the
truck is leaving.
Okay, So in this way, I have explained the theoretical concept.
Let's move towards the code part and explore some new things.
Let's go towards it.