Train, Convert, Run MobileNet on Sipeed MaixPy and MaixDuino !

Could you include the proper version of NCC with your Maix_Toolbox?
For linux and windows.
The ncc.dll properties show version 1.0.0 but shows v 0.1.0rc5 and above in the thread, you talk about a version 0.4 … which is confusing

Wu corrected the get nnc to the latest and now it’s converting a kmodel no problem :fist:

But the kmodel is about 4MB, not 2.7MB, is there a way to know what is eating up so much space?

Also loading never ends and boxing the task = kpu.load(0x200000) with

	task = kpu.load(0x200000)
	lcd.draw_string(100,112,"ERROR: "%e)

Doesn’t show any error so:

  1. how do we detect kpu.loading progress?
  2. how do we catch errors?

Hi, I use 0.75x version, but you use 1.0x version, so mine is 2.7MB, and yours is 4MB
not implement catch for kpu load yet, but you can check it by your self.
It will output error mag if load failed.

I use mobilenet_7_5_224_tf_no_top as well. I think that’s because the new top is 2x dense 1024 and a 512, that’s 1.5MB additional I think. I’ll simplify :sweat_smile: … and done, I replaced with dense 512+128+32 and now all is good, it fits and it’s quite accurate for obstacles.

Regarding error catch, I don’t understand what you suggest, can you give an example?
Also what happens if the model is too large to fit in?
Ideally we’d prefer the system rebooth rather than a freeze.

too big model will case malloc failed, and return error.

try/catch doesn’t catch the error, I guess you’ll add error handling in the next firmware.


How did you fix the PAD problem? I tried updating ncc using the following script, but I still get the error.

mkdir -p ncc
mkdir -p workspace
mkdir -p images
mkdir -p log
cd ncc
tar xJvf ncc-linux-x86_64.tar.xz
rm ncc-linux-x86_64.tar.xz
echo "download nncase ok!"

With this version of NCC the likely cause is that you aren’t using the modified version of so it’ll complain that you have a non uniform padding.

Thanks for your reply.
The code is still not working as intended, it keeps saying layer not supported.
Even when using the keras model supplied on the sipeed github (mbnet75.h5) I get the following error when trying to convert to .kmodel:
Fatal: Layer Conv2d is not supported
I am running tensorflow 1.13.1 and keras 2.2.4.
I also use the as provided on the sipeed github.
What am I doing wrong?

did you update newest nncase?

Yes, I am using v0.1.0-rc5

Simple Hardware issue:
Running the MaixPy demo with a Dam dock arranged with camera and LCD back-to-back, sensor.set_hmirror(1) does not change the camera image, I am getting Horizontally reversed images.
(OK with Maix Bit)

Documentation note
All of the python vocabulary docs for MaixPy seems to have vanished:

( I was going to mention that sensor.set_vflip() was not in the reference material)

hi, please refer to chinese version, we are lack of people to translate it, you can use google translate to see chinese version document

Why does the program need the images twice?
Once to train the keras/h5 model, and again to convert the tflite to kmodel?
What does the use the images for?

h5 -> pb -> tflite -> kmodel
kmodel is the model for maix

Dear Zepan,

I am now trying to call KPU using c and have downloaded the kmodel from (
if( mbnet.begin("/sd/mbnet75.kfpkg") != 0)
is it correct? And, if I save those kmodel in an external sd card, what the path will be?



I am still wondering why ./tflite2kmodel needs images in the Maix_Toolbox/images folder. Didn’t we train it before?

the image is used for quant purpose, not for train purpose

cool 666

HI, how could i change the code to count objetcs using tensorflow counting api?