A comprehensive Python toolkit for assessing Scanning Electron Microscope (SEM) image quality and ensuring consistency between different SEM tools. Designed for semiconductor manufacturing and metrology workflows where stable image quality is critical for accurate measurements.
Modern CD-SEM workflows depend on stable image quality. This toolkit provides:
- Image Quality Assessment (IQA): Quantitative metrics to detect focus drift, stigmation, detector noise, and operating-point drift
- Tool-to-Tool Matching: Statistical comparisons to verify operating-point consistency across multiple SEM tools
- Comprehensive Analysis: Both full-reference and no-reference metrics with explainable visualizations
- Clear overview of the project's purpose and capabilities
- Easy installation instructions
- Quick start examples for immediate use
- Comprehensive documentation of all major features
- Practical application scenarios for semiconductor professionals
- Professional formatting with badges and clear structure
- Proper attribution to academic sources
- Modular organization that's easy to navigate
The README emphasizes the practical industrial applications while maintaining academic credibility through proper citations and methodological explanations.
- Normalized Variance Focus Score (Normvar) - Adapted from Yu Sun et al.
- Structural Similarity Index (SSIM)
- Peak Signal-to-Noise Ratio (PSNR)
- Laplacian Variance (Sharpness measurement)
- FFT High-Frequency Ratio (Fine-detail energy)
- Contrast-to-Noise Ratio (CNR) on fixed ROIs
- Histogram Analysis (Brightness/Contrast/Shape comparison)
- Statistical Summary
- Quality Assessment Categories (Excellent/Good/Fair/Poor)
- Gaussian blur (defocus simulation)
- Stigmation-like anisotropic blur
- Poisson noise (shot noise simulation)
- Gaussian noise (read noise simulation)
- Contrast/Brightness drift
- Python 3.7+
- OpenCV
- scikit-image
- NumPy
- Matplotlib
- SciPy
pip install opencv-python scikit-image numpy matplotlib scipy tabulate pandasFor BRISQUE no-reference quality assessment:
pip install opencv-contrib-pythonimport SEM_IQA
# Load your SEM images
reference_image = 'path/to/reference.bmp'
test_image = 'path/to/test.bmp'
# Calculate comprehensive quality metrics
metrics = calculate_all_metrics(reference_image, test_image)
# Generate quality report
generate_quality_report(metrics, "Your Distortion Type")
# Compare tool-to-tool histograms
hist_results = compare_histograms(reference_image, test_image, plot_histograms=True)# Demo with Gold-on-Carbon reference image
results = create_focus_assessment_demo('Gold_on_Carbon.jpg')# Compare FFT sharpness between reference and test images
fft_results = fft_sharpness_comparative(reference_image, test_image)
plot_fft_comparison(fft_results)# Apply stigmation (anisotropic blur)
stigmatized = apply_stigmation(original_image, ksize_x=9, ksize_y=3, angle=45)
# Add Poisson noise (simulates electron shot noise)
noisy_image = add_poisson_gaussian(original_image, peak=20, read_std=0.002)SEM_IQA/
├── SEM_IQA.ipynb # Main Jupyter notebook
├── figures/
│ ├── reference_images/ # Clean reference images
│ └── distorted_images/ # Images with various degradations
├── opencv_models/ # BRISQUE model files
│ ├── brisque_model_live.yml
│ └── brisque_range_live.yml
└── README.md
calculate_all_metrics()- Comprehensive metric calculationNormvarFocus()- Normalized variance focus scoreBrisqueScore()- No-reference quality assessmentcompute_sharpness_lap()- Laplacian sharpness
compare_histograms()- Statistical histogram comparisonfft_sharpness_comparative()- Frequency domain analysis
apply_stigmation()- SEM stigmation simulationadd_poisson_gaussian()- Realistic SEM noise simulation
The toolkit provides:
- Quantitative Metrics: Numerical scores for all quality dimensions
- Visual Comparisons: Side-by-side image and histogram plots
- Quality Reports: Structured assessment with insights
- Tool Matching Scores: Correlation metrics and quality ratings
- SEM Tool Qualification: Post-maintenance validation
- Process Control: Continuous image quality monitoring
- Multi-Tool Matching: Ensure measurement consistency across tools
- Troubleshooting: Identify specific degradation types
- Preventive Maintenance: Early detection of tool drift
The selected metrics are intentionally simple, explainable, and fast. They capture main SEM failure modes without requiring heavy models or opaque tuning. Visual overlays (SSIM maps, FFT magnitude views) help reviewers see where quality diverges—not just get a number.
Gold sputtered on carbon substrate images (GoC) are typically the first images acquired after SEM tool maintenance. The Normalized Variance method is stable and coincides with human perception of focus.
Contributions are welcome! Please feel free to submit pull requests for:
- Additional IQA metrics
- Improved visualization
- Performance optimizations
- Documentation improvements
- This project is licensed under the MIT License. See LICENSE file for details.
If you use this notebook or code, please cite:
Khan, I. (2025). SEM Image Quality Assessment & Tool-to-Tool Matching (Jupyter notebook). Version 1.0. GitHub. https://github.com/imranlabs/SEM_image_quality_analysis/tree/main
- Normalized Variance Focus Score adapted from Yu Sun et al.
- Public domain SEM images from various sources
- OpenCV and scikit-image communities
- The non-proprietary distortions used and inspired from the TID2013 paper.
For questions or issues:
- Check the example usage in the notebook
- Review the function documentation
- Open an issue on GitHub