Food.AI
Real-time object detection on Android for easy calorie tracking.
Install / Use
/learn @jonathanyin12/Food.AIREADME
Food.AI
Easy calorie tracking using real-time object detection on Android.
<img src="Food.AI_demo.gif" width="300" height="660"/>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.ipynband follow the notebook instructions. -
To use the newly trained model, download
food_detect.tflitefrommodel_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.txtaccordingly. Then, zip theOIDv4_ToolKitfolder and upload it tofood_detection. -
Modify label_map.pbtxt to match the custom classes and upload it to
food_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.tflitefrommodel_checkpoints/tflite_model/and move it to the assets folder in Android Studio. It should replace the existing pretrained model. -
Modify
food_labelmap.txtaccordingly. Make sure to keep???as the first line. -
Modify
calorie_info.txtto reflect the custom classes
Related Skills
proje
Interactive vocabulary learning platform with smart flashcards and spaced repetition for effective language acquisition.
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
