Automated AI-Based
PCB Defect Detection

Industrial-Grade Quality Assurance Platform

Presented by: Atharva Mundke
Internship Project | Dec 2025 - Jan 2026
βœ“ 97.8% Accuracy β€’ Zero Critical Escapes
Raw PCB Board
Green solder mask
Copper traces
Component pads
AI Analysis
Defects highlighted in real-time
Automatic classification
Cost analysis included

What Makes This Different?

This isn't just defect detectionβ€”it's a complete QA platform with business intelligence, database analytics, batch processing, and automated reporting.

The Manufacturing Challenge

Why manual inspection is failing modern electronics

πŸ” Current Standard: Manual Optical Inspection (MOI)

Human operators spend 8+ hours daily inspecting circuit boards under magnification, checking for microscopic defects that could cause product failures.

πŸ˜“ Operator Fatigue

After hours of repetitive work, concentration drops. Subtle defects like "Mouse Bites" or hairline "Opens" get missed.

⚠️ Inconsistent Standards

Different operators have different judgment. This subjectivity creates quality variance across shifts.

πŸ’° Expensive Escapes

When defective boards reach customers, the cost is catastrophic: recalls, warranty claims, and brand damage.

The Failure Cascade

πŸ‘€ Manual Inspection
(Human operator with magnifier)
↓
😴 Operator Fatigue
(After 4-6 hours of work)
↓
❌ Missed Defects
(3-5% error rate typical)
↓
πŸ’Έ Massive Financial Loss

🎯 Our Mission

Eliminate human error through AI automation
Reduce inspection time: 2 min β†’ 1.2 sec
Ensure 100% consistency with objective analysis

Complete QA Platform Architecture

Three integrated systems working as one

πŸ‘οΈ

Computer Vision Engine

Smart Alignment: Automatically corrects rotated/shifted boards using ORB feature matching

EfficientNetB0: Deep learning model identifies 6 distinct defect types with high precision

97.8% Accuracy
100% Recall on Critical
πŸ’°

Business Intelligence

Smart Costing: Real-time calculation of repair costs ($1.50 - $11.25)

BER Logic: Beyond Economic Repair engine auto-flags SCRAP when cost > 75% value

Instant Go/No-Go
Prevents Wasteful Repairs
πŸ—„οΈ

Enterprise Database

SQLite Backend: Permanent storage with timestamps, defects, and costs

Batch Processing: Process 50+ boards simultaneously via ZIP upload

Full Production History
Regulatory Compliance

πŸš€ From Detection to Decision

Unlike academic projects, this system answers critical business questions: "Should we repair this?" "How much will it cost?" "Is our yield improving?"

Smart Alignment Technology

Solving the rotation & misalignment challenge

πŸ”§ The Technical Challenge

In real factories, PCBs are never perfectly aligned. Boards can be:

  • Rotated by 2-15 degrees
  • Shifted horizontally or vertically
  • Scaled due to camera distance

Simple image subtraction would show EVERY edge as a "defect".

βœ… Solution: Homography Transformation

ORB (Oriented FAST and Rotated BRIEF) finds stable keypoints (corners, edges) on both the template and test board.

These points define a mathematical transformation (Homography Matrix) that "warps" the test board to align perfectly.

Alignment Process

1
Feature Detection (ORB)
Extract 500-2000 keypoints from both Template and Test images.
2
Feature Matching
Match keypoints using Hamming distance. Keep top 70%.
3
Homography Calculation
Calculate matrix via RANSAC. Warp test image to match.

❌ Without Alignment

Edges don't match, false positives

βœ“ With Alignment

Perfect overlay, only real defects

From Pixels to Defect Regions

ROI (Region of Interest) Extraction Pipeline

1
Otsu's Binarization
Converts grayscale difference map into pure black/white using optimal threshold. White pixels = potential defects.
2
Morphological Filtering
Erosion: Removes noise.
Dilation: Merges fragmented defect parts into solid objects.
3
Contour Detection
OpenCV findContours() identifies white blob boundaries. Draws bounding boxes. Filters small noise (< 20px).

Step 1: Raw Difference

Grayscale noise

Contains defects + dust + lighting variations

Step 2: Binary Mask

Clean defect candidates

Step 3: Final ROIs

Bounding boxes β†’ AI input

The "Heavy Head" Innovation

From 92% to 97.8% accuracy through architectural design

EfficientNetB0

πŸ”’ Frozen Backbone

Feature extraction only

β†’

Custom Head

Global Avg Pooling
Dense 256 + ReLU ⚑
Dropout (0.3)
Dense 6 + Softmax
β†’

6 Classes

β€’ Mouse Bite   β€’ Open Circuit

β€’ Short            β€’ Spur

β€’ Spurious       β€’ Missing Hole

❌ Baseline Problem (92% Accuracy)

Standard transfer learning struggled with similar defects (e.g., "Spur" vs "Spurious Copper") because simple output layers can only draw linear decision boundaries.

βœ… Heavy Head Solution (97.8% Accuracy)

The Dense 256 layer provides computational capacity to learn non-linear boundaries. Dropout prevents memorization. Result: System distinguishes subtle geometric differences.

Architecture Validation Accuracy Training Time Status
Baseline (Simple Head) 92.0% 45 min ❌ Insufficient
Heavy Head (Dense 256) 97.8% 52 min βœ“ Target Exceeded

Dual-Box Inference Strategy

Solving the "Context Myopia" problem

🚨 The Critical Problem

The AI consistently misclassified "Open Circuits" (gap in trace) as "Shorts" (bridge between traces). With tight cropping, both looked like generic "blobs" without context.

❌ Traditional (Tight Crop)

AI sees only a blob. Can't see if it's a gap or bridge.
15% False Positive Rate.

βœ“ Dual-Box Solution

AI gets wider context (64px padded). Sees surrounding traces.
0% False Positives.

Implementation

UI Box: Tight crop (5px padding) for operator display.
AI Box: Forced min 64x64px + 20px padding for inference.
Result: +15% accuracy improvement on Open Circuits.

Smart Factory Decision Engine

Beyond detection: automated business logic

πŸ’΅

Smart Costing

Mouse Bite: $11.25

Open Circuit: $2.25

Short: $1.50

Missing Hole: SCRAP

Real-time labor/material calculation

βš–οΈ

BER Logic Engine

IF Repair Cost > $37.50
(75% of board value)

OR "Missing Hole" detected

THEN Status = SCRAP

Prevents uneconomical repairs

πŸ“‹

Work Orders

Open β†’ "Solder jumper wire"

Short β†’ "Remove bridge with blade"

Mouse Bite β†’ "File edge smooth"

Actionable technician instructions

Decision Flow

Defect Detected
↓
Calculate Repair Cost
↓
Too Expensive? β†’ 🚫 SCRAP
Repairable? β†’ βœ… WORK ORDER

Enterprise Memory & Analytics

From temporary prototype to permanent production system

πŸ—„οΈ SQLite Database Backend

Every inspection is permanently logged for ISO 9001 compliance and traceability.

Field Description
Timestamp Exact date/time
Defect List JSON list of classifications
Health Score 0-100% quality rating
Status PASS / FAIL / SCRAP

Value Proposition

Enables longitudinal analysis, trend detection, and serves as a legal record for quality audits.

πŸ“Š Analytics Dashboard

πŸ“ˆ Trend Tracking

Line chart visualizes Health Score over time. Alerts managers to process drift.

🎯 Yield Rates

Bar charts show PASS/FAIL distribution. Critical for hitting production targets.

πŸ’° Loss Tracking

Calculates total financial impact of scrapped inventory.

πŸ” Audit Trail

Filterable logs exportable to CSV for external reporting.

High-Volume Batch Processing

From single-board testing to production-scale automation

1
πŸ“¦ ZIP Upload
Upload one file containing 50+ board images.
πŸ“
2
βš™οΈ Parallel Processing
System runs full pipeline on each board. 50 boards in ~90s.
⚑
3
πŸ“Š Master Report
Generates unified CSV summary with yield rates.
πŸ“ˆ

❌ Single-Board Workflow

Time for 50 boards: ~25 minutes
Effort: High (Manual clicks)
Risk: Easy to skip boards

βœ“ Batch Processing

Time for 50 boards: ~90 seconds
Effort: Minimal (One click)
Reliability: 100% processed

Production Impact

Enables end-of-shift quality reports. A manager can upload a day's production (200+ boards) and get a complete defect analysis and yield report in under 5 minutes.

Automated Documentation System

From defect detection to professional certification in < 1 second

πŸ“„ PDF Generation Engine

Instant creation of formal inspection certificates.

  • βœ“ Visual Proof: Embedded defect map.
  • βœ“ Detailed Log: Table with defect type, confidence, and cost.
  • βœ“ Financial Summary: Total repair cost & Final Status.
  • βœ“ Traceability: Timestamps and Model Version for audits.

90% Time Savings

Traditional reporting: 15 mins/board
Our System: < 1 second/board

PCB INSPECTION CERTIFICATE

Board ID: PCB_001

Date: 2026-01-03

Defects: 2

Cost: $13.50

βœ“ PASS - REPAIR

Open Circuit$2.25
Mouse Bite$11.25

Validated Performance Results

Rigorous testing on 590 held-out images

97.8%
Accuracy
Exceeded 95% target
100%
Critical Recall
Zero missed failures
1.2s
Speed
100x faster than manual
Defect Type Accuracy Recall Criticality
Open Circuit 98.0% 100% πŸ”΄ Critical
Short 99.0% 100% πŸ”΄ Critical
Mouse Bite 96.8% 96.8% 🟑 Major
Missing Hole 99.0% 100% πŸ”΄ Critical

🎯 100% Critical Recall

The system never missed a defect that could cause electrical failure (Opens, Shorts). This is the key metric for safety-critical apps.

⚑ Speed Comparison

Human: 2 mins/board (30/hr)
AI: 1.2 secs/board (3000/hr)

Roadmap to Production v2.0

Current limitations and planned enhancements

⚠️ Current Challenges

πŸ’‘ Lighting Sensitivity

Extreme factory lighting variations can reduce subtraction accuracy. Fix: Histogram equalization.

⏱️ Speed Bottleneck

CPU-based feature matching limits throughput to 1.2s. Fix: GPU/CUDA acceleration (Target: 0.3s).

🎨 Non-Standard PCBs

Currently optimized for green solder masks. Fix: Multi-color dataset augmentation.

πŸš€ Future Enhancements

πŸ“Ή Real-Time Camera Integration

Connect directly to RTSP/GigE industrial cameras for live conveyor belt scanning (Zero-touch operation).

☁️ Cloud Deployment

Migrate database to AWS/Azure for multi-factory analytics and centralized quality monitoring.

🧠 Active Learning Loop

"Human-in-the-Loop" feedback. When operators correct the AI, the model retrains overnight.

Transforming PCB Quality Assurance

From manual inspection to intelligent automation

97.8%

Accuracy β€’ Zero Critical Escapes

🎯

Reliability

Consistent, objective analysis eliminating human fatigue.

🧠

Intelligence

Integrated financial logic and automated work orders.

πŸ“ˆ

Scalability

Batch processing and persistent enterprise database.

Presented by

Atharva Mundke

Internship Project

GitHub: PCB-Defect-Detection-and-Classification/atharvam_1732