The model shows nan values

Hello I have a CNN model that takes 2 input to detect gusture and I test the code and it works correctly in tensorflow, also I verify the real time code on arduino nano ble 33 and it shows no error, however when I test the model and perform the gusture it shows “nan”, can someone help? Also I tried to import the model in edge impulse but is shows that the model has to have 1 input.

Hi @shouq11,

Can you explain what do you mean by you

  • verified the real time code on arduino nano ble 33? Did you export from Studio the Arduino Nano BLE 33 Sense export?
  • you tested the model … and it shows “nan”? How did you test this model? TFLite? C++? On Arduino Nano? Was this model trained in Studio or pretrained?

Yes, Edge Impulse only supports models with 1 input. You can concatenate the input to a single input and retrain your model.

First I’m using Arduino nano ble 33 with headers,
I built the CNN model in tensorflow then generated the tflite file, after that I built the C++ code to use the model on the bord and to test it in real time, then I verify the code in Arduino IDE then upload it to the board and when performing the gusture it shows nan.

Also, to check if the model work I used the data as input in tensorflow and test the tflite and it shows the results correctly, and can detect the gusture. Thus, I don’t know what is the reason for the nan values.

I tried that and get the c++ codes; however, I didn’t understand the output code also I am using others pins in the board and I want to write some codes and I don’t know how can I write on the output files


Can you share a snippet of your C++ code? Are you using our Arduino Library (Deployment > Arduino Library)? We have examples for arduino nano for time series data see nano_ble33_sense_fusion.ino or nano_ble33_sense_accelerometer.ino. Or to test just a static input data use static_buffer.ino.

Can you share a screenshot of your model viewed in Netron. I’d like to see the input and ouput formats.