Skip to content

NUSSETO/Semiconductor_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”¬ Wafer Map Defect Classification using CNN

Python TensorFlow License Accuracy

An automated defect classification system for semiconductor wafer maps using Convolutional Neural Networks (CNN) to identify and categorize spatial defect patterns.

πŸ“‹ Table of Contents


🎯 Overview

This project develops an Automated Defect Classification system using Convolutional Neural Networks (CNN) to automatically categorize spatial defect patterns on semiconductor wafer maps. The system aims to:

  • Replace manual inspection processes
  • Reduce human error in defect classification
  • Accelerate identification of process anomalies
  • Enable faster Root Cause Analysis (RCA)

πŸ’Ό Business Value

In semiconductor manufacturing, wafer map patterns provide critical insights into fabrication process health. This automated system delivers:

Yield Ramp-Up πŸš€

Rapid identification of defect clusters (e.g., Scratch, Edge-Ring) enables process engineers to perform Root Cause Analysis faster.

Cost Reduction πŸ’°

Automating classification reduces the "man-to-machine" ratio and minimizes misclassification risks due to operator fatigue.

Process Monitoring πŸ”

Detecting systematic patterns vs. random defects helps pinpoint specific faulty process steps, such as:

  • Etching uniformity issues
  • CMP (Chemical Mechanical Planarization) handling errors
  • Equipment-specific failures

πŸ“Š Dataset

Source: WM811K Wafer Map Dataset

Dataset Characteristics:

  • Scale: 811,000+ wafer maps
  • Format: 2D images with pixel values representing die status
    • 0: Background
    • 1: Good Die
    • 2: Defective Die
  • Classes: 9 categories
    • 8 defect patterns: Center, Donut, Edge-Loc, Edge-Ring, Loc, Random, Scratch, Near-full
    • 1 normal class: None
  • Challenge: Natural class imbalance (common in manufacturing data)

Please be aware that the original dataset (WM-811K) contains a typo in the column header: trianTestLabel is used instead of trainTestLabel. To maintain compatibility with the raw data, this project uses the original spelling (trianTestLabel) throughout the codebase.

Defect Pattern Distribution

Defect Distribution

The dataset exhibits significant class imbalance, with Edge-Ring and Edge-Loc being the most common defect types.

Defect Size Distribution

Defect Size Distribution


πŸ› οΈ Installation

Prerequisites

  • Python 3.11+
  • pip package manager

Setup

  1. Clone the repository
git clone https://github.com/NUSSETO/Semiconductor_Project.git
cd Semiconductor_Project
  1. Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Download dataset
  • Download the WM811K dataset from Kaggle
  • Place LSWMD.pkl in the project root directory

πŸ”„ Project Workflow

1. Exploratory Data Analysis (EDA)

  • Analyze class distribution
  • Visualize spatial defect patterns
  • Understand data characteristics

2. Data Preprocessing

Resize Example

  • Resize wafer maps to standardized dimensions (64Γ—64 and 96x96 for comparative analysis)
  • Apply denoising techniques
  • Handle class imbalance

3. Model Architecture

Design and train CNN tailored for spatial pattern recognition:

  • Convolutional layers for feature extraction
  • MaxPooling for dimensionality reduction
  • Dense layers for classification
  • Dropout for regularization

4. Training & Optimization

  • Monitor training/validation metrics
  • Optimize hyperparameters
  • Implement data augmentation

5. Error Analysis

Investigate model performance through confusion matrices:

Initial Model Performance: Original Confusion Matrix

After First Optimization: Second Confusion Matrix

Final Model Performance: Final Confusion Matrix


πŸ“ˆ Results

Model Performance Metrics

Metric Value
Overall Accuracy ~78%
Macro Recall ~79%
Training Time ~28 minutes
Model Size ~19 MB

Training History

Training History


πŸ—οΈ Model Architecture

Sequential Model:
β”œβ”€β”€ Input (96 x 96 x 3)
β”œβ”€β”€ Conv2D (32 filters, 5Γ—5)
β”œβ”€β”€ MaxPooling2D (2Γ—2)
β”œβ”€β”€ Conv2D (64 filters, 3Γ—3)
β”œβ”€β”€ MaxPooling2D (2Γ—2)
β”œβ”€β”€ Conv2D (128 filters, 3Γ—3)
β”œβ”€β”€ MaxPooling2D (2Γ—2)
β”œβ”€β”€ Conv2D (256 filters, 3Γ—3)
β”œβ”€β”€ MaxPooling2D (2Γ—2)
β”œβ”€β”€ Flatten
β”œβ”€β”€ Dense (128 units)
β”œβ”€β”€ Dropout (0.5)
└── Dense (8 units, softmax)

Key Features:

  • Input shape: 96Γ—96Γ—3
  • Activation: ReLU for hidden layers, Softmax for output
  • Optimizer: Adam
  • Loss function: Categorical Crossentropy
  • Note on Input Size: While the exploratory phase and initial training (as seen in main.ipynb) experimented with 64x64 resolution for efficiency, the final deployed model architecture has been optimized for 96x96 resolution to capture finer details of defect patterns.

πŸš€ Usage

Running the Notebook

  1. Start Jupyter Notebook
jupyter notebook
  1. Open main.ipynb

  2. Run all cells or execute step-by-step:

Quick Start Example

# Load the trained model
from tensorflow.keras.models import load_model

# Option 1: Load the modern Keras format (Recommended)
model = load_model('model/wafer_defect_model.keras')

# Option 2: Load the legacy H5 format
# model = load_model('model/wafer_defect_model.h5')

# Predict on new wafer map
prediction = model.predict(preprocessed_wafer_map)
defect_class = np.argmax(prediction)

πŸ“ Project Structure

Semiconductor_Project/
β”œβ”€β”€ main.ipynb              # Main analysis notebook
β”œβ”€β”€ main.html               # For easy access
β”œβ”€β”€ LICENSE                 # MIT License
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ .gitignore              # Git ignore rules
β”œβ”€β”€ README.md               # This file
β”œβ”€β”€ img/                    # Visualization images
β”‚   β”œβ”€β”€ Defect_distribution.png
β”‚   β”œβ”€β”€ Defect_size.png
β”‚   β”œβ”€β”€ Resize_example.png
β”‚   β”œβ”€β”€ Training_history.png
β”‚   β”œβ”€β”€ Original_CM.png
β”‚   β”œβ”€β”€ Second_CM.png
β”‚   └── Final_CM.png
β”œβ”€β”€ model/ 
β”‚   β”œβ”€β”€ wafer_defect_model.h5
β”‚   └── wafer_defect_model.keras
└── data/
    └── LSWMD.pkl           # Dataset (not tracked in git)

πŸ™ Acknowledgments

  • Dataset: WM811K Wafer Map Dataset
  • Inspired by semiconductor manufacturing quality control practices
  • Built with TensorFlow/Keras/Antigravity/Gemini

License

This project is open-source and available under the MIT License.


Author: Jason Huang
Focus: Semiconductor Manufacturing Quality Control, Machine Learning, Data Analysis

About

Wafer Map Defect Classification using Deep Convolutional Neural Networks (CNN) with TensorFlow/Keras on the WM-811K dataset.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors