Giter Club home page Giter Club logo

tiny-ml-classifier's Introduction

Tiny ML Classifier

Tiny ML classifier - Glasses or No Glasses

Image

DEMO

Todo (09.09.2021)

  • Create infrastructure for Git
  • Quick R&D
  • Free data
  • Transfer
  • Augmentation data
  • Pytorch or TF (as tflite)
  • free skeleton model for init weights (I think it will be EfficientNet-Lite* models, MobileNetV2 or ResNet50)
  • Training Loop (Use API for convertin to Tiny models - for example .tflite)
  • Create inference demo
  • Optimised
  • Bonus --->
    • Deployment for example RPi (with minimal memory - like RPi 3 with 1GB memory and without threading CPU)
    • Documentation on GitHub
    • Video demonstration realtime classification from Camera

Clone Tiny ML Classifier

git clone https://github.com/rvjenya/tiny-ml-classifier.git
or use ssh - [email protected]:rvjenya/tiny-ml-classifier.git
cd tiny-ml-classifier

Up env

Create env with Python3.7

python3.7 -m venv venv

source venv/bin/activate

./install.sh

Dataset

  • Go to (kaggle.com) and download Free dataset from - Here

Transfer and Augmentation

  • Tools for Augmentation data and exporting many formats (roboflow.com)

  • From Scratch Augmentation - use Albumentations

Use TF classification notebook

  • Open on your PC with GPU or Colab (I've attached colab version but you can export it to your GPU env) Open All Collab
https://colab.research.google.com/drive/1hThmbqVvYiMUD5AOORX_TXjLq2XiH-DO?usp=sharing

GPU Setting

Edit > Notebook settings or Runtime > Change runtime type and select GPU as Hardware accelerator

Training

  • Done Models:
    • mobilenet_v2 (will be faster)
    • Inception_v3

For all models I've made FP16 version tflite - you can use it on GPU.

Save TF and TFLite models

Final models .pb and .tflite here You can test my another tflite models with number calibration = 45 / 100 and 200 (If you want, you can try it parameters in TFLiteConverter step)

Training result

My result of training by 10 Epoch:

Image of plt

Test infer

Testing classification:

Image of plt Image of plt

Realtime Inference

DEMO

If you need specific architecture you can use these models:

  • FP32 (Full)
  • FP16 (optimisation for GPU)

for Realtime Camera Demo use:


(venv) python cam-demo.py

for Raspberry Pi Camera demo use

DEMO

python3 classify-cam-rpi.py \
  --model /model/tflite/optimise_to_3Mb/MobileNetV2/model.tflite \
  --labels /model/tflite/optimise_to_3Mb/MobileNetV2/labels.txt

tiny-ml-classifier's People

Contributors

rvjenya avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

rajaramkuberan

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.