Home
Name Modified Size InfoDownloads / 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

  1. Download TrashNet dataset
  2. Run: bash python model/train_model.py
  3. The trained garbage_model.h5 will be saved in model/

Deploy to Render.com

  1. Push to GitHub
  2. Go to render.com → New → Web Service
  3. Connect your GitHub repo
  4. Set:
  5. Build Command: pip install -r requirements.txt
  6. Start Command: gunicorn app:app --bind 0.0.0.0:$PORT --workers 1 --timeout 120
  7. Deploy!

Note: The .h5 model file is in .gitignore. For deployment, either: - Remove *.h5 from .gitignore and push the model, OR - Add a startup script that generates the demo model automatically.

Source: README.md, updated 2026-03-13