Point a camera at a piece of waste and the model tells you what it is.
9 categories, 92.99% test accuracy, photo upload and live webcam.
A college deep learning project built by a team of 7. We trained a baseline CNN and a transfer learning model on the RealWaste dataset (4,752 images, 9 classes), improved the better model through four separate experiments, and wrapped the result in a Streamlit app with live webcam classification.
The project was presented and defended live.
| Model | Test accuracy | Macro-F1 |
|---|---|---|
| Baseline CNN (4 conv blocks, trained from scratch) | 78.54% | 78.61% |
| MobileNetV2, fine-tuned + improved (final) | 92.99% | 0.9359 |
- Strongest classes: Cardboard, Textile Trash and Vegetation (F1 about 0.96 to 0.98).
- Weakest class: Miscellaneous Trash (F1 0.8707).
- Most common mistake: Plastic and Metal get mixed up, though far less than in earlier runs.
- Before test-time augmentation, two full training runs landed at 92.85% and 92.43%. We did not seed PyTorch, so expect around ±0.4% between runs.
Data. RealWaste, 4,752 images across 9 classes. Preprocessing keeps the aspect ratio when resizing, normalizes separately for the baseline and the pretrained model, and checks for corrupted files.
Models.
- Baseline CNN: 4 conv blocks (32 / 64 / 128 / 256 filters), a dense layer, dropout.
- MobileNetV2 (ImageNet pretrained), trained in two phases: first only the new classification head, then the last layers unfrozen at a low learning rate.
Model improvement. Four teammates each tested one idea on MobileNetV2, and we combined the winners:
| Idea | What we found |
|---|---|
| How many layers to unfreeze | Deeper unfreezing helped; we unfreeze whole blocks (features[-11:]) so Conv and BatchNorm layers stay paired |
| Optimizer, LR schedule, dropout | Tuned values with ReduceLROnPlateau gave a clear gain |
| Loss function | Label Smoothing beat Focal Loss |
| Test-time augmentation | 5-crop averaging at inference raised test accuracy by about 1 point |
Built with Streamlit, with three tabs:
- Classify Image: upload a photo and see a confidence bar for every class.
- Live Camera: webcam classification through OpenCV.
- Model Specs: details about the model.
There's also a light and dark theme. The checkpoint path is a text field in the app, so it runs on any laptop without editing code.
git clone <YOUR-REPO-LINK>
cd <repo-folder>
pip install torch torchvision streamlit opencv-python pillow
streamlit run app.pyPut the trained checkpoint (task7_combined.pth) next to app.py, or paste its path into the app's sidebar.
- The model learned from RealWaste, which is photos of waste at a sorting facility. Clean product photos (a glass tumbler on a white background, for example) can be misclassified. That's a domain gap in the data, not a bug in the app.
- The webcam tab classifies short bursts of frames, not a continuous video stream.
streamlit-webrtcwould be the upgrade. - Plastic, Metal and Glass remain the hardest classes to separate.
Team of 7, built at Government Polytechnic Mumbai.
| Yashmit Katekar (team lead) | Dataset and preprocessing, CNN research, baseline model, loss function experiment, model improvement |
| Mukta (team lead) | Transfer learning architecture research, unfreeze depth experiment |
| Shreeyans | Optimizer, scheduler and dropout tuning |
| Rudra | Test-time augmentation |
Dataset: RealWaste, from the UCI Machine Learning Repository.