Showing results for 
Search instead for 
Did you mean: 

Data validation failed

Associate II

Following is my data , I am trying to validate on option of 'validate on desktop'. I am getting following error

Loading: /home/censdata/workspace/har/har_ai/har_ai.ioc project

Initializing: STM32F429ZITx

 [AI:network] Analyzing model

 [AI:Generator] Command /home/censdata/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/3.4.0/Utilities/linux/generatecode --auto -c /tmp/mxAI227727002133516706206695419651859/

 [AI:Generator] Python generation ended

 [AI:network] Analyze and code generation complete on AI model

 [AI:network] Starting AI validation on desktop with custom dataset : /home/censdata/stm_ai/HAR-CNN-Keras-master/data_compressed/data_3_Axis.txt...

 [AI:Validator] Command /home/censdata/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/3.4.0/Utilities/linux/validate - -p /home/censdata/stm_ai/HAR-CNN-Keras-master/model.h5 -t keras_dump --compress 4 -i /home/censdata/stm_ai/HAR-CNN-Keras-master/data_compressed/data_3_Axis.txt

Matching results...

 [AI:Validator] ValueError: cannot reshape array of size 5242880 into shape (1048576,90,3,1)

I am using keras model

ST Employee


Thanks for the provided files. In your case the provided txt is not correctly formatted. As indicated in the UM (section14.2). The expected file (.csv or .txt extension) should be a simple txt file with one input tensor by line (flattened input tensor) and the comma is used as separator (There is not check in the CUBE-AI). With your file, numpy.genfromtxt() returns:

shape =  (1048576, 5)

[[-0.6946377 12.680544  0.50395286     nan     nan]

 [ 5.012288  11.264028  0.95342433     nan     nan]

 [ 4.903325  10.882658  -0.08172209     nan     nan]


which can be not reshaped after with the following function:

inputs = np.reshape(inputs, (len(inputs), ) + (90,3,1))

and the following Python erro is generated.

ValueError: cannot reshape array of size 5242880 into shape (1048576,90,3,1)

Correct syntax:



Best Regards,



I tried the way you had suggested to input the flatten tensor file but still it is giving the error on desktop validation. Please find the attached file of my data


For people still having this problem, I had the same issue and I solved it by changing the value of _APP_DEBUG_ from 0 to 1 (defined in "aiValidation.c")

What is the document you are referring to?