# Three-Dimension Inversion of Magnetic Data Based on Multi-Constraint UNet++
## 2 Materials and Methods
### Generating Training Dataset  
In the process of training the network, a large quantity of labeled training data are required. Because the anomalous body boundary of the measured aeromagnetic data is difficult to calibrate and the quantity of data is small, we used simulation data to train the model. For convenience, the underground space was evenly divided into 32 \(\times\) 32 \(\times\) 16 cuboid units. According to the size of the actual measurement area to be processed, each cuboid unit in this study was designed to be 93 m \(\times\) 156.8 m \(\times\) 100 m, to simulate an underground space with the size of 2976 m \(\times\) 5017.6 m \(\times\) 1600 m (the size of a single cuboid can be modified according to different test area sizes and detection requirements); then, the magnetic susceptibility of the abnormal geological body is 0.1, and the magnetic susceptibility of the surrounding rock is 0. As is commonly understood, in neural networks, the richer the information contained in the training set, the more features the network can learn, and the better the effect will be when applied to the actual data. In order to make the network identify more accurately the boundary of the actual subsurface anomaly, as shown in Figure 1, we used a random model generated via the random growth of cubes, which is closer to the irregular shape of the actual magnetic anomaly geological body than a prism. Using this method, we obtained 20,000 samples of data. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \(\alpha\) & **0.1** & **0.2** & **0.3** & **0.4** & **0.5** & **0.6** \\ \hline Model fitting difference & 0.0131 & 0.0119 & 0.0103 & 0.0131 & 0.0144 & 0.0153 \\ \hline Data fitting difference/nT & 0.6534 & 0.5613 & 0.4517 & 0.4829 & 0.5731 & 0.5812 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The results of the constant value selection experiments. After designing the model, we conducted forward modeling and adopted the sensitivity matrix calculation method. In order to facilitate the calculation, we assumed that the magnetization inclination and declination angle of the geomagnetic field and the remanent magnetic anomaly were consistent; that is, the magnetization inclination was \(90^{\circ}\) and the magnetic declination angle was set to \(0^{\circ}\). Under this condition of vertical magnetization, as shown in Figure 2, the magnetic anomaly \(\Delta T\) produced by a single cuboid at point P \((x,y,z)\) was as follows [15]:  
\[\Delta T=\left.\frac{\mu_{0}M}{4\pi}\right\{(\zeta-z)\text{arctan}\left[- \frac{(x-\xi)(y-\eta)}{r(z-\zeta)}\right]\}\Big{|}_{\xi_{1}}^{\xi_{2}}\Big{|}_ {\eta_{1}}^{\eta_{2}}\Big{|}_{\xi_{1}}^{\xi_{2}} \tag{5}\]  
where \(\mu_{0}\) is the permeability; \(M\) is the magnetization; \(\xi_{1}\) and \(\xi_{2}\) are the coordinates of the two endpoints of the cuboid along the \(X\) direction, and \(\xi_{1}<\xi_{2}\); \(\eta_{1}\) and \(\eta_{2}\) are the coordinates of the two endpoints of the cuboid along the \(Y\) direction; and \(\xi_{1}\) and \(\xi_{2}\) are the coordinates of the two endpoints of the \(\zeta\) cuboid along direction \(Z\). All units in the formula are SI units, so the unit of \(\Delta T\) is Tesla. The vertical magnetic anomaly in Formula (5) represents the magnetic anomaly data after polarization, and it has important applications in magnetic data processing and the forward and inversion effects. When the magnetization intensity \(M\) is extracted from the formula, the following sensitivity coefficient \(S\) of the magnetic anomaly is obtained:  
Figure 1: Training set data display. (**a**) Training set data; (**b**) training set labels. Figure 2: A diagram of the relationship between the position coordinates of a single cuboid anomaly and the measured position coordinates.