Welcome back to the OpenVINO channel
On previous videos we saw how to use the model optimizer for reshaping the input image
Now let me show you how to -Cut portions of the network, at the beginning or the end of it
-and pre-process the input data to the network..
Either to scale it or subtract the mean..
We will still use the squeezenet example.
Look at the model-downloader video on how to get it..
Let's say that we want to get rid of few layers,
And start the flow at a specific layer or end it at a specific layer..
Let's get rid of the first layers and start the topology only from "pool1" layer..
Just need to use --input and the name of the first layer --input pool1
Let's run it..
In the original file, the first layer was CONV1 And now the first layer is POOL1
Loading the new IR you can see that the first 2 layers were cut out..
In the same manner we can use the command --output to specify the last layer..
Let's stop at pool10
in the original IR file, the last layer is layer 65..
And here, we stop at layer 64, pool10
The second feature I'd like to talk about is the ability to pre-process the input data..
A very common practice during training is to use not the images directly, but normalized image values instead.
Often data scientists subtract the mean image value from each of the training images that are fed to the model
Subtracting the mean values is easy by the model-optimizer, but you need to know the values.
For this you should consult the data scientist who trained the model
Or look it up in the internet..
A nice trick is to go back to the model-downloader configuration file..
Here you can find the right parameters to use when running the model optimizer..
Let's look for our squeeze net. And copy the parameters for the model-optimizer..
And run it.
And you can see that a layer was added after the first data layer, to scale the input numbers Just before the conv1 layer..
Another practice it to scale the image values,
for example instead of using values of 0 to 255 per pixel, use values of 0 to 1.
This, again is easy to fix by the model-optimizer..
We use the "scale" option --scale 10, will multiply all the channels by 10
--scale_values can multiply each of the planes, R,G or B by a different factor.
You can also specify where to do the scaling, so you can --scale_values with the layer name..
And a layer of scaling will be added before that specific layer..
By the way,
Sometimes these layers cannot be seen because the model-optimizer is fusing them with other layers to boost your performance.
If you insist to see it all without any layers fusing, please use the flag: --disable_fusing
Let's see it working
So I'm scaling the values, and running model-optimizer
So we have seen how to Cut portions of the network
And to Pre-process the input data with the Model Optimizer
Subscribe to the OpenVINO channel, to get more videos like this one.
Thank you.