DFC parser cannot parse a Tensorflow model trained with Quantization aware training (QAT)

My tensorflow model was trained with Quantization aware training (QAT)and doesn’t seem to go through the parser successfully. The parser complains that it cannot find the specified end nodes.

The DFC doesn’t support models that have been trained with Tensorflow’s QAT. There are layers such as act_quant and FakeQuantWithMinMaxVars that cannot be parsed.

Solution is to remove QAT using one of the following method:

  1. If you are using Keras to create your mode from scratch, as suggested in Quantization aware training comprehensive guide | TensorFlow Model Optimization , and if there is a call to tfmot.quantization.keras.quantize_model () when the model is created, Tensorflow automatically add the act_quant and FakeQuantWithMinMaxVars layers even if you don’t quantize at the end. It is when TFLite converter is called(), that the model gets quantized.
    So make sure to remove calls to tfmot.quantization.keras.quantize_model (). in your Keras code.

  2. If you are using the TensorFlow Object Detection API, according to Quantization of TensorFlow Object Detection API Models | Galliot , the way to disable QAT in such a case, is to remove these lines in ssd_mobilenet_v2_quantized_300x300_coco.config:

graph_rewriter {
  quantization { 
  delay: 48000
  weight_bits: 8
  activation_bits: 8
  } 
}