This repository contains source code for Telegram bot, which can detect and analyze food objects by photo. It's main function is to print nutrition facts about a dish in response to your photo. Here is an example:
- YOLO v3 is used as a detector pretrained on Open Images v4 dataset (500 classes).
- Model is converted to TensorFlow/Keras for ease of use.
- Processing of one images on CPU takes 5-6 seconds.
- As postprocessing of YOLO output takes a long time (~30-40 seconds for one image on local machine) for all 500 classes I selected only food-related classes (59 classes) information from entire output tensor and sent it to postprocessing block. This procedure decreases processing time to 5-6 seconds per image.
- YOLO detector is not very accurate, so replacing it with another one (for example, from R-CNN family) or training on larger and more diverst dataset could improve its performance. But excellent performance was not my goal in this pet-project.
- Download this repo in your working directory.
- Type in command line pip install -r requirements.txt from calorie_counter directory.
- Download pretrained weights for YOLO v3 from this link.
- Convert Darknet model to Keras using this link.
- Put converted model with .h5 extention in calorie_counter/bot/model folder.
- From command line or IDE run main.py file.
- Done! Your bot is working!