Image making · Research feature

STEMDiff: A Wavelet-Enhanced Diffusion Model for Physics-Informed STEM Image Generation

A new AI model creates realistic scanning transmission electron microscopy images by embedding physical principles and preserving experimental noise patterns.

Adapted from research by Yihui Bao, Xinyi Lu, Yanyan Xia and colleagues.

Journal publication · 2025-09-27 · Attribution & reuse
In this article
Editorial illustration of motion paths.

Editor’s introduction

The study introduces STEMDiff, a diffusion model that uses discrete wavelet transforms to generate realistic STEM images from crystal structure labels. It preserves high-frequency details and experimental noise, which are critical for accurate atomic-scale analysis. The model produces images that are nearly indistinguishable from real data, with a 17-fold improvement over prior methods, as measured by quantitative metrics. The approach reduces reliance on manually annotated data, offering a scalable solution to training data scarcity in STEM analysis. The findings demonstrate that the model effectively retains structural fidelity and noise characteristics, supporting its use in materials characterization.

Introduction

Advancing the understanding of materials at the atomic scale is fundamental to designing next‐generation functional materials for applications ranging from quantum computing to heterogeneous catalysis and energy storage, as well as water treatment. Scanning transmission electron microscopy (STEM) has emerged as an indispensable tool in this pursuit, enabling direct visualization of atomic arrangements with sub‐angstrom resolution. However, the extraction of comprehensive quantitative information from these complex images, such as encompassing atomic positions, defects, strain fields, and compositional variations, increasingly requires sophisticated machine learning (ML) approaches to handle the scale and complexity of modern electron microscopy datasets.

The ability to precisely characterize nanoscale material features has profound implications for chemical process development and optimization. In heterogeneous catalysis, atomic‐level understanding of active site distributions, particle morphologies, and support interactions directly influences reaction pathways, selectivity, and catalyst lifetime. These structure‐property relationships critically impact process design parameters, including reactor configurations, operating conditions, and economic viability of chemical processes.

A critical bottleneck in deploying ML for STEM image analysis is the scarcity of high‐quality annotated training data. The acquisition of experimental STEM images is time‐intensive and limited by access to specialized instruments, while manual annotation introduces human bias and severely restricts dataset size. Conventional approaches that rely on physics‐based simulations followed by manual addition of experimental artifacts are not only labor‐intensive but also fall short in capturing the statistical complexity of real experimental images. These artifacts include detector noise, drift‐induced distortions, probe instabilities, and sample contamination, all of which significantly influence image characteristics yet are challenging to model analytically.

Recent attempts to bridge this simulation‐experiment gap have explored generative adversarial networks (GANs), which have shown promise in creating realistic STEM images. For instance, Khan et al. demonstrated that cycle‐consistent GANs can transform simulated STEM images into experimental‐like ones with a Fréchet Inception Distance (FID) score of 0.35. However, GANs often suffer from training instability, mode collapse, and limited interpretability, constraining their practical utility for scientific imaging applications where physical accuracy is paramount.

Diffusion models represent a fundamentally different approach to generative modeling, learning the underlying noise distribution of data through a progressive denoising process. Unlike GANs, these models offer improved training stability, better mode coverage, and a more principled probabilistic framework. Despite these advantages, the commonly used U‐Net architectures, which work as a denoising module in diffusion models, exhibit an inherent high‐frequency bias, i.e., they tend to prioritize low‐frequency image components while inadequately capturing the high‐frequency details that are critical in experimental STEM images. This limitation is particularly problematic for scientific applications where fine details often contain essential physical information.

Here, we propose STEMDiff, a conditional diffusion model trained on physically simulated STEM images that transforms simple binary label maps derived directly from crystal structures into highly realistic STEM images through a physics‐informed approach. The key innovation lies in the development of Discrete Wavelet Transform (DWT)‐based Noise Retaining Blocks that are strategically integrated into the model architecture. These specialized blocks effectively isolate and preserve the high‐frequency components characteristic of experimental STEM images, overcoming the high‐frequency bias inherent in standard diffusion models. This wavelet‐based approach proves particularly advantageous for electron microscopy images, where atomic‐level details and experimental artifacts occupy specific frequency bands that must be accurately reproduced. The performance of STEMDiff surpasses previous approaches by a substantial margin, achieving an FID score of 0.02, representing a 17 fold improvement over state‐of‐the‐art GAN‐based methods. Quantitative analysis using Kullback‐Leibler (KL) divergence further confirms that the statistical distribution of STEMDiff‐generated images closely aligns with that of experimental data. More importantly, these synthetic images retain the physical fidelity required for downstream analytical tasks, as demonstrated by the successful training of atomic column detection networks using exclusively STEMDiff‐generated data.

STEMDiff provides a practical approach for physics‐informed synthetic data generation that could transform how ML is applied across scientific imaging modalities. By enabling the creation of virtually unlimited training data with ground truth annotations, this approach addresses a fundamental challenge in scientific machine learning, i.e., bridging the gap between simulation and experiment while preserving physical accuracy. As the volume and complexity of electron microscopy data continue to grow, such tools will become increasingly essential for extracting meaningful insights and accelerating materials discovery. Beyond electron microscopy, the physics‐informed generative framework of STEMDiff offers a blueprint for synthetic data generation in other modalities, such as X‐ray tomography or optical imaging, where data scarcity hinders artificial intelligence (AI) driven discovery. This positions our work at the interdisciplinarity of materials science, computational chemistry, and ML, with potential to impact fields like water treatment, renewable energy, and nanotechnology.

Architectural Design and Theoretical Framework of STEMDiff

The fundamental challenge in STEM image generation lies in creating realistic simulations that capture both structural accuracy and experimental artifacts. While conventional simulation approaches often struggle with this dual requirement, we address it through a novel generative framework combining diffusion models with wavelet theory, denoted as STEMDiff modeling.

It is important to emphasize that although STEMDiff generates images during inference using binary structural labels and Gaussian noise as inputs, the model is trained on paired datasets comprising precisely simulated STEM images and their associated label maps. These simulated images are derived from ab initio physical simulations, providing an essential basis for the ability of STEMDiff to generate images from structural information.

In this study, a binary label map denotes a 2D matrix matching the resolution of the simulated STEM image. It is created by projecting atomic positions from the input crystal structure file onto a 2D grid, where pixels representing atomic columns receive a value of 1, and background areas are assigned 0. As such, this binary map acts as a streamlined depiction of the structure, maintaining the spatial arrangements and rough outlines of atomic columns. The label maps are produced using a custom Python script that ensures perfect alignment with the simulated STEM images generated from identical atomic coordinates.

High‐Frequency Preservation through Noise Retaining Blocks (NRB)

A critical limitation we identified in conventional diffusion architectures when applied to scientific imaging is their inherent preference for reconstructing low‐frequency information at the expense of crucial high‐frequency details. The frequency bias becomes particularly problematic for STEM imaging, where atomic‐scale features and experimental artifacts predominantly occupy high‐frequency spectral ranges.

This wavelet‐based approach transforms how frequency information flows through the network, enabling STEMDiff to preserve and reconstruct the intricate high‐frequency details that characterize authentic experimental STEM observations. By replacing conventional skip connections with NRBs throughout the architecture, we achieve substantially improved fidelity while maintaining computational efficiency.

Raw Simulated Image Enhancement Protocol

The development of STEMDiff necessitated the implementation of sophisticated pre‐processing methodologies to bridge the realism gap between simulations and experimental reality. Our comprehensive enhancement protocol consists of the following sequential steps: Statistical noise injection: Introduction of physically motivated Poisson noise patterns at the pixel level, accurately replicating the quantum statistical fluctuations inherent in experimental electron detection systems.Geometric distortion modeling: Application of a sequence of spatial geometric manipulations, including horizontal shear, vertical compression, and jittering.Environmental noise simulation: Integration of calibrated Gaussian noise distributions to mimic unpredictable variations encountered in real‐world imaging environments.Contamination effect reproduction: Extraction and incorporation of low‐frequency background components from experimental STEM images using Fourier filtering to replicate localized ultra‐bright regions caused by sample contamination.

This comprehensive enhancement strategy, combined with the wavelet‐enhanced diffusion architecture, enables STEMDiff to generate synthetic STEM images with unprecedented experimental fidelity while preserving ground truth structural information critical for ML applications in materials science. The implementation and training details are provided in the supporting information.

Generation of Experimentally Authentic STEM Images via STEMDiff

STEMDiff demonstrates unprecedented capability in bridging the persistent gap between computational simulations and experimental reality in STEM. To systematically evaluate this capability, by taking monolayer tungsten diselenide (WSe2) as an example, we conducted comparative analyses between three distinct image classes, i.e., raw simulated images, STEMDiff‐generated outputs, and experimental STEM images, examining both their spatial and frequency‐domain characteristics.

Initially, we established a baseline by generating idealized STEM simulations using the abTEM and atomic simulation environment (ASE) Python packages, incorporating precise electron optical parameters matched to experimental conditions. However, these conventional simulated images intrinsically lack critical experimental features, including detector noise, drift distortions, probe jittering, lens aberrations, thickness variations, and surface contamination phenomena. These experimental realities collectively contribute to the characteristic signature of authentic STEM observations that conventional simulation methodologies fundamentally cannot reproduce.

Beyond visual fidelity, STEMDiff demonstrates competitive computational efficiency by circumventing the sequential sampling iterations required by traditional Denoising Diffusion Implicit Models (DDIM). This optimization enables the generation of high‐resolution (256 × 256 pixel) experimentally authentic STEM images within milliseconds rather than seconds, representing a substantial computational acceleration that facilitates large‐scale dataset creation for ML applications.

While the current implementation specifically addresses WSe2 monolayer systems, the underlying framework possesses inherent extensibility to diverse crystalline structures and material compositions through appropriate expansion of the training dataset. This capability establishes a transformative pathway for automated STEM image generation that eliminates the requirement for laborious manual simulation parameter optimization, fundamentally advancing materials characterization workflows.

Quantitative Assessment of STEMDiff Image Authenticity

These competitive statistical metrics directly result from the architectural elements of STEMDiff, particularly the NRBs, which enable the model to learn and reproduce the complex statistical distributions characteristic of experimental STEM observations. This capability extends beyond superficial visual similarity to encompass the nuanced noise characteristics, contrast variations, and high‐frequency spectral components that collectively define experimental authenticity.

Spectral Analysis of High‐Frequency Preservation Mechanisms

The notable experimental fidelity achieved by STEMDiff stems from its fundamental architectural innovations designed to overcome inherent limitations in conventional diffusion models. This section presents a detailed frequency‐domain analysis elucidating the mechanisms through which STEMDiff preserves critical high‐frequency components that define experimental STEM imagery.

Recent investigations into diffusion model behavior have revealed an intrinsic high‐frequency bias that significantly impacts scientific image generation quality. Specifically, diffusion models exhibit a systematic tendency to prioritize reconstruction of low‐frequency image components while progressively attenuating high‐frequency details during the denoising process. This behavior reflects an underlying propensity of neural networks to preferentially learn low‐frequency representations during training, subsequently compromising the generation of sophisticated textural elements and fine structural details. For STEM imaging specifically, this limitation becomes particularly pronounced as experimental authenticity fundamentally depends on accurate reproduction of high‐frequency components encompassing atomic‐scale features, instrumental artifacts, and quantum noise patterns.

This phenomenon can be mechanistically understood through analysis of the denoising process dynamics. 1) During initial denoising iterations, the input signal predominantly contains high‐amplitude noise components, enabling the standard U‐Net architecture to effectively model the approximately uniform spectral characteristics of Gaussian noise through its skip‐connection mechanism. 2) As denoising progresses toward completion (n approaching 1), the residual noise components become progressively subtler and more structurally correlated with the underlying image content. 3) At this critical stage, the conventional U‐Net architecture demonstrates diminished capacity to capture high‐frequency noise modes, resulting in significant spectral distortion.

This wavelet‐based approach leverages the inherent multi‐resolution capabilities of DWT to efficiently capture and preserve frequency information across multiple scales, providing a mathematically principled solution to the high‐frequency bias problem. Consequently, STEMDiff generates images that exhibit both visual and spectral congruence with experimental references, establishing a standard for experimental fidelity in computational STEM image generation.

Application of STEMDiff in Atomic Column Detection with Fully Convolutional Networks

Beyond theoretical performance metrics, the ultimate validation of the utility of STEMDiff lies in its capacity to support downstream analytical applications in materials characterization. To demonstrate this practical value, we implemented a fully convolutional network (FCN) for atomic column detection in experimental STEM imagery, trained exclusively on STEMDiff‐generated synthetic data.

Accurate localization of atomic columns represents a fundamental analytical challenge in materials characterization, with substantial implications for understanding structure‐property relationships. Traditional approaches for addressing this challenge broadly categorize into two methodological families: 1) real‐space techniques utilizing geometric fitting algorithms, and 2) reciprocal‐space methods employing template matching. While geometrically intuitive, real‐space approaches typically require extensive manual parameter optimization and demonstrate limited robustness to experimental artifacts. Conversely, reciprocal‐space methods exhibit superior performance under idealized imaging conditions but suffer substantial degradation when confronted with beam‐induced specimen modifications, contamination effects, and other experimental variables.

Contemporary deep learning approaches offer compelling advantages for addressing these challenges through their capacity to learn complex image‐to‐structure mappings directly from data. However, their practical implementation has been severely constrained by the scarcity of appropriately annotated training datasets, as the acquisition and manual annotation of experimental STEM images represents a prohibitively resource‐intensive process.

Trained on STEM images produced via physical simulations, the STEMDiff framework supports an effective structure‐to‐image generative approach at inference time, effectively linking crystallographic representations with images that closely resemble real experimental results. To demonstrate this capability, we implemented an FCN with the architectural configuration to identify atomic positions of monolayer in experimental STEM images, comprising a symmetric encoder‐decoder structure with skip connections between corresponding resolution levels. This network was trained solely on synthetic data, and in this study, we take monolayer WSe2 and graphene structures as examples. The synthetic dataset was generated through a streamlined workflow incorporating: 1) programmatic extraction of atomic coordinates from crystallographic information files, 2) generation of binary structural maps with intensity peaks corresponding to atomic column positions, and 3) application of STEMDiff to transform these abstract representations into experimentally authentic STEM visualizations.

For the experimental implementation, we generated 400 binary structural images incorporating diverse geometric transformations (rotations, scaling, and translations) to ensure robust generalization. After processing through STEMDiff and subsequent quality filtering, 185 synthetic training examples were retained for FCN training. Despite its moderate size, the collection of training examples demonstrated remarkable efficacy in identifying atomic position coordinates within experimental STEM images.

This practical demonstration establishes several significant advantages of the STEMDiff‐FCN workflow: 1) dramatic reduction in manual annotation requirements through automated label generation, 2) remarkable data efficiency, with high‐performance models trained on just ≈120 synthetic examples, 3) preservation of physically meaningful high‐frequency features critical for structural analysis, and 4) closed‐loop validation of experimental fidelity of STEMDiff through successful transfer learning to authentic experimental conditions.

While taking WSe2 and graphene monolayers as examples in this study, the methodology exhibits inherent extensibility to diverse material systems and experimental configurations, establishing a generalizable framework for automated structural analysis in electron microscopy. This capability represents a crucial bridge between theoretical simulation and experimental analysis, substantially accelerating materials characterization workflows while reducing human intervention requirements.

Conclusion

The development of STEMDiff represents a significant advancement in addressing a fundamental challenge in data‐driven materials characterization, i.e., the creation of realistic, physics‐informed training data for ML applications in electron microscopy. By combining conditional diffusion models with Discrete Wavelet Transform‐based Noise Retaining Blocks, we’ve successfully overcome the high‐frequency bias inherent in traditional generative networks, enabling the preservation of critical atomic‐scale details and experimental artifacts that define authentic STEM imagery. The competitively low FID scores (0.02) and KL divergence metrics demonstrate that STEMDiff generates images nearly indistinguishable from experimental data, outperforming conventional approaches by orders of magnitude. More importantly, the practical utility of this approach is validated through downstream atomic column detection tasks, where FCNs trained solely on synthetic STEMDiff data achieve remarkable precision on real experimental images containing complex noise patterns and contamination artifacts. This bridging of the simulation‐experiment gap opens new avenues for accelerated materials discovery by enabling rapid, autonomous analysis of electron microscopy data with minimal human intervention. The methodology offers a versatile framework applicable to diverse material systems and imaging modalities. STEMDiff thus offers a novel path for physics‐informed synthetic data generation that could fundamentally transform how one trains ML models for materials characterization and discovery, with extensions to fields like environmental science.