flutter flutter logo tensorflow lite

A Flutter project for demonstrating usage of TensorFlow Lite model created with teachablemachine.

TensorFlow Lite Machine Learning
image1

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 IdLabel Name
0Black Texture
1Blue Texture
2Green Texture
3Orange Texture
4Pink Texture
5Purple Texture
6Red Texture
7White Texture
8Yellow 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);
        });
    }

GitHub

Download the full project for this post from the following button

This source is fully free for all time

Download as zip

Comments are closed.

You're Offline!

Top