I saw the code
if mode == 'object-detection':
tflite_model, tflite_quant_model = ei_tensorflow.object_detection.convert_to_tf_lite(
args.out_directory,
saved_model_dir='saved_model',
validation_dataset=validation_dataset,
model_filenames_float='model.tflite',
model_filenames_quantised_int8='model_quantized_int8_io.tflite')
I want to get the source code of ei_tensorflow, or I wonder the different of the code ei_tensorflow.object_detection.convert_to_tf_lite
and the covert code of tensorflow.lite
def representative_dataset():
for _ in range(100):
data = np.random.rand(1, 96, 96, 3)
yield [data.astype(np.float32)]
converter = tf.lite.TFLiteConverter.from_saved_model('my_models/saved_model')
converter.experimental_new_converter = True
converter.experimental_new_quantizer = True
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_dataset
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.target_spec.supported_types = [tf.dtypes.int8]
converter.inference_input_type = tf.int8
converter.inference_output_type = tf.int8
tflite_quant_model = converter.convert()
Please help me about this!
Best wishes to you!