Wafer Defect Classification
# Wafer Defect Classification
## Introduction & Motivation
Detecting and classifying wafer defects through ML accelerates semiconductor quality control. ML models identify defect types from images and patterns for rapid wafer screening.
Motivation: Classify wafer defects for quality control.
Applications: Defect detection, classification, spatial analysis, yield prediction.
---
## Core Concepts & Theory
### Defect Types
Scratches, particles, voids.
### Spatial Distribution
Location patterns.
### Defect Size
Dimensions and impact.
### Classification Accuracy
Detection rate.
---
## Mathematical Formulation
Classification:
$$\hat{y} = \arg\max_c P(c|\mathbf{x})$$
Precision:
$$P = \frac{TP}{TP + FP}$$
Recall:
$$R = \frac{TP}{TP + FN}$$
---
## Advanced Theory & Extensions
### Convolutional Networks
Image processing.
### Attention Mechanisms
Region focus.
### Transfer Learning
Pre-trained models.
---
## Computational Considerations
Images: O(W·H·C) input.
CNN: O(D²) network.
Classification: O(D) per wafer.
---
## Practical Implementation Strategies
### Image Preprocessing
Normalization, augmentation.
### Feature Extraction
Pattern recognition.
### Classification Layers
Softmax output.
---
## Benchmark Datasets & Evaluation
WM-811K: Wafer defect data.
Semiconductor Datasets: Industry data.
Literature Defects: Published images.
---
## Key Challenges & Limitations
### Class Imbalance
Rare defects.
### Spatial Variation
Position effects.
Resolution Dependence
Image quality.
---
## Hyperparameter Tuning
Layers: 3-5 conv layers.
Filters: 32-512 per layer.
Learning rate: 1e-4 to 1e-2 schedule.
---
## Real-World Applications & Case Studies
Si Wafers: Logic chips.
GaAs Wafers: RF devices.
Si Carbide: Power electronics.
---
## Integration with Other Methods
Defect ML + imaging; + SEM; + yield models.
---
## Summary & Key Takeaways
ML classifies wafer defects efficiently.
Principles:
1. Imaging: Data acquisition.
2. Preprocessing: Image preparation.
3. Features: Pattern extraction.
4. Classification: Defect typing.
5. Analysis: Spatial patterns.
---
## Appendix: Practical Labs
### Lab 1: Wafer Image Preprocessing
import numpy as np
def preprocess_wafer_image(image, target_size=256):
"""Preprocess wafer defect image"""
resized = image[:target_size, :target_size]
normalized = (resized - np.mean(resized)) / (np.std(resized) + 1e-6)
return normalized
image = np.random.randn(512, 512)
processed = preprocess_wafer_image(image)
assert processed.shape == (256, 256), "Preprocessing failed"
print(f"✓ Preprocessed image shape: {processed.shape}")### Lab 2: Defect Classification
import numpy as np
class DefectClassifier:
def __init__(self, num_classes=5):
self.weights = np.random.randn(128, num_classes) * 0.1
self.bias = np.zeros(num_classes)
def classify(self, features):
"""Classify defect type"""
logits = features @ self.weights + self.bias
probs = np.exp(logits) / np.sum(np.exp(logits))
return np.argmax(probs)
features = np.random.randn(128)
classifier = DefectClassifier()
defect_class = classifier.classify(features)
assert 0 <= defect_class < 5, "Classification failed"
print(f"✓ Predicted defect class: {defect_class}")### Lab 3: Confusion Matrix
import numpy as np
def compute_confusion_matrix(predictions, labels, num_classes):
"""Compute confusion matrix"""
cm = np.zeros((num_classes, num_classes))
for pred, true in zip(predictions, labels):
cm[true, pred] += 1
return cm
preds = np.array([0, 1, 2, 1, 0])
labels = np.array([0, 1, 1, 1, 0])
cm = compute_confusion_matrix(preds, labels, 3)
assert cm.shape == (3, 3), "Confusion matrix failed"
print(f"✓ Confusion matrix shape: {cm.shape}")### Lab 4: Detection Metrics
import numpy as np
class DefectMetrics:
def __init__(self):
pass
def compute_precision_recall(self, tp, fp, fn):
"""Compute precision and recall"""
precision = tp / (tp + fp + 1e-6)
recall = tp / (tp + fn + 1e-6)
f1 = 2 * precision * recall / (precision + recall + 1e-6)
return precision, recall, f1
tp = 90
fp = 10
fn = 20
metrics = DefectMetrics()
p, r, f1 = metrics.compute_precision_recall(tp, fp, fn)
assert 0 <= p <= 1 and 0 <= r <= 1, "Metrics failed"
print(f"✓ Precision: {p:.2%}, Recall: {r:.2%}, F1: {f1:.2%}")---