EmanHussein/ResNet50_Garbage_Classifier
0
1# ♻️ Waste Category Image Classifier (Streamlit + Keras)2 3An 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.4 5---6 7## 🚀 Demo8 9Upload an image and instantly get a class prediction with confidence and full class-wise probabilities.10 1112 13---14 15## 🧠 Model Summary16 17- **Architecture**: Custom CNN18- **Input Shape**: 224×224 RGB19- **Layers**:20 - Convolutional layers with BatchNorm and ReLU21 - MaxPooling22 - Global Average Pooling23 - Dense layers with Dropout24- **Optimizer**: Adam (`lr=1e-5`)25- **Loss**: Categorical Crossentropy26- **Final Layer**: Softmax (10 classes)27 28---29 30## 📂 Dataset31 32The dataset consists of images from 10 waste-related categories:33 34| Class | Count |35|---------------|-------|36| battery | 944 |37| biological | 997 |38| cardboard | 1825 |39| clothes | 5327 |40| glass | 3061 |41| metal | 1020 |42| paper | 1680 |43| plastic | 1984 |44| shoes | 1977 |45| trash | 947 |46 47### 🔀 Data Split48 49| Split | Images |50|-----------|--------|51| Training | 15,806 |52| Validation| 1,976 |53| Testing | 1,980 |54 55### 🧼 Preprocessing56 57- All images resized to `224×224`58- Normalized using: `rescale=1./255`59 60---61 62## 🏗️ Model Architecture (Keras Sequential)63 64```python65Input(shape=(224, 224, 3)) ➜66Conv2D(32) ➜ BN ➜ ReLU ➜67Conv2D(64) ➜ BN ➜ ReLU ➜ MaxPool(4×4) ➜68Conv2D(128) ➜ BN ➜ ReLU ➜69Conv2D(128) ➜ BN ➜ ReLU ➜ MaxPool(2×2) ➜70Conv2D(256) ➜ BN ➜ ReLU ➜ MaxPool(2×2) ➜71Conv2D(512) ➜ BN ➜ ReLU ➜ MaxPool(2×2) ➜72GlobalAveragePooling ➜73Dense(256) ➜ Dropout(0.4) ➜74Dense(10, activation='softmax')75````76 77---78 79## 🖥️ Web App Features80 81* ✅ Upload image and classify in real-time82* 📈 Display confidence score83* 📊 Class probabilities table/bar chart84* 🧠 Show model architecture summary in sidebar85 86---87 88## 📦 Installation & Run Locally89 901. **Clone the repo**91 92```bash93git clone https://github.com/Amr1Moussa/NTI-final_projects.git94cd NTI-final_projects95```96 972. **(Optional)** Create a virtual environment98 99```bash100python -m venv venv101source venv/bin/activate # On Windows: venv\Scripts\activate102```103 1043. **Install dependencies**105 106```bash107pip install -r requirements.txt108```109 1104. **Run the app**111 112```bash113streamlit run app.py114```115 116---117 118## 📄 Requirements119 120See `requirements.txt`:121 122```txt123streamlit124tensorflow125numpy126pillow127pandas128matplotlib129```130 131## 📃 License132 133MIT License — use freely, contribute openly, credit kindly.134 