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.
- Run Locally
- Dataset
- Model Architecture
- Hyperparameter Optimization
- Evaluation
- Model Deployment with TensorFlow Lite
- Dependencies
- License
- Author
- Contributors
- Clone this repository using the following command.
git clone https://github.com/Deepmalya-Rakshit/MobileNetV2-FoodClassifier.git
- Create a new python virtual environment.
python -m venv your-envirorment-name
- Activate your created python virtual environment.
your-envirorment-name\Scripts\activate
- Install the required dependencies.
pip install -r requirements.txt
- Now you are all set.
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
- 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:
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:
- Evaluation conducted on test data.
- Achieved accuracy: 93.14%.
- Classification report:
- Confusion matrix:
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.
Distributed under the MIT License. See LICENSE
for more information.
- BeautifulSoup
- Keras Tuner
- Matplotlib
- NumPy
- Pandas
- Pillow
- Requests
- Scikit-Learn
- Seaborn
- TensorFlow
- deepmalyarakshit@gmail.com
- Department of CSE, Techno International New Town, West Bengal, India
-
Department of CSE, Techno International New Town, West Bengal, India
© 2024 MobileNetV2-FoodClassifier by Deepmalya Rakshit