forked from UppuluriKalyani/ML-Nexus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request UppuluriKalyani#355 from mehul-m-prajapati/food_cl…
…assify Added food classification
- Loading branch information
Showing
2 changed files
with
422 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
355
Computer Vision/Food Classification/food_classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.