cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeAI-Keras Sequential model with multiple inputs gives INTERNAL ERROR: unpack_from requires a buffer of at least 4 bytes

GanesanGuru
Associate II

I've followed this tinyML for stm32 from Digikey "TinyML: Getting Started with STM32 X-CUBE-AI | Digi-Key Electronics" reference,and got no Errors in STM32CubeMX when I clicked "Analyze" button after I've uploaded the tfLitemodel.

Later I've tried this

import tensorflow as tf

from tensorflow.keras.layers import *

from tensorflow.keras.models import Sequential, Model

from tensorflow.keras.optimizers import Adam, RMSprop

import numpy as np

input1 = Input(shape=(1,))

input2 = Input(shape=(1,))

input = Concatenate()([input1, input2])

x = Dense(2)(input)

x = Dense(1)(x)

model = Model(inputs=[input1, input2], outputs=x)

model.summary()

model.compile(

    optimizer = RMSprop(lr=0.02,rho=0.9,epsilon=None,decay=0),

    loss = 'mean_squared_error'

)

x1=np.array([2600, 3000, 3200, 3600, 4000 ,4100])

x2=np.array([3.0 ,4.0,4.0,3.0, 5.0,6.0])

y=np.array([550000,565000,610000, 595000,760000,810000])

history = model.fit([x1, x2], y,epochs=500)

model.predict([np.array([3000]),np.array([4])])

The python code executes without error and even prediction is working fine. Yet when I've uploaded this tfLite model in stm32cubeMX and went for "Analyze" button , I get "INTERNAL ERROR: unpack_from requires a buffer of at least 4 bytes"

PS : I'm using stm32 x-cube-ai : 5.1.2 version

Also, the reference code uses Sequential Model, while my code doesn't

1 ACCEPTED SOLUTION

Accepted Solutions
GanesanGuru
Associate II

It got resolved, when using latest version of stm32 x-cube-ai (i.e.) 7.2.version

View solution in original post

1 REPLY 1
GanesanGuru
Associate II

It got resolved, when using latest version of stm32 x-cube-ai (i.e.) 7.2.version