EmanHussein's picture
..
4d42d1c
|
Raw History Blame Contribute Delete
2.85 kB

♻️ Waste Category Image Classifier (Streamlit + Keras)

An interactive web app for classifying waste images into 10 distinct categories using a custom-trained Convolutional Neural Network (CNN). Built with TensorFlow/Keras and deployed via Streamlit, this app demonstrates the power of deep learning in sustainability-oriented image classification.


πŸš€ Demo

Upload an image and instantly get a class prediction with confidence and full class-wise probabilities.

demo-screenshot


🧠 Model Summary

  • Architecture: Custom CNN
  • Input Shape: 224Γ—224 RGB
  • Layers:
    • Convolutional layers with BatchNorm and ReLU
    • MaxPooling
    • Global Average Pooling
    • Dense layers with Dropout
  • Optimizer: Adam (lr=1e-5)
  • Loss: Categorical Crossentropy
  • Final Layer: Softmax (10 classes)

πŸ“‚ Dataset

The dataset consists of images from 10 waste-related categories:

Class Count
battery 944
biological 997
cardboard 1825
clothes 5327
glass 3061
metal 1020
paper 1680
plastic 1984
shoes 1977
trash 947

πŸ”€ Data Split

Split Images
Training 15,806
Validation 1,976
Testing 1,980

🧼 Preprocessing

  • All images resized to 224Γ—224
  • Normalized using: rescale=1./255

πŸ—οΈ Model Architecture (Keras Sequential)

Input(shape=(224, 224, 3)) ➜
Conv2D(32) ➜ BN ➜ ReLU ➜
Conv2D(64) ➜ BN ➜ ReLU ➜ MaxPool(4Γ—4) ➜
Conv2D(128) ➜ BN ➜ ReLU ➜
Conv2D(128) ➜ BN ➜ ReLU ➜ MaxPool(2Γ—2) ➜
Conv2D(256) ➜ BN ➜ ReLU ➜ MaxPool(2Γ—2) ➜
Conv2D(512) ➜ BN ➜ ReLU ➜ MaxPool(2Γ—2) ➜
GlobalAveragePooling ➜
Dense(256) ➜ Dropout(0.4) ➜
Dense(10, activation='softmax')

πŸ–₯️ Web App Features

  • βœ… Upload image and classify in real-time
  • πŸ“ˆ Display confidence score
  • πŸ“Š Class probabilities table/bar chart
  • 🧠 Show model architecture summary in sidebar

πŸ“¦ Installation & Run Locally

  1. Clone the repo
git clone https://github.com/Amr1Moussa/NTI-final_projects.git
cd NTI-final_projects
  1. (Optional) Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Run the app
streamlit run app.py

πŸ“„ Requirements

See requirements.txt:

streamlit
tensorflow
numpy
pillow
pandas
matplotlib

πŸ“ƒ License

MIT License β€” use freely, contribute openly, credit kindly.