Welcome back.
We understood our model, hierarchy and shapes.
Now let's continue with the object detector class.
And here under those variables start creating the SSD mobile net output structure.
Start with private val output locations equals to array of size one.
And what this array contains array.
And it's of maximum detection number.
And set this the float array of size four.
Then private val output classes.
It's an array one of float array maximum detection number private val output scores array of one float
array and maximum detection number.
Don't worry we're gonna clarify everything.
Output detection number which is float array of size one.
Actually, those are the variables that are used for handling the object detection model output.
This is the classic output structure for an object detection model specifically designed to handle the
float32 output we discussed.
Okay, so let me write here the output structure output structure for an object which is float32 okay.
The output locations bounding box coordinates in a normalized coordinates from 0 to 1.
So the shape would be one maximum detection number for and.
This purpose stores the bounding box coordinates for each detected object.
Each box has four values, typically y minimum x minimum y maximum x maximum normalized to zero one
or x center, y center width and height, which is normalized.
Okay.
So this is the bounding box in normalized coordinates.
Here we have for example y maximum or y minimum.
We start with minimum x minimum y max and x max.
Okay.
This is the first variable the output location.
This is the for the box the bounding box.
Okay.
We need to display the box.
So we have to create the boundaries.
The boundaries in a in a for for uh for elements array or an array containing four elements.
Okay.
Now the output classes.
Class IDs the shape would be one and maximum detection.
Maximum detection number stores the class index for each detection.
So this is a very important lesson because we need to understand the output also, and why we need them
as a float32, and why we need to get those arrays and analyze them.
So we get the first array that represents the y minimum x minimum y maximum x maximum.
Those are for the bounding boxes.
The second array is for storing the class index for each detection okay.
So the integer class IDs stores as floats.
For example 0.0, f 1.0, f 2.0 f, and so on.
Okay, this is for the output classes.
Now we have the output scores the confidence scores.
So confidence scores shape one.
Maximum detection number stores the confidence score for each detection floats between 0.0 and 1.0.
So 0.6 refers for 60% confidence.
This is the confidence that we used in drawing the boxes.
If you remember here draw into canvas.
This text is used to draw the object detection and get the score from it.
Okay now we have the last one is the output number detections which is the valid detection count.
For example, shape one tells how it tells you how many of the maximum detection number detections are
usually valid.
So how many valid detections.
There are a lot of detections but they are not uh not sure.
And if you remember here in the data, the detection parameters we set the threshold is 0.6.
So if you uh, if you open your camera and direct it to the door.
There is there is a possibility of detecting a window, but the window here is 0.4.
It's detected, but it's that the score threshold is 0.6.
So we have door 0.7, window 0.4.
It's eliminated.
We keep the door.
So it will be 0.7 greater than 0.6.
So the inference and the score is higher than 0.6.
Go and display and draw the box around the object.
This is the output detection only process.
The first output number of detections.
To end detections we need to get the highest rank, the highest inference, the highest score from the
detections.
So we learned about the output of an output structure for the SSD mobile.
Net model.