TEM Diffraction Pattern Analysis with Deep Learning Networks
Einleitung
The microstructure of a material strongly influences its properties and must therefore be studied carefully to tailor those properties for specific applications. A suitable method for analysing the crystallographic structure of a material is scanning transmission electron microscopy (STEM). The resulting diffraction patterns (DPs) provide detailed information about the crystal lattice, grain orientations, phase composition, and lattice defects. However, interpreting these DPs using traditional methods, such as template matching, is a highly demanding computational task. As a result, such approaches become impractical for high-throughput microstructural characterization, particularly in automated or in-situ analyses. To overcome these limitations, this project explores the use of different deep learning models for predicting grain orientations directly from experimental DPs. The main objectives are to establish an efficient analysis workflow, perform a systematic hyperparameter study, evaluate the performance of several model architectures, and generate high-quality crystal orientation maps suitable for further microstructure investigations. The development and training of these large machine learning models require substantial computational resources, both for handling extensive datasets and for optimizing networks with millions of parameters. Therefore, the use of a High-Performance Computer (HPC) is essential. The HPC infrastructure enables efficient parallelization of data processing, accelerated model training using multiple GPUs, and large-scale testing of different network architectures. These capabilities are crucial for achieving accurate and generalizable results within reasonable computation times.
Methoden
The analysis approach is based on deep learning models designed to predict crystallographic grain orientations directly from experimental diffraction patterns. In total, seven models were trained, representing three architecture types: one convolutional neural network (CNN), two Dense Convolutional Networks (DenseNets), and four Swin Transformers in their tiny configuration. For both DenseNet and Swin Transformer architectures, plain and pretrained variants were evaluated to assess the influence of transfer learning on model performance. All models were implemented in Python using the PyTorch framework. A systematic hyperparameter study was conducted to identify suitable learning rates, batch sizes, and model parameters. Model training and evaluation were executed on the High-Performance Computer, enabling parallel computation on multiple GPUs and efficient exploration of the different architectures and configurations.
Ergebnisse
The trained models successfully predicted crystallographic orientations directly from experimental diffraction patterns of a LiNiO₂ sample. This enabled the automated generation of crystal orientation maps, which revealed detailed microstructural features such as grain boundaries and intra-grain orientation distributions. All models achieved strong predictive performance, demonstrating the general suitability of deep learning for diffraction pattern analysis. Among the evaluated architectures, the convolutional neural network (CNN) served as a baseline, while the DenseNet and Swin Transformer models achieved notably higher accuracy. The Swin Transformer with an adjusted architecture yielded the best overall performance, producing crystal maps with sharp grain boundaries and coherent grain interiors. It also exhibited sensitivity to overlapping grains and dynamic diffraction effects, which are often challenging to capture using traditional template matching approaches. The hyperparameter study, primarily conducted on the CNN, revealed that dataset quality and training configuration have a substantial impact on model performance. Sorting the dataset by confidence scores of the template matching method improved label reliability and led to higher predictive accuracy. Furthermore, an intermediate batch size combined with an exponentially decaying learning rate ensured stable convergence and reduced training time. In contrast, modifications such as output clamping or larger convolutional kernels did not enhance performance.
Diskussion
The results demonstrate that deep learning provides an efficient and accurate alternative to conventional template matching for crystallographic orientation analysis. Attention-based architectures, such as the Swin Transformer, are particularly effective in capturing subtle diffraction features and handling complex cases like overlapping grains. The generated crystal maps are consistent with the expected microstructural characteristics and can serve as a robust basis for further quantitative analysis. Compared to traditional methods, the presented approach offers a substantial reduction in computation time while maintaining or exceeding the accuracy of established techniques. The automated prediction pipeline enables fast, large-scale generation of orientation maps, facilitating high-throughput microstructural characterisation. This opens the possibility for real-time or in-situ analyses, where rapid feedback on structural evolution is required. Beyond performance improvements, the conducted hyperparameter study highlights the importance of label quality and optimized training parameters in achieving reliable model behaviour. The findings also suggest that transfer learning can further enhance
generalisation when sufficient pretraining data are available. Future work will focus on extending the approach to simulated diffraction datasets with precisely defined orientation labels to minimize indexing uncertainties. Additionally, the influence of sample thickness and experimental conditions on prediction accuracy will be systematically investigated. These developments will contribute to further improving model robustness and advancing automated microstructure analysis workflows.