Skip to content

This project involves developing a Convolutional Neural Network (CNN) model for classifying food images using the Food101 dataset. Utilizing transfer learning with EfficientNetV2B0 as the base model, the goal is to achieve high accuracy in classifying images into 101 different food categories. The model is fine-tuned to reach an accuracy of 81%.

License

Notifications You must be signed in to change notification settings

altamashajaz/Food-Vision-CNN-101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Food Classification with Transfer Learning using EfficientNetV2B0

This repository contains a Convolutional Neural Network (CNN) model for food classification using the Food101 dataset. The model leverages transfer learning with EfficientNetV2B0 as the base model. The goal of this project is to surpass the accuracy reported in the reference experiment paper.

Table of Contents

Introduction

Food classification is a challenging task due to the large variety of food types and the visual similarity between certain classes. This project uses transfer learning with EfficientNetV2B0 to build a high-accuracy food classification model. The goal is to achieve and surpass the accuracy reported in the experiment paper link to paper.

Dataset

The Food101 dataset consists of 101,000 images of food divided into 101 categories, with 750 training images and 250 test images per class. The dataset can be directly loaded from TensorFlow Datasets.

Model Architecture

The base model used is EfficientNetV2B0, a state-of-the-art CNN architecture known for its efficiency and performance. The pre-trained weights on ImageNet are used for transfer learning. The model architecture is modified by adding a few fully connected layers on top of the base model for the food classification task.

Training and Fine-Tuning

1. Transfer Learning: The EfficientNetV2B0 base model is used with pre-trained weights, and only the top layers are trained initially.
2. Fine-Tuning: After achieving a satisfactory baseline accuracy, the entire model is fine-tuned by unfreezing the base model and training with a lower learning rate.

Steps:

  1. Load the Food101 dataset.
  2. Preprocess the images and labels.
  3. Build the model using EfficientNetV2B0 as the base.
  4. Compile the model with appropriate loss function and optimizer.
  5. Train the top layers.
  6. Fine-tune the entire model.
  7. Evaluate the model on the test set.

Results

The model achieved an accuracy of 81% on the Food101 dataset, surpassing the accuracy reported in the reference experiment paper.

Tools Used

  • Google Colab
  • TensorFlow
  • NumPy
  • Pandas
  • Matplotlib

References

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Fine-Tuned Model Access

The fine-tuned model weights can be accessed and downloaded from the following link:

Download Fine-Tuned Model

Loading Fine-Tuned Model

To load the fine-tuned model in your Python code, you can use the tf.keras.models.load_model function. First, make sure TensorFlow is installed:

pip install tensorflow

Then, use the following code snippet to load the model:

import tensorflow as tf

Replace 'path_to_your_model_weights' with the actual path where you saved the model weights model = tf.keras.models.load_model('path_to_your_model_weights')

Now you can use the model object for inference on new images.

About

This project involves developing a Convolutional Neural Network (CNN) model for classifying food images using the Food101 dataset. Utilizing transfer learning with EfficientNetV2B0 as the base model, the goal is to achieve high accuracy in classifying images into 101 different food categories. The model is fine-tuned to reach an accuracy of 81%.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published