This project aims to automatically detect failures during 3D printing using computer vision and machine learning. A YOLOv8 model was trained to recognize different types of 3D print failures in real-time. The trained model was then deployed alongside an ESP32-CAM to capture live print images and detect failures, allowing the system to stop or alert the user and prevent material waste.
- Detect 3D print failures like Spaghetti, Layer Shifts,Over Extrusion, Under Extrusion and Stringing.
- Use a YOLOv8 object detection model for accurate detection.
- Deploy the system with ESP32-CAM for real-time inference.
- Improve efficiency and reduce waste in 3D printing.
-
Combined multiple publicly available datasets with our oun custom prepared dataset on 3D print failures.
-
Annotated images using Roboflow, creating bounding boxes for:
SpaghettiLayer_ShiftOver_ExtrusionUnder_ExtrusionStringinggood_print
-
Exported the dataset in YOLOv8 format.
-
Dataset split:
- Training: 70%
- Validation: 20%
- Test: 10%
-
Performed data augmentation (flip, brightness, contrast) in Roboflow.
- Model: YOLOv8n (lightweight variant for fast inference)
- Training Command:
yolo task=detect mode=train model=yolov8n.pt data=data.yaml epochs=50 imgsz=640
-
Evaluation Metrics:
- [email protected]: ~88%
- Precision: 89.4%
- Recall: 93.3%
- F1 Score: 91.3%
[ESP32-CAM] --> captures image -->
[Edge Device] --> runs YOLOv8 inference -->
If failure:
--> sends signal (Bluetooth/WiFi/UART) to alert/stop print
- Converted trained YOLOv8 model to ONNX → TFLite.
- Quantized model using INT8 for lightweight inference.
- Edge device (e.g., Raspberry Pi or laptop) runs inference.
- ESP32-CAM captures real-time images and sends them to the edge device.
- Fault signals (1 or 0) are sent back to ESP32 to take action (e.g., alert/pause).
| Metric | Value |
|---|---|
| Accuracy | 92.4% |
| Precision | 89.4% |
| Recall | 93.3% |
| F1 Score | 91.3% |
| Avg Detection Time | < 2 sec |
- Object Detection (YOLOv8)
- Embedded Systems (ESP32-CAM)
- Dataset Annotation (Roboflow)
- Image Processing (OpenCV)
- Edge Deployment (ONNX, TFLite)
- Communication Protocols (UART/Bluetooth/WiFi)
- Evaluation Metrics and Model Optimization
- Store detection history on Firebase / AWS IoT.
- Add a dashboard interface for monitoring.
- Automate printer control with relay modules.
3D-Printing_Failure_Detection-main/
├── data.yaml
├── images/
│ ├── train/
│ ├── valid/
│ └── test/
├── labels/
│ ├── train/
│ ├── valid/
│ └── test/
├── train.py
├── detect.py
├── weights/
│ └── best.pt
├── esp32-code/
│ └── cam_sender.ino
└── README.md
