| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| README.md | 2026-03-13 | 1.9 kB | |
| app.py | 2026-03-13 | 4.3 kB | |
| create_demo_model.py | 2026-03-13 | 1.6 kB | |
| train_model.py | 2026-03-13 | 2.9 kB | |
| requirements.txt | 2026-03-13 | 102 Bytes | |
| Totals: 5 Items | 10.9 kB | 0 |
Garbage Detection System
A web-based garbage classification system using MobileNetV2 transfer learning.
Classes Detected
- Cardboard (Recyclable)
- Glass (Recyclable)
- Metal (Recyclable)
- Paper (Recyclable)
- Plastic (Recyclable)
- Trash (Non-recyclable)
Project Structure
├── app.py # Flask web application
├── requirements.txt # Python dependencies
├── render.yaml # Render.com deployment config
├── model/
│ ├── train_model.py # Training script (use with TrashNet dataset)
│ ├── create_demo_model.py # Creates demo model without dataset
│ └── class_indices.json # Class label mapping
├── templates/
│ └── index.html # Web UI
└── static/
└── uploads/ # Uploaded images
Local Setup
# 1. Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# 2. Install dependencies
pip install -r requirements.txt
# 3. Generate demo model (skip if you have a trained model)
python model/create_demo_model.py
# 4. Run the app
python app.py
# Visit http://localhost:5000
Training with Real Data
- Download TrashNet dataset
- Run:
bash python model/train_model.py - The trained
garbage_model.h5will be saved inmodel/
Deploy to Render.com
- Push to GitHub
- Go to render.com → New → Web Service
- Connect your GitHub repo
- Set:
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn app:app --bind 0.0.0.0:$PORT --workers 1 --timeout 120 - Deploy!
Note: The
.h5model file is in.gitignore. For deployment, either: - Remove*.h5from.gitignoreand push the model, OR - Add a startup script that generates the demo model automatically.