量子化と枝刈り
量子化または枝刈りの実行による深層ニューラル ネットワークの圧縮
Deep Learning Toolbox™ を Deep Learning Toolbox Model Quantization Library サポート パッケージと共に使用し、以下を行うことで、深層ニューラル ネットワークのメモリ フットプリントの削減と計算要件の緩和を行います。
層の重み、バイアス、および活性化を、低い精度にスケーリングされた整数データ型に量子化します。その後、この量子化ネットワークから、C/C++ コード、CUDA® コード、または HDL コードを生成できます。
このソフトウェアは、C/C++ および CUDA のコード生成のため、畳み込み層の重み、バイアス、および活性化を、8 ビットにスケーリングされた整数データ型に量子化することで、畳み込み深層ニューラル ネットワーク用のコードを生成します。この量子化は、関数
calibrate
によって生成されたキャリブレーション結果ファイルをcodegen
(MATLAB Coder) コマンドに渡すことで行われます。コード生成では、関数
quantize
によって生成された量子化済みの深層ニューラル ネットワークがサポートされません。1 次テイラー近似を使用して畳み込み層からフィルターを枝刈りします。その後、この枝刈りされたネットワークから、C/C++ コードまたは CUDA コードを生成できます。
関数
アプリ
ディープ ネットワーク量子化器 | Quantize a deep neural network to 8-bit scaled integer data types |
トピック
深層学習の量子化
- 深層ニュートラル ネットワークの量子化
量子化の影響とネットワーク畳み込み層のダイナミック レンジの可視化方法を学習します。 - 量子化ワークフローの必要条件
深層学習ネットワークの量子化に必要な製品。
GPU ターゲットの量子化
- 深層学習ネットワーク用の INT8 コードの生成 (GPU Coder)
事前学習済み畳み込みニューラル ネットワークを量子化してコードを生成します。 - Quantize Residual Network Trained for Image Classification and Generate CUDA Code
This example shows how to quantize the learnable parameters in the convolution layers of a deep learning neural network that has residual connections and has been trained for image classification with CIFAR-10 data. - Quantize Layers in Object Detectors and Generate CUDA Code
This example shows how to generate CUDA® code for an SSD vehicle detector and a YOLO v2 vehicle detector that performs inference computations in 8-bit integers for the convolutional layers.
FPGA ターゲットの量子化
- Deploy INT8 Network to FPGA (Deep Learning HDL Toolbox)
Reduce the memory footprint of a deep neural network by quantizing the weights, biases, and activations of convolution layers to 8-bit scaled integer data types. This example shows how to use Deep Learning Toolbox Model Quantization Library and Deep Learning HDL Toolbox to deploy theint8
network to a target FPGA board. - Classify Images on an FPGA Using a Quantized DAG Network (Deep Learning HDL Toolbox)
In this example, you use Deep Learning HDL Toolbox™ to deploy a quantized deep convolutional neural network and classify an image. The example uses the pretrained ResNet-18 convolutional neural network to demonstrate transfer learning, quantization, and deployment for the quantized network. Use MATLAB ® to retrieve the prediction results. - Classify Images on FPGA by Using Quantized GoogLeNet Network (Deep Learning HDL Toolbox)
This example show how to use the Deep Learning HDL Toolbox™ to deploy a quantized GoogleNet network to classify an image. The example uses the pretrained GoogLeNet network to demonstrate transfer learning, quantization, and deployment for the quantized network. Quantization helps reduce the memory requirement of a deep neural network by quantizing weights, biases and activations of network layers to 8-bit scaled integer data types. Use MATLAB® to retrieve the prediction results.
CPU ターゲットの量子化
- Generate int8 Code for Deep Learning Networks (MATLAB Coder)
Quantize and generate code for a pretrained convolutional neural network. - Generate INT8 Code for Deep Learning Network on Raspberry Pi (MATLAB Coder)
Generate code for deep learning network that performs inference computations in 8-bit integers.
枝刈り
- Parameter Pruning and Quantization of Image Classification Network
Use parameter pruning and quantization to reduce network size. - Prune Image Classification Network Using Taylor Scores
This example shows how to reduce the size of a deep neural network using Taylor pruning. By using thetaylorPrunableNetwork
function to remove convolution layer filters, you can reduce the overall network size and increase the inference speed. - Prune Filters in a Detection Network Using Taylor Scores
This example shows how to reduce network size and increase inference speed by pruning convolutional filters in a you only look once (YOLO) v3 object detection network.