Built to order

PCB Defect Detection using CNN

This project builds automated optical inspection for bare PCBs — a detector that localizes and classifies six defect types (open, short, mousebite, spur, pinhole, spurious copper) on the DeepPCB dataset of 1,500 template/tested board pairs. Board photos are aligned to a golden reference, a YOLO-style detector outputs bounding boxes with severity and rework actions, and the demo gives a PASS/FAIL verdict per board. Suitable for B.E./B.Tech final-year projects in Electronics, Computer Science and AI/ML.

PCB Defect Detection using CNN — project thumbnail preview
More project photos (2)

The problem

Manual PCB inspection is slow, tiring and inconsistent — inspectors miss hairline opens and tiny solder bridges after hours at the microscope, and small fabrication units cannot afford commercial AOI machines. Automated optical inspection compares each board against a golden reference and flags deviations. The DeepPCB dataset (Huang et al., Huawei Noah's Ark Lab) provides 1,500 template/tested image pairs with bounding-box annotations for six defect classes, mirroring real AOI stations: align, difference, classify. This project implements that pipeline with a modern single-shot detector — template alignment via feature matching, a YOLO-style detection head, non-maximum suppression, and a verdict UI mapping each defect to severity and rework action.

How it works

  1. The tested board photo is registered to its golden template via ORB feature matching and homography.
  2. The aligned 640x640 pair feeds a YOLO-style detector with a lightweight backbone (CSPDarknet-tiny/MobileNet).
  3. The detection head predicts candidate bounding boxes with class scores across the six defect types.
  4. Non-maximum suppression removes overlapping boxes; survivors below the confidence threshold are dropped.
  5. Each detection maps to a severity (minor/major/critical) and a rework action for the operator.
  6. Training uses mosaic + photometric augmentation on the 1,000-pair DeepPCB training split.

Tech stack:

  • Python 3.10, PyTorch
  • YOLO-style detector (Ultralytics tooling or equivalent)
  • DeepPCB dataset (Huawei Noah's Ark Lab)
  • OpenCV (alignment, NMS, visualization)
  • Flask (demo backend)
  • HTML/CSS/JavaScript (demo UI)
  • Git

Dataset & Model Details

  • Dataset: DeepPCB — 1,500 template/tested image pairs with bounding-box annotations, 6 defect classes (open, short, mousebite, spur, pinhole, spurious copper); source: T. Huang et al., Huawei Noah's Ark Lab. Standard split: 1,000 train / 500 test.
  • Model input: 640x640 aligned board image. Output: bounding boxes + class + confidence per defect.
  • Architecture: YOLO-style single-shot detector; lightweight backbone; NMS post-processing.
  • Metric: mAP@0.5 per class and overall, measured on the 500-pair test split after training. No figure is claimed before the training run.
Parameter Value
Defect classes 6 (DeepPCB taxonomy)
Input 640x640 aligned board photo
Output Boxes + class + confidence + verdict
Alignment ORB feature matching + homography
Inference Under 1 s per board on CPU (design target)
Demo Board upload + PASS/FAIL verdict

Project features

  • [Six defect classes] Open, short, mousebite, spur, pinhole and spurious copper — the full DeepPCB taxonomy.
  • [Bounding-box localization] Every detection ships with a box, class label and confidence, overlaid on the board photo.
  • [Template alignment] Tested boards are registered to the golden reference with feature matching before comparison.
  • [PASS/FAIL verdict engine] Detections map to severity levels and concrete rework actions (e.g. solder bridge → desoldering wick).
  • [YOLO-style detector] Single-shot architecture with a lightweight backbone; 640x640 input, NMS-filtered output.
  • [Per-class mAP evaluation] mAP@0.5 measured per class on the 500-pair test split — hardest classes identified honestly.
  • [Inspection web demo] Upload a board photo; get boxes, verdict and rework guidance in the browser.

What is included

  • Python training notebook (detector training, augmentation, evaluation)
  • Template-alignment + inference pipeline code
  • Trained detector weights
  • Test-split evaluation: per-class mAP@0.5 from the actual run
  • Inspection web demo (upload, boxes, severity, rework actions)
  • Project report PDF (methodology, error analysis, measured results)
  • PPT presentation for final review
  • Viva Q&A preparation document

Limitations & prerequisites

  • Covers bare-PCB defects only — not assembled-board issues like missing or tombstoned components.
  • Needs a roughly top-down, well-lit board photo; extreme angles break the template alignment.
  • Tiny defects (pinhole, spur) are the hardest classes — the per-class mAP table shows this honestly.
  • Detector training strongly benefits from a GPU; CPU training is very slow.
  • Rework actions are guidance for a trained operator, not a repair robot.

Frequently Asked Questions

What is DeepPCB?

A public dataset from Huawei Noah's Ark Lab: 1,500 pairs of defect-free template and defective tested PCB images with bounding-box labels for six defect types — the standard benchmark for PCB defect detection.

Why align to a template first?

Real AOI stations compare against a golden reference. Alignment lets the detector learn the template-vs-tested difference instead of memorizing board layouts, so it generalizes to unseen designs.

Which defects are hardest?

Typically pinhole and spur — they are tiny. The report's per-class mAP@0.5 table identifies the weak classes with measured numbers instead of hiding them.

Can it inspect assembled boards?

No — this project targets bare PCBs. Assembled-PCBA defects are listed as future scope.

Do I need a GPU?

Strongly recommended for detector training. Inference and the demo run on CPU.

Is this project suitable for a final-year project?

Yes — for Electronics, Computer Science and AI/ML programs. It combines object detection, image alignment, industrial evaluation metrics and a genuinely useful inspection demo. Suitable for B.E./B.Tech final-year projects in Electronics, Computer Science and AI/ML.

Components & software requirements
  • Python 3.10, PyTorch
  • YOLO-style detector (Ultralytics tooling or equivalent)
  • DeepPCB dataset (Huawei Noah's Ark Lab)
  • OpenCV (alignment, NMS, visualization)
  • Flask (demo backend)
  • HTML/CSS/JavaScript (demo UI)
  • Git

Dataset & Model Details

  • Dataset: DeepPCB — 1,500 template/tested image pairs with bounding-box annotations, 6 defect classes (open, short, mousebite, spur, pinhole, spurious copper); source: T. Huang et al., Huawei Noah's Ark Lab. Standard split: 1,000 train / 500 test.
  • Model input: 640x640 aligned board image. Output: bounding boxes + class + confidence per defect.
  • Architecture: YOLO-style single-shot detector; lightweight backbone; NMS post-processing.
  • Metric: mAP@0.5 per class and overall, measured on the 500-pair test split after training. No figure is claimed before the training run.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation