Commit Β·
1334d72
1
Parent(s): 4d42d1c
..
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135# Garbage Classification Using ResNet50This project implements an image classification model using **Transfer Learning with ResNet50** to categorize images of garbage into multiple classes. The model is trained on the ["Garbage Classification V2"](https://www.kaggle.com/datasets/sumn2u/garbage-classification-v2) dataset and built with TensorFlow and Keras.---## π DemoUpload an image and instantly get a class prediction with confidence and full class-wise probabilities.## π Dataset* **Source**: [Kaggle - Garbage Classification V2](https://www.kaggle.com/datasets/sumn2u/garbage-classification-v2)* **Classes**: Mixed garbage categories such as cardboard, glass, metal, paper, plastic, trash, etc.* **Format**: Folder-based classification (i.e., one subfolder per class)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 | 13,833 || Validation| 3,952 || Testing | 1,976 |---### π§Ό Preprocessing- ```tensorflow.keras.applications.resnet50.preprocess_input```---## π§ Model Architecture```Input Image (224x224x3)βResNet50 Base (Frozen)βGlobalAveragePooling2D()βDense(256, activation='relu')βDropout(0.5)βDense(num_classes, activation='softmax')```---## π§ͺ Training Configuration* **Image Size**: 224x224* **Batch Size**: 32* **Epochs**: Customizable (default usually 10β25)* **Optimizer**: Adam* **Loss Function**: Categorical Crossentropy* **Metrics**: Accuracy---## π₯οΈ 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 Locally1. **Clone the repo**```bashgit clone https://github.com/Amr1Moussa/NTI-final_projects.gitcd NTI-final_projects```2. **(Optional)** Create a virtual environment```bashpython -m venv venvsource venv/bin/activate # On Windows: venv\Scripts\activate```3. **Install dependencies**```bashpip install -r requirements.txt```4. **Run the app**```bashstreamlit run app.py```---## π RequirementsSee `requirements.txt`:```txtstreamlittensorflownumpypillowpandasmatplotlib```---## π LicenseMIT License β use freely, contribute openly, credit kindly.1234567891011121314151617181920---title: ResNet50 Garbage Classifieremoji: πcolorFrom: redcolorTo: redsdk: dockerapp_port: 8501tags:- streamlitpinned: falseshort_description: Streamlit template spacelicense: mit---# Welcome to Streamlit!Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [communityforums](https://discuss.streamlit.io).
README.md+15-130