Introduction

Characterizing the microstructure of polycrystalline solids—including the size, morphology, and crystallographic orientation of the constituent crystal grains—is essential for understanding the relationships between process history, microstructure, and materials properties. This information enables predicting the behavior of structural and functional components and underpins the design of next-generation, high-performance materials1. The standard practice for crystallographic characterization involves diffraction-based methods, which rely on electron or X-ray microscopy techniques. One of the most utilized amongst these techniques is electron backscatter diffraction (EBSD). EBSD provides an accurate mapping of the material’s constituent phases and grains as a function of their crystallographic orientation by measuring and indexing the local diffraction patterns produced by the atomic lattice as the electron beam is scanned across the sample surface2,3. Being tied to an electron microscope, however, EBSD is limited in terms of measurement throughput, field of view, and maximum specimen dimensions. Therefore, orientation imaging by EBSD is generally carried out on small-area specimens (of the order of mm2), whose microstructure is representative of an entire component produced using a given manufacturing process. Due to these limitations, EBSD is inefficient at building materials libraries that are based on numerous specimens produced using different process parameters4, or at characterizing samples that exhibit large-scale microstructure heterogeneity. These limitations are particularly detrimental in the context of metal additive manufacturing (AM). Indeed, the complex and variable solidification pathways during fusion-based AM processes are known to yield microstructures that vary throughout the build and even across batches of nominally identical parts1,5. A high-throughput crystallographic characterization technique would significantly accelerate the development of additive processes as well as their adoption by the industry5.

One possible solution is to employ optical microscopy techniques, which provide significantly faster data acquisition and a larger field of view compared to EBSD. Since the atomic lattice cannot be resolved directly under visible light, however, optical orientation mapping may only be achieved indirectly, by analyzing optical signals that encode the underlying crystallographic orientation6,7. Based on this principle, techniques have been developed to quantify orientation-dependent changes in light intensity and polarization upon reflection from optically active materials8,9, or to reconstruct the topography of etch-pits10, which inherit their geometry and orientation from the underlying atomic lattice. Directional reflectance microscopy (DRM) falls in this second category10,11. The working principle of DRM is based on measuring and analyzing the reflection of light from the surface of the material as a function of the illumination direction10,11,12. When the material is chemically etched, the preferential dissolution of specific crystallographic planes13,14,15 or phases16 can generate topographical surface features which are linked to crystallographic orientation. These features reflect visible light preferentially at certain angles, producing a directional (i.e., anisotropic) reflectance effect. Once captured by DRM, directional reflectance data is analyzed by computational methods to enable spatial mapping of grain orientation10,11. Until now, however, orientation imaging by optical means has only been attained on pure crystalline solids, for which the measured optical signals could be indexed using material-specific, physics-based models. Expanding high-throughput optical orientation imaging to engineering metal alloys and other technologically relevant materials remains an open challenge, given that the complex, multi-phase microstructures of these materials give rise to optical signals that are difficult to decode using physics-based models.

Here, we present an optical method to perform grain orientation mapping in metal alloys. We use a convolutional neural network (CNN) to infer crystal orientation from the optical signal acquired by DRM. We name our model EulerNet because it predicts crystallographic orientation as represented by a set of Euler angles17. Our machine learning method circumvents some noteworthy limitations of physics-based approaches. Firstly, EulerNet learns the relationships between directional reflectance and crystal orientation autonomously, during training. That makes our workflow easier and faster by reducing the need for human intervention. No specialized studies are needed to build up knowledge about the morphology and crystallography of the microstructural constituents responsible for directional reflectance. Secondly, a machine learning model has the capacity of recognizing complex patterns in directional reflectance signals, which may otherwise go unnoticed by human analysis, or which may be difficult to outline using conventional digital signal processing. Finally, our data-driven framework is flexible. It can be easily templated and applied to other alloys with different microstructures, making it possible to extend optical orientation imaging to a variety of materials. In the following sections, we describe our machine learning workflow and demonstrate its effectiveness on Inconel 718 (I718) specimens produced by directed energy deposition (DED).

Results and discussion

Datasets, microstructure, and optical orientation maps

We produced a library of ten I718 specimens with rectangular geometry (24 mm × 24 mm × 12–18 mm) by DED. During the DED process, raw material in powder form (in this case, I718) is continuously fed into a melt pool through a nozzle, melted by a high-power laser source, and solidified upon cooling18. The material is deposited layer by layer on a build platform to create a three-dimensional shape. We produced our specimens using different combinations of laser powers, laser translating speeds, layer heights, and powder feed rates (Supplementary Table 1). These process parameters affect melt pool solidification and the thermal history of the material19,20. As a result, different specimens exhibit different microstructures. Some specimens display highly textured, columnar dendritic grains of the face-centered cubic (FCC) γ matrix phase, which grows along the build direction (BD). In other specimens, we observe portions of finer, randomly oriented grains interrupting the columnar growth, which produces a large-scale microstructure heterogeneity across the entire build. This heterogeneity is often found in DED-produced materials21. After deposition, we heat-treated the specimens following the ASTM standard for solutionizing and hardening I718 (see Methods). This heat treatment results in the formation of intermetallic precipitates in the microstructure, which are pivotal to our work. Among these precipitates, the orthorhombic phase δ (Ni3Nb) nucleates at the γ matrix grain boundaries and at dendrite boundaries through partial decomposition of the metastable, body-centered cubic (BCC) γ″ (Ni3Nb) phase22. δ precipitates appear in the microstructure as elongated, platelet-like structures22,23.

To enable optical orientation mapping, we etched the specimens using a chemical reagent that selectively dissolves the γ matrix, letting the corrosion-resistant δ platelets protrude from the surface (Fig. 1a, bottom). Because they are tilted with respect to the XY plane, these precipitates produce a directional reflectance signal which can be measured by DRM (Fig. 1a, top). Leveraging the crystallographic relationship between δ and γ, we use the directional reflectance signal to assess the orientation of the γ matrix grains. Indeed, δ and γ are oriented such that (111)γ//(010)δ and [\(\bar 101\)]γ//[100]δ22,24. Moreover, the habit plane of δ precipitates (i.e., the predominant platelet facet plane) is aligned parallel to {111}γ22.

Fig. 1: Illustration of the DRM technique.
figure 1

a In I718, chemical etching reveals δ phase precipitates in the form of elongated platelets protruding on the surface (here, seen under the scanning electron microscope). These platelets are in a specific crystallographic relationship with the γ matrix, causing surface reflectance to vary with grain orientation and the incident illumination angle. b The DRM apparatus (here, represented schematically) consists of a stereomicroscope focused on a fixed specimen and a moving white light source. A sequence of micrographs is captured while the light source rotates around the specimen.

We took a DRM measurement of each specimen using the setup shown schematically in Fig. 1b and following the procedure detailed in reference6. The local directional reflectance signal from any individual grain in the microstructure consists of the reflection intensity measured at that grain as a function of the light source elevation (θ) and azimuth (φ) angles. Peaks in reflection intensity may be observed at angles at which δ platelets reflect the incoming light directly into the optical microscope. Because the orientation of the platelets depends on the crystallographic orientation of the corresponding γ grain, different grain orientations produce distinct reflectance signals with different reflectance peaks.

Figure 2 illustrates the diversity of reflectance patterns encountered in I718. In this figure, we represent seven different crystal orientations in the inverse pole figure (IPF) map along the Z-axis as octahedra. The facets in each octahedron lay parallel to the {111}γ planes of the underlying grains, which coincide with the habit planes of the δ precipitates22. In general, we observe that the number and position of reflectance peaks in the reflectance patterns follow the underlying crystal symmetry. For instance, the reflectance pattern of the (100)γ grain contains four peaks separated by a 90° angle, which is consistent with the fourfold symmetry of the face-centered cubic (FCC) structure in this orientation. Similarly, the (110)γ grain pattern exhibits a two-fold symmetry. By contrast, we observe a six-fold symmetry in the pattern produced by (111)γ grains. The position of these reflectance peaks qualitatively matches the coordinates at which we would expect to observe specular reflections from {111}γ planes. This finding is a strong indication that reflectance peaks stem from specular reflections of the incoming light at the protruding δ platelets.

Fig. 2: Directional reflectance signals in I718.
figure 2

Directional reflectance signals measured from differently oriented grains exhibit different reflectance peaks. Each reflectance pattern is connected to its corresponding crystallographic orientation along the Z-axis (i.e., the sample surface normal) in the inverse pole figure (IPF) triangle. The peaks occur at illumination angles that coincide with specular reflections from {111}γ crystallographic planes.

Based on these observations, we speculate that grain orientation may be retrieved analytically, in principle, by devising a physics-based reflection model that relates peaks position and intensity to the etch-induced surface topography and to the underlying crystal orientation. In practice, however, developing such a model is challenging, time-consuming, and relies heavily on the input of human experts. It requires sophisticated digital signal analysis to accurately identify the key directional reflectance features in the optical signals, detailed characterization of the morphology, distribution, and crystallography of the microstructural constituents responsible for directional reflectance, and an in-depth understanding of how these constituents interact with visible light to produce the directional reflectance signal10. All these aspects make this approach difficult to template and hardly compatible with a high-throughput materials characterization paradigm.

By contrast, our machine learning model, EulerNet, can recognize complex patterns in directional reflectance signals autonomously and predict orientation with high accuracy and throughput. As the relationships between the input and output are learned in a fundamentally unguided way during training, the model requires minimal human supervision. In particular, no specialized microstructural studies are required to build up prior knowledge of the linkage between surface topography, directional reflectance, and crystal orientation. When used on a test specimen, EulerNet predicts a crystallographic orientation for each pixel in the DRM dataset, enabling grain orientation to be mapped spatially over the specimen’s surface in a similar fashion as EBSD. Figure 3 compares the EulerNet and EBSD IPF grain maps (831 × 1102 pixels) from one of our I718 specimens. From visual inspection of these maps, it appears that the crystal orientation predictions by EulerNet based on DRM generally match the results obtained by EBSD. Acquiring a DRM measurement on our samples took about 20 min while generating the orientation maps using EulerNet took only a few minutes when running on a modern laptop computer. By contrast, acquiring the EBSD measurement took several hours. Furthermore, different instances of the EulerNet model can be trained on different material datasets. Therefore, the methodology can be easily templated and reapplied to different alloys, regardless of their microstructural complexity. All these characteristics make our machine learning approach suited to deliver high-throughput optical orientation imaging while minimizing development time and effort.

Fig. 3: Orientation maps produced by EulerNet (DRM) and EBSD.
figure 3

The IPF maps produced by our EulerNet model from directional reflectance are visually almost identical to the ground truth EBSD maps, both in-plane (along the X and Y reference directions) and out-of-plane (along the Z direction). The specimen shown in the figure was not used for training the model. The scale bar represents 5 mm.

Machine learning model

The CNN architecture of our EulerNet model is shown schematically in Fig. 4. CNNs are state-of-the-art machine vision algorithms that have proven effective at processing image-like data and have gained significant attention in computer vision25,26. Our model takes as input a directional reflectance signal in the form of a two-dimensional numerical array of 6 × 72 continuous values, which represent the local surface reflection intensity across the array of illumination angles measured during DRM.

Fig. 4: Convolutional neural network model architecture.
figure 4

Our CNN model, EulerNet, connects the input directional reflectance signal to crystal orientation, which is represented as a set of three Euler angles. The input is first passed through convolutional layers and max-pooling layers to extract visual patterns, and then through fully connected regression layers, leading to the Euler angles prediction.

To predict crystal orientation from this input, the directional reflectance signal is passed through two convolutional and max-pooling layers followed by two fully connected regression layers. The role of the convolutional and max-pooling layers is to extract visual patterns in the reflectance signal which are informative about crystal orientation. In the first convolutional layer, simple visual patterns are detected. These so-called low-level features could be, for instance, edges and blobs. In the second convolutional layer, these patterns are assembled into more complex visual patterns representing, presumably, characteristics of the reflectance peaks, such as their position, number, and intensity. These high-level features are then flattened (i.e., reduced to a single dimension) and further passed through the fully connected regression layers. The resulting output prediction takes the form of three continuous values: the Euler angles used to represent crystal orientation. Euler angles parameterize an ordered sequence of three rotations that bring the (right-handed) Cartesian coordinate system attached to the specimen onto that of the crystal.

The convolutional layers and the fully connected layers comprise several tunable parameters—such as weights and biases—that must be learned during a training phase. Training is performed iteratively by comparing model predictions to the ground truth, computing prediction error, and readjusting the trainable parameters through backpropagation to minimize the error and improve prediction accuracy27. Here, we use EBSD measurements as ground truth labels and design our EulerNet model to minimize the mean disorientation angle between the predicted crystal orientation and the ground truth. The disorientation angle represents the minimum angle of rotation about a given axis to bring the two crystal orientations into coincidence28. Once trained, we test the model on previously unseen specimens; namely data which we did not use for training. This approach is representative of a real application scenario, in which a newly produced part with an unknown microstructure must be characterized. To test our model, we apply cross-validation over ten splits to our set of specimens. We use data from nine specimens for training and hold one out for testing, switching the test specimen in-between each split. We further detail the process of selecting data for training and testing in the Methods section.

Performance evaluation

We evaluate the performance of our EulerNet model by comparing the predicted and ground truth (EBSD) orientations at selected locations (i.e., pixels in the dataset) at the center of grains to avoid including data that might be misregistered in the test set (see Methods). For completion, we also include a comparative analysis on a pixel-level without filtering the data in the supplementary materials (Supplementary Fig. 2). In Fig. 5a, we show the distribution of disorientation angles in the combined tests from all cross-validation splits. The median disorientation angle between the predicted and true orientations averaged across the ten cross-validation splits is 6.7° ± 0.8°. While this value is a useful performance indicator, we believe it overestimates the real error because of two existing and hardly avoidable limitations in our evaluation method. Firstly, registration of the EBSD and DRM datasets is challenging because of the substantial differences in spatial distortion resulting from the two types of measurement, which require nonlinear methods to bring the two fields of view into coincidence. In this work, we employed an image registration algorithm based on optical flow estimation. We anticipate that, despite selecting pixels at the center of grains for the error evaluation, imperfections in the registration process may still lead to mislabeling of a fraction of the test data (see Supplementary Fig. 2c). The tail of the distribution at high disorientation angles in Fig. 5a likely contains this mislabeled data. Secondly, mounting the specimen for DRM such that the transverse and build directions are aligned parallel to the corresponding directions in the EBSD dataset is also a process that is subject to manual error, which is difficult to correct given the differences in spatial distortion between the two datasets.

Fig. 5: Evaluation of EulerNet performance.
figure 5

a The disorientation angle between the predicted orientation and the EBSD ground truth is centered around 5-8°. b The disorientation angle is marginally higher in the vicinity of the {111}γ orientation out-of-plane (Z) and is otherwise mostly uniform across the other orientations.

We also examine the orientation dependence of the prediction error by evaluating it along each of the specimen’s reference directions. To evaluate the error along these axes, we consider the two 3 × 3 rotation matrices associated with the Euler angles predicted by EulerNet, g1, and the EBSD measurement, g2. We compute eX, eY, and eZ, which represent the angles between the predicted and true normal vectors of the plane facing the specimen’s reference directions, as:

$${\it{e}}_{{{\mathrm{X}}}} = \mathop {\sum}\limits_{{\it{j}} = 1}^3 {{{{\mathrm{arccos}}}}} \left( {{{{\mathbf{g}}}}_{1\,j,1}^{ - 1} \cdot {{{\mathbf{g}}}}_{2\,j,1}^{ - 1}} \right)$$
(1)
$$e_{{{\mathrm{Y}}}} = \mathop {\sum}\limits_{j = 1}^3 {{{{\mathrm{arccos}}}}} \left( {{{{\mathbf{g}}}}_{1\,j,2}^{ - 1} \cdot {{{\mathbf{g}}}}_{2\,j,2}^{ - 1}} \right)$$
(2)
$$e_{{{\mathrm{Z}}}} = \mathop {\sum}\limits_{j = 1}^3 {{{{\mathrm{arccos}}}}} \left( {{{{\mathbf{g}}}}_{1\,j,3}^{ - 1} \cdot {{{\mathbf{g}}}}_{2\,j,3}^{ - 1}} \right)$$
(3)

We compute the mean values of eX, eY, and eZ, in the test set and name these metrics DX, DY, and DZ. The values of DX, DY, and DZ, averaged across all cross-validation splits, are respectively 6.5° ± 0.6°, 6.4° ± 0.6° and 5.8° ± 0.6°. This result indicates a slightly lower prediction error along the out-of-plane direction (DZ) compared to the in-plane directions (DX, DY). This difference may come from the greater potential for misalignment of the specimens in-plane compared to out-of-plane when mounting them to carry out DRM measurements. Finally, in Fig. 5b, we plot the disorientation angle as a function of crystal orientation in the principal axes of the specimen’s coordinate system. The error distribution is mostly uniform, except for the slight increase near the {111}γ orientation in the out-of-plane direction (Z). We believe that this minor inhomogeneity could be related to the peculiar six-fold symmetry seen in the directional reflectance signal corresponding to this crystal orientation (Fig. 2).

Our EulerNet model provides reliable orientation mapping in all our I718 specimens (Supplementary Fig. 1) despite the marked differences in their microstructure, which stem from the different DED parameters we used to produce them. This result suggests that EulerNet is robust to variations induced by the manufacturing process and can be used to characterize a wide range of I718 microstructures. Nevertheless, we note that our reported accuracy of 6.7°—even though overestimated by dataset misregistration—is substantially higher than the typical accuracy attainable by EBSD (~0.6°)17. We speculate that the error rate of our optical technique may also be affected by the inherent tolerance found in the elements that make DRM, including the level of light collimation, the quality of the optical lens of the camera, the accuracy of the motors which move the light source around the specimen, and the variability of the etch-induced surface structures. Thus, it is likely that increasing equipment accuracy would enhance the measurement accuracy significantly. In addition, given the vast design space of neural networks and the rapid developments in this field, it is possible that future improvements in the design or in the implementation of our CNN model could further contribute to improve performance.

Finally, we believe that DRM should not be considered as a direct substitute for EBSD, which remains the main technique for detailed analysis of crystallographic features, especially at the small scale. Instead, we believe that DRM combined with our machine learning technique can be an invaluable tool in supporting materials development efforts that require the application of orientation mapping to large specimens or vast databases. It may also be particularly suitable for applications that tolerate a modest trade-off in accuracy for a considerably increased measurement throughput. Many of such applications already exist. A notable example is the identification of relationships between crystallographic texture, process parameters, and part geometry in metal AM.

Handling anomalous data

Once an EulerNet is trained and validated, it becomes permanently available for future characterization of a specific material. The model used in this study, for instance, is available online (see Data Availability) and is suitable for the characterization of I718 specimens produced by DED. We believe that our model would yield reliable results on any such specimen as long as the δ phase precipitates—which generate the directional reflectance signal—are well-developed in the alloy and visible after etching. These conditions should be met when carrying out ASTM standard heat treatments on I718 and when the specimen surface preparation (including polishing and chemical etching) is performed following the same steps as those used to prepare the training dataset. We note that using DRM apparatuses that consist of equipment different from that used to produce the training set (e.g., the optical microscope, the camera sensor, the light source, etc.) could potentially introduce systematic bias into the data and affect the error rate. To minimize equipment bias and ensure model transferability across the community, we advise for equipment calibration, which we detail in the Methods section. If systematic equipment bias persisted despite the calibration, we foresee that applying transfer learning29,30 to fine-tune neural networks to a specific set of hardware might be a suitable solution to explore.

Regardless of its origins, it is important to be able to detect and exclude biased data to prevent fundamentally wrong microstructure characterization output. Indeed, machine learning models make predictions without any judgment on the quality of the input data or without any capacity to assess the uncertainty associated with the predictions31. If a test specimen is markedly different from the training specimens—which may occur, for example, as a result of failed specimen preparation, or when using a new DRM apparatus—the input data may be out-of-distribution (i.e., unrepresentative) and the associated predictions by the machine learning model may be flawed32. To detect out-of-distribution data, we propose an anomaly detection model based on dimensionality reduction of the DRM dataset by principal component analysis (PCA)33. We compute the two first principal components of the directional reflectance signals in the training set and project the data in this manifold. By construction, PCA components represent axes along which variance in the data is maximized. Along the PCA axes, training data is scattered following a distribution close to normal. We standardize these distributions by centering them around 0, with a standard deviation of 1, to ensure that they are in the same relative range. Then, we define the average of both variables as a single out-of-distribution indicator, z. This indicator is unitless. It reflects how far the data is from the mean of the training set distribution.

This z-score model is both simple to implement and efficient in detecting biased data. We illustrate its effectiveness by comparing two separate I718 specimens produced by DED. The first one (in Fig. 6a) is a specimen whose microstructure contains a few lack-of-fusion defects (see Fig. 6c) resulting from an excessive layer height setting during the DED process. The other (in Fig. 6d) is a specimen that, despite being heat-treated and etched according to standards, shows underdeveloped crystallographic surface features, and even a complete absence of them (see Fig. 6f) in the region near the baseplate. This anomaly is due to the variable cooling rates established within the alloy during processing, which led to high Nb retention in solid solution (and, correspondingly, depletion of δ phase precipitates) in the first portion of the build34. The corresponding z-maps successfully identify both anomalies. In the specimen in Fig. 6a, the distribution of the z value (in Fig. 6b) approximately follows that of the training dataset, indicating that directional reflectance in this specimen and in the training set are globally alike. However, lack-of-fusion defects get highlighted by the anomaly detection model. The uniformly bright appearance of the lack-of-fusion defects in the bright-field optical micrograph in Fig. 6c suggests that the surface remained locally flat (i.e., mirror-like) and that it did not react to the chemical etchant. In the specimen in Fig. 6d, it is apparent that z is generally higher compared to the training set (see Fig. 6e), and increases progressively towards the bottom of the sample, where there are no δ phase precipitates.

Fig. 6: Detection of anomalies and systematic bias in DRM datasets.
figure 6

Applying anomaly detection to new directional reflectance datasets enables to preemptively detect and discard unrepresentative data, which is not suitable for orientation imaging by the EulerNet model. a Anomaly detection in a regular specimen containing lack-of-fusion defects. When mapping z across the surface, the defects get highlighted by the anomaly detection model. b The distribution of z in this specimen is otherwise close to that of the training set distribution. c An example of lack-of-fusion defect seen under the optical microscope. d In a specimen with underdeveloped or absent δ phase precipitates exhibiting a globally high z-score. e The distribution of z is shifted compared to that of the training set. f Under SEM, no δ phase precipitates are visible on the specimen’s surface in the area close to the baseplate. The scale bars in (a, d) represent 5 mm and the scale bar in (f) represents 5 µm.

These examples illustrate that applying anomaly detection to new specimens of interest can be effective at detecting unrepresentative data, enabling preemptively verifying its suitability for orientation imaging by the EulerNet model. As the meaning of a high z-score can vary, the final decision to keep or discard data based on this indicator should be left to the operator based on his/her domain expertise and interpretation of the data.

Future outlook

Our results underpin the tremendous potential of machine learning algorithms for the automated decoding of directional reflectance signals and their application to crystallographic orientation mapping. In this paper, we decided to focus on Inconel 718 owing to the technological relevance of this alloy, which is used for many components in aircraft, rocket engines, turbines, and combustion chambers. In principle, however, our method would be applicable to any other alloy for which a reliable crystallographic etching method can be identified. Fortunately, the identification of etchants that are amenable to producing crystallographic features on the specimen surface is facilitated by the large body of literature produced by metallographers, who have perfected the chemical etching of metals and metal alloys over the past several decades14.

Once a suitable etchant is identified for a given material, our machine learning approach can be applied without the need for detailed microstructural studies or for deriving and manually tuning a physics-based orientation indexing model. The only requirement is to gather an initial set of specimens of the material to be characterized, assess their microstructure by means of DRM and EBSD, and train and validate the corresponding EulerNet model. Because of the relatively high cost of initially gathering data to perform training, validation, and optimization of a new model, there is great benefit in sharing trained models across the materials science community at large for a variety of different materials, alongside detailed information about surface preparation of the specimens, DRM equipment used (and the corresponding calibration), and the attainable performance. This endeavor could be achieved, for example, through e-collaborations.

The low cost and availability of the equipment required to carry out DRM measurements hold the promise to spread optical orientation mapping capabilities across both academia and the industry. We believe that our method would find immediate application in the research and development of metal AM processes, where there is high interest in expanding orientation imaging to entire, large-scale components. Moreover, our machine learning approach is the first to demonstrate orientation imaging of a complex alloy by optical means. As such, it could be pivotal in establishing a solid foundation for high-throughput optical orientation microscopy, leading to faster discovery of process-structure-property relationships and accelerated materials discovery.

Methods

Datasets

The nominal composition of the I718 specimens was 54% Ni, 18% Cr, 20% Fe, 5% Mo, 2% Nb, and 1% Ti. We produced them using a commercial-directed energy deposition machine (by BeAM) equipped with a 24Vx nozzle. We set the hatch spacing to 1.5 mm with 33% overlap, the working distance to 13 mm, and the central and secondary gas flow rates to 6 and 10 L/min. After deposition, we heat-treated the I718 specimens in a vacuum furnace using a three-stage process including a 60-min hold at 950 °C, an 8-h hold at 750 °C (for age hardening), and another 8-h hold at 690 °C (following standard AMS5663 for I718). We cut the heat-treated specimens along the XY plane perpendicular to the build direction (Z), and mechanically ground them according to standard metallographic sample preparation techniques to reveal the microstructure. To grind the specimens, we used a sequence of silicon carbide paper from 320 grit to 4000 grit. We then polished them to a mirror-like finish using a colloidal suspension of silica particles. Finally, we etched the specimens by immersion in a bath of Kalling’s 2 reagent (5 g cupric chloride, 100 mL hydrochloric acid, and 100 mL ethanol) at room temperature for 10 min.

For all specimens, we measured crystal orientation by EBSD and registered the EBSD and DRM fields of view so that each reflectance pattern could be associated to a reference orientation, which we regard as a ground truth. We performed EBSD measurements in a JEOL 7600 F field emission scanning electron microscope equipped with an Oxford instruments Nordlys 2 S EBSD detector. We used a 15 mA emission current, 20 kV accelerating voltage, and a 15 μm step size. To perform DRM measurements, we used an apparatus consisting of an Olympus SZ6145 stereomicroscope equipped with a 3X objective lens, an industrial monochrome CMOS camera, and a white LED light source. We varied the light source elevation angle (θ) from 15° to 65° in steps of 10° and the azimuth angle (φ) from 0° to 355° in steps of 5° and captured an image for each (θ, φ) combination. As a result, each DRM dataset contained a stack of 6 × 72 = 432 images. The original resolution of the images captured was 2448 × 2048 pixels. The images were downscaled to 1224 × 1024 pixels in the DRM datasets to reduce memory transfer during data processing. We normalized the measured reflectance against a uniform white reflector6 to compensate for uneven light intensity. We registered the DRM and EBSD datasets using the Python Scikit-image implementation of the TV-L1 solver for coarse to fine optical flow estimation35.

Model implementation

We implemented our EulerNet model in the Python Tensorflow library36 using the Keras Functional API37. In Table 1, we report the specifications of all constitutive layers. Our model leveraged a total of 1’219’523 trainable parameters.

Table 1 EulerNet model layer specifications.

Objective function

The aim of our EulerNet model was to minimize the disorientation angle between the predicted output and the ground truth EBSD orientation28. In face-centered cubic (FCC) crystal structures (the structure of the γ phase in I718), 24 different symmetry operations can be applied to the crystal and result in equivalent orientations. Owing to this crystal symmetry, the disorientation angle is derived as the minimum among the 24 different angles computed between the ground truth and all orientations equivalent to the predicted orientation. Considering two 3 × 3 rotation matrices g1 and g2, associated with the Euler angles of the predicted and ground truth orientations, respectively, and Si=1:24 the ensemble of the 24 symmetry operators for the FCC crystal structure, the disorientation angle is given by:

$$D\left( {{{{\mathbf{g}}}}_1,{{{\mathbf{g}}}}_2} \right) = \mathop {{{{{\mathrm{min}}}}}}\limits_{i \in [1,24]} \left\{ {arccos\left( {\frac{{tr\left[ {{{{\mathbf{g}}}}_1S_i{{{\mathbf{g}}}}_2^{ - 1}} \right] - 1}}{2}} \right)} \right\}$$
(4)

During training, the input data was passed into the model iteratively in mini-batches of 50 examples. At each mini-batch iteration, the weights and biases of the fully connected components and the filters of the convolutional layers were progressively updated by backpropagating the error given by the objective function28 using an optimizer algorithm. As an optimizer, we used the Adam algorithm38 which requires the objective function to be differentiable with respect to its inputs to enable computation of the gradients. This is not the case of the disorientation expression above because the arccos(x) function is only defined in the domain of [−1, 1], which induces discontinuities in the gradient of the disorientation metric with respect to the input orientations. Therefore, this expression cannot be used directly as an objective function17. Instead, we implemented an approximation to the disorientation function as:

$$L\left( {{{{\mathbf{g}}}}_1,{{{\mathbf{g}}}}_2} \right) = \mathop {{\min }}\limits_{i \in [1,24]} \left\{ {\sqrt {3 - tr\left[ {{{{\mathbf{g}}}}_1S_i{{{\mathbf{g}}}}_2^{ - 1}} \right]} } \right\}$$
(5)

This function takes as input two rotation matrices defining the orientations and returns a value approximating the disorientation angle in the vicinity of tr(x) = 3, which corresponds to small disorientations. The function otherwise monotonically decreases with tr(x), thus following the disorientation function. These properties make it a suitable choice of objective function because its minimization conjointly minimizes the disorientation function while it is also differentiable with respect to the input orientations.

Training

For all specimens, we registered the DRM and EBSD fields of view so that each reflectance pattern could be associated to the corresponding reference orientation. Instead of using all the pixels in the datasets for training and evaluating the models—which would be inefficient due to the redundancy of pixels belonging to the same grain—we selected a single reflectance pattern and its associated orientation from each grain to form both training and test sets. We first segmented the microstructures into grains using the LRC-MRM algorithm detailed in reference39. Then, we excluded grains smaller than six pixels in diameter, for which registration between the DRM and EBSD datasets might be inaccurate. In all remaining grains, we selected the pixel furthest from any grain boundaries as a training data point, based on the maximum of the Euclidean distance transform of the grain40. Following this strategy, we included on average 68’850 data points for training. The size of the training set varied slightly depending on the cross-validation split. Moreover, we used data augmentation to increase the variety of the training data, which can reduce potential overfitting41. We augmented the training set by randomly rotating of the reflectance signals around the azimuth and multiplying the reflectance signals by a random factor sampled from a normal distribution, with an average of 1 and a standard deviation of 0.2 (we clipped the resulting values in the range 0–1). We performed these augmentations based on the assumption that the model should be able to recover the correct crystal orientation regardless of the origin of the azimuth and of variations in reflection intensity, as neither alteration is expected to change the structure of the reflectance patterns.

We trained the neural network for 100 epochs (an epoch corresponds to one full cycle through the training dataset) starting from a random initialization of the trainable parameters. We tuned the learning rate by searching over a logarithmic grid of values between 10−6 and 10−2. We found that the value leading to the lowest error was 3.1 × 10−3. With these parameters, it took 1 h and 32 min to train the EulerNet model on a commercial laptop computer equipped with an Intel i7-9750 CPU.