WEBVTT

00:00.080 --> 00:01.040
Welcome back.

00:01.080 --> 00:08.360
We talked about the input shape that returns for example, an array of four elements.

00:08.360 --> 00:10.840
The first element returns the batch size.

00:11.080 --> 00:16.960
The second element returns the image width, the third element returns the image height, and the fourth

00:16.960 --> 00:23.080
element returns the number of colors and the color channels RGB channels.

00:23.360 --> 00:29.040
Okay, now we created before the input width and height.

00:29.080 --> 00:35.840
So let me update those variables by using the elements of the input shape.

00:35.880 --> 00:41.000
Using input width equals to input shape dot.

00:41.040 --> 00:44.360
Get the second element number one.

00:44.520 --> 00:52.520
If not, go and put it by default to two for and similar to the input width, we need to update the

00:52.520 --> 00:55.440
input height by using input shape.

00:55.760 --> 00:58.800
Get two and 2 to 4.

00:58.840 --> 01:09.720
You can also make a logcat to determine if there is um, for example, uh any more, any errors.

01:09.880 --> 01:12.950
So log dot v verbose.

01:12.990 --> 01:19.670
Name the key tag and here the model input shape.

01:19.710 --> 01:23.310
Set the input shape like this.

01:23.470 --> 01:24.830
Content dot.

01:24.990 --> 01:26.790
You can use join to string.

01:27.070 --> 01:27.910
It's better.

01:27.950 --> 01:32.430
Okay, here we are getting the model input shape.

01:32.670 --> 01:37.510
The third step as we said the first step is loading the model.

01:37.550 --> 01:39.510
The second step the input shape.

01:39.710 --> 01:44.030
The third step is the output shape.

01:44.070 --> 01:45.670
Output shape val.

01:45.710 --> 01:48.470
Output shape the interpreter dot.

01:48.510 --> 01:51.630
Get output tensor and zero.

01:51.630 --> 01:54.750
Passing the output index dot shape.

01:54.950 --> 01:56.910
Also log v.

01:57.230 --> 02:02.110
Let me create the log and then we'll lecture about the output.

02:02.110 --> 02:10.550
So here model output shape output shape dot to join to string okay.

02:10.750 --> 02:12.990
So this is our output shape.

02:12.990 --> 02:21.950
In the same way we use the interpreter to get the output tensor and accessing the first output tensor

02:21.950 --> 02:31.900
at index zero from your TensorFlow Lite model, a model can have multiple outputs, but most object

02:31.900 --> 02:37.220
detection or classification models use just one.

02:37.500 --> 02:46.620
The shape function returns an array of integers that describes the dimensions of the model's output.

02:46.900 --> 02:53.980
This tells you what kind of data and how much data the model produces per inference.

02:54.100 --> 03:04.020
For example, a classification model might output shape um, for example, uh one and 1001.

03:04.020 --> 03:08.620
So probabilities for 1001 classes.

03:08.660 --> 03:20.060
Another example is um that ten bounding boxes 110 for the an object detection model might output like

03:20.060 --> 03:27.900
this array the ten boxes, ten bounding boxes, each with four coordinates.

03:28.020 --> 03:35.690
Some models output multiple arrays boxes, labels, scores, but this reads the first one.

03:35.850 --> 03:38.730
Now let me take a look at here.

03:38.730 --> 03:41.250
So this is the look at that.

03:41.290 --> 03:43.690
The output shape would be printed.

03:43.690 --> 03:49.010
And look at the fourth step is to load the labels.

03:49.010 --> 03:51.890
So here loading the labels.

03:51.890 --> 03:56.730
Did you remember the text file that we we've added before with the ML.

03:56.770 --> 03:58.570
It's called labels dot txt.

03:58.610 --> 04:01.930
So labels file dot load labels.

04:01.930 --> 04:11.570
Whenever we need to access the assets we use labels file util load labels and context and labels dot

04:11.570 --> 04:16.370
txt okay this is our function set up interpreter.

04:16.530 --> 04:24.930
Here we need to close it with a catch block and e exception listener dot on error.

04:25.290 --> 04:30.730
And if we need to print this message we can use log dot v.

04:30.930 --> 04:35.330
Set up interpreter and pass the message okay.

04:35.530 --> 04:38.890
Remove those extra curly braces.

04:38.890 --> 04:42.770
And this is our set up interpreter function.
