A deep learning based web application that classifies food images and provides nutritional insights. The system uses a MobileNetV2 convolutional neural network to identify food items from images and displays nutrition information and health advice through a simple Flask web interface.
This project combines Computer Vision and Web Development to create an intelligent food analysis system.
Users can upload an image of food, and the system will:
-
Identify the food item using a trained deep learning model
-
Display the prediction confidence
-
Show nutritional information
-
Provide health suggestions like:
- Best time to eat
- Recommended serving
- Who should avoid it
The project demonstrates the use of:
- Deep Learning
- Transfer Learning
- Image Classification
- Flask Web Applications
- 🍕 Classifies 20 different food categories
- 🧠 Uses MobileNetV2 transfer learning
- 📊 Displays prediction confidence
- 🥗 Shows nutritional information
- 💡 Provides health recommendations
- 🌐 Interactive Flask web interface
- 📂 Modular project structure
The model is built using MobileNetV2, a lightweight deep convolutional neural network designed for efficient image classification.
- Efficient for small datasets
- Pretrained on ImageNet
- Faster training
- Good accuracy for image classification tasks
| Component | Description |
|---|---|
| Base Model | MobileNetV2 |
| Input Image Size | 160 × 160 |
| Training Method | Transfer Learning |
| Base Model Training | Frozen |
| Output Layer | Softmax |
| Number of Classes | 20 |
| Optimizer | Adam |
| Loss Function | Sparse Categorical Crossentropy |
- Image Upload
- Image Preprocessing
- Deep Learning Prediction
- Food Classification
- Nutrition Data Display
The model was trained on a custom dataset of 20 food categories.
- Total Classes: 20
- Images per Class: 200 – 500
- Total Images: ~6000+ images
- Image Size: Resized to 160 × 160
- Idli
- Biryani
- Burger
- Cheesecake
- Chole Bhature
- Crispy Chicken
- Donut
- Fries
- Gulab Jamun
- Ice Cream
- Kadai Paneer
- Masala Dosa
- Momos
- Pani Puri
- Pav Bhaji
- Pizza
- Samosa
- Sushi
- Taco
- Vada Pav
data/raw/combined_dataset/
├── idli
├── biryani
├── burger
├── cheesecake
├── chole_bature
├── crispy_chicken
├── donut
├── fries
├── gulab_jamun
├── ice_cream
├── kadai_paneer
├── masala_dosa
├── momos
├── pani_puri
├── pav_bhaji
├── pizza
├── samosa
├── sushi
├── taco
└── vada_pav
Due to GitHub size limitations, the dataset is not included in this repository.
The web application is built using Flask and allows users to interact with the trained model.
- Upload food image
- Model predicts food category
- Nutrition information is displayed
- Health suggestions are shown
food-image-classifier-nutrition
│
├── app.py
├── model_utils.py
├── nutrition.py
├── predict.py
├── requirements.txt
├── README.md
├── .gitignore
│
├── models
│ └── food_classifier.h5
│
├── static
│ ├── css
│ │ └── style.css
│ └── uploads
│
├── templates
│ ├── index.html
│ └── result.html
│
├── notebooks
│ └── train_model.py
│
├── data
│ ├── raw
│ └── processed
│
└── screenshots
Clone the repository:
git clone https://github.com/Nandan-1127/food-image-classifier-nutrition.git
Navigate into the project folder:
cd food-image-classifier-nutrition
Create virtual environment:
python -m venv venv
Activate environment:
venv\Scripts\activate
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Main libraries used in the project:
- TensorFlow
- Flask
- NumPy
- Pillow
- Scikit-learn
- Matplotlib
Install using:
pip install -r requirements.txt
Start the Flask server:
python app.py
Open browser and go to:
http://127.0.0.1:5000
Upload a food image and view prediction results.
Possible enhancements for the project:
- Increase dataset size
- Improve model accuracy
- Add more food categories
- Use real-time nutrition APIs
- Deploy the application online
- Add mobile-friendly UI
- Add calorie tracking system
Nandan Sunkara B.Tech Student Indian Institute of Information Technology Design and Manufacturing Jabalpur(IIITDMJ)
GitHub: https://github.com/Nandan-1127
If you found this project useful, please consider giving it a star ⭐ on GitHub.