Giter Club home page Giter Club logo

object_detection's Introduction

Food.AI

Easy calorie tracking using real-time object detection on Android.

Overview

This demo app allows users to quickly obtain calorie information using their camera. The object detection model utilizes a MobileNetV2 SSD architecture that was trained using transfer learning on 15 unique food classes from the Open Images v4 dataset.

Note: this app was built and modified from the TensorFlow Lite Object Detection Android Demo.

Usage

To build the pretrained demo in Android Studio, select "Open an existing Android Studio project" and navigate to the Food.AI/Food.AI directory. Then, connect a device and press 'run'.

Tip: to view additional details (e.g. detection confidence, inference time, etc.) when detecting foods, press a volume key.

Model training

  • Create a directory in Google Drive called food_detection.

  • Add the training dataset and label_map.pbtxt to food_detection.

  • Open FoodAI_train.ipynb and follow the notebook instructions.

  • To use the newly trained model, download food_detect.tflite from model_checkpoints/tflite_model/ and move it to the assets folder in Android Studio. It should replace the existing pretrained model.

Custom food classes

Preparing the data

  • Create a directory in Google Drive called food_detection.

  • Use OIDv4 ToolKit to download images and bounding box annotations for the desired classes.

  • Change the classes in OIDv4_ToolKit/classes.txt accordingly. Then, zip the OIDv4_ToolKit folder and upload it to food_detection.

  • Modify label_map.pbtxt to match the custom classes and upload it tofood_detection.

Training the model

  • When generating the TFRecords, set the flags to point to the location of the dataset.

  • Edit the number of classes in the model configuration file (s = re.sub('90', 'NUM_CUSTOM_CLASSES', s)).

Adding the model to Android Studio

  • Download food_detect.tflite from model_checkpoints/tflite_model/ and move it to the assets folder in Android Studio. It should replace the existing pretrained model.

  • Modify food_labelmap.txt accordingly. Make sure to keep ??? as the first line.

  • Modify calorie_info.txt to reflect the custom classes

object_detection's People

Contributors

jonathanyin12 avatar

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.