This demo showcases an automated waste sorting system using artificial intelligence. The system captures real-time images from a camera, identifies the type of waste using the YOLOv5n-garbage model, and controls a servomotor on a Raspberry Pi for physical sorting. Images are saved in both raw form and with annotations for later verification.
/
├── src/
│ ├── model.py # Loads the model and detection function
│ ├── control.py # Servo control (RPi.GPIO)
│ └── main.py # Main logic: capture, detection, control
├── data/
│ ├── input/ # Raw input images
│ └── output/ # Images with drawn predictions
├── weights/
│ └── best.pt # Trained model weights
├── yolov5/ # YOLOv5 source code (cloned from GitHub)
├── requirements.txt # List of required packages
└── README.md # Project documentation
Test images with actual results from the YOLOv5n-garbage model:
- Python > 3.7
- Raspberry Pi or other camera-compatible device
- Minimum 1 GB free RAM
- Connected and properly configured camera
git clone https://github.com/Bahna-Darius/garbage_sort
cd garbage_sortgit clone https://github.com/ultralytics/yolov5.gitpython -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtpython src/main.py- Make sure the camera is connected and functional before running
- Adequate lighting significantly improves detection accuracy
- Check the
data/outputfolder for processed images and results
- Camera error: Check device connection and permissions
- Servo problem: Ensure GPIO pins are properly configured
- Poor detection: Adjust lighting and object positioning
This project is distributed under a Personal License. See the LICENSE file for details.
This project was created and is maintained by Bahna Darius. You can find me on LinkedIn.


