Custom Object Detection Using TensorFlow Teachable Machine In Flutter Apps

Shivam Ahuja
4 min readNov 11, 2020

There are plenty of articles available on Training your own custom object detection model using TensorFlow, YoloV3, Keras, etc. But most of us doesn't know how to do it or want to spend a lot of time on just reading and understanding the algorithms and then creating our own dataset and then training that dataset which requires resources and time and a lot of research, So if you are one of us this article is for you

Here is a sneak peek of what's about to happen:-

  1. Collect images for training.
  2. Upload dataset to TensorFlow Teachable Machine to train the model.
  3. Export the model with .tflite extension to be used in your app.
  4. Clone the repository and install the dependencies.
  5. Replace the .tflite file and .txt file in the assets/tflite folder with your custom model .tflite file and make sure to rename it.
  6. Run the app and congratulations🎊🎉 , there you have your custom object detector up and running.

Trending AI Articles:

1. How to automatically deskew (straighten) a text image using OpenCV

2. Explanation of YOLO V4 a one stage detector

3. 5 Best Artificial Intelligence Online Courses for Beginners in 2020

4. A Non Mathematical guide to the mathematics behind Machine Learning

Let's begin.

Step 1: Collecting Images

It’s very difficult to manually download each and every image from the internet. NO worries today I’m here to make your life easier

Artificial Intelligence Jobs

.

Here is a Chrome extension to download images in bulk in one go Imageye. Just add it to your browser, search for the object you are looking for. Click on the extension and BOOM!! there you go all the images will be downloaded.

Step 2: Uploading the dataset for training

Open this link. just like show in the picture you have to create a class give the class a label, click on upload>choose images from your files>select the images that you have previously downloaded, repeat this step for all the objects that you want to detect.

Now you are ready to train your model by just clicking on the Train Model button.

Step 3: Exporting the trained model

After the model is trained you can test it by uploading an image and the result will be displayed below.

If everything is working well, now you can export the model. Click on the Export Model button and this popup will open, now select the TensoflowLite tab and click on Download my model. It will download a zip file for you.

Step 4: Creating the flutter project

Clone this repository and install the dependencies by running the command in the terminal

Flutter pub get

Step 5: Replacing the custom trained model with your model

In the assets/tflite folder, you will find two files i.e. ssd_mobilenet.tflite and ssd_mobilenet.txt. Extract the zip file that you downloaded above and replace these files in the assets folder and make sure to rename them.

Step 6: Run the app and test it

Now simply you just have to run the app and the interface looks like this, obviously, this is a demo UI you can make your own tweaks and changes to make it shine.

There You Goo, CONGRATULATIONS 🎊🎉 on your own custom object detector

If you have made it through this article very well make sure to clap👏 and start the repository if you like it, have a good day.

Thanks for reading. ✌️

for any queries connect with me on linkedIn

Don’t forget to give us your 👏 !

--

--