Skip to main content
micoliju
Associate
November 13, 2019
Question

X-CUBE_AI: validation on desktop error

  • November 13, 2019
  • 3 replies
  • 1290 views

Hello,

i'm trying to validate the generated C model inside STM32CubeMX.

I'm follow the Getting started documentation (UM2526 - rev 3)

Like page 22, (4.5 Validating the generated C model) i wan't to use custom data-set (CSV file) on inputs and on outputs, but i have an error:

0690X00000ArzmgQAB.png

I use previously self-generated values from STM32CubeMX validations files at "/home/user/.stm32cubemx/stm32ai_output/"

Seem to be an issue with shape detection:

With output csv file like this:

# file created : 2019-11-13 15:28:48

# output C-model features - 10/10

9.932567382812500000e+03

1.614522812500000000e+05

-6.814434570312500000e+03

-1.008901718750000000e+05

1.514196777343750000e+03

8.807486328125000000e+03

4.036426171875000000e+04

-3.264179492187500000e+04

-1.473285644531250000e+04

-1.134370546875000000e+05

I have the message: "Using reference output file, shape=(1, 10)"

And if i use csv output file like this:

# file created : 2019-11-13 15:28:48

# output C-model features - 10/10

9.932567382812500000e+03,1.614522812500000000e+05

1.614522812500000000e+05,1.614522812500000000e+05

-6.814434570312500000e+03,1.614522812500000000e+05

-1.008901718750000000e+05,1.614522812500000000e+05

1.514196777343750000e+03,1.614522812500000000e+05

8.807486328125000000e+03,1.614522812500000000e+05

4.036426171875000000e+04,1.614522812500000000e+05

-3.264179492187500000e+04,1.614522812500000000e+05

-1.473285644531250000e+04,1.614522812500000000e+05

-1.134370546875000000e+05,1.614522812500000000e+05

I have the message: "Using reference output file, shape=(10, 2)"

Why shape(x,y) going to shape(y,x)??

Regards,

Julien

This topic has been closed for replies.

3 replies

ST Employee
November 13, 2019

​Hello Julien,

I suppose that you have a model with the output shape: (1,).  Effectively the import of the first output csv file seems not correct. Normally we expect a shape=(10,1) not (1,10), 10 samples of 1 dimension.

I look if I reproduce the issue.

Regards,

Jean-Michel

ST Employee
November 14, 2019

​Hello Julien,

I confirm the issue. We have an issue where the csv file has a single row or column. I create a internal  ticket to fix it.

Currently, if you want to use this type of csv file, you need to convert it to npy format for example with the following snippet Python code:

import numpy as np

f_in = 'file_10_1.csv'

f_out = 'file_10_1.npy' 

array = np.genfromtxt(f_in, delimiter=',')

n_array = np.reshape(array, (array.shape[0],1))

np.save(f_out, n_array)

Regards,

Jean-Michel

micoliju
micolijuAuthor
Associate
November 14, 2019

Hello Jean-Michel,

Thank you very much for your help,

I confirm that it works well with the npy file

Regards,

Julien