Welcome back.
Whenever you change any object detection model, you get a different shape, a different input and output
shapes.
You should update the object detector class.
So this is the most important class.
This is the core of your project.
This is the core of your application that you should update whenever you have a different model okay.
Remember we need those input and output shapes Float32 one 640 640 and three.
The output 32 Float32 one five 8400.
For those, we're going to update those variables inside the companion object.
The SSD mobile net expects 300 by 300 input, while the YOLO let me write YOLO shape expects 640 by
640.
Okay, so remove this and write 640.
The maximum detection number is ten.
Default or maximum result.
Uh, default.
Maximum result can make it like ten, for example.
And you can add the other parameters.
Private constant output size equals to 8400.
Private constant val num number of features equals to 84.
Confidence index equals to.
For the class probability index, start equals to five.
This is the corresponds to.
This number of features correspond to this and this number.
So it's five.
We are detecting only one class.
And the output of the data data per detection is five.
So this is five.
We set the number of features equals to five.
The input size is correct 8400.
And this constant there is no need for it because only we have only one class to detect.
Okay, now let's create the output.
So here we have the output classes output scores output detections.
We're going to remove them.
We're going to create only one output buffer matching that one five 8400.
For that let me create val output equals to array.
And here array of number of features.
And set the float array of the output size.
Here the number of features is five.
It's an array of five.
And it's a float array of output size which is 8400.
Here we created an array of size one.
Inside it we create an array of number of features which is five.
Then we created a float array that it is float array which is float32 output size, which is 8400.
Okay.
So an array inside an array inside an array.
This is the output buffer matching the model output.
This is very very important.
Now let's create the input buffer input buffer private void input buffer.
Remember that input buffer is one 640 640 and three.
For that you use tensor buffer dot create fixed size and inside it start with int array of one.
Matching this image size.
The variable that we created before 640.
Image size 640 and three, which is the last one.
Remember we need to return Float32 one 640 640 and three three.
Is the color channels RGB?
What is the data type uh of our of our input buffer.
It's a float 32 okay.
So data type dot float32 okay.
Let's use the input buffer and output buffer.
Scroll down here.
We don't need all of those.
Let me scroll down to analyze.
We have the background scoop launch detections and the listener scroll down here to the detect prepare
image for model image proxy interpreter dot run for multiple input outputs.
We need to remove it because it's not our case here the interpreter dot run pass the input which is
input buffer and pass the output which is output okay, not the output map.
It's called the output.
You see guys this is the objects that we created.
The output and input.
Scroll up the input buffer and the end, the input buffer and the output.
You can name it as output buffer in order to distinguish it.
Okay, so let me use this output buffer.
Scroll down here inside the text and output buffer okay.
Now let's parse the detections.
You can return parse detection result that it's a list of detection object.
So here parse the detections.
Parse detections.
Also we can create a new function to distinguish it from parse detection result because it's completely
different.
So I'll comment it and parse YOLO detections okay.
This is the new function we need to create.
So here private function partial detections.
List of detection result detection object.
And in the next video we'll continue with this function.