Sid Sathi Richard Zorger Jonathan Deng
Our group would like to create an application that allows people to take pictures of food and see how this food would affect their progress towards nutrition and diet goals. Using a pre-trained image classifier, the USDA REST API for nutrition information, and files on nutrition guidelines provided by the USDA, we can make a prediction what food item the user took a picture of, and show how eating the food would affect their health goals.
-
User uploads an image to the
/data
directory of this project. (In a mobile application, the client would have access to the camera API and handle this) -
A training image set is uploaded to the Microsoft Azure Custom Vision API, where a pre-existing classifier is trained on tagged food images. (In a production application this training step would occur asynchronously prior to the user uploading their photo)
-
The user uploaded image is classified by the model running on Azure, which returns a String of the food name, i.e. "banana" or "apple"
-
The search string is use to query the USDA Food Database REST API for nutrition details about the food.
-
The user enters nutrition and health goals and information about their age, sex, and activity level. This allows the program to build a user profile.
-
The program references USDA guidelines (stored in csv files in this project) to look up specific requirements based on the user profile
-
The program compares nutrition information describing the uploaded food image and compares it to personalized guidelines to inform a user how eating that food affects them.
This project uses Maven as a build tool to import dependency libraries. It needs to be imported into the IDE as a Maven project to delegate build and run tasks to Maven.
This project depends on 2 external APIs, which require keys:
- Microsoft Custom Vision: key is hardcoded in class representing the API access (don't worry it's a free account level test key!)
- USDA Database API: key needs to be pasted in
apiKey.txt
in the root level. (Delete"DEMO_KEY"
string in that file.)
To get a USDA API Key go to this page and click "Sign Up Now".
The main class that orchestrates the entire user flow is NutritionHelper.java
.
Run this project by running NutritionHelper.main
Unit tests for this project are contained in the test
directory
Sometimes the Microsoft Custom Vision API refuses to create a project with the same name as one previously. Change this String to something that you haven't used before to fix this problem