Update README.md
Browse files# CNN Waste Classification - PyTorch & OpenCV
## Model Overview
This model is a Convolutional Neural Network (CNN) designed for image-based waste classification. It predicts one of 10 waste categories using a single static image or a real-time webcam feed. The model is implemented in PyTorch, uses OpenCV for image handling, and is intended for educational, research, or smart-recycling prototype purposes.
* **GitHub Repository:** [cnn-waste-classification-opencv-pytorch](https://github.com/gokulseetharaman/cnn-waste-classification-opencv-pytorch)
* **Dataset Source:** [Kaggle Garbage Classification Dataset](https://www.kaggle.com/datasets/mostafaabla/garbage-classification)
## How to Use
**Download the model weights (`saved models/best_model.pth`) and `object-detection.py` from this repository or the [GitHub project](https://github.com/gokulseetharaman/cnn-waste-classification-opencv-pytorch).**
Run predictions from webcam or an image using:
```bash
python object-detection.py
```
**Sample usage in `object-detection.py`:**
```python
import cv2
from object-detection import WebcamPredictor
model_path = "best_model.pth"
predictor = WebcamPredictor(model_path)
predictor.start_webcam() # For webcam prediction
# or
predictor.predict_sample_image("path_to_sample_image.jpg") # For single image
```
*The script supports both webcam feed and static images. Class names and instructions are embedded in the code.*
## Model Details
* **Classes**: Battery, Cardboard, Clothes, Food Waste, Glass, Metal, Paper, Plastic, Shoes, Trash
* **Input size**: 224x224 RGB
* **Architecture**: 6 convolutional layers with batch normalization, ReLU, max pooling, dropout, and two fully connected layers.
* **Data Augmentation**: Includes random crop, flips, rotation, color jitter, affine transforms.
## Performance
* **Validation Accuracy**: 89.5% on the validation set.
* **Per-Class F1-scores**: Most classes achieve above 0.85, with detailed precision/recall in the [GitHub README](https://github.com/gokulseetharaman/cnn-waste-classification-opencv-pytorch#results).
* **Confusion Matrix**: Available in the GitHub repo for further analysis.
## Citation
If you use this model, please cite or reference:
```
Gokul Seetharaman. (2025). CNN Waste Classification with OpenCV and PyTorch.
https://github.com/gokulseetharaman/cnn-waste-classification-opencv-pytorch
```
## Author
**Gokul Seetharaman**
For questions or contributions, see the [GitHub Issues](https://github.com/gokulseetharaman/cnn-waste-classification-opencv-pytorch/issues).
@@ -1,3 +1,11 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: image-classification
|
6 |
+
tags:
|
7 |
+
- CNN
|
8 |
+
- computer-vision
|
9 |
+
- image-classificaion
|
10 |
+
- waste-classification
|
11 |
+
---
|