Flutter Tensorflow Tutorial

This Article is posted by theindianappguy at 1/28/2020 4:15:34 AM



Today let's learn how to build a tensorflow model on Techable Machine and then run it on flutter app.
Here is how it works when we will press the floating action button we will select an image file and our model will tell if it is a dog or a cat
For this first we will Create a new flutter project, then remove all the boiler plate code in the main.dart in lib
Now first lets build our model for this we will use Teachable Machine it is a web platform by google where we can create model and can test, and export to run on mobile
Step1: Visit https://teachablemachine.withgoogle.com/ click "get started" then select Image Project
Step2: There will be two class class1 & class 2 rename them to cat and dog, then now we need images  to train our model which you can get here https://www.kaggle.com/tongpython/cat-and-dog
then upload the images which we download for cat and dog respectively
Step3: Click train Model, let it train don't close or switch tab
Step4: Click Export Model
Step5: Click on Download my model, it will convert and download the model
now we have the model lets work on Flutter app
Step1: Visit the build.gradle file in app there inside android{} add this
Step2: Make sure the minSdkVersion is 19
Then now time to get packages
Step3: Get these packages
Step5: Create a assets folder and add the file which we download , (obviously first extract) you will have two file one is model and the other is labes then add this in pubspec.yaml file
Now  run, Hurray we have finally create a Flutter app that runs Tensorflow lite model
If you like the blog and it helped then do consider Recommending me on Linkedin for respective skills https://www.linkedin.com/in/lamsanskar/
Thanks, have a great day ahead
Sanskar Tiwari

Tags: Tensorflow,flutter,teachable machine








0 Comments
Login to comment.
Recent Comments












© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com