pcb-defect-detection
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: ChiragSingh01
- License: agpl-3.0
- Language: Python
- Default Branch: main
- Size: 3 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
- Releases: 0
Metadata Files
README.md
🟢 PCB Defect Detection using YOLOv5
Automated detection and localization of PCB manufacturing defects using YOLOv5 and the Akhatova PCB Defects dataset
📌 Overview
Printed Circuit Boards (PCBs) are the backbone of modern electronics — even tiny manufacturing defects can lead to malfunction, costly repairs, or total product failure. Manual inspection is time-consuming and error-prone.
This project implements an automated PCB defect detection system using YOLOv5, a state-of-the-art real-time object detection framework. The model is trained to locate and classify multiple PCB defect types with high accuracy, enabling rapid and reliable inspection in manufacturing environments.
🎯 Key Highlights
- ⚡ Fast & accurate detection using YOLOv5
- ✅ Trained on the Akhatova PCB Defects Dataset
- 📌 Detects common PCB defects: missing hole, mouse bite, open circuit, short, spurious copper, etc.
- 🗂️ Modular pipeline for training and inference
- 🔍 Precise bounding boxes for defect localization
- 🧩 Easy to retrain or extend for other defect types
⚙️ Tech Stack
- Python 3.x
- YOLOv5 (Ultralytics)
- PyTorch
- OpenCV
- NumPy, Pandas, Matplotlib
📂 Project Structure
pcb-defect-detection/ ├── dataset/ # PCB images & labels (YOLO format) ├── runs/ # YOLOv5 training runs & results ├── weights/ # Trained model weights (.pt) ├── train.py # Training script ├── detect.py # Inference script for testing ├── dataset.yaml # YOLOv5 dataset configuration ├── requirements.txt # Project dependencies └── README.md # Project documentation (this file)
🚀 Getting Started
1️⃣ Clone the repository
bash
git clone https://github.com/ChiragSingh01/pcb-defect-detection.git
cd pcb-defect-detection
2️⃣ Install dependencies
bash
pip install -r requirements.txt
or manually:
bash
pip install torch torchvision torchaudio
pip install opencv-python
pip install matplotlib
pip install pandas
3️⃣ Download the dataset
Download the PCB Defects Dataset and extract it to the dataset/ folder.
Ensure your folder structure looks like this:
bash
dataset/
├── images/
│ ├── train/
│ ├── val/
│ ├── test/
├── labels/
│ ├── train/
│ ├── val/
│ ├── test/
4️⃣ Configure the dataset
Make sure your dataset.yaml file is correctly set up. Example:
```yaml train: dataset/images/train val: dataset/images/val
nc: 6 names: ['missinghole', 'mousebite', 'opencircuit', 'short', 'spuriouscopper', 'other_defects'] ```
5️⃣ Train YOLOv5
bash
python train.py --img 640 --batch 16 --epochs 50 --data dataset.yaml --weights yolov5s.pt
Adjust image size, batch size, or starting weights as needed.
6️⃣ Run detection
After training, run detection on new images:
bash
python detect.py --weights runs/train/exp/weights/best.pt --source dataset/images/test
Detected images with bounding boxes will be saved in runs/detect/.
Model performance:
- ✔️ mAP: ~95% (update with your actual test results!)
- ✔️ Fast detection speed on standard hardware
- ✔️ Multiple defect categories detected with high precision
📌 Use Cases
- 📏 Automated optical inspection (AOI) in PCB production lines
- ⚡ Real-time defect detection and sorting
- 🧩 Extendable to other electronics manufacturing tasks
🔍 Future Improvements
- 📈 Improve accuracy with more diverse training data & augmentations
- 🗂️ Add support for real-time video stream inspection
- 🧩 Integrate with industrial edge devices (Jetson Nano, Raspberry Pi, etc.)
- 📝 Generate automatic defect reports for quality control
📚 References
👨💻 Author
Chirag
⭐ Support
If you find this project useful, please ⭐ star this repo and share it — it helps more developers discover it!
Owner
- Name: Chirag
- Login: ChiragSingh01
- Kind: user
- Repositories: 1
- Profile: https://github.com/ChiragSingh01
Citation (CITATION.cff)
cff-version: 1.2.0
preferred-citation:
type: software
message: If you use YOLOv5, please cite it as below.
authors:
- family-names: Jocher
given-names: Glenn
orcid: "https://orcid.org/0000-0001-5950-6979"
title: "YOLOv5 by Ultralytics"
version: 7.0
doi: 10.5281/zenodo.3908559
date-released: 2020-5-29
license: AGPL-3.0
url: "https://github.com/ultralytics/yolov5"
GitHub Events
Total
- Push event: 1
Last Year
- Push event: 1