hi I have built a model a now I want to deploy it on TensorFlow lite
the problem is that I can inference the model before moving one to the android application
the code is below
#Generate a SavedModel
export_dir = 'saved_model/1'
tf.saved_model.save(model, export_dir)
#CONVERT
converter = tf.lite.TFLiteConverter.from_saved_model(export_dir)
#converter.optimizations = [optimization]
tflite_model = converter.convert()
#SAVE
tflite_model_file = pathlib.Path('model.tflite')
tflite_model_file.write_bytes(tflite_model)
# Load TFLite model and allocate tensors
#allocating the tensors for the model via the interpreter's allocate tensors function
interpreter = tf.lite.Interpreter(model_content=tflite_model)
interpreter.allocate_tensors()
#extract the inputs and outputs tensors of the model to begin testing.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
print (input_details)
[{'name': 'lstm_input', 'index': 0, 'shape': array([ 1, 100, 6]), 'shape_signature': array([ 1,
100, 6]), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters':
{'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension':
0}, 'sparsity_parameters': {}}]
print (output_details)
[{'name': 'Identity', 'index': 83, 'shape': array([], dtype=int32), 'shape_signature': array([],
dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters':
{'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension':
0}, 'sparsity_parameters': {}}]
#fill the current input tensor with some valid data
interpreter.set_tensor(input_details[0]['index'], X_test)
#invoke the interpreter to run the model
interpreter.invoke()
#get the results produced by our TF Lite model by getting the output sensor.
tflite_results= interpreter.get_tensor(output_details[0]['index'])
ValueError: Cannot set tensor: Got value of type NOTYPE but expected type FLOAT32 for input 0, name: lstm_input
is the problem due to 0 index in input_details?