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


#15

can you post the pb to check?


#16

https://drive.google.com/open?id=1mTOUrn8xWj29ugSoFACg0vSyo0FokDni


#17

please do not use PAD method, use SpaceToBatchND instead, here is the example:
image


#18

Since I’m using Keras I don’t see where the PAD method come from and I’m using your modified mobilenet.py that has ZeroPadding2D((1,1),(1,1))
Can you tell me how to replace PAD with SpaceToBatchND?


#19

You may need to update keras to the latest version.


#20

2.2.4 is already installed.


#21

I reinstalled the entire conda environment to isolate and it seems that PAD comes from layers.ZeroPadding2D :confused:
So how did you get it working @Zepan? What version of … everything are you using? Is there another way to do ZeroPadding which is K210 compatible?


#22

strange, did you follow the step and use the tools in my github?
in my workspace, there have no problem
should I upload docker image?


#23

Yes I followed every step and used all your tools.
A docker could help yes but only a temporarily fix as it’s ultimately better to know the root cause so I attached the keras .h5 file as well as the .py that does the training. Could you have a look? Maybe the reason lies somewhere there.
https://drive.google.com/open?id=16MvITFFONZg6CWe0uApA2ghL0iJCaot-


#24

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 https://github.com/kendryte/nncase/releases/tag/v0.1.0-rc5 shows v 0.1.0rc5 and above in the thread, you talk about a version 0.4 … which is confusing


#25

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

try:
	task = kpu.load(0x200000)
except:
	e=sys.exc_info()[0]
	lcd.draw_string(100,112,"ERROR: "%e)
else:
	lcd.draw_string(100,112,"Done")

Doesn’t show any error so:

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

#26

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.


#27

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.


#28

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


#30

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


#31

Hello,

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

 #!/bin/bash
mkdir -p ncc
mkdir -p workspace
mkdir -p images
mkdir -p log
cd ncc
wget https://github.com/kendryte/nncase/releases/download/v0.1.0-rc5/ncc-linux-x86_64.tar.xz
tar xJvf ncc-linux-x86_64.tar.xz
rm ncc-linux-x86_64.tar.xz
echo "download nncase ok!"

#32

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


#33

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 mobilenet.py as provided on the sipeed github.
What am I doing wrong?


#34

did you update newest nncase?


#35

Yes, I am using v0.1.0-rc5