Closed hahmad2008 closed 4 years ago
Hi @hahmad2008 .. I did not try tf_lite with TF2 before, but will look at it this weekend. Meanwhile, can you check this solution: https://github.com/tensorflow/tensorflow/issues/22564#issuecomment-425515540
@abdelrahman-gaber Thank you! I tried to convert the checkpoint (saved_model) using this solution, it is successfully converted but I think it is incorrect since I checked the input for the model I got it as [1,1,1,3] instead of [1,300,300,3]
I use this directory
what type of model you generated in the exported_model/saved_model is it a saved or frozen model?
In the exported_model/saved_model, it is saved models. It is the same as all models in the model zoo. I think we should use the saved model in TF2 instead of frozen graphs. refer to this thread for more information. But there are some ways to freeze the model as mentioned in the thread, and also here.
Thank you @abdelrahman-gaber have you had a chance to convert the model to TensorFlow lite?
@hahmad2008 Can you please try this. This solution is working on colab with the newest tensorflow nightly version, but not working on my machine with Tensoflow 2.2.0 and giving me errors. Please confirm if the output model is working with you, and then we can check the TF version which works best.
Thank you @abdelrahman-gaber I also tried this solution it works as well.
But I am trying to test the tflite model. could u please check that?
@hahmad2008 Great. It is basically the same solution I tried in the colab, but it will need tensorlfow version higher than 2.2.0 Anyways, I will check exactly what is the minimum version required and let you know about that.
To test the tflie model, you should use the tflite interpreter .. I will try to make some instructions for tflite conversion and inference in the tutorial, I think it maybe helpful.
Thanks, @abdelrahman-gaber . No need. I tried the following and it works :D
Great! So maybe you can share your complete solution here for anyone who will face this issue in the future 🙏
@abdelrahman-gaber Ya sure!
For testing TFLITE model on images check this code: LINK
Thank you, Abdelrahman, so much for the well-organized tutorial, I really spent time searching for good tutorials for object detection and up to date.
I had successfully train and test the model as you explained, but when I tried to convert it to tensorflow lite, I got the following error: Could you please help me?
tflite_convert \ --saved_model_dir=models/ssd_mobilenet_v2_raccoon/exported_model/saved_model \ --output_file=models/ssd_mobilenet_v2_raccoon/ssd_mobilenet_v2_raccoon.tflite
I got this error: