Exception: Invalid number of features, expected 720, but got 685 (trying to reshape into [720]) Application exited with code 1

Exception: Invalid number of features, expected 720, but got 685 (trying to reshape into [720])
Application exited with code 1

Hi I am getting this error while model testing while I have uploaded the same data in training as well and the model trains perfectly. I have tried with other similar data samples as well.
I downloaded the code for the model using edit locally mode and trained the model on local and re uploaded it for testing but while testing I am getting this error:

Scheduling job in cluster…
Container image pulled!
Job started
Traceback (most recent call last):
File “/home/classify_float32.py”, line 43, in
ei_tensorflow.inference.classify_keras(input_x_file, input_y_file, mode, output_file, dir_path, model_path,
File “/app/./resources/libraries/ei_tensorflow/inference.py”, line 705, in classify_keras
scores = run_model(mode=mode,
File “/app/./resources/libraries/ei_tensorflow/inference.py”, line 264, in run_model
return run_vector_inference(interpreter, item, specific_input_shape)
File “/app/./resources/libraries/ei_tensorflow/inference.py”, line 301, in run_vector_inference
output, output_details = invoke(interpreter, item, specific_input_shape)
File “/app/./resources/libraries/ei_tensorflow/inference.py”, line 279, in invoke
raise Exception('Invalid number of features, expected ’ + str(np.prod(specific_input_shape)) + ', but got ’ +
Exception: Invalid number of features, expected 720, but got 685 (trying to reshape into [720])
Application exited with code 1

Job failed (see above)

Project Id is 266538.

You can also see in another project if I train model on edge impulse instead of local, and then go for model testing I get no error.(Project Id is 253151)

Hi @Garvit007,

When you upload your own model, there is no preprocessing added in the project. If you look in your project 253151 (where you trained the model in Edge Impulse), you can see that there is a preprocessing block before the signal processing and model blocks (go to “Impulse design” and look for the block that says “Time series data”). There’s an option there to “Zero-pad data.” That option says to add 0s to any sample under the required input length (720, in this case). So, if you give it a sample with 685 data points, it will automatically add 35 0s to the end to make it match the expected 720 points.

However, when you bring your own model, that preprocessing is no longer available. So, it’s up to you to ensure that your input data dimensions match the expected input of the model. It looks like one of your samples has 685 data points where the model expects 720. You’ll need to pad the sample with 0s before adding it to your test set to make it work with your model.

Hope that helps!

Hi, Thanks for the reply. I checked the test dataset and tried uploading different files in the test dataset. It still gives the same error. That’s why I am only uploading one sample as a test set.