Can't load kmodel created with nncase


I’m desperately trying to load my freshly generated kmodel.

I’ve been training a CNN MobileNet V1 with Keras. I exported the model in tflite format.
Then I managed without any problem to convert my tflite to kmodel with NNCase v0.2.0 Beta2.

I first tried to load it with MaixPy with this version maixpy_v0.5.0_9_g8eba07d_minimum, you can see my flash-list.json below. Unfortunately it didn’t work out.

“version”: “0.1.0”,
“files”: [
“address”: 0,
“bin”: “maixpy_v0.5.0_9_g8eba07d_minimum.bin”,
“sha256Prefix”: true
“address”: 0x00A00000,
“bin”: “mbnet.kmodel”,
“sha256Prefix”: false

import KPU as kpu
task = kpu.load(0xA00000)
ERR_KMODEL_VERSION: only support kmodel V3 now
Traceback (most recent call last):
File “”, line 1, in
ValueError: [MAIXPY]kpu: load error:2

So I tried with the kendryte-standalone-sdk using incbin with a simple example.
if I’m to believe the size of the firmware, the kmodel is there.
but likewise I got model init error

INCBIN(model, “mbnet.kmodel”);

Now I’m stuck.
By the way, my dev board is a Maixduino. Thank you for your help.

Are you prepared to work in C, if yes there is hope to get your model working.

If you want to work on MaixyPy then you have to wait for them to release an update which supports the new KModel

good news, new version MaixPy support Kmodel V4 come out!

It works with the new version of MaixPy, thank you!

I also managed to load with the kendryte-standalone-sdk, I trusted platformio but their version was not up to date.

Unfortunately, I have a new problem, my camera ov2640 on Maixduino shows only a white background with this example. I think I have a problem initializing the camera so I haven’t fully tested my kmodel with the kendryte-standalone-sdk.

you need to download the development version of SDK from github for the nncase to work correctly, You can look at platformio forums on how to configure it, I have posted details there.

I’ve given up on platformio for now. Currently I’m compiling with cmake using the develop branch of kendryte-standalone-sdk.

Everything compiles without problem but the ov2640 camera has a problem at initialization. I get :

Init DVP

camera not recognition; you need check the link of camera module

I checked the link but it works with MaixPy so so I don’t understand.

Hi Zepan, trying to load model file on a M5StickV with the last firmware version (maixpy_v0.5.0_19_g64e411a_m5stickv.bin) but still I get:
ERR_KMODEL_VERSION: only support kmodel V3 now

The support for V4 is not in the m5stickv firmware yet ?

Thanks for the support

please refer to