Regarding E2E Object Detection in TFLite

1 view
Skip to first unread message

Sayak Paul

unread,
Sep 12, 2020, 11:52:49 PM9/12/20
to ML on Mobile OS Working Group, Khanh LeViet, Soonson Kwon
Hi folks,

A few days ago I open-sourced this repository that shows how to train a custom detection model with the TFOD API (TF2 and TF1), optimize it with TFLite, and perform inference with the optimized model. It contains the following notebooks (pardon the naming) - 
  • Training_a_pets_detector_model_within_minutes_with_TFOD_API.ipynb: Shows how to train a custom object detection model on the Pets dataset (non-eager mode) with Cloud TPUs. Note that it does not use TPUs offered by Colab.
  • Running_inference_with_a_custom_TFOD_API_model.ipynb: Shows how to export a SavedModel graph from the trained checkpoint files, and run inference.
  • Object_Detection_in_TFLite.ipynb: Shows how to quantize the original model, generate a TFLite model, and run inference.
  • Training_MobileDet_Custom_Dataset.ipynb: Shows how to train a custom object detection model on the Pets dataset (non-eager mode) on Colab (GPU), optimize the fine-tuned model with TFLite, and perform inference with the optimized model. 
I hope you'd find them to be useful. I would like to thank the GDE program for providing me with GCP support which made the first notebook possible :)

Sayak Paul | sayak.dev

Kshitiz Rimal

unread,
Sep 13, 2020, 12:27:44 AM9/13/20
to Sayak Paul, ML on Mobile OS Working Group, Khanh LeViet, Soonson Kwon
Thanks for sharing this, Sayak! Looks amazing!

Regards,
Kshitiz 

--
You received this message because you are subscribed to the Google Groups "ML on Mobile OS Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlwg-mobile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mlwg-mobile/CAGa_XGExtViSJOLCBPxWjwEnDz8Q%2BkdeXx28AAorRQn6%3DSNhpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Soonson Kwon

unread,
Sep 13, 2020, 7:29:13 PM9/13/20
to Kshitiz Rimal, Karl Weinmeister, Martin Gorner, Sayak Paul, ML on Mobile OS Working Group, Khanh LeViet
+Karl Weinmeister +Martin Gorner FYI for Cloud TPU

Thank you for sharing, Sayak!


Srivatsan Srinivasan

unread,
Sep 13, 2020, 9:05:21 PM9/13/20
to Sayak Paul, ML on Mobile OS Working Group, Khanh LeViet, Soonson Kwon
Sayak,

This is really amazing 👏

George Soloupis

unread,
Sep 13, 2020, 11:56:00 PM9/13/20
to Sayak Paul, ML on Mobile OS Working Group, Khanh LeViet, Soonson Kwon
You have done a great job Sayak!
Really useful! 👏

Khanh LeViet

unread,
Sep 14, 2020, 7:55:09 AM9/14/20
to George Soloupis, Sayak Paul, ML on Mobile OS Working Group, Soonson Kwon
This is great! Thanks Sayak.
--
    
Le Viet Gia Khanh (カン)
TensorFlow Developer Advocate


Shibuya Stream 
3-21-3 Shibuya, Shibuya-ku, Tokyo
150-0002, Japan

Sayak Paul

unread,
Sep 15, 2020, 2:41:25 AM9/15/20
to ML on Mobile OS Working Group
Hi folks,

Thanks for the kind words. Today I updated the Colab Training notebook and also added a notebook to build a dataset for TFOD API training (non-eager mode). 

So, here's two complete notebooks that demonstrate an end-to-end detection pipeline solely on Colab:


Thanks to Khanh for the dataset idea. 


Sayak Paul | sayak.dev

Kshitiz Rimal

unread,
Sep 15, 2020, 3:08:40 AM9/15/20
to Sayak Paul, ML on Mobile OS Working Group
Hi Sayak,

Thanks for sharing the notebook. Looks amazing. Alternatively, have you tried converting directly from PASCAL or COCO type format to TFRecords using the scripts provided in dataset tools?

I found it quite useful when your dataset is in any one of those popular format:

There is also a service called RoboFlow which allows you to directly convert any of those format to TFRecord with data-preprocessing, data split and augmentation features for free.

Here is a blog to that:

Enjoying your E2E notebooks on object detection, it was something I was also looking into for a while. Again, thanks for sharing.

Regards,
Kshitiz 

-- 
You received this message because you are subscribed to the Google Groups "ML on Mobile OS Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlwg-mobile...@googlegroups.com.

Sayak Paul

unread,
Sep 15, 2020, 3:11:51 AM9/15/20
to Kshitiz Rimal, ML on Mobile OS Working Group
Hey Kshitiz,

Thanks for the kind words :)

I am aware of the dataset scripts provided by the TFOD API. But I wanted to have a bit more autonomy in the process, hence :) 

RoboFlow is from another galaxy! Thank you so much for sharing the resources. I will check them out in details in a few days. 

Sayak Paul | sayak.dev


Reply all
Reply to author
Forward
0 new messages