Smart Garbage Classifier: A Neural Network Approach

Project Title: Smart Garbage Classifier: A Neural Network Approach

CSI_7_DEL: DEEP LEARNING

Overview

The Smart Garbage Classifier project addresses the growing global waste crisis by using deep learning to automate garbage sorting for efficient and sustainable waste management. Imagine if we could use AI to sort trash faster and more accurately than humans—this project does exactly that! By training neural networks with different garbage datasets, we developed an AI that can easily identify and classify waste, reducing human error, optimizing resource use, and making the environment cleaner.

We used two machine learning models: a Convolutional Neural Network (CNN) and an Artificial Neural Network (ANN) with a One-vs-All approach. The CNN outshone the ANN, achieving the highest accuracy, even compared to other models like RecycleNet, MobileNet, and ResNet-50.

Why is This Important?

Think about all the waste produced every day. Manually sorting all of that trash is not only inefficient but also error-prone. Mismanaged waste leads to serious pollution problems, harming both the environment and public health. That’s why an automated solution is needed—something that can speed up recycling, reduce what ends up in landfills, and ultimately lower the impact on our environment. That’s where our Smart Garbage Classifier comes in!

How Did We Do It?

We approached this challenge by building and comparing two different models for sorting garbage:

  1. Data Collection and Preparation: We used the TrashNet dataset, which has images of various types of garbage, like cardboard, paper, metal, plastic, glass, and trash. Imagine taking a ton of pictures of different types of garbage and using those images to train an AI. We made sure the images were top-quality, and we used techniques like one-hot encoding, data augmentation (to increase image variety), resizing, and normalization to get the dataset ready for training.

  2. Model 1: Convolutional Neural Network (CNN)
    • CNN Architecture: The CNN model is like a set of smart filters that look at the images and automatically learn which features are important. It has layers that convolve (look at parts of the image), pool (simplify information), and connect it all to make decisions. With ReLU activation functions to add non-linearity and softmax for classification, it worked like a charm!

Mathematically, the convolution operation can be described as:

In our context, represents the input image and represents the filter applied during the convolution process.

Training and Results: The CNN was trained with a lot of fine-tuning. And guess what? It reached an impressive accuracy of 94%—meaning it can classify most of the trash correctly.

3. Model 2: Artificial Neural Network (ANN) Using One-vs-All (OvA)

    • With the One-vs-All approach, we broke the classification problem into simpler tasks, each focused on separating one type of trash from the rest. Unfortunately, the ANN struggled with the complex visual data, achieving an accuracy of just 46.77%, making it clear that CNNs are much better at image-related tasks.

The One-vs-All approach mathematically means that for classes, we train separate classifiers where each classifier aims to distinguish class from all other classes.

4. How Did We Measure Success?: We used different evaluation metrics like accuracy, precision, recall, F1-score, and even a confusion matrix to see how well our models performed. The CNN came out on top in all these areas.

    • Accuracy is calculated as:

Where:

      • : True Positives
      • : True Negatives
      • : False Positives
      • : False Negatives
    • Precision and Recall were also key metrics, helping us determine how well the model predicted each class accurately:
    • F1-Score provides a balance between precision and recall, calculated as:
    • The Confusion Matrix was used to visualize where the model was getting confused between different classes, helping us understand areas of improvement.

Key Results

    • The CNN model showed massive improvements compared to traditional methods and even other deep learning models. With 95-96% accuracy after optimization, it became our best choice for garbage classification.
    • The ANN One-vs-All model had difficulty handling the multi-class nature of the garbage dataset, proving that CNNs are far more capable when it comes to visual data processing.

How Can It Be Used?

To make this garbage classifier practical, we built a Graphical User Interface (GUI) using Taipy, a Python library. Imagine an app where you can simply upload a picture of some trash, and it tells you what type of waste it is. That’s exactly what our GUI does! It makes it super easy to use the trained model in real-life waste management systems.

Why It Matters

Automating garbage classification brings huge benefits:

  • Operational Efficiency: Imagine not needing to sort garbage by hand anymore—this saves a lot of time and reduces mistakes.
  • Environmental Impact: Sorting garbage more accurately means more recycling and less pollution, which leads to a healthier planet for all of us.
  • Cost Reduction: By reducing errors and improving sorting accuracy, waste disposal becomes cheaper, and companies can comply with environmental regulations more easily.

What Did We Learn?

The Smart Garbage Classifier using CNNs is a game-changer for waste management. It automates a labor-intensive process, makes it faster and more efficient, and reduces our environmental footprint. With a simple interface, this technology can easily be adopted by waste management facilities, leading to smarter use of resources and a significant reduction in waste-related problems.

This course was taught by Dr. Brahim El Boudani. 

Github Link: https://github.com/Adeoluwa2/Hypoglycaemia-Hyperglycaemia-Detection/blob/main/Machine_Learning_CW_Group3.ipynb

Resources

Lecturer

Top