An intelligent AI-powered waste classification system that helps users sort household waste by analyzing images of waste items. The system uses deep learning (ResNet50-based transfer learning) to classify waste into 12 categories with high accuracy and provides explainable classification results through an intuitive graphical interface.
- Image-based Waste Classification: Automatically classify household waste into 12 categories (batteries, biological waste, glass types, cardboard, clothes, metal, paper, plastic, shoes, and general trash)
- PyQt5 GUI Interface: User-friendly graphical application for real-time image analysis
- Transfer Learning Architecture: ResNet50 backbone with fine-tuning for optimal accuracy
- Multi-stage Training: Warmup → Fine-tuning → Full training pipeline for robust model
- Explainable Results: Displays confidence scores for each waste category
- Bilingual Support: English and Russian labels (интерфейс поддерживает русский язык)
- Data Augmentation: Robust training with rotation, shifts, zoom, and brightness adjustments
- Class Weighting: Handles imbalanced datasets effectively
Wastewise/
├── README.md # Project documentation
├── LICENSE # License file
├── requirements.txt # Python dependencies
├── config.py # Configuration parameters
│
├── model.py # ResNet50-based model architecture
├── train.py # Training pipeline (3-stage training)
├── evaluate.py # Model evaluation metrics
│
├── dataset.py # Data loading and augmentation utilities
├── interface.py # PyQt5 GUI application
│
├── data/
│ └── download_dataset.py # Kaggle dataset downloader
│
├── utils/
│ └── callbacks.py # Keras callbacks (checkpoint, early stopping, LR scheduling)
│
├── models/ # Trained model weights (generated during training)
│ └── best_model.h5 # Best model checkpoint (downloaded from Google Drive)
│
├── test_image/ # Sample images for testing
│ └── [test images]
│
└── __pycache__/ # Python cache files
The model classifies waste into the following categories:
- Battery (Батарейки) - Electrical batteries and accumulators
- Biological (Органика) - Organic waste, food scraps
- Brown Glass (Коричневое стекло) - Brown/amber glass bottles
- Cardboard (Картон) - Cardboard boxes and packaging
- Clothes (Одежда) - Textile clothing and fabrics
- Green Glass (Зелёное стекло) - Green glass bottles
- Metal (Металл) - Metal containers and items
- Paper (Бумага) - Paper and cardstock
- Plastic (Пластик) - Plastic containers and items
- Shoes (Обувь) - Footwear
- Trash (Прочее) - General waste and mixed materials
- White Glass (Белое стекло) - Clear/white glass bottles
- Python 3.8 or higher
- pip (Python package manager)
git clone https://github.com/bakytbekovJ27/Wastewise.git
cd Wastewisepython -m venv venv
# Windows (PowerShell):
venv\Scripts\activate.bat
# Linux / macOS:
source venv/bin/activate
pip install -r requirements.txtThis will install:
- TensorFlow (≥2.16.2) - Deep learning framework
- Keras (≥3.11.3) - Neural network API
- NumPy (≥1.26.4) - Numerical computing
- Scikit-learn (≥1.6.1) - Machine learning utilities
- Pillow (≥11.3.0) - Image processing
- PyQt5 (≥5.15.11) - GUI framework
- kagglehub (≥0.4.1) - Kaggle dataset downloader
The trained model is available on Google Drive due to size constraints:
- Download the model from: Google Drive Link
- Place the downloaded
best_model.h5file in themodels/directory:Wastewise/models/best_model.h5
python interface.pyThis launches the PyQt5 graphical interface where you can:
- Load an image from your computer
- View the classified waste category
- See confidence scores for all 12 categories
- Display the image preview
python train.pyThe training process:
- Automatically downloads the garbage classification dataset from Kaggle
- Stage 1 - Warmup (10 epochs): Freezes ResNet50 backbone, trains only the classification head
- Learning rate: 1e-3
- Stage 2 - Fine-tuning (40 epochs): Unfreezes last 50 layers of ResNet50
- Learning rate: 1e-4
- Includes ModelCheckpoint, EarlyStopping, and ReduceLROnPlateau callbacks
- Stage 3 - Full Training (20 epochs): Trains all layers end-to-end
- Learning rate: 1e-5
Trained model checkpoints are saved to models/best_model.h5
python evaluate.pyGenerates:
- Classification report (precision, recall, F1-score for each class)
- Confusion matrix
- Per-class performance metrics
Edit config.py to adjust training parameters:
IMG_SIZE = (224, 224) # Input image size for ResNet50
BATCH_SIZE = 32 # Training batch size
VAL_SPLIT = 0.2 # Validation split ratio (20%)
WARMUP_EPOCHS = 10 # Stage 1 epochs
FINETUNE_EPOCHS = 40 # Stage 2 epochs
FULL_EPOCHS = 20 # Stage 3 epochs
LR_WARMUP = 1e-3 # Warmup learning rate
LR_FINETUNE = 1e-4 # Fine-tuning learning rate
LR_FULL = 1e-5 # Full training learning rate
MODEL_DIR = "outputs" # Output directory for models- Base Network: ResNet50 pre-trained on ImageNet
- Input: 224×224 RGB images
- Output: 12-class probability distribution (softmax)
ResNet50 backbone
↓
GlobalAveragePooling2D
↓
BatchNormalization
↓
Dropout (0.5)
↓
Dense(512, relu) + L2 regularization
↓
BatchNormalization
↓
Dropout (0.3)
↓
Dense(12, softmax) [output]
- Transfer Learning: Leverages pre-trained ImageNet weights
- Progressive Unfreezing: Gradually trains deeper layers
- Data Augmentation: Rotation, shifts, zoom, brightness adjustments
- Class Weighting: Handles imbalanced waste categories
- Regularization: L2 weight penalty to prevent overfitting
- Early Stopping: Prevents training on plateau with patience=10
The project uses the Garbage Classification Dataset from Kaggle:
- Source: mostafaabla/garbage-classification
- Classes: 12 waste categories
- Automatic Download: Handled by
data/download_dataset.pyduring training
- CPU: 4-core processor
- RAM: 8 GB
- Storage: 5 GB (for dataset and models)
- GPU: NVIDIA GPU with CUDA support (e.g., GTX 1060 or better)
- RAM: 16 GB
- Storage: 10+ GB SSD
To enable GPU acceleration for training:
pip install tensorflow[and-cuda]Solution: Download the pre-trained model from Google Drive and place it in models/best_model.h5
Solution: Reduce BATCH_SIZE in config.py (try 16 or 8)
Solution: Ensure GPU is available (nvidia-smi to check) or reduce dataset size
Solution: Ensure kagglehub is properly configured with Kaggle API credentials
- Test Set Accuracy: ~97.5%
- Validation Set Accuracy: ~98.0%
The model demonstrates stable convergence with excellent performance:
- Epoch Range: 70 epochs total (10 warmup + 40 fine-tuning + 20 full training)
- Model Accuracy: Reaches ~98% at convergence
- Model Loss: Converges to ~0.1
- Validation Performance: Consistent improvement with minimal overfitting
- Training Stability: Smooth curves indicate robust optimization
Classification Results by Waste Category:
| Category | True Positives | Accuracy | Notes |
|---|---|---|---|
| Battery (Батарейки) | 181 | 98.4% | Excellent recognition |
| Biological (Органика) | 192 | 98.5% | Highly accurate |
| Brown Glass (Коричневое стекло) | 114 | 97.4% | Good performance |
| Cardboard (Картон) | 162 | 93.6% | Some confusion with paper |
| Clothes (Одежда) | 1054 | 99.1% | Outstanding accuracy |
| Green Glass (Зелёное стекло) | 118 | 96.7% | Solid performance |
| Metal (Металл) | 139 | 90.9% | Minor misclassifications |
| Paper (Бумага) | 202 | 96.7% | Good differentiation |
| Plastic (Пластик) | 151 | 88.3% | Some overlap with other materials |
| Shoes (Обувь) | 391 | 99.0% | Excellent recognition |
| Trash (Прочее) | 137 | 95.8% | Reliable classification |
| White Glass (Белое стекло) | 127 | 92.2% | Good accuracy |
Key Observations:
- Clothes category shows exceptional accuracy (99.1%) with 1054 true positives
- Shoes are also highly accurate (99.0%) with 391 correct classifications
- Glass types show good differentiation despite similar visual properties
- Slight confusion between cardboard and paper is expected due to material similarity
- Overall model demonstrates robust waste classification across all categories
- Inference Time: ~100-200ms per image (CPU)
- Throughput: 5-10 images per second (single CPU core)
- GPU Inference: ~50-100ms per image (with NVIDIA GPU)
This project is licensed under the terms specified in the LICENSE file.
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch
- Commit your improvements
- Submit a pull request
- Support for batch processing multiple images
- Export to ONNX format for mobile deployment
- Add uncertainty estimation for low-confidence predictions
- Web interface (Flask/FastAPI)
- Model quantization for edge devices
- Integration with waste management systems
- ResNet50 architecture from TensorFlow/Keras
- Garbage classification dataset from Kaggle (mostafaabla)
- PyQt5 for the GUI framework

