kendryte / nncase

Open deep learning compiler stack for Kendryte AI accelerators ✨
Apache License 2.0
734 stars 181 forks source link

Model init error nncase example #75

Closed krishnak closed 4 years ago

krishnak commented 4 years ago

I am trying to compile and execute the nncase fastface detect example on a Sipeed Maix Dock. I have managed to successfuly compile using st7789.c as that is the display I am having.

I have compiled the nncase example verbatim using the standalone SDK.

I have flashed the binary to the board.

I have two issues, if you can give me some hints to solve it - I would appreciate it.

  1. When I connect to debug terminal, I see the printf outputs - it shows "Model init error" - can you let me know me know what is causing this? The firmware size is 705,405 bytes
Output from platform io build task is
Building project_build_files/sipeed-maix-one-dock/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
DATA:    [=         ]  10.7% (used 670648 bytes from 6291456 bytes)
PROGRAM: [          ]   4.2% (used 705289 bytes from 16777216 bytes)
  1. Since I am getting this model error, to test whether the LCD driver is working, I have added the following code before the model gets loaded
    rgb888_to_lcd(gImage_image, lcd_gram, 320, 240);
    lcd_draw_picture(0, 0, 320, 240, (uint32_t*)lcd_gram);

    This draws the image on to the LCD screen, but the image is heavily pixelated.

Is this how it is supposed to be? As I have uploaded the JPEG version of the 320x240 image to the board using another method and it was unpixelated.

krishnak commented 4 years ago

Some more debug information for any one who care to throw their opinion In kpu.c

kpu_load_kmodel() the header->version is having a value of 1263354956

krishnak commented 4 years ago

I came across this thread it talks about this version value having 1263354956, when loading new models. It appears that its a KModel version 4, clash, however I am confused as why it should appear in a nncase sample code which has no relation to MaixPy

krishnak commented 4 years ago

Looks like platform io framework packages still have an old version of kpu.c, the newer version of kpu.c has the following code to handle incbin in kpu_load_kmodel() method.

else if(header->version == 'KMDL') { return nncase_load_kmodel(ctx, buffer); } else { return -1; }

krishnak commented 4 years ago

The example code in this requires a different SDK than 0.5.6 released, the model init error will disappear if you download the SDK from github - the github package.json is showing SDK version as 0.5.4 - I don't know whether it is correct - most probably the file hasn't been updated.