Clear Filters
Clear Filters

Is fully connected layers quantization supported by Deep Network Quantizer?

1 view (last 30 days)
Hi!
I try to use the deep network quantization feature. I've installed Deep Learning Toolbox Model Quantization Library and everything else needed for quantization to work with GPU, and it works. But I've noticed a strange thing: fully connected layers are never quantized! Convolutional - yes, but not fc. They are always marked with "This layer cannot be quantized" message.
Here is an example with the network for digits classification from matlab documentation:
The fc layer checkbox is grayed out :-( The same situation happens with any other network with fc that I've tried.
Are fc layers are not supported by Deep Network Quantizer?

Accepted Answer

Pilo Bolo
Pilo Bolo on 25 Feb 2021
Answering the question myself: Yes, fc layers are currently not supported, and it is written at the top of the Deep Network Quantizer description: "Use the Deep Network Quantizer app to reduce the memory requirement of a deep neural network by quantizing weights, biases, and activations of convolution layers to 8-bit scaled integer data types."
But! You can replace fc layer with a conv layer with filters' size equal to prev layer output dims, so they will only be applied once.

More Answers (1)

Maksym Tymchenko
Maksym Tymchenko on 3 Nov 2023
As of R2023b, the quantization of fullyConnectedLayer objects is supported for the following execution environments:
  • GPU
  • FPGA
  • CPU
In Deep Network Quantizer, you can choose the Execution Environment when you start the quantization of a new network. The reason it was greyed out in your screenshot is because you selected a "MATLAB" execution environment. The "MATLAB" execution environment indicates a target-agnostic quantization of the neural network will be performed. This option does not require you to have target hardware in order to explore the quantized network in MATLAB.
Alternatively, you can also select it using the name-value pair argument ExecutionEnvironment when creating a dlquantizer object.

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!