Skip to main content
HAlzo
Associate III
March 17, 2020
Question

Different behavior between model on Python and on STM32

  • March 17, 2020
  • 0 replies
  • 627 views

Hello,

I created a CNN model used Keras with tensorflow

here's the model

model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32,1)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.Flatten())
model.add(layers.Dense(32, activation='relu'))
model.add(layers.Dense(4))

when I test the model on Python using model.evaluate()

I get the following results

loss: 0.0086 - accuracy: 0.9955

but when I test on STM32 , using the code creaded from CUBE-MX-AI :

I get always result of negative value from -15 to -23 for the 1st output and 0's for the last three outputs.

after commented the code of randomizing the input data in MX_X_CUBE_AI_Process()

the result is some negative value for 1st output and 0's for the last three outputs.

I can't understand why I didn't get the same result as testing on python .

This topic has been closed for replies.