journal article·2026-07-01Open access

Contrast Transfer Functions Help Quantify Neural Network Out-Of-Distribution Generalization in HRTEM

Luis Rangel DaCosta, Mary C Scott

Microscopy and Microanalysis· Volume 32· Issue 4

Abstract

Abstract Neural networks, while effective for tackling many challenging scientific tasks, are not known to perform well out-of-distribution (OOD), i. within domains which differ from their training data. Understanding neural network OOD generalization is paramount to their successful deployment in experimental workflows, especially when ground-truth knowledge about the experiment is hard to establish or experimental conditions significantly vary. With inherent access to ground-truth information and fine-grained control of underlying distributions, simulation-based data curation facilitates precise investigation of OOD generalization behavior. Here, we probe generalization with respect to imaging conditions of neural network segmentation models for high-resolution transmission electron microscopy (HRTEM) imaging of nanoparticles, training and measuring the OOD generalization of over 12,000 neural networks using synthetic data generated via random structure sampling and multislice simulation. Using the HRTEM contrast transfer function, we further develop a framework to compare information content of HRTEM datasets and quantify OOD domain shifts. We demonstrate that neural network segmentation models enjoy significant performance stability, but will smoothly and predictably worsen as imaging conditions shift from the training distribution. Lastly, we consider limitations of our approach in explaining other OOD shifts, such as of the atomic structures, and discuss complementary techniques for understanding generalization in such settings.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Advanced Electron Microscopy Techniques and Applications · Machine Learning in Materials Science · Electron and X-Ray Spectroscopy Techniques

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Materials Science and Engineering, University of California , Hearst Memorial Mining Building, Berkeley, CA 94720 ,

National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory , 1 Cyclotron Rd., Berkeley, CA 94720 ,

Funding

Office of Science · Office of Basic Energy Sciences · U.S. Department of Energy · Office of Advanced Scientific Computing Research · Department of Energy Computational Science Graduate Fellowship

References (72)

Show source-provided references
1. SAM-I-Am: Semantic boosting for zero-shot atomic-scale electron micrograph segmentation10.1016/j.commatsci.2024.113400 ↗
2. Invariance principle meets information bottleneck for out-of-distribution generalization
3. Ansel · 2024
4. Arjovsky · 2020
5. Improving multislice electron ptychography with a generative prior10.1109/ICCVW69036.2025.00382 ↗
6. A theory of learning from different domains10.1007/s10994-009-5152-4 ↗
7. Deep learning analysis of solid-electrolyte interphase microstructures in lithium-ion batteries10.1002/admi.202500558 ↗
8. Visualizing high-dimensional loss landscapes with Hessian directions10.1088/1742-5468/ad13fc ↗
9. Electron ptychography achieves atomic-resolution limits set by lattice vibrations10.1126/science.abg2533 ↗
10. Ask your distribution shift if pre-training is right for you
11. Ultimate resolution and information in electron microscopy II. The information limit of transmission electron microscopes10.1016/0304-3991(93)90213-H ↗
12. An image is worth 16×16 words: Transformers for image recognition at scale
13. Quantum limits of transmission electron microscopy10.1103/PhysRevLett.130.056101 ↗
14. Quantum and classical Fisher information in four-dimensional scanning transmission electron microscopy10.1103/PhysRevB.110.024110 ↗
15. Deep learning in electron microscopy10.1088/2632-2153/abd614 ↗
16. BASS: An R package for fitting and performing sensitivity analysis of Bayesian adaptive spline surfaces10.18637/jss.v094.i08 ↗
17. Multivariate adaptive regression splines10.1214/aos/1176347963 ↗
18. Machine Learning pipeline for segmentation and defect identification from high-resolution transmission electron microscopy data10.1017/S1431927621000386 ↗
19. A statistical framework for efficient out of distribution detection in deep neural networks
20. A case for reframing automated medical image classification as segmentation
21. Deep neural networks tend To extrapolate predictably
22. Leveraging generative adversarial networks to create realistic scanning transmission electron microscopy images10.1038/s41524-023-01042-3 ↗
23. Self-supervised machine learning framework for high-throughput electron microscopy10.1126/sciadv.ads5552 ↗
25. Kirkland · 202010.1007/978-3-030-33260-0 ↗
26. Low-dose cryo-electron ptychography of proteins at sub-nanometer resolution10.1038/s41467-024-52403-5 ↗
27. Quantifying noise limitations of neural network segmentations in high-resolution transmission electron microscopy10.1016/j.ultramic.2023.113803 ↗
28. PtyRAD: A high-performance and flexible ptychographic reconstruction framework with automatic differentiation10.1093/mam/ozaf070 ↗
29. A simple unified framework for detecting out-of-distribution samples and adversarial attacks
30. Electron dose dependence of signal-to-noise ratio, atom contrast and resolution in transmission electron microscope images10.1016/j.ultramic.2014.01.010 ↗
31. Li · 2025
32. TEMImageNet training library and AtomSegNet deep-learning models for high-precision atom segmentation, localization, denoising, and deblurring of atomic-resolution images10.1038/s41598-021-84499-w ↗
33. Liu · 2023
34. An empirical study on distribution shift robustness from the perspective of pre-training and data augmentation
35. Deep convolutional neural networks to restore single-shot electron microscopy images10.1038/s41524-023-01188-0 ↗
36. Aberration measurement using the Ronchigram contrast transfer function10.1016/j.ultramic.2010.04.006 ↗
37. Information in 4D-STEM: Where it is, and how to use it10.1016/j.ultramic.2026.114351 ↗
38. Detecting extrapolation with local ensembles
39. A deep learning approach to identify local structures in atomic-resolution transmission electron microscopy images10.1002/adts.201800037 ↗
40. The abTEM code: Transmission electron microscopy from first principles10.12688/openreseurope.13015.1 ↗
41. Domain generalization using causal matching
42. Accelerating iterative ptychography with an integrated neural network10.1111/jmi.13407 ↗
43. Accuracy on the line: On the strong correlation between out-of-distribution and in-distribution deneralization
44. Disentangling multiple scattering with deep learning: Application to strain mapping from electron diffraction patterns10.1038/s41524-022-00939-9 ↗
45. Resolution beyond the “information limit” in transmission electron microscopy10.1038/374630a0 ↗
46. Automatic software correction of residual aberrations in reconstructed HRTEM exit waves of crystalline samples10.1186/s40679-016-0030-1 ↗
47. Correction of three-fold astigmatism for ultra-high-resolution TEM10.1016/S0304-3991(96)00096-4 ↗
48. Vision transformers are robust learners10.1609/aaai.v36i2.20103 ↗
49. Fishr: Invariant gradient variances for out-of-distribution generalization
50. Diverse weight averaging for out-of-distribution generalization10.52202/068431-0786 ↗
51. Prismatic 2.0—simulation software for scanning and high resolution transmission electron microscopy (STEM and HRTEM)10.1016/j.micron.2021.103141 ↗
52. A robust synthetic data generation framework for machine learning in high-resolution transmission electron microscopy (HRTEM)10.1038/s41524-024-01336-0 ↗
53. Random vs realistic amorphous carbon models for high resolution microscopy and electron diffraction10.1063/1.4831669 ↗
54. U-net: Convolutional networks for biomedical image segmentation10.1007/978-3-319-24574-4_28 ↗
55. Information transfer in transmission electron microscopy10.1016/0304-3991(84)90038-X ↗
56. Deep learning segmentation of complex features in atomic-resolution phase-contrast transmission electron microscopy images10.1017/S1431927621000167 ↗
57. Model-free estimation of completeness, uncertainties, and outliers in atomistic machine learning using information theory10.1038/s41467-025-59232-0 ↗
58. Sketching curvature for efficient out-of-distribution detection for deep neural networks
59. LCA-on-the-line: Benchmarking out of distribution generalization with class taxonomies
60. Spence · 2017
61. Understanding the influence of receptive field and network complexity in neural network-guided TEM image analysis10.1017/s1431927622012466 ↗
62. Generalization across experimental parameters in neural network analysis of high-resolution transmission electron microscopy datasets10.1093/micmic/ozae001 ↗
63. Residual wave aberrations in the first spherical aberration corrected transmission electron microscope10.1016/S0304-3991(97)00102-2 ↗
64. Ultimate resolution and information in electron microscopy: General principles10.1016/0304-3991(92)90202-U ↗
65. Varnavides · Microsc Microanal · 2026 · 3210.1093/mam/ozag005 ↗
66. Varnavides · 2024
67. Developing and evaluating deep neural network-based denoising for nanoparticle TEM images with ultra-low signal-to-noise10.1017/S1431927621012678 ↗
68. AutoDetect-mNP: An unsupervised machine learning algorithm for automated analysis of transmission electron microscope images of metal nanoparticles10.1021/jacsau.0c00030 ↗
69. Williams · 2008
70. Ye · 2021
71. Ye · 2022
72. Yu · 2024