I want to quantize a DenseNet model. I am using Tensorflow 2.4.
import tensorflow_model_optimization as tfmot
model = tf.keras.applications.DenseNet121(include_top=True,weights=None,input_tensor=None,input_shape=None,pooling=None,classes=1000)
quantize_model = tfmot.quantization.keras.quantize_model
model = quantize_model(model)
But I got the following message:
RuntimeError: Layer conv2_block1_0_bn:<class 'tensorflow.python.keras.layers.normalization_v2.BatchNormalization'> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig
instance to the quantize_annotate_layer
API.
Is there a way how I can do this. I can not change the keras code.