A YOLOv8-based Computer Vision solution for automated detection and classification of defects on Printed Circuit Boards (PCBs), with a desktop application built with Tauri.
- Detection: Locate defects with bounding boxes
- Classification: Identify 6 types of PCB defects
- Real-time: Fast inference with YOLOv8
- Desktop App: Cross-platform application with Tauri
- Export: ONNX format for deployment
| ID | Defect | Description |
|---|---|---|
| 0 | missing_hole |
Missing drill hole |
| 1 | mouse_bite |
Irregular edge |
| 2 | open_circuit |
Broken trace |
| 3 | short |
Short circuit |
| 4 | spur |
Copper protrusion |
| 5 | spurious_copper |
Unwanted copper |
| Métrique | Valeur | Description |
|---|---|---|
| Précision de détection | 95.5% | Le modèle localise correctement 95.5% des défauts |
| Précision stricte | 51.8% | Précision avec des critères plus stricts |
| Fiabilité | 95.4% | 95.4% des détections sont de vrais défauts |
| Taux de détection | 91.0% | Le modèle trouve 91% de tous les défauts |
Résultats après 100 époques d'entraînement sur Kaggle avec YOLOv8s.
Prerequisites:
- Add dataset
akhatova/pcb-defectsvia "+ Add Input" - Enable GPU T4 in notebook settings
!pip install ultralytics -q
!rm -rf /kaggle/working/pcb-defect-detector
!git clone https://github.com/alainpaluku/pcb-defect-detector.git
%cd /kaggle/working/pcb-defect-detector
!python run_kaggle.pygit clone https://github.com/alainpaluku/pcb-defect-detector.git
cd pcb-defect-detector
pip install -r requirements.txt
# Train
python main.py train --epochs 100
# Detect
python main.py detect path/to/image.jpg --save
# Export to ONNX
python main.py export --model output/pcb_model.pt --format onnxA cross-platform desktop app built with Tauri 2 and React for real-time PCB inspection.
- Drag & drop image upload
- Real-time defect detection with bounding boxes
- Classification with confidence scores
- Dark/Light mode
- History of inspections
Prerequisites:
- Node.js 18+
- Rust 1.70+
- System dependencies (see below)
Fedora:
sudo dnf install webkit2gtk4.1-devel javascriptcoregtk4.1-devel gtk3-devel glib2-devel openssl-devel libsoup-devel librsvg2-develUbuntu/Debian:
sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-devBuild:
cd desktop-app
npm install
npm run tauri buildThe built application will be in:
- Linux:
src-tauri/target/release/bundle/deb/orrpm/ - Windows:
src-tauri/target/release/bundle/msi/ - macOS:
src-tauri/target/release/bundle/dmg/
- Train on Kaggle and download
best.ptorpcb_model.onnx - Place the ONNX model in
desktop-app/public/model/pcb_detector.onnx - Build and run the app
pcb-defect-detector/
├── src/ # Python training code
│ ├── config.py # Configuration
│ ├── data_ingestion.py # Data loading & conversion
│ ├── model.py # YOLOv8 model wrapper
│ ├── detector.py # Inference interface
│ ├── trainer.py # Training pipeline
│ └── utils.py # Utilities
├── desktop-app/ # Tauri desktop application
│ ├── src/ # React frontend
│ ├── src-tauri/ # Rust backend
│ └── public/model/ # ONNX model location
├── run_kaggle.py # Kaggle runner
└── requirements.txt
| Property | Value |
|---|---|
| Base Model | YOLOv8s |
| Input Shape | (1, 3, 640, 640) |
| Output | Bounding boxes + 6 classes |
| ONNX Size | ~22 MB |
- 1386 images with XML annotations
- 6 defect classes
- VOC format bounding boxes
Alain Paluku - @alainpaluku
MIT License