Model init error nncase example



  • 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)
    

    2.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.

    Model file from github
    https://github.com/kendryte/nncase/blob/master/examples/fast_facedetect/k210/kpu_fast_facedetect_example/ultra_face.kmodel



  • Model init error is due to newer Kmodel version being produced by nncase, kpu.c which is in released SDK 0.5.6 doesn't support it. I am yet to get it working using the development SDK

    Edit: If you are using the platformIO setup, there is some work to be done in installing a development sdk along with released SDK to get it working. Details of adding new framwork in platformIO can be found here

    The image is still pixelated, I am yet to find a solution for that

    Edit2: Image pixelation is due to 2 reasons

    1. incorrect driver signals
    2. if the input image is not exact 320x240 the image2c file produces unpadded images, it results in ghosted images.

    Both have been addressed and no further issues.



  • Pixelated image through standalone code using rgb888 to lcd is as below

    0_1578732229385_IMG_20200111_130739.jpg



  • 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

    Smooth image displayed through Loboris micropython code
    0_1578730612673_IMG_20200111_132734.jpg