Is fully connected layers quantization supported by Deep Network Quantizer?

3 次查看(过去 30 天)
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?

采纳的回答

Pilo Bolo
Pilo Bolo 2021-2-25
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.

更多回答(1 个)

Maksym Tymchenko
Maksym Tymchenko 2023-11-3
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.

类别

Help CenterFile Exchange 中查找有关 Quantization, Projection, and Pruning 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by