A Raspberry Pi-based waste detection and classification system that uses computer vision to identify waste objects, assign them to the correct waste category, track disposal statistics, and display the results through a local web dashboard.
The system uses a custom-trained YOLOv8 object detection model exported to TensorFlow Lite for Raspberry Pi deployment.
The project was created to explore how artificial intelligence and computer vision can improve waste sorting.
A Raspberry Pi Camera captures waste objects placed in front of the system. The detected object is classified as plastic, paper, or organic waste. The corresponding LED is activated to indicate where the object should be disposed.
The system also records the number of detected objects and displays live information through a Flask web application.
A secondary USB camera is used to estimate whether the waste bin is full.
- Real-time waste object detection
- Custom YOLOv8 model trained on manually collected images
- Classification into plastic, paper, and organic waste
- TensorFlow Lite inference on Raspberry Pi
- LED indicators for waste categories
- Waste disposal counters
- Local storage of detection counts
- Live camera stream through a Flask dashboard
- Bin fullness detection using a secondary camera
- Confidence filtering and non-maximum suppression
- Controlled detection intervals for improved Raspberry Pi performance
The model was trained to detect the following object classes:
applebananamilk_cartonpaper_containerpaper_rollplastic_bagplastic_bottleplastic_container
These object classes are mapped to three waste categories:
| Category | Objects |
|---|---|
| Organic | Apple, banana |
| Paper | Milk carton, paper container, paper roll |
| Plastic | Plastic bag, plastic bottle, plastic container |
The dataset was collected manually using a several cameras.
Images were taken of different waste objects under varying positions, backgrounds, and lighting conditions. Each image was labelled with the correct object class and then divided into training and validation datasets.
The model was trained using a pretrained YOLOv8 Nano model.
yolo detect train \
model=yolov8n.pt \
data=data.yaml \
epochs=100 \
imgsz=640 \
batch=18 \
name=clean_run| Metric | Result |
|---|---|
| Precision | 0.979 |
| Recall | 0.983 |
| mAP50 | 0.992 |
| mAP50–95 | 0.792 |
The results show strong object detection performance on the validation dataset. Real-world accuracy can still be affected by lighting, camera angle, object condition, and background complexity.
For each detection cycle, the system:
- Captures a frame using the Raspberry Pi Camera.
- Resizes and normalises the image.
- Passes the processed image to the TensorFlow Lite model.
- Filters detections using a confidence threshold.
- Applies non-maximum suppression to remove duplicate detections.
- Maps the detected class to a waste category.
- Activates the corresponding LED.
- Updates the category counter.
- Saves the latest counter values locally.
- Updates the Flask dashboard.
Detection is performed at controlled intervals to reduce Raspberry Pi CPU usage.
The Flask web interface displays:
- Live Raspberry Pi Camera stream
- Number of detected plastic objects
- Number of detected paper objects
- Number of detected organic objects
- Current bin fullness status
- General system status
Detection counts are stored locally so they can be restored after the application restarts.
When an object is detected:
- The organic LED activates for organic waste.
- The paper LED activates for paper waste.
- The plastic LED activates for plastic waste.
- The associated waste counter increases.
- The dashboard is updated.
When the secondary camera determines that the bin is full, the full-bin LED is activated.
- Raspberry Pi inference is slower than desktop inference.
- Detection quality depends on lighting and camera placement.
- Objects outside the trained classes cannot be classified correctly.
- Similar-looking objects can occasionally be confused.
- Bin fullness estimation may be affected by unevenly distributed waste.
- The system identifies the correct category but does not physically move the object into a bin.