cancel
Showing results for 
Search instead for 
Did you mean: 

X-Cube-AI 9.1.0: data file failed in validation

qs202310
Associate II

I am trying to validate a CNN on STM32CubeMX with X-Cube-AI 9.1.0. I provided a datainput.CSV and a dataoutput.csv files to  "Validation inputs:  & Validation outputs: " respectively. When ran Validate on desktop or Validate on target, they all failed >>  "E204(ValParamError): number of data files is not enough, 4 are expected."

Could you please help me sort out this problem?

Do data files in .csv  correct?

Only have 2 boxes for 2 files providing, why expected 4?

 

QS 

1 ACCEPTED SOLUTION

Accepted Solutions

Could you share your model in a zip file? or send it to me in private message

 

I created a very simple CNN to test, and it worked with your input and output files:

 

import tensorflow as tf
from tensorflow.keras import layers, models

model = models.Sequential([layers.Conv1D(filters = 16, kernel_size = 2, activation = 'relu', input_shape=(9,1)),
                           layers.Flatten(),
                           layers.Dense(4, activation = 'softmax')
                           ])

model.compile(optimizer='adam',
              loss='sparse_categorial_crossentropy',
              metrics=['accuracy'])

model.save("test.h5")

 

 

When activating CubeAI in CubeMX, you selected the Validation template right?

 

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

9 REPLIES 9
Julian E.
ST Employee

Hello @qs202310,

 

Your error is pretty strange, but in any case, you should use npy files.

For example, let's say that I have a model with an input size of 32x32x3 (RGB images) and 5 classes. I can generate two files containing 10 examples like this:

import numpy as np

# generate random images and labels
x_test = np.random.rand(10,32,32,3)
y_test = np.random.rand(10,5)


#  Save one file for the inputs, another for the outputs
np.save("x_test.npy", x_test)
np.save("y_test.npy", y_test)

 Then load these files in CubeAI:

JulianE_0-1733404244542.png

 

Have a good day,

Julian

 

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Many thanks Julian for your reply. I have changed the data files following your instruction. However, still got the same problem. I would like to upload the data files for your having a look, but here does not support the .npy format files. 

Would you mind advise me trying anything else?

QS

 

qs202310_0-1733407901153.png

 

You can zip the files and attach the zip.

If you could add your model or at least give me your input shape and output shape.

 

It is my first time encountering the issue, but it makes me think of maybe an issue between the number of inputs and the number of outputs. Let's say you have 4 images but only 2 labels in your files? I don't know, we will see with your files.

 

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello Julian,

My CNN model gets 9 inputs and 4 outputs. The compressed data files is attached.

 

Regards

QS

This is the error:

qs202310_0-1733410719725.png

 

Hello Julian,

Please do not be confused. The issue is not sorted out. I mistakenly pressed a button accepting the solution!

 

QS 

qs202310
Associate II

Hello Julian,

If you need my AI model for working on this issue, I can email to you.

 

QS 

Could you share your model in a zip file? or send it to me in private message

 

I created a very simple CNN to test, and it worked with your input and output files:

 

import tensorflow as tf
from tensorflow.keras import layers, models

model = models.Sequential([layers.Conv1D(filters = 16, kernel_size = 2, activation = 'relu', input_shape=(9,1)),
                           layers.Flatten(),
                           layers.Dense(4, activation = 'softmax')
                           ])

model.compile(optimizer='adam',
              loss='sparse_categorial_crossentropy',
              metrics=['accuracy'])

model.save("test.h5")

 

 

When activating CubeAI in CubeMX, you selected the Validation template right?

 

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Many thanks Julian.

The issue has been sorted out by modifying the CNN model inputs >> Combines the three groups of inputs together. That is why 2 more data files are required by the validation.

 

QS