Skip to content

An intelligent system to detect, classify, and analyze waste using AI-powered object detection and material composition prediction. This project combines YOLOS object detection with a custom-trained classifier to identify and categorize waste as degradable or non-degradable.

License

Notifications You must be signed in to change notification settings

muhammad-fiaz/SWMS

Repository files navigation

preview

♻️ Smart Waste Management System (SWMS)

An intelligent system to detect, classify, and analyze waste using AI-powered object detection and material composition prediction. This project combines YOLOS object detection with a custom-trained classifier to identify and categorize waste as degradable or non-degradable.


🚀 Features

  • 🧠 Object detection using YOLOS (Vision Transformer)
  • 📊 Predicts plastic, metal, and glass composition
  • 🔍 Classifies waste as Degradable or Non-Degradable
  • 📤 Simple drag-and-drop GUI using PyQt6
  • 📁 CLI support for training, single-image analysis, and GUI mode
  • 🧪 Easily extensible dataset-based training
  • ✅ MIT Licensed & open source

📦 Installation

Requires Python 3.12+

pip install -r requirements.txt

Or using pyproject.toml:

pip install .

🛠️ Usage

🔧 Train the model

Place your CSV files in Datasets/ (e.g. Datasets/data1.csv), then:

python detect.py --train

🖼️ Analyze an image via GUI

python detect.py --gui

🖼️ Analyze an image via command-line

python detect.py --image path/to/image.jpg

📁 Dataset Format for Training

CSV files should be like:

label,plastic,metal,glass
phone,42,38,20
bottle,100,0,0
  • label: The item name (must match YOLOS labels; you can list them by running python detection_items.py)
  • plastic, metal, glass: Composition percentages (should sum to ~100).

🧠 Model

  • Object Detection: hustvl/yolos-base (transformers)
  • Composition Predictor: PyTorch feed-forward model trained from CSV data
  • File Format: .safetensors

📸 Project Structure

assets/
    └── logo.png    # Logo image
datasets/           # Dataset folder
    └── data1.csv   # dataset example 1
    └── data2.csv   # dataset example 2
.gitignore          # Git ignore file
detect.py           # main detection script
LICENSE             # License file
pyproject.toml      # Project metadata
README.md           # Project documentation
uv.lock             # Dependency lock file
requirements.txt    # Python dependencies
label2idx.json      # Encoded label mappings (used by the model)
model.safetensors   # Trained model weights

📊 Output Report Example

Detected Items 1 in image.jpg:
- cell phone

Estimated Recyclable Components:
Plastic: 42%
Metal: 38%
Glass: 20%

♻️ Waste Classification:
✅ Degradable Waste: 0% 
❗ Non-Degradable Waste: 100%
----------------------------------------

🪪 License

This project is licensed under the MIT License.


🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first.

About

An intelligent system to detect, classify, and analyze waste using AI-powered object detection and material composition prediction. This project combines YOLOS object detection with a custom-trained classifier to identify and categorize waste as degradable or non-degradable.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages