We converted the normalized center to pixel coordinates, and we succeeded in drawing the bounding box
and applying clamping boundaries to contour to ensure the rectangle stays within the visible screen.
Now let's scroll up.
Here.
We created the results, which is a mutable list of detection object and we need to return it.
So for this purpose we need to return the results dot sorted by ascending.
But our results mutable list is empty.
So here results dot add.
We need to add this detection object detection object.
And if we open the detection object we need to pass three parameters score, label and bounding box.
The first uh the first is the score, the second is label and the third is the bounding box.
Okay.
This is the bounding box which is the rectangle okay.
This is the results dot.
Add the detection object and return results dot sorted by ascending.
Let's try to run our application and see if there is any missing, uh, functions, any missing, uh,
things we need to do.
For example, this is the tensor image.
Um, we missed to add it, but let me see.
Let me run at first and see if there is any errors.
This is our app working fine but it's not detecting any objects.
So we need to check our codes.
Let me scroll to the tensor image here.
I've used the input buffer instead of using the tensor image.
So input.
Let me check the tensor image the tensor image dot buffer.
So change the input buffer in to tensor image dot buffer.
Let me run again.
Here we have our application and it's detecting the battery.
Let me run it again.
Here we go.
You see, guys, we are detecting the batteries, but our application is crashing.
Let me check the the logcat.
And by the way, congratulations, guys.
This is a complex application.
We are making our custom object detection application.
Okay, if we check here we have this error array index out of bounds exception links.
Fix six and index six.
Array list dot get and drop boxes Lambda.
Let me check that.
Drop boxes dot key file and the error here.
Inside draw a path color list.
Let me check the color path.
It's a list of colors.
Go to to that list of colors that we passed for the drop boxes.
I think it's in the object detector, so scroll up.
Search for search for um path color list.
So ctrl f path color list and apply at index I to the RGB.
So maybe there is many detections.
If you see guys there are a lot of detections and overlap detections um, on uh on the screen and it's
uh it's not for example checking for the colors.
We have six colors.
Let me check guys.
So open that detection screen.
And here we have six parameters green, cyan, red, yellow magenta and black.
And if you notice that the black box is drawn.
So we reached the maximum size of this color list.
Let me add the new colors in order to solve the problem.
Also we can uh right here in order to prevent any errors, we can make a modulus or repeating the colors
again.
Okay, but since for for now we've added four more colors.
When you reach white color, then the next detected one will make an error.
Okay, let me test this application.
And notice if if this the the real problem here is the detection.
And it's working fine.
Now you see guys everything is working fine.
And congratulations.
This is our lovely application.
Those are two batteries.
Let me test okay.
You see guys, we are.
We are detecting two batteries.
Let me see.
And this is what we trained our model, uh, for.
So this is our lovely application.
Okay.
So congratulations, guys, and thank you for following me.