cancel
Showing results for 
Search instead for 
Did you mean: 

If a general float model is quantized in STM32CubeMX, please inquire about the inference method.

김경훈
Associate

hello

I have a question related to the title.

The input data is as follows,

 

// 13 x 15

int new_data[195] = { /* fill with your sensor data */
440, 501, 743, 479, 546, 658, 596, 523, 493, 684, 855, 3, 2,
536, 605, 743, 576, 664, 791, 728, 523, 591, 799, 993, 4, 2,
536, 605, 743, 576, 664, 791, 728, 523, 591, 799, 993, 4, 2,
659, 735, 924, 707, 664, 965, 728, 651, 722, 961, 1184, 4, 2,
659, 735, 924, 707, 827, 965, 901, 651, 722, 961, 1184, 4, 2,
826, 735, 1168, 887, 827, 965, 901, 827, 901, 961, 1446, 4, 2,
826, 920, 1168, 887, 1059, 1198, 1128, 827, 901, 1192, 1446, 5, 2,
826, 920, 1480, 887, 1059, 1198, 1128, 1084, 901, 1192, 1736, 5, 2,
1067, 1174, 1480, 1130, 1395, 1507, 1407, 1084, 1151, 1519, 1736, 4, 2,
1067, 1174, 1480, 1130, 1395, 1507, 1407, 1084, 1151, 1519, 1736, 4, 2,
1413, 1510, 1765, 1443, 1395, 1790, 1663, 1437, 1480, 1778, 1950, 4, 2,
1413, 1510, 1765, 1443, 1686, 1790, 1663, 1437, 1480, 1778, 1950, 4, 2,
1711, 1510, 1996, 1730, 1686, 2009, 1663, 1714, 1746, 1778, 2113, 4, 2,
1711, 1784, 1996, 1730, 1908, 2009, 1573, 1714, 1746, 1970, 2113, 4, 2,
1711, 1784, 1703, 1682, 1908, 2009, 1573, 1921, 1746, 1970, 2242, 4, 2
};

We created a model that outputs values ​​between 0 and 1 as shown below:

    new_data = new_data / np.max(new_data)
    new_data = new_data.reshape((new_data.shape[0], 15, 13))

    prediction = model.predict(new_data)
    print(f'prediction : {prediction}')
    print(f'Prediction: {"White Wall" if prediction >= 0.5 else "Black Wall"}')

And the code was generated through STM32CubeMX's X-CUBE-AI.

But I don't know how to fill in the parts below.
please answer my question.

int acquire_and_process_data(ai_i8* data[])
{
/* fill the inputs of the c-model
for (int idx=0; idx < AI_NETWORK_IN_NUM; idx++ )
{
      data[idx] = ....
}

*/
return 0;
}

int post_process(ai_i8* data[])
{
/* process the predictions
for (int idx=0; idx < AI_NETWORK_OUT_NUM; idx++ )
{
      data[idx] = ....
}

*/
return 0;
}

 

0 REPLIES 0