Welcome back.
We talked about the output shapes.
Now let's understand how to connect and bridge between the model inference engine and your output arrays.
This is a very common pattern in TensorFlow Lite and other mobile inference frameworks.
So I want from you to focus with me to understand the map.
The output map start with private val output map equals to mutable map of.
Here we have an integer and any from Kotlin and use the apply function.
And I'm gonna use the SSD mobile.
Net typical output order.
Put zero for output locations, one for output classes, two for output scores and three for output.
Some detections.
The output map tells the model interpreter where to write the output tensors after inference.
Each integer key corresponds to a specific output tensor from your model.
The output map is a bridge between the model inference engine and your output arrays.
This is a common pattern in TensorFlow Lite and other mobile inference frameworks like YOLO.
Okay, the first line here represents the bounding boxes 110 and for the second one is output classes.
The class labels from one, one and ten.
The third line put two the output scores.
The confidence score 110 and put three output detection number.
Number of detections and set it to one.
Why this pattern is used for memory efficiency.
Preallocate the arrays once.
Reuse for every inference.
Avoid garbage collection from creating new arrays constantly.
Direct performance and direct memory mapping between model and your arrays.
No copying your conversion overhead.
Also, this pattern works with TensorFlow Lite.
Run for multiple inputs outputs.
Compatible with Android's and and and API and other mobile inference engines.
Okay so this is a very important pattern.
You should know in order to get the output map.
So this pattern is used to handle object detection outputs on mobile devices.
Now, outside this output map we need to update the params.
So a new function here called update params and this function used.
This params equals to params.
This function takes params.
It's of type detection parameters.
Okay, this function is a configuration method that allows dynamic updating of detection parameters
at runtime.
This function enables real time adjustment of your object detectors behavior without recreating the
entire detector instance.
Okay, so this is a very important note.
You should pay attention to it.