Skip to content

πŸ₯˜ MobileNetV2-FoodClassifier achieves 93.14% accuracy in image classification with web-scraped food images, offering deployment guidance for local and TensorFlow Lite conversion for mobile and edge devices.

License

Notifications You must be signed in to change notification settings

Pramit726/MobileNetV2-FoodClassifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MobileNetV2-FoodClassifier

This project utilizes a dataset acquired via web scraping from Unsplash, comprising diverse high-quality food ingredient images.

Employing transfer learning with MobileNet V2 for feature extraction, fine-tuning, and hyperparameter tuning, various models are trained for image classification.

The selected model is converted into TensorFlow Lite format for efficient deployment on mobile and edge devices, ensuring practical application in real-world scenarios.

Model Predictions

preview

Table of Contents

πŸƒ Run Locally

  1. Clone this repository using the following command.
  git clone https://github.com/Pramit726/MobileNetV2-FoodClassifier.git
  1. Create a new python virtual environment.
  python -m venv your-envirorment-name
  1. Activate your created python virtual environment.
  your-envirorment-name\Scripts\activate
  1. Install the required dependencies.
  pip install -r requirements.txt
  1. Now you are all set.

πŸ“¦ Dataset

The dataset is collected via web scrapping through Unsplash.

If you want to use the exact dataset as ours you can download from here:

https://drive.google.com/file/d/1JsY1u6MIEwGQN6ilFBm3a1w18HmA9nfj/view?usp=drive_link

πŸ—οΈ Model Architecture

  • Base model: MobileNet V2, known for its efficiency and accuracy.
  • Feature extraction: Utilized MobileNet V2's pre-trained weights on imagenet to capture key features from food ingredient images.
  • Fine-tuning: Modified MobileNet V2's architecture, focusing on fine-tuning parameters from block 6 onwards to optimize performance for the food ingredient dataset.
  • Model architecture diagram:

model

🧠 Hyperparameter Optimization

To enhance model performance, we conducted hyperparameter optimization, specifically targeting learning rates. We experimented with three different values: 10^-2, 10^-3, and 10^-4, across three epochs. This process allowed us to fine-tune our model's training process and achieve optimal results.

Following illustration shows the trial information, learning rates and respective maximum validation accuracy conducted using Keras Tuner random search:

Screenshot 2024-12-20 213341

πŸ“Š Evaluation

  • Evaluation conducted on test data.

  • Achieved accuracy: 93.14%.

  • Confusion matrix: Confusion_matrix

πŸ“± Model Deployment with TensorFlow Lite

To deploy our MobileNetV2-FoodClassifier on mobile and edge devices, we converted the trained TensorFlow model to TensorFlow Lite format. The converted model, optimized for efficiency, weighs approximately 11.9 MB. TensorFlow Lite ensures efficient on-device inference with minimal latency, making our model practical for real-world applications. For detailed deployment instructions, consult the TensorFlow Lite documentation.

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.

πŸ› οΈ Dependencies

  • BeautifulSoup
  • Keras Tuner
  • Matplotlib
  • NumPy
  • Pandas
  • Pillow
  • Requests
  • Scikit-Learn
  • Seaborn
  • TensorFlow

πŸ§‘β€πŸ’» Author

Pramit De

Β© 2024 MobileNetV2-FoodClassifier by Pramit De

About

πŸ₯˜ MobileNetV2-FoodClassifier achieves 93.14% accuracy in image classification with web-scraped food images, offering deployment guidance for local and TensorFlow Lite conversion for mobile and edge devices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published