Low-dimensional magnetic systems are an interesting topic of research due to their scientific significance and potential applications in next-generation electronic devices. In particular, unique spin textures in two-dimensional magnetic systems, such as magnetic stripe domains (1–5) and magnetic skyrmions (6–10), and their connection to various magnetic Hamiltonian parameters have been extensively studied. To quantitatively understand the properties of these magnetic structures, not only experimental methods (11–14) but also various theoretical methods (15–21) including numerical calculations have been used. In general, the results from numerical calculations or analytical approaches cannot be directly compared with experimental results, since not all experimental factors can be considered in theoretical calculations. Therefore, the development of a method of directly converting the experimental data to various essential parameters for the theoretical studies is an important issue not only in magnetism but also throughout scientific research in general.
Meanwhile, machine learning techniques, which first emerged decades ago, have been used in diverse fields, showing much enhanced performance and capabilities over conventional techniques. In particular, the deep learning that a machine learning technique using an artificial neural network with multiple layers between the input and output, which is called deep neural network (22), have been used to address many scientific challenges, including searching for the ab initio solution of many-electron systems (23), predicting protein structures (24), solving quantum many-body problems (25, 26), and finding ground states of various magnetic systems (27). In particular, a previous study (28) showed the potential of deep learning techniques for predicting various properties of simulated low-dimensional magnetic systems.
In this study, we have used deep learning techniques to develop a method to estimate the magnetic Hamiltonian parameters from the experimentally observed images of magnetic domains formed in two-dimensional magnetic systems. The schematic diagram of this study is shown in Fig. 1.
First, energy-minimized spin configurations were generated using Monte Carlo–simulated annealing methods in which the temperature was decreased from above the Curie temperature to zero temperature. During the annealing process, the spontaneous symmetry breaking involves the formation of spin textures, so the domains and domain walls in the generated spin configurations have various morphological characteristics (Fig. 1A). Using these spin configurations as the input, several neural network structures were trained to estimate the magnetic Hamiltonian parameters, which were used to generate the input spin configurations (Fig. 1B). Error analysis was performed to test the validity of the trained network (Fig. 1C). Last, to further prove the effectiveness of the method, we used the trained network to estimate the magnetic Hamiltonian parameters from experimentally observed magnetic domain images using spin-polarized low-energy electron microscopy (SPLEEM) (Fig. 1D) (29).
Dataset generation, noise injection, and network capacity
We generated a total spin configuration dataset appearing in a two-dimensional magnetic system under the Hamiltonian in Eq. 1
(1)where J is the exchange interaction strength,
is a dimensionless displacement vector between i and j grid sites, and K is the perpendicular magnetic anisotropy (PMA) strength. All ij pairs are counted once in the summations. Since the range of each parameter used to generate the spin configurations is different, we defined the normalized parameters βN, KN, and DN using the relation,
where Y stands for all β, K, or D and Ymin and Ymax indicate the respective minimum and maximum values of each parameter range. These normalized parameters are used to train the networks, and the estimated parameters from the trained network are transformed into prenormalized values using a reverse process.
The goal of our study is to estimate Hamiltonian parameters from experimentally observed magnetic domain images. Whereas the experimental data have noises for various inevitable reasons, the spin configurations generated by simulation are noiseless in the final state of the simulated annealing process. The total generated spin configurations were divided into three “noiseless” datasets with a ratio of 70, 20, and 10% for training, validating, and testing the neural network, respectively, as shown in fig. S1. To investigate the effect of noises on magnetic domain images, we also constructed “noisy” training and validation datasets by injecting artificial noises with random amplitude into each spin configuration in the noiseless datasets (fig. S2A). In the case of the test datasets, the amplitude of the injected noises, εTs, was adjusted step by step for a detailed analysis on the noise resistance of neural networks (fig. S2B). The details about the datasets and training process are described in Methods.
We built three network structures, ResNet18, ResNet50, and customized convolutional neural network (CNN) structures, as described briefly in fig. S3. ResNet (32) structures are well-known deep neural networks exhibiting a great performance in extracting features from images. A customized CNN was used to represent a non–deep neural network with relatively less network capacity than the ResNet structures, and the comparison with the latter highlights the importance of a deep neural network. Each neural network was trained separately using the noisy and noiseless datasets, and the mean absolute error (MAE) values were obtained using each test dataset after the training process as shown in Fig. 2.
As the injected noise amplitude εTs increases, the accuracy of parameter estimation tends to decrease for all cases (Fig. 2), since the injected noises make it difficult to extract detailed characteristics of magnetic domain structures in the input images. Note that the networks trained using noisy images (left column in Fig. 2) are much more robust on various noise amplitudes in the test dataset than the networks trained only with noiseless images (right column in Fig. 2); there is almost one order difference in scale between the y axes ranges in the left and right columns in Fig. 2. The network, overfitted with the noiseless feature of the datasets, loses the accuracy rapidly as the strength of εTs increases.
The network capacity also affects noise resistance. The ResNet18 structure, which has a medium size network capacity among the three network structures in our study, shows the most stable performances on various values of εTs. Meanwhile, both the ResNet50 and the customized CNN, which have more deep and less deep structures than the ResNet18, are unstable and inaccurate compared to the ResNet18, respectively. The customized CNN is inaccurate for all parameter estimation when εTs > 0.5 (left column of Fig. 2), and the ResNet50 trained only with noiseless dataset behaves in an unstable way when it is tested by the dataset with injected noises. This shows that small network capacity can make it difficult to extract sophisticated features from an image and that large network capacity can make overfitting problems serious (33). It means that there is a proper network capacity around the ResNet18. The capacity may be further optimized; however, the goal of this study is not to find the most optimal network. Therefore, given that ResNet18 already shows stable performance on noise resistance, the ResNet18 model trained with the noisy dataset was chosen for our further discussion.
Error estimation and error vector distribution
The characteristics of the magnetic domains shown in the input images are important for the trained network to estimate Hamiltonian parameters. The estimation errors are also affected by the domain characteristics, and there can be specific relations between them. Figure 3 maps the input domain images and absolute error values from the test dataset on the same KN and DN parameter space.
It is found that the accuracies of the parameter estimation for β, K, and D are not uniform in the parameter space. In the case of β = 0 (first row in Fig. 3), the parameter estimation around KN ≈ 0 and DN ≈ 0 becomes inaccurate, which is reasonable, since the generated spin configurations under this condition are in-plane single domains without any domain wall structures (uniform color images in the left bottom corner of Fig. 3A). Without domain wall structures, β cannot be estimated correctly, since the DMI directly affects the domain wall characteristics in two-dimensional perpendicular magnetic systems (18, 20). In addition to DMI strength, the anisotropy and dipolar interaction strength are also inaccurately estimated from in-plane single domains, since they have a wide range in K < 2πD (18) and are not determined to a specific set of values. In the case of β = 3D (second row in Fig. 3), there is also a tendency that the accuracy of the parameter estimation decreases when the anisotropy becomes strong, indicated by the gray shades in left side of the heatmaps in Fig. 3 (F to H). One of the possible reasons for this is that other parameter values can generate comparable structural features shown in the domain images. In general, it is difficult to pinpoint what structural features of domain images were extracted by the trained networks and how the trained network estimates Hamiltonian parameters, since the network is too complex to be fully analyzed by a mathematical approach. Additional studies on what characteristics are extracted by the trained network from the input magnetic domain image are necessary to fully develop this approach.
One can notice that the estimation error values of anisotropy and dipolar interaction strength are strongly correlated. To investigate whether the inaccuracies of parameters are related, we defined the error vector as
, which is composed of three error values, and investigated how
are distributed. Figure 3I shows the tips of the error vectors as gray dots in a three-dimensional error space. We note that the estimation errors are not spherically dispersed but rather exhibit a two-dimensional flat distribution in a three-dimensional space. We performed a principal components analysis (PCA) (34) on error vectors to see how the uncertainties of estimations are related. The PCA, a statistical procedure using an orthogonal transformation, searches for the principal components that can best explain the variance in the data and reveals the internal structure of the data. The PCA results on the error vectors indicate that a specific axis, ∆K ≅ 2π∆D, is the most dominant principal component; this axis corresponds to a linear relationship between the error values of PMA and dipolar interaction strength. This does not merely mean that the estimation difficulties on K are related to those on D but rather implies that ∆K was compensated by 2π∆D in the parameter estimation; D is overestimated/underestimated when K is overestimated/underestimated.
This is a notable result: We did not build the algorithm explicitly to include a specific relation between PMA and shape anisotropy from short-range dipolar interaction; yet, the neural network realized spontaneously through the training process that it is the effective anisotropy Keff( = K − 2πD) that is the key criterion determining the characteristics of out-of-plane magnetic domain structure, which is a well-known parameter in low-dimensional magnetism. The trained network has also realized that the minimization of ∣∆Keff∣( = ∣∆K − 2π∆D∣) is the most important factor for estimating the magnetic Hamiltonian parameters accurately from the two-dimensional spin configurations. One of the main advantages of deep learning techniques is that an efficient method can be obtained through the training process even without intrinsic programming. The spontaneous realization of the importance of Keff by our neural network clearly exemplifies the advantage of deep learning techniques.
We also investigated how much the errors shown in Fig. 3 affect the structural characteristics of magnetic domains. Most of
values are about 0.01, and these small errors do not significantly affect the characteristics of magnetic domain structures. More discussion is given in section S4.
Validation with SPLEEM data
To verify the validity and effectiveness of the trained network, we applied our network to the experimentally observed magnetic domain images of the Ni/[Co/Ni]2/Ir/Pt(111) system shown in Fig. 4A. In the previous work (35), the effective magnitude and sign of the DMI were tuned by adjusting the Ir layer thickness, as the effective anisotropy strength was kept constant (fig. S5).
Figure 4B shows the SPLEEM images of magnetic domains separated by the chiral domain walls. We transformed the raw experimental images to colored images using the same color scheme as in the simulated results (Fig. 4C). Several subpanels with 100 by 100 pixels sizes were cropped from the colored images with 370 by 400 pixels to be used as input data of our trained network. The estimated values of K and D remain almost constant, while the estimated DMI parameter gradually changes from positive to negative values, as the Ir thickness increases (Fig. 4D). The estimations are consistent with the results reported in the experimental study (35).
To quantitatively evaluate whether the predicted parameters are proper values, which can be used to simulate the system shown in SPLEEM images, we compared the domain wall profiles from a SPLEEM image and a simulation result using the estimated parameters (Fig. 4E). From the fitting curves, we obtained the fitting parameter for domain wall length scale, w, to be 2.238 and 2.241 from the SPLEEM image and the simulation result, respectively. Since the size of single pixel in a SPLEEM image is around 25 nm (~10-μm field of view/400 pixels), each domain wall width can be approximated as 175.8 and 176.0 nm. This subpixel order difference of domain wall width indicates that the estimated parameters from the SPLEEM images properly simulates the system and suggests that our algorithm can be used to extract magnetic parameters from experimentally observed magnetic domain images.
The long-range dipolar energy constant of the system shown in Fig. 4A is calculated to be 0.171 meV from
. It is known that the DMI considered in this study directly competes with the dipolar interaction to form Néel domain walls in two-dimensional magnetic systems (20). Hence, we can convert the range of the estimated DMI parameters to units of energy using a simple relation,
, where DL = 0.171 meV. The β written in energy unit when dIr = 0 is 0.187 meV without Ir, and it changes to−0.115 meV, as Ir thickness increases. This value has similar magnitude with those shown in the previous study (35), except when Ir is thin. It is expected that the estimation accuracy will be enhanced if we use a larger dataset with a variety of domain characteristics.
We applied a deep learning algorithm to estimate magnetic Hamiltonian parameters from magnetic domain images. By varying magnetic Hamiltonian parameter values, ~80,000 spin configurations were generated through a simulated annealing process by a Monte Carlo method. The effects of noise, which is unavoidable in experimental data, were considered in the generated dataset. The noise-injected dataset was used to train, validate, and test several neural network structures. It was found that deep neural networks are necessary to have sufficient resistance to noise. The error values of the magnetic parameters estimated through the trained network are analyzed using heatmap analysis and PCA to evaluate the performance of the trained network and to investigate whether there are specific relations between the error values. From the analysis, we found that the network learned that the accurate estimation of the effective anisotropy is a key factor to determine the magnetic Hamiltonian parameters from the out-of-plane magnetic domain structures formed in a two-dimensional magnetic system.
We applied the trained network to estimate magnetic Hamiltonian parameters from magnetic domain images observed by SPLEEM and showed that the behaviors of estimated parameters are consistent with the published results in the previous studies. This test demonstrates the effectiveness of applying the deep learning method to determine the strengths of magnetic interactions from experimentally observed images.
Details of dataset generation
A large dataset of various spin configurations was generated showing the magnetic domain structures and the corresponding magnetic Hamiltonian parameters. A simulated annealing process using a Monte Carlo method with the magnetic Hamiltonian in Eq. 1 was performed to obtain the spin configurations in a 100 by 100 square grid lattice. We intentionally modulated the annealing rate of the simulation so that the resulting spin configurations do not necessarily represent the ground-state domain configurations. The ground-state spin configurations may be helpful to train the network to extract the characteristics of domain structures, but it can cause an overfitting problem on some limited structural features of magnetic domains in the ground state; i.e., when only using ground states, the network cannot learn the structural diversity of the magnetic domains in local energy minimum states (38).
We fixed J = 1, and the other parameters were scaled to their ratio with J. Other Hamiltonian parameters were varied as β = − 3D ~ 3D and K = 0.1Kshape ~ 1.2Kshape, where Kshape = 2πD and D = 0.05 ~ 0.13 to generate a diverse set of magnetic domains on the 100 by 100 grid system. These parameter variation ranges are based on previous studies (17, 18, 20). The step sizes used to vary each of the β, K, and D parameters were 0.3D, 0.02Kshape, and 0.005, respectively. As shown in Fig. 3A, the out-of-plane domains are formed when the β = 0 and the K is stronger than the dipole shape anisotropy Kshape, i.e., KN > 0. This result is consistent with the previous studies (17, 20), showing the formation of magnetic stripe domains under the K > Kshape conditions. The tendency that the stripe domain width is proportional to J/D was also found in theoretical and numerical calculations of previous studies (17). In the presence of DMI, as shown in Fig. 3E, domain width is reduced compared with Fig. 3A, which agrees with previous reports (18, 20). Therefore, within the parameter space used to generate the spin configurations in this study, it is confirmed that the proper magnetic domains were created by the simulated annealing process.
We generated 20 spin configurations for each magnetic parameter set and divided the spin configurations into 14, 4, and 2 spin configurations each for training, validation, and testing datasets, respectively. Since the magnetic domain shape is determined by spontaneous symmetry breaking during the simulated annealing process, each of 20 spin configurations that are generated using the same magnetic parameter set shows different magnetic domain shapes as shown in fig. S1. This means that the total dataset contains essentially no duplicated data. The total number of generated spin configurations was about 80,000.
Noise injection on each dataset
We injected arbitrary noises in spin configurations in our training and validation dataset using
, where i is for an index of a spin configuration in each dataset,
are noisy and noiseless spin configurations, respectively, εi is a randomly chosen noise amplitude between 0 and 1,
is a unit vector map composed of arbitrary directions, and L2Norm. indicates the normalization process to make unit vectors. The sampled spin configurations from a noisy dataset are shown in fig. S2A.
For the test dataset, we injected stepped increased noises on them to investigate the robustness of trained networks with various noise amplitudes. The same relation mentioned above is used except that the εi is replaced by εTs increased with 0.1 step size. An example of a noisy test dataset is shown in fig. S2B.
The cost that should be minimized to train our networks is the mean squared error value between the estimated magnetic Hamiltonian parameters from our networks and true parameters, which were used to generate the input spin configurations. In this process, to avoid the results from the biased training caused by the scale differences among the parameters, the normalized true parameters, βN, KN, and DN, are used to calculate the cost value.
One epoch is defined as one complete run of the training process using the entire training dataset. A total of 1000 epochs were run. A validation dataset was used to monitor the training process at the end of each epoch. We chose the trained neural network model with the lowest validation cost value for the testing process after the whole training process. We shuffled the entire training dataset randomly, and the mini-batches of the dataset were used as the input data with 200 batch size. Adam optimizer (39) is used to train the network with a 10−4 learning rate.