As environment, environmental sustainability, and pollution becoming ever more significant topic, recycling became crucial.

What it does

This web application classifies your garbage into 6 different categories: cardboard, plastic, glass, metal, paper, trash, using convolutional neural network model. The model was trained to classify different types of recycling with about 91% accuracy. The web application is simple. You can upload an image that falls into above 6 different categories, and the model will predict which category it falls into.

How I built it

First of all, through various trial and errors using different machine learning libraries like Keras and Pytorch, and implementing different cnn models with different number of layers, I decided to use pre-trained model, ResNet, with Fastai. The data came from Kaggle Garbage Classification (link). The image data was organized and pre-processed first. After learning-rate was found and the model was trained with the data. The data had 50-25-25 split. After number of epochs, and getting reasonable accuracy and validation loss, model was exported and I started working on the web-app.

Flask was used for the web-app and it was made using template and configuring to my needs. After it was deployed on Render and Heroku.

Challenges I ran into

There were multiple challenges in the process of finishing this project. Since this was my first time working on a machine-learning project, I had struggled through learning new terms, libraries reading documentation. Also using Fastai, there were a lot of different methods to do things compared to other popular libraries like Pytorch or Keras. Some times it made easier to do things but other times harder. Furthermore, at first, trying to make a web-app that uses web-cam to give real-time classification was a hassle. Therefore, I decided to use uploading image system instead. Deploying was another problem. At first I was trying to deploy the app on Render. With the template Render provides, it becomes very easy to deploy on their site, However, memory problem was raised. Therefore, I tried using Heroku, and figured out how to reduce memory with environment dependencies. Having the right dependency for different libraries was also problem. I had to use Anaconda virtual environment for Fastai and right version of torch and torchvision. In the end, both Render and Heroku worked.

Accomplishments that I'm proud of

It has been a great experience trying to work through different challenges that I have faced. I had been patient and kept trying from start to end, from pre-processing, training cnn model to making a web-app and deploying it on a server. I am proud that I successfully went through all the challenges and made a final result.

What I learned

I learned about image classification with different methods like SVM, K-NN and CNN. I learned more about different machine-learning libraries and coding in Python. I also experienced in working with Flask and deploying an app.

What's next for Recycling Classifier

Recycling Classifier could be real-time image classification using web-cam. Also, accuracy could be higher using different pre image processing and fine-tuning.

Share this project:

Updates