Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍎 Fruit Freshness Detection using Machine Learning

A Machine Learning-based Fruit Freshness Detection system that classifies fruit images as Fresh or Rotten using handcrafted image features and multiple machine learning algorithms. The project compares model performance, automatically selects the best model, and provides predictions through a Streamlit web application.


📌 Features

  • Image preprocessing and handcrafted feature extraction
  • Multiple Machine Learning algorithms
    • Random Forest
    • Decision Tree
    • Logistic Regression
  • Model comparison
  • Automatic best model selection
  • Confusion Matrix visualization
  • Performance evaluation
  • Streamlit web application
  • Best model saved for deployment

🛠 Technologies Used

  • Python
  • OpenCV
  • NumPy
  • Pandas
  • Scikit-learn
  • Matplotlib
  • Streamlit
  • Joblib

📂 Project Structure

Fruit_Freshness_ML_v2/
│
├── dataset/
├── features/
├── model/
│   └── best_model.pkl
├── screenshots/
├── utils/
├── app.py
├── feature_extraction.py
├── train_model.py
├── requirements.txt
├── comparison_results.csv
├── model_comparison.png
├── random_forest_confusion_matrix.png
├── decision_tree_confusion_matrix.png
├── logistic_regression_confusion_matrix.png
└── README.md

🤖 Machine Learning Algorithms

The following algorithms were trained and evaluated:

  • Random Forest
  • Decision Tree
  • Logistic Regression

📊 Model Comparison

Algorithm Accuracy
Random Forest 87.72%
Decision Tree 81.58%
Logistic Regression 73.68%

🏆 Best Model

Random Forest

Accuracy: 87.72%


📈 Evaluation Metrics

  • Accuracy
  • Precision
  • Recall
  • F1-Score
  • Classification Report
  • Confusion Matrix

🖥 Streamlit Application

Run the application using:

streamlit run app.py

or

python -m streamlit run app.py

📦 Install Dependencies

pip install -r requirements.txt

🚀 Train the Model

python train_model.py

📷 Results

Model Comparison

Model Comparison

Random Forest Confusion Matrix

Random Forest Confusion Matrix

Decision Tree Confusion Matrix

Decision Tree Confusion matrix

Logistic Regression Confusion Matrix

Logistic Regression Confusion Matrix

👩‍💻 Author

Ayesha Shafique

GitHub: https://github.com/ayeshacs7


📄 License

This project is developed for educational and portfolio purposes.

About

Machine Learning-based Fruit Freshness Detection using handcrafted image features with Random Forest, Decision Tree, and Logistic Regression. Includes model comparison, confusion matrices, best model selection, and Streamlit deployment.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages