How to use spectral analysis with TensorFlow Lite model?

I downloaded the model in tensorflow lite format via the dashboard tab. It seems that in this form there is no a processing block(?) and the features must be given already pre-processed. Is there any way to implement this so that I can use spectral analysis and provide raw data to the model?

This is how i try to test the model:

import numpy as np
import tensorflow as tf

model_path = “/path/to/model”

interpreter = tf.lite.Interpreter(model_path=model_path)

interpreter.allocate_tensors()

input_details = interpreter.get_input_details()

output_details = interpreter.get_output_details()

accelerometer_data = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

input_data = np.expand_dims(accelerometer_data, axis=0)

interpreter.set_tensor(input_details[0][‘index’], input_data.astype(np.float32))

interpreter.invoke()

output_data = interpreter.get_tensor(output_details[0][‘index’])

predicted_class = np.argmax(output_data)

print(“Model Output:”, output_data)

print(f"Predicted Class: {predicted_class}")

Moi/Hi Pertti,

You can use the Python SDK, I did similar for EEG-signals a year ago.
Here’s my

Hopefully this helps you forward

Hej Thomas,

I got it working. Thank you so much!

1 Like