Page 1 of 1

How to convert model.h5 to model.network for OpenMV

Posted: Sun Apr 28, 2019 6:04 am
by uraibeef
I want to convert my images classification model (model.h5) from keras to .network type and deploy it to the OpenMV M7

(My model is used to classify A-Z, 0-9 on OpenMV)

What should I do?

thank you very much

Re: How to convert model.h5 to model.network for OpenMV

Posted: Sun Apr 28, 2019 12:43 pm
by kwagyeman
Hi, I'm about to get tensorflow lite running on the OpenMV Cam. I'm aiming to get the PR done for this in the next 3 days or so. Once I do that you can take any tensor flow model and run it on the M7/H7. Tensorflow will only support depthwise convolutions and fully connected however. So, you want to use transfer learning from mobilenet.

Re: How to convert model.h5 to model.network for OpenMV

Posted: Mon Apr 29, 2019 12:22 pm
by uraibeef
kwagyeman wrote:
Sun Apr 28, 2019 12:43 pm
Hi, I'm about to get tensorflow lite running on the OpenMV Cam. I'm aiming to get the PR done for this in the next 3 days or so. Once I do that you can take any tensor flow model and run it on the M7/H7. Tensorflow will only support depthwise convolutions and fully connected however. So, you want to use transfer learning from mobilenet.
thank you for your answer, I'm very excited to use it.

Re: How to convert model.h5 to model.network for OpenMV

Posted: Thu May 02, 2019 1:44 am
by uraibeef
@kwagyeman, Is this the git you mean?
https://github.com/openmv/tensorflow-lib

And if it's yes, How can I use it? Do you have a example to use?

Re: How to convert model.h5 to model.network for OpenMV

Posted: Thu May 02, 2019 12:18 pm
by kwagyeman
I'm almost done getting tensor flow working on the camera. The library is just for other folks wanting to use the code on their custom MCUs.

Anyway, I'm actively working on the library. I've gotten past most compile issues and should be getting it integrated into our firmware soon. I'll have as a first demo mobilenet running on the OpenMV Cam.

Re: How to convert model.h5 to model.network for OpenMV

Posted: Tue May 14, 2019 2:52 am
by uraibeef
Do u have any update?

Re: How to convert model.h5 to model.network for OpenMV

Posted: Wed May 15, 2019 12:41 am
by kwagyeman
Sorry, this has gotten bogged down.

The code has been pushed to a branch on my github fork here:

https://github.com/kwagyeman/openmv/tree/kwabena/add_tf

I was about to have mobilnet working. However, google's default memory allocator uses up all of our RAM and is not efficient. It allocates very layer for the net in RAM instead of just the two layers its actually working on. As such, I don't have a network to demo. So, I have to write a guide for how to train a tensor flow model. Anyway, I have not found time for this because the email load is quite every right now.

If you have a tflite network that's been trained and quantizied I may be able to run it and debug my code however. That would help me. Since I'm just a wrapper around tensor flow and tensor flow is already verified I could get this released to everyone more quickly then. I'd need a network that does something obvious however.