FoodSnap.ai is a complete AI-powered food analysis platform that delivers a seamless pipeline — from data collection and intelligent inference to real-time visualization. It combines food image classification, weight estimation, and nutritional analysis into a unified experience with a rich, user-friendly interface.
- Food Classification Model — Classifies Indian food images into predefined categories.
- Weight Prediction Model — Predicts the total weight (mass in grams) of food items from images.
- Inference Server — REST API for real-time predictions using both models.
- FoodSnap Web App — Provides a user-friendly interface and seamless experience.
- Data Scrapper — Python script that executes API calls to extract nutritional data and store it as CSV.
Indian Food Classification (Kaggle)
- Uses MobileNetV2 as a base model with transfer learning.
- Can classify below food items
["burger", "butter_naan", "chai", "chapati", "chole_bhature", "dal_makhani", "dhokla", "fried_rice", "idli", "jalebi", "kaathi_rolls", "kadai_paneer", "kulfi", "masala_dosa", "momos", "paani_puri", "pakode", "pav_bhaji", "pizza", "samosa"].
- Test accuracy : 87.39%
Food Nutrients Dataset (HuggingFace)
- Model is a CNN-based regression network.
- Predicts food weight (total mass in grams) from images.
- RMSE (Root Mean Squared Error) : 131.78434
- R² Score : 0.29374
- Null/Baseline Model Test RMSE : 156.81286
A simple REST API server that takes an image and returns:
- Predicted food name
- Class code
- Estimated weight (grams)
- Confidence score (%)
- Time taken (seconds)
POST /predict
multipart/form-data- Key:
foodImage - Value: food image file (
.jpg,.png, etc.)
{
"food_name": "Masala Dosa",
"food_code": "masala_dosa",
"weight": 322.45,
"confidence": 94.38,
"time_taken": "0.86 seconds"
}
If you encounter any version-related issues with Python & tensorflow, switch to Python 3.11
- Clone the repository
git clone <repo url>
cd Food_Classification_Model- Install dependencies
pip install -r req.txt- Run script
python3.11 server/app.pyA powerful and modern web application built using Laravel and FilamentPHP to manage, visualize, and interact with AI-powered food classification and weight estimation models.
This panel acts as the front-end interface for:
- Uploading food images for inference*
- Displaying classification results and estimated weight
- Showing food nutrition details
- Presenting charts and statistical overviews
- Managing user-submitted entries and food records
- PHP >= 8.2
- Composer
- MySQL or SQLite
- Node.js & npm
- Clone the Repository
git clone <repo url>
cd FoodSnap_App- Install PHP Dependencies
composer install- Create and Configure
.env
cp .env.example .env
php artisan key:generateUpdate your .env file with the correct DB and app settings:
DB_CONNECTION=mysql # or sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
FOOD_DETECTION_API_URL='http://localhost:5000/predict'- Run Migrations
php artisan migrate- Seed Initial Data
php artisan db:seed- Create Storage Link
php artisan storage:link- Serve the App
php artisan serveYour app will now be accessible at: http://localhost:8000
This Python script mimics an API request made by a food website to fetch nutritional data for a list of specified foods. It extracts structured nutritional details and saves them to a CSV file for further analysis or integration.
- Performs API call to a food website.
- Sends food names via POST request to the nutrition endpoint.
- Parses the response to extract:
- Food Name
- Serving Size
- Calories
- Protein
- Carbohydrates
- Fats
- Sugar
- Fibre
- Saves all data to a
.csvfile.
- Clone the repository
git clone <repo url>
cd Data_Scrapper- Install dependencies
pip install -r req.txt- Run script
python scrapper.py