Skip to content

aman-coder03/WaferShield-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaferShield AI: Edge AI for Semiconductor Defect Detection


Live at https://coder0304-wafershield-ai.streamlit.app

Real-time wafer defect classification using EfficientNet-Lite0 with ONNX deployment.
Achieves high accuracy with low latency, optimized for edge environments.

  • Test Accuracy: 90.34%
  • ONNX Accuracy: 89.77%
  • Latency: 8.55 ms per image (CPU)
  • Model Size: 6.76 MB

Overview

WaferShield AI is an edge-optimized deep learning system designed to classify semiconductor wafer defects in real time. The system addresses practical constraints in fabrication environments, including latency, compute limitations, and scalability.

The solution combines a lightweight architecture with an efficient deployment pipeline to enable high-throughput inspection without reliance on centralized infrastructure.


Key Features

  • Lightweight EfficientNet-Lite0 architecture optimized for edge deployment
  • ONNX FP16 model for fast and portable inference
  • Real-time performance with sub-10 ms latency per image
  • Balanced dataset and robust evaluation pipeline
  • Grad-CAM based explainability for model interpretability
  • Streamlit-based interactive interface for live inference

Problem Statement

Semiconductor fabrication produces large volumes of wafer inspection data. Traditional inspection workflows rely on manual analysis or centralized systems, leading to:

  • Increased latency
  • High infrastructure costs
  • Bandwidth constraints
  • Limited scalability

WaferShield AI enables localized, real-time defect classification suitable for deployment on edge devices.


Dataset

Selected Classes

  • Center
  • Clean
  • Donut
  • Edge-Loc
  • Edge-Ring
  • Loc
  • Random
  • Scratch

Dataset Configuration

  • Samples per class: 149
  • Total dataset size: 1,192 images
  • Train/Validation/Test split: 70/15/15
  • Stratified and balanced across all classes

Model Architecture

The system uses EfficientNet-Lite0 with transfer learning.

Key considerations:

  • Optimized for mobile and embedded systems
  • Strong accuracy-to-compute tradeoff
  • Suitable for real-time inference scenarios

Model Performance

Test Metrics

  • Accuracy: 90.34%
  • Macro F1 Score: ~0.90

Per-Class Performance

Class Precision Recall F1 Score
Center 0.92 1.00 0.96
Clean 0.91 0.91 0.91
Donut 0.88 1.00 0.94
Edge-Loc 0.67 0.91 0.77
Edge-Ring 1.00 0.86 0.93
Loc 1.00 0.64 0.78
Random 1.00 1.00 1.00
Scratch 1.00 0.91 0.95

The Loc class remains the most challenging due to similarity with Edge-Loc patterns.


Confusion Matrix

Confusion Matrix

The model shows strong class separation with minor confusion between spatially similar defect types.


Deployment

ONNX Model

  • Format: FP16 ONNX
  • Model Size: 6.76 MB
  • ONNX Accuracy: 89.77%

The ONNX model enables efficient cross-platform deployment and edge inference.


Edge Benchmarking

  • Total Test Images: 176
  • Total Inference Time: 1.5056 seconds
  • Average Latency: 8.55 ms per image
  • Throughput: 116.9 images per second
  • Runtime: ONNX Runtime (CPUExecutionProvider)

These results confirm real-time suitability for high-volume inspection systems.


Explainability

Grad-CAM visualizations highlight regions contributing to predictions:

  • Center defects show strong central activation
  • Edge-Loc focuses on boundary regions
  • Random defects show distributed activation
  • Loc shows subtle localized activation

This ensures the model learns meaningful defect patterns rather than background noise.


Tech Stack

  • Python
  • PyTorch (training)
  • ONNX Runtime (inference)
  • Streamlit (deployment interface)
  • NumPy, OpenCV, Pillow

Project Structure

WaferShield-AI/
│
├── app.py                  # Streamlit application
├── requirements.txt        # Deployment dependencies
├── README.md               # Project documentation
│
├── results/                # Visual outputs and evaluation artifacts
│   ├── confusion_matrix.png
│   ├── gradcam_Center.png
│   ├── gradcam_Edge-Loc.png
│   ├── gradcam_Loc.png
│   └── gradcam_Random.png

Usage

Run the Streamlit Application

streamlit run app.py

Training Pipeline

python src/train.py

Evaluation

python src/evaluate.py

Engineering Highlights

  • Edge-optimized model under 7 MB
  • Real-time inference with sub-10 ms latency
  • Balanced multi-class dataset
  • Robust evaluation and benchmarking
  • ONNX deployment pipeline
  • Explainability with Grad-CAM

Future Work

  • Validation on external datasets
  • Integration with embedded AI toolchains (e.g., NXP eIQ)
  • Hardware-specific optimizations
  • Real-time industrial deployment pipeline

License

This project is intended for academic and research purposes.

About

Edge-AI powered defect classification system designed to detect and classify semiconductor wafer defects using deep learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages