Skip to content

Commit

Permalink
Merge pull request UppuluriKalyani#355 from mehul-m-prajapati/food_cl…
Browse files Browse the repository at this point in the history
…assify

Added food classification
  • Loading branch information
UppuluriKalyani authored Oct 15, 2024
2 parents 9a9ca02 + 6c5505c commit 7e817fa
Show file tree
Hide file tree
Showing 2 changed files with 422 additions and 0 deletions.
67 changes: 67 additions & 0 deletions Computer Vision/Food Classification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Food Image Classification with TensorFlow
=========================================

This project demonstrates food image classification using TensorFlow and a pre-trained MobileNetV2 model. Users can upload an image of food and the model classifies it as either "pizza" or "burger."

Table of Contents
-----------------

* [Installation](#installation)
* [Usage](#usage)
* [Code Breakdown](#code-breakdown)
* [Possible Enhancements](#possible-enhancements)
* [Example Use Case](#example-use-case)
* [Requirements](#requirements)

Installation
------------

To install the necessary libraries, run the following command:

!pip install tensorflow

Usage
-----

1. Upload an image of food (either pizza or burger) using the provided file upload feature in Google Colab.
2. The model will preprocess the image and make a prediction.
3. The predicted class and confidence score will be displayed.

Code Breakdown
--------------

1. **Library Installation**: Installs TensorFlow, NumPy, and Matplotlib.
2. **Loading Pre-trained Model**:
* Loads the MobileNetV2 model pre-trained on the ImageNet dataset.
* Freezes the base model's weights.
3. **Model Creation**:
* Builds a custom model with a global average pooling layer and a dense output layer using sigmoid activation for binary classification.
4. **Model Compilation**: Compiles the model with the Adam optimizer and binary cross-entropy loss.
5. **Image Upload**: Allows users to upload images for classification.
6. **Image Preprocessing**: Resizes the image, converts it to an array, and preprocesses it.
7. **Making Predictions**: Classifies the uploaded image and outputs the predicted class and confidence score.

Possible Enhancements
---------------------

* **Multi-Class Classification**: Extend to classify more food items.
* **Data Augmentation**: Implement techniques to improve model accuracy.
* **Web Interface**: Create a user-friendly web application for easy image uploads.

Example Use Case
----------------

This food image classification tool can be used for food identification, dietary tracking, and restaurant menu automation, allowing users to quickly classify and log their meals.

Requirements
------------

* TensorFlow
* NumPy
* Matplotlib

### How to Run

1. Install the required libraries.
2. Upload an image of food.
3. Run the code to see the classification result and confidence score.
355 changes: 355 additions & 0 deletions Computer Vision/Food Classification/food_classification.ipynb

Large diffs are not rendered by default.

0 comments on commit 7e817fa

Please sign in to comment.