tensorflow object detection api graph rewriter

时间:2022-11-28 16:58:24

目前,tensorflow 目标识别的api函数可以使用 graph rewriter这样的配置,这样配置的引入主要是为了模型压缩使用,具体设置参数有:

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
}
}