An end-to-end food classification application built with PyTorch, Flask, and a modern web interface.
Welcome to FoodVision AI, a project that demonstrates the entire machine learning lifecycle from model training and optimization to global deployment. This application can accurately classify 101 different food categories from any uploaded image.
- 101 Food Categories: Classifies a wide variety of dishes from the challenging Food-101 dataset.
- Optimized for Mobile: A lightweight frontend with client-side image resizing for a seamless experience on any device.
- High-Performance API: A Flask backend that serves a quantized PyTorch model, ensuring fast and efficient predictions.
- Robust Deployment: Configured for stable deployment on cloud platforms like Render, handling large model files effectively.
- Backend: Python, Flask, Gunicorn
- Machine Learning: PyTorch, torchvision
- Model Optimization: Quantization for a 4x size reduction
- Frontend: HTML, CSS, JavaScript
- Deployment: Render
- Python 3.8+
pipandgit
git clone https://github.com/Raja-89/FoodVision-AI.git
cd FoodVision-AI-
Create a Virtual Environment:
python -m venv venv source venv/bin/activate # On macOS/Linux .\venv\Scripts\activate # On Windows
-
Install Dependencies:
pip install -r requirements.txt
-
Get the Model: Our model is too large for a standard Git repository. Run the
app.pyfile, and it will automatically download the necessary model file from a public URL. -
Run the Flask App:
python app.py
The application will be available at http://127.0.0.1:5000.
.
├── app.py # Flask backend, API logic, and model handling
├── requirements.txt # Python dependencies
├── Procfile # Render/Heroku deployment command
├── templates/
│ └── index.html # Frontend web interface (HTML/CSS/JS)
├── food_classifier_model.pth # The original PyTorch model
├── food_classifier_model_quantized.pth # The optimized, smaller model
├── .gitignore # Git ignore file
└── README.md # This file!