Skip to content

PRATHAM10805/CNN-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 College Presentation Guide: Garbage Classification CNN

Use this guide to explain your project to your professor. It covers the "Why," "How," and "What" of your AI model.


1. The Core Objective

The goal was to build an automated waste segregation system using Computer Vision. Instead of humans manually sorting trash, this AI can identify images of garbage and classify them into 6 categories: Cardboard, Glass, Metal, Paper, Plastic, and Trash.

2. The Dataset: "TrashNet"

  • Source: We used the industry-standard TrashNet dataset (Gary Thung and Mindy Yang).
  • Contents: About 2,500 images of waste.
  • Challenge: Garbage images are difficult because items are often crushed, dirty, or overlapping (like the plastic collage we tested).

3. The Architecture: Transfer Learning

Building a model from scratch requires millions of images. Instead, we used Transfer Learning:

  • Base Model: We used MobileNetV2. This is a state-of-the-art model developed by Google, pre-trained on 1.2 million images (ImageNet).
  • Why MobileNetV2?: It is designed to be lightweight and fast, making it perfect for real-time applications like our web app.
  • Custom Head: we removed the original "top" (the 1,000 ImageNet categories) and replaced it with our own layers specifically for 6 garbage categories.

4. Advanced Training: Fine-Tuning

Initially, the model was good but not perfect (it confused some plastics with paper). To fix this, we implemented Fine-Tuning:

  • Phase 1: We froze the base model and only trained the new top layers.
  • Phase 2: We unfroze the internal layers of MobileNetV2 and continued training with a very small learning rate.
  • Result: This allowed the model to adjust its "knowledge of textures" to specifically recognize the difference between plastic sheen and paper texture.

5. Confidence & Error Handling

We implemented a Confidence Threshold (70%).

  • If the model sees a "foreign" object (like a photo of a person), it will likely be confused.
  • If its highest guess is below 70%, the app displays a "Item Not Recognized as Garbage" warning.
  • This makes the system more "honest" and robust for real-world use.

6. The Web App (Tech Stack)

  • Backend: Python with TensorFlow/Keras.
  • Frontend: Built with Gradio, which allows us to quickly share a user interface for uploading and testing files.
  • Deployment: Runs on a local server (localhost) for instant interaction.

Potential Professor Questions (Q&A)

  • Q: Why did it sometimes show 'Paper' for screenshots?
    • A: This is called 'Out-of-Distribution' data. Since the model only knows 6 things, if it sees flat white areas and sharp edges (like in a screenshot), it mathematically maps them to the category that looks most similar: Paper.

7. How the Layers Work (The "Vision Pipeline")

If your professor asks how the model "sees," explain these 4 stages:

  1. The Input Layer (224x224x3):

    • The model receives a grid of pixels. '3' stands for the RGB color channels (Red, Green, Blue).
  2. Convolutional Layers (Feature Extractors):

    • Early Layers: Detect "Low-level features." They look for simple edges, corners, and color gradients.
    • Middle Layers: Combine edges into "Mid-level features" like circles, rectangles, or textures (e.g., the crinkle of plastic or the grain of wood).
    • Deep Layers: Detect "High-level features." They recognize entire parts of objects, like the neck of a bottle or the edge of a cardboard box.
  3. Global Average Pooling (GAP):

    • This layer takes the complex 2D maps from the previous layers and calculates the average value. It "flattens" the spatial information into a single list of numbers (a vector) that summarizes everything the model saw.
  4. The Dense (Fully Connected) Output Layer:

    • The final layer acts like a committee. Based on the summary from the GAP layer, it votes on which category the image belongs to.
    • Softmax Activation: This is the final step that turns those votes into percentages (e.g., 92% Plastic) that we show in the app.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages