sipeed / MaixPy-v1

MicroPython for K210 RISC-V, let's play with edge AI easier
https://wiki.sipeed.com/maixpy
Other
1.67k stars 436 forks source link

Unable to load kmodel v4 #300

Open shanejohnpaul opened 3 years ago

shanejohnpaul commented 3 years ago

Firmware: maixpy_v0.5.0_123_g859098d NNcase: v0.2.0 Beta4

I saw this issue and it said to use the latest firmware to support kmodel v4. I even tried the Beta2 version of nncase as stated in the issue.

This is the error I got. ValueError: [MAIXPY]kpu: load error:2002, ERR_KMODEL_VERSION: only support kmodel V3

Neutree commented 3 years ago

https://dl.sipeed.com/MAIX/MaixPy/release/master/maixpy_v0.5.0_124_g92d9c04

image

zyx-dev commented 3 years ago

whether the latest version “with lvgl” support kmodel V4?

Neutree commented 3 years ago

@zyx-dev upload failed, but you can customize your firmware here: https://www.maixhub.com/compile.html

shanejohnpaul commented 3 years ago

https://dl.sipeed.com/MAIX/MaixPy/release/master/maixpy_v0.5.0_124_g92d9c04

image

This actually worked!!! (the one with model v4 support) But now I can only load my model. When I try to set the frame size of the camera to QVGA, it says E (22399959088) SYSCALL: Out of memory.

The model is just 2.25MB and I downloaded it at 0x200000. Is there something we could do?

Neutree commented 3 years ago

compile your firmware follow the build.md, remove the module you don't need, and try to reduce the lcd resolution image

and if you can kmodel V3, just use V3, and V3 support kpu.load_flash(), which support load big model from flash when running

Neutree commented 3 years ago

image

image

shanejohnpaul commented 3 years ago

Thanks. I'll try them.

shanejohnpaul commented 3 years ago

Does the online compiler work? I chose the kmodel v4 option in it and it wasn't able to load the model.

shanejohnpaul commented 3 years ago

I compiled the firmware as mentioned in here. I went with the maixpy_k210_minimum project. I set all the options as mentioned above. But still, it's running out of memory when trying to load the camera sensor. Is there anything else I could do?

I tried to compile my tflite model to kmodel v3 but I'm getting some errors. But with v4, everything went fine.