Fix metadata in tflite models
margaretmz opened this issue · comments
I figured out the (black) image issue on Android! It was caused by incorrect image post processing (from tflite metadata).
@sayakpaul please fix the metadata in the tflite models as follows:
update from
output_image_normalization.options.mean = [0.0] output_image_normalization.options.std = [1.0]
to
output_image_normalization.options.mean = [-1]. output_image_normalization.options.std = [0.00784313] # 1/127.5
I have verified that this will mirror the post processing in the conversion notebook, and it works on Android.
cc: @khanhlvg
When adding metadata to the tflite models, I also find it helpful to put a date stamp in the version code for example something like this: v3_2020-08-03. Otherwise it's really difficult for me to keep track of the various model versions.
This is super exciting! Thanks Margaret :)
@margaretmz thanks so much for your hard work on this. I have updated everything as per your feedback.
Updated Colab Notebooks:
Model files:
Let me know if anything is unclear.
Thanks @sayakpaul for the updates! The int8 and dr models now work in Android.
FP16 one still crashes and I asked @khanhlvg to help take a look at it.
Fair enough @margaretmz. Thank you for the updates.