Smart Sorting: Transfer Learning for
Identifying Rotten Fruits and Vegetables
Figure: Web App Output - Prediction of Rotten Fruit
Abstract
In the agriculture and food industry, identifying spoiled produce is essential to prevent
contamination and reduce waste. Manual sorting of fruits is time-consuming, inconsistent,
and prone to human error. This project proposes a smart solution using deep learning and
transfer learning to automatically classify fruits as fresh or rotten. A MobileNetV2-based
model is trained and deployed using a Flask web application to provide real-time
predictions.
Objectives
- Develop a model that classifies fruits as fresh or rotten.
- Reduce human involvement in quality checking.
- Provide a real-time prediction interface using a web app.
- Use Transfer Learning for high performance with fewer resources.
Technologies Used
• Python
• TensorFlow/Keras
• MobileNetV2
• Flask
• HTML/CSS
• Google Colab
• Pillow
Dataset
The dataset used contains labeled images of various fruits categorized into two classes:
fresh and rotten. It includes common fruits like apples, bananas, and oranges. The dataset is
split into training, validation, and test sets (70-20-10).
Methodology
1. Data Preprocessing: Images were resized to 224x224 and normalized.
2. Data Augmentation: Applied flips, rotations, and zooms.
3. Model Building: MobileNetV2 with custom dense layers.
4. Model Training: Trained with validation monitoring.
5. Deployment: Flask web app with image upload and prediction.
Results
The model achieved over 93% accuracy on test data. The web app provides fast, real-time
predictions and can classify common fruits accurately.
Conclusion
This project demonstrates the effective use of transfer learning for automating fruit quality
detection. The app reduces human labor and improves consistency in fruit sorting systems.
It is scalable and can be extended to real-time camera-based systems for industry use.