Giter VIP home page Giter VIP logo

machine-learning-app's Introduction

SGPA Sem - 5 Project

A Flutter application in which user can know What is Machine Learning, How Models are Train and Deployment of these Trained Models.

Abstract

Building a machine Learning model is an easy task nowadays as most algorithms are available and by using these Algorithm we can implement Models. The main task is to known how we can deploy the model in Application. So by using tensorflow tflite model I have deploy Some basic ML models in a single Android Application.

Introduction a

Only a small fraction of real-world ML systems is composed of the ML code, as shown by the small black box in the middle (see diagram below). The required surrounding infrastructure is vast and complex. Machine Learning Systems

Useful Courses books

I have enrolled in some coursera courses but these courses help me a lot for building this application

Differnet Models to Train and Delop them in single Application (Custom Based - offline)

  • Dog vs Cat
  • Flower Recognition (5 Flower)
  • MNIST (1-10 Numbers)
  • Color Detection (Realtime)

Project Flow flow

  • Collection of different dataset.
  • Train one part of Dataset
  • Test with the other to known the Accuracy of Model
  • Convert the Model in tflite version
  • Deploy this Model in Android Application

Dataset Collection memo

Training - Testing man_technologist

Converting film_strip

# Converting a SavedModel to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
# Converting a tf.Keras model to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
# Converting ConcreteFunctions to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_concrete_functions([func])
tflite_model = converter.convert()

Deployment cyclone

Add tflite package in pubspec.yaml

dependencies:
  tflite: ^1.1.1

Every tensorflow (tflite) model gives 3 different output that are

  1. index
  2. label
  3. confidence.

The dog and cat model and flower recognition model both are deployed by using tflite package function runModelOnImage()

var output = await Tflite.runModelOnImage(
      path: image.path,
      numResults: 2,
      threshold: 0.5,
      imageMean: 127.5,
      imageStd: 127.5,
    );

For MNIST model I have used canvas to create an image which will be resized to 28x28px that is the same size of image we used to train our model. Then will convert this image to list of Uint8 and run runModelOnBinary() method.

var output = await Tflite.runModelOnBinary(
      binary: imageToByteListFloat32(image, 224, 127.5, 127.5),// required
      numResults: 6,    // defaults to 5
      threshold: 0.05,  // defaults to 0.1
      asynch: true      // defaults to true
);

For Color Detection model I have used method runModelOnFrame() as this model is real-time based and image is changing every frame by frame.

var output = await Tflite.runModelOnFrame(
      bytesList: img.planes.map((plane) {return plane.bytes;}).toList(),// required
      imageHeight: img.height,
      imageWidth: img.width,
      imageMean: 127.5,   // defaults to 127.5
      imageStd: 127.5,    // defaults to 127.5
      rotation: 90,       // defaults to 90, Android only
      numResults: 2,      // defaults to 5
      threshold: 0.1,     // defaults to 0.1
      asynch: true        // defaults to true
);

Gif tada

Machine Learning App Gif

machine-learning-app's People

Contributors

adityalalwani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ankit1057

machine-learning-app's Issues

No such file or directory

Task :app:compileFlutterBuildDebug
lib/colorTexture/detect_screen.dart:6:8: Error: Error when reading '/C:/Users/DELL/Downloads/sgpa_sem5/lib/colorTexture/camera_helper.dart': No such file or directory
import 'file:///C:/Users/DELL/Downloads/sgpa_sem5/lib/colorTexture/camera_helper.dart';
^
lib/colorTexture/detect_screen.dart:7:8: Error: Error when reading '/C:/Users/DELL/Downloads/sgpa_sem5/lib/colorTexture/tflite_helper.dart': No such file or directory
import 'file:///C:/Users/DELL/Downloads/sgpa_sem5/lib/colorTexture/tflite_helper.dart';
^
lib/colorTexture/detect_screen.dart:8:8: Error: Error when reading '/C:/Users/DELL/Downloads/sgpa_sem5/lib/colorTexture/result.dart': No such file or directory
import 'file:///C:/Users/DELL/Downloads/sgpa_sem5/lib/colorTexture/result.dart';
^
lib/colorTexture/detect_screen.dart:22:8: Error: Type 'Result' not found.
List outputs;
^^^^^^
lib/colorTexture/detect_screen.dart:97:49: Error: Type 'Result' not found.
Widget _buildResultsWidget(double width, List outputs) {
^^^^^^
lib/colorTexture/detect_screen.dart:22:8: Error: 'Result' isn't a type.
List outputs;
^^^^^^
lib/colorTexture/detect_screen.dart:26:5: Error: The getter 'TFLiteHelper' isn't defined for the class '_DetectScreenPageState'.

  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'TFLiteHelper'.
    TFLiteHelper.loadModel().then((value) {
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:28:9: Error: The getter 'TFLiteHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'TFLiteHelper'.
    TFLiteHelper.modelLoaded = true;
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:32:5: Error: The getter 'CameraHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'CameraHelper'.
    CameraHelper.initializeCamera();
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:36:5: Error: The getter 'TFLiteHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'TFLiteHelper'.
    TFLiteHelper.tfLiteResultsController.stream.listen(
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:47:13: Error: The getter 'CameraHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'CameraHelper'.
    CameraHelper.isDetecting = false;
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:71:17: Error: The getter 'CameraHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'CameraHelper'.
    future: CameraHelper.initializeControllerFuture,
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:77:31: Error: The getter 'CameraHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'CameraHelper'.
    CameraPreview(CameraHelper.camera),
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:92:5: Error: The getter 'TFLiteHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'TFLiteHelper'.
    TFLiteHelper.disposeModel();
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:93:5: Error: The getter 'CameraHelper' isn't defined for the class '_DetectScreenPageState'.
  • '_DetectScreenPageState' is from 'package:sgpa_sem5/colorTexture/detect_screen.dart' ('lib/colorTexture/detect_screen.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'CameraHelper'.
    CameraHelper.camera.dispose();
    ^^^^^^^^^^^^
    lib/colorTexture/detect_screen.dart:97:49: Error: 'Result' isn't a type.
    Widget _buildResultsWidget(double width, List outputs) {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.