A machine learning web app that classifies trash into **plastic, paper, glass, or metal** using classical ML techniques (no deep learning).
Deployed with Flask on Render. Clone the repo:
git clone https://github.com/ojayballer/Trash-image-classifier.git
cd Trash-image-classifierSet up a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # WindowsInstall dependencies:
pip install -r requirements.txtRun the Flask app:
python app.pyOpen in browser:
👉 http://127.0.0.1:5000/👉 Try it online: [Trash Classifier on Render](https://trash-image-classifier.onrender.com)
Upload a **.jpg image** of trash (e.g., bottle, newspaper, soda can) and the model will predict its category in real time✅ 76% accuracy (benchmark was 67%)
✅ Can detect multiple items in one image (e.g., paper + metal together)
✅ Fully deployed as a Flask web app on Render
✅ Robust preprocessing and optimized feature extraction Language: Python
Libraries: scikit-learn, scikit-image, NumPy, Pillow, Flask
Dataset: TrashNet & similar Kaggle datasets
Deployment: Flask + RenderData Preprocessing
Converted all images to grayscale
Resized to 64×64
Normalized pixel values
Feature Engineering
HOG: captured edges and orientations
LBP: captured textures
GLCM: captured spatial patterns (contrast, homogeneity, correlation)
Final feature vector = HOG + LBP + GLCM
Model Training
Tried SVM, Random Forest, Logistic Regression
Selected the best performing model
Saved with joblib
Evaluation
Achieved 76% accuracy (benchmark was 67%)
Works with images containing multiple objectsWaste management is a global challenge.
This project shows how AI — even classical ML without deep learning — can help automate recycling systems by detecting and sorting waste more efficiently.Inspired by 20+ research papers on trash classification
Dataset: Kaggle TrashNet
Thanks to the open-source community 💙This project is licensed under the MIT License — free to use and modify
