This app uses Flutter and Google ML Kit and TensorFlow Lite. use google_ml_kit 0.12.0 (2022/8)
https://console.firebase.google.com/u/0/
google-services.json (android) GoogleService-Info.plist (ios)
FlutterVision (project)
📁android
:file_folder:gradle
:open_file_folder:app
:file_folder:build
:file_folder:src
:notebook:build.gradle
:notebook:google-service.json :arrow_left:
📁ios
:file_folder:Flutter
:file_folder:Runner
:file_folder:Assets.xcaseets
:file_folder:Base.lpoj
:notebook:AppDelegate.swift
:notebook:GoogleService-Info.plist :arrow_left:
:notebook:Info.plist
# pip install tensorflow
# pip install tflite-model-maker
import os
import numpy as np
import tensorflow as tf
from tflite_model_maker import model_spec
from tflite_model_maker import image_classifier
from tflite_model_maker.config import ExportFormat
from tflite_model_maker.config import QuantizationConfig
from tflite_model_maker.image_classifier import DataLoader
import matplotlib.pyplot as plt
data = DataLoader.from_folder('train/')
train_data, test_data = data.split(0.9)
model = image_classifier.create(train_data)
loss, accuracy = model.evaluate(test_data)
model.export(export_dir='.')
model.export(export_dir='.', export_format=ExportFormat.LABEL)
flutter:
assets:
- assets/model.tflite ←Add
- assets/labels.txt ←Add