This project classifies images of waste into six categories using a custom-built Convolutional Neural Network (CNN). It's designed to help with smarter waste management by automatically identifying the type of waste — whether it's glass, metal, paper, plastic, cardboard, or just trash.
- Trains a CNN model from scratch
- Uses image augmentation for better generalization.
- Applies class balancing to handle unequal dataset classes.
- Evaluates with a confusion matrix and accuracy graphs.
- Saves the best model automatically.
- check real-time classification using your webcam.
- Python
- TensorFlow / Keras
- NumPy, Matplotlib, Seaborn
- OpenCV (for real-time classification)
- FastAPI
The dataset should be organized with one folder per class (e.g., cardboard, glass, metal, paper, plastic, trash), all under a main dataset-resized/ directory.
-
Clone this repo:
git clone https://github.com/yourusername/WasteGen-waste-segregation.git cd waste-classifier-cnn -
Make sure your dataset is in
dataset_waste/. -
Run the training script:
python train_and_model.py
The model will be saved as best_model.h5 after training.
Once you have the trained model, you can try classifying waste in real time using your webcam:
python realtime_classifier.py- Training & validation accuracy plots
- Confusion matrix to visualize predictions
- Label displayed live on webcam feed
- Deploy as a web app using Streamlit or Flask
- Add support for mobile camera input
- Connect to a smart dustbin or IoT system
Feel free to fork the repo and open a pull request if you want to improve anything — from better CNN architecture to UI features!