Multiclass Classification Model on Arduino rev sense2


I am trying to run a multiclass classification model on my arduino ble rev sense 2 but dring inference I am getting nan or some times it overflows sometimes its the largest possible float value(overflow) again.

So to simplify I resorted to a binary classification model which resulted in same problems when trying to interpret on my microcontroller.

How ever after experimenting/debugging I was able to work it somewhat in case of binary classification.

So If I remove the logistic activation from the final layer I am able to interpret it on arduino. but if its kept as logit i am still getting nan or ovf as output.

Define your model

model = tf.keras.Sequential([
tf.keras.layers.Dense(32, activation=‘relu’, input_shape=(X_train.shape[1],)),
tf.keras.layers.Dense(16, activation=‘relu’),
tf.keras.layers.Dense(1, activation=None) # Output layer without activation for integer logits