目前,tensorflow 目標識別的api函數可使用 graph rewriter這樣的配置,這樣配置的引入主要是爲了模型壓縮使用,具體設置參數有:python
syntax = "proto2";
package object_detection.protos;
// Message to configure graph rewriter for the tf graph.
message GraphRewriter {
optional Quantization quantization = 1;
}
// Message for quantization options. See
// tensorflow/contrib/quantize/python/quantize.py for details.
message Quantization {
// Number of steps to delay before quantization takes effect during training.
optional int32 delay = 1 [default = 500000];
// Number of bits to use for quantizing weights.
// Only 8 bit is supported for now.
optional int32 weight_bits = 2 [default = 8];
// Number of bits to use for quantizing activations.
// Only 8 bit is supported for now.
optional int32 activation_bits = 3 [default = 8];
}
實際在pipline.config裏面是:
graph_rewriter {
quantization {
delay: 48000 # 迭代次數後使用graph_rewriter 量化
activation_bits: 8 #激活位數
weight_bits: 8 #權重位數,支持int8 }}