A flutter project for demonstarting usage of TensorFlow Lite model created with teachablemachine.

Overview

tensorflow_lite_flutter

A flutter app to demonstrate usage of tensor flow lite ML.

App Demo Teachable Machine

The "TensorFlow" model is trained using Teachable Machines. The model is trained with different texture colors of walls. App will recognize the color and classify the color according to best match. This app will load a pre-trained model and start classification on frames received from Camera Controller. App will show results in real-time along with confidence percentages.

Model can be downloaded from this download link and re-loaded on "Teachable Machines" website.

Labels

Class Id Label Name
0 Black Texture
1 Blue Texture
2 Green Texture
3 Orange Texture
4 Pink Texture
5 Purple Texture
6 Red Texture
7 White Texture
8 Yellow Texture

TFLite Helper Class

    // Load Model
    static Future<String> loadModel() async{
        AppHelper.log("loadModel", "Loading model..");
    
        return Tflite.loadModel(
          model: "assets/model_unquant.tflite",
          labels: "assets/labels.txt",
        );
    }
    
    //Start Classification on CameraImage frames
    static classifyImage(CameraImage image) async {
    
        await Tflite.runModelOnFrame(
                bytesList: image.planes.map((plane) {
                  return plane.bytes;
                }).toList(),
                numResults: 5)
            .then((value) {
      
          //Send results
          tfLiteResultsController.add(_outputs);
        });
    }

Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

You might also like...

Rename Flutter Project Bundle ID Plugin with Firebase Project Support

About (Null-Safety) It helps you to change your flutter project's AppName and BundleId for different platforms, currently only available for IOS, Andr

Nov 12, 2021

News App created in Flutter using News API for fetching realtime data and Firebase as the backend and authenticator.

News App created in Flutter using News API for fetching realtime data and Firebase as the backend and authenticator.

News Buzz News App created in Flutter using News API for fetching realtime data and Firebase as the backend and authenticator. Features Custom news fe

Dec 30, 2022

A simple, cross-platform password manager created with Flutter.

A simple, cross-platform password manager created with Flutter.

PassMan PassMan Logo © 2021 by Yash Ahir is licensed under CC BY-NC 4.0 A simple, cross-platform password manager created with Flutter. How to run thi

Dec 14, 2022

Password Manager Created Using Flutter And SQLite

Password Manager Created Using Flutter And SQLite

Dec 24, 2022

This is an app created by me while undertaking an android app development in flutter course on Udemy.

Expense Planner App A Flutter project created by Mithilesh Ghadge in a Fluttter Android app development course on Udemy. Create a new Flutter project

Oct 14, 2021

This is a weather app created in Flutter with backend in Dart

This is a weather app created in Flutter with backend in Dart

Flutter Weather A Flutter application to view current weather status. Features ✅ Beautiful minimal UI ✅ Dark and Light themes ✅ Current temperature, m

Jul 4, 2022

Application created in flutter based on the shadowhunters series.

seriesflutterproject A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

Nov 24, 2021

This is a movie application created in the flutter course of Fernando Herrera

This is a movie application created in the flutter course of Fernando Herrera

movies_app Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is your first Flutte

Nov 26, 2021

Todo app created by Flutter.

todo_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Dec 3, 2021
Comments
  • Error

    Error

    Hi @umair13adil , I am new to flutter and working lo tflite andi prepared a app with detecting a leaf image through camera and gallery and i had converted the hdf5 model to tflite and using that tflite model with some label while testing/predicting the image i am getting an error like

    Exception has occurred. PlatformException (PlatformException(error, Unsupported value: java.lang.IllegalArgumentException: Cannot copy between a TensorFlowLite tensor with shape [1, 38] and a Java object with shape [1, 40]., null)) in flutter Coulod any one help me

    Thanks and Regards, Manikantha Sekhar.

    opened by mady143 2
  • Unable to use a different model

    Unable to use a different model

    I'm trying to use a custom model with the following properties: Screenshot 2020-11-12 at 18 48 33

    The original model has these properties instead: Screenshot 2020-11-12 at 19 09 01

    In theory, this should not be a problem as tflite is supposed to accept any TFLite model.

    However, this error is thrown

    E/AndroidRuntime(29968): Caused by: java.lang.IllegalArgumentException: Cannot copy from a TensorFlowLite tensor (Identity) with shape [1, 3, 6400, 85] to a Java object with shape [1, 80]
    

    when I try to classify an image

    Tflite.runModelOnFrame(
          bytesList: image.planes.map((plane) => plane.bytes).toList(),
        )
    

    A similar error

    E/AndroidRuntime( 2360): Caused by: java.lang.IllegalArgumentException: Cannot copy from a TensorFlowLite tensor (Identity) with shape [1, 3, 6400, 85] to a Java object with shape [1, 20, 20, 425]
    

    is thrown when trying to detect an object

    Tflite.detectObjectOnFrame(
          bytesList: image.planes.map((plane) => plane.bytes).toList(),
          model: "YOLO",
          imageHeight: 640,
          imageWidth: 640,
          imageMean: 0,
          imageStd: 255.0,
          anchors: [
            10,
            13,
            16,
            30,
            33,
            23,
            30,
            61,
            62,
            45,
            59,
            119,
            116,
            90,
            156,
            198,
            373,
            326
          ],
        )
    

    Does anyone has any idea about why this could be happening?

    opened by ghost 0
  • Load the Model

    Load the Model

    Hi @umair13adil ,

    I want to know some information regarding my app just i have created an app in flutter and i deployed a ml model into that app locally and working fine while taking the build its of more than 40 mb size in that my model is of 42mb size so its taking to large so i want to do i want to call my model from the server i was completed don't about that functionality could you help me in that .

    Thanks & Regards, Manikantha Sekhar.

    opened by mady143 2
Owner
Muhammad Umair Adil
Software Engineer (Android/iOS/Flutter) @EmbraceITMobile
Muhammad Umair Adil
A personalized yoga trainer app based on Flutter and TensorFlow Lite.

Yoga Guru Yoga Guru is your personalized yoga trainer app based on Flutter. It uses posenet, a pre-trained deep learning model, to estimate body poses

Aditya Sharma 157 Nov 9, 2022
A project to showcase usage of basic principles to convert any 3D design into a working application using Flutter.

Developing apps with 3D designs in flutter This project is developed to showcase how we can use some basic principles to convert any 3D design into a

Manas Pratap Thakur 30 Dec 22, 2022
This is a Yoga app made in Flutter. This is an integration of a model that i found on https://www.uistore.design.

Yoguha A Flutter project made with Firebase that helps you for your next Yoga sessions. It contains : An authentication system A timer Some relaxing p

Scythe 2 Feb 1, 2022
App to verifiy model predictions

bird_verifier Verify bird calls and songs Getting Started Our current audio machine learning model analyses each audio recording that is uploaded from

Tim Hunt 2 Oct 17, 2021
Actor model implementation in Dart. This package makes it easier to work with isolates, create clusters of isolates.

Actor model implementation in Dart Languages: Introduction About Theater Installing What is Actor Notes about the actors Actor system Actor tree Using

Gleb Batykov 39 Nov 14, 2022
This is one of my flutter project that I have created with login and register page.

?? Hi, I’m @D-ENCODER (Flutter Developer) ?? I’m interested in Flutter native cross platform apps ?? I’m currently learning data structures and algori

D - ENCODER 9 Oct 1, 2021
Project created to replicate design made by DesignSense 😎

☀️ Weather App ❄️ Project created to replicate design made by DesignSense ?? . Demo: Packages used: flutter_svg: ^0.22.0 sleek_circular_slider: ^2.0.1

Mosart 11 Dec 21, 2022
This design has been created for educational purposes. Also this project has integrated push notifications with firebase and my own server in python.

Ui Clone of the Nequi application This design has been created for educational purposes. Also this project has integrated push notifications with fire

Juan Suarez 3 Nov 17, 2022
A Simple Todo app design in Flutter to keep track of your task on daily basis. Its build on BLoC Pattern. You can add a project, labels, and due-date to your task also you can sort your task on the basis of project, label, and dates

WhatTodo Life can feel overwhelming. But it doesn’t have to. A Simple To-do app design in flutter to keep track of your task on daily basis. You can a

Burhanuddin Rashid 1k Jan 6, 2023