BACK_TO_KNOWLEDGE_BASE
Deep LearningComputer Vision

Understanding Convolution in CNNs for Defect Analysis

June 4, 2026

Feature Extraction in CNNs

When working with semiconductor wafer maps, detecting macro-level defects like rings or scratches requires robust spatial feature extraction.

A standard deep learning approach relies on Convolutional Neural Networks (CNNs). Here is a standard implementation snippet in TensorFlow:

import tensorflow as tf
from tensorflow.keras import layers, models

def build_wafer_model():
    model = models.Sequential()
    
    # First Convolutional Block
    model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(64, 64, 1)))
    model.add(layers.MaxPooling2D((2, 2)))
    
    # Second Convolutional Block
    model.add(layers.Conv2D(64, (3, 3), activation='relu'))
    model.add(layers.MaxPooling2D((2, 2)))
    
    model.add(layers.Flatten())
    model.add(layers.Dense(64, activation='relu'))
    model.add(layers.Dense(9, activation='softmax')) # 9 Defect Classes
    
    return model

Why it works

The convolution kernels scan across the wafer map, naturally capturing spatial hierarchies. Early layers learn basic lines and curves (like a scratch), while deeper layers combine these into complex shapes (like a center ring).