29. Full integer quantization
of weights and activations
https://www.tensorflow.org/lite/
performance/post_training_quantization
import tensorflow as tf
def representative_dataset_gen():
for _ in range(num_calibration_steps):
# Get sample input data as a numpy array in a method of your choosing.
yield [input]
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_dataset_gen
tflite_quant_model = converter.convert()
100( 1000 ) calibration
37. edgetpu_compiler
--show_operations
Number of operations that will run on Edge TPU: 8
Number of operations that will run on CPU: 2
Operator Count Status
MAX_POOL_2D 2 Mapped to Edge TPU
QUANTIZE 1 Operation is otherwise supported, but not mapped due
to some unspecified limitation
CONV_2D 4 Mapped to Edge TPU
DEQUANTIZE 1 Operation is working on an unsupported data type
SOFTMAX 1 Mapped to Edge TPU
FULLY_CONNECTED 1 Mapped to Edge TPU
38. edgetpu_compiler
--show_operations
Number of operations that will run on Edge TPU: 8
Number of operations that will run on CPU: 2
Operator Count Status
MAX_POOL_2D 2 Mapped to Edge TPU
QUANTIZE 1 Operation is otherwise supported, but not mapped due
to some unspecified limitation
CONV_2D 4 Mapped to Edge TPU
DEQUANTIZE 1 Operation is working on an unsupported data type
SOFTMAX 1 Mapped to Edge TPU
FULLY_CONNECTED 1 Mapped to Edge TPU
CONV2D DenseSoftMaxPooling
Quantize Dequantize
Edge TPU
CPU