Converting a trained keras CV attention model to TFLite #17
Replies: 5 comments 24 replies
-
Thanks for your sharing, but here are somethings you may care:
|
Beta Was this translation helpful? Give feedback.
-
Thanks. I've tried your technique for generating a tflite model like below:
But when I try to load the generated tflite file into a tflite interpreter like below:
I get this error:
I didn't even load an image so cant be an issue with the input image being the wrong dimensions. |
Beta Was this translation helpful? Give feedback.
-
I was trying out your quantize cotnet fix with:
and have pulled your latest code but when I run:
I get the error: When I remove the 'cotnet.set_global_tpu_test(True) ' line it goes back to the expanded dims error. Note that the h5 weights file was created using the most up to date code. |
Beta Was this translation helpful? Give feedback.
-
I should have seen the 'by_name' load_weights parameter you mentioned. I did try and it removed the 612 layers vs 633 layers problem but then the expanded dims error returned. |
Beta Was this translation helpful? Give feedback.
-
I tried which is currently 2.8.0.dev20211214 and gave the error:
when trying above code. Might need to build for a specific stable version of tensorflow. Not sure how to get a specific nightly build. I tried:
|
Beta Was this translation helpful? Give feedback.
-
The following code is an example of freezing a 300meg Resnet_family.RegNetZD trained model to make a 50meg pruned.lite model. Useful if you want to use it on a smartphone for example:
This code is an example of loading the 50meg pruned.lite model and using it for inference on a PNG file:
Beta Was this translation helpful? Give feedback.
All reactions