Trash Classifier: Let's be Waste Conscious

Save the world by recycling waste. Waste Management and Segregation are essential to every household. I have built a system that uses the embedded vision starter kit along with the Basler camera & UP board to segregate your everyday trash into categories of paper, plastic, glass, metal and others.


Trash Classifier

Motivation for this Project

Being able to sort trash according to different materials is very important for recycling. However, sorting trash is one of the toughest tasks to do. While it is easy to sort metals and non-metals, it is very difficult to sort paper, glass, plastic, and cardboard.

Currently, it is done by people. It is not a good job and such people are often in danger of being exposed to harmful chemicals, medical wastes and be exposed to diseases. If instead, we can use a neural network that can do the classification then we can make the process faster, safer and more accurate.

This project attempts to use a convolutional neural network to do just that.

Edge Computing

It is not always possible to run a machine learning model on a GPU as there can be cost and space restrictions. And always making an API call can have latencies and internet might not always be available.

In these cases using small, cheap devices at the edge (where the data is generated) is the best solution.

The problem with running models on the edge is that we are limited by the amount of computation power that we have. There are many ways to overcome this. You could use a hardware accelerator like a Neural Computer Stick. Or you could use some models that are built specifically to not be computationally expensive and run on the edge.

In this project, we use the UP Board Embedded Vision Kit to run inference on the edge. We use the MobileNet model which is computationally less expensive.


Prediction of Plastic Waste

Project Structure

The whole project is available here

  • You can use this script to train the model.
  • The script to classify trash on the UP Board Embedded kit.
  • prediction_images: Directory Containing the predicted images.
  • models: The saved model


The data for this project was collected from the trashnet project


Sample code for training

python3 --nb_epoch 2 --batch_size 32 --model models/model1.h5


Sample code for classification.

Note: This will run only with the basler camera.



This project requires python3.6 and opencv. Other requirements are present in the requirements.txt file.


GitHub Repository


Soham Chatterjee
pushed 9283d93fbf746ab9452d73f1a83113f2eda39ad7
Fix for security
2019-04-30 17:27:54 UTC
pushed 6dda8c1ce56f750585d52818858efc38aebda182
pi script
2019-01-04 12:13:13 UTC
Soham Chatterjee
pushed 91d687f0293725cbe0536a3c6b574bddb9000cba
Delete paper1.png
2018-11-30 06:24:48 UTC
Soham Chatterjee
pushed 2eab573aea1151d4e97080287a3bc27fa4f77798
Delete glass.png
2018-11-30 06:24:33 UTC
Soham Chatterjee
pushed 3bd0cb2ac59b9ec84bebbeb75cc3dacdf509f47b
Small typo fix
2018-11-29 17:46:58 UTC
Soham Chatterjee
pushed 70265ac98f4214adecdd25b3627e2ea71e52edfe
Merge pull request #1 from soham96/add-license-1
2018-11-29 17:16:26 UTC
Soham Chatterjee
pushed 0c7663569f2ca323b3269ecec44168c624f65a57
2018-11-29 17:13:17 UTC
pushed 22c51773c8471c093609f3565c5e427c61862549
2018-11-29 14:10:37 UTC
pushed 14cdf88de112796342b11b30ae96468fe0075acc
New Prediction images
2018-11-29 06:18:34 UTC
pushed 057e01bb3810907bcb2b172d57b13c43a40fff93
Added Predicted Images
2018-11-28 14:36:43 UTC
pushed a2e6cac9936a35786630b720e703686c241f89c5
new model
2018-11-28 13:25:59 UTC
pushed 0605ca055ed498dc69fb8c40deab99a37d7f81d6
Script for prediction
2018-11-28 12:39:13 UTC
pushed a12e1cd4d85fe3be600c05dc76361aa1bb3079eb
Training Script and model
2018-11-24 18:13:14 UTC
Soham Chatterjee
pushed eb37790f7c276796c0beab347bcc08af1050783d
Initial commit
2018-11-24 11:15:14 UTC
Title Description Format
Prediction Image for Paper png

Project State

Public Project


Software Licence: GPL v.3
Hardware Licence: Project has no hardware

Project Tags




Does this project pique your interest?

Login or register to join or follow this project.

Back to top

Your comments, please!

Want to comment this ... Show more