# โ™ป๏ธ 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](https://github.com/user-attachments/assets/b10da05a-33e3-46b1-9468-bc0b88823414) --- ## ๐Ÿง  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) ```python 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** ```bash git clone https://github.com/Amr1Moussa/NTI-final_projects.git cd NTI-final_projects ``` 2. **(Optional)** Create a virtual environment ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` 4. **Run the app** ```bash streamlit run app.py ``` --- ## ๐Ÿ“„ Requirements See `requirements.txt`: ```txt streamlit tensorflow numpy pillow pandas matplotlib ``` ## ๐Ÿ“ƒ License MIT License โ€” use freely, contribute openly, credit kindly.