Urban waste management has always been a challenging problem due to the increasingly abundant amount of mixed domestic waste without household waste segregation. The remarkable advancement in deep learning helps computer vision systems gain splendid achievements in image classification and image recognition, including image-based waste identification and classification.
- We separate three significant categories of domestic waste: recyclable waste (plastic, paper, glass-metal), biodegradable waste, and non-recyclable waste.
- Our ResNet50-based proposed model achieves an 87.50% prediction accuracy on the test dataset.
- Python 3 and above
- OpenCV 3.4.0 for Python
- Numpy
- Keras
- Tensorflow
- Scikit-learn
The overall dataset includes 3495 images combined from selected data from Trashnet
and Waste-set
(build by our own). Given the nature of the data and the purpose of research towards solutions contributing to environmental protection and support appropriate supply for recycling plants, the data is classified into three main categories.
- Recyclable wastes:
- Plastic: 538
- Paper/Cardboard: 616
- Glass & Metal: 849
- Organic wastes: 487
- Non-recyclable wastes: 1005
The dataset is available for download here
In our experiments, we use the ImageDataGenerator class1 from Keras to provide several transformations for generating new training data, such as rotation, zooming, translation, randomly flipping images horizontally, and filling new pixels with their nearest surround pixels.
The process of building NEU-Bin consists of two stages:
- Phase 1: Since the layers of the pre-trained model has been trained on the ImageNet dataset, we freeze the classes of the ResNet50 model and only update the weights of added layers. When the loss function becomes more stable, and the network reaches a higher level of accuracy with the added layers, we continue to the next phase.
- Phase 2: At this stage, we unfreeze the last few layers of the pre-trained model and continue training with these layers along with the newly added adjustment layers.
Model | Accuracy (%) | Parameters (M) |
---|---|---|
ResNet50 | 87.50 | 23.7 |
DenseNet121 | 86.50 | 7.10 |
MobileNetV2 | 83.40 | 2.34 |
VGG16 | 82.30 | 14.7 |
InceptionV3 | 82.50 | 21.9 |
$ git clone https://github.com/209sontung/NEU-Bin.git
You can download the trained model here
model = load_model('model_5class_resnet_87%.h5')
- To change input camera (0 means built-in camera):
cap = cv2.VideoCapture(0)
- To change threshold:
threshold = 0.85
Lower the threshold, lower the confidence of the model
Run the code and the detection will start. Hit Q
to exit.
- Supervisor: Tuan Nguyen
- Team Members: Tung Nguyen, Duc Ha, Ha Phuong Dinh