# Magnetic Moment Estimation Algorithm Based on Convolutional Neural Network
## 2 Materials and Methods
### Magnetic Dipole Model  
In magnetic anomaly detection research, the size of the magnetic anomaly target is typically much smaller than the distance between the measurement point and the target. When this distance is 2 to 3 times greater than the target size, the magnetic material can be approximated as a magnetic dipole [25]. Under this assumption, the magnetic field of the dipole can serve as an equivalent representation of the target magnetic field.  
Relying on the condition that the magnetic target can be equivalently represented as a magnetic dipole, the magnetic anomaly signal is derived using the magnetic dipole model. A coordinate system is established according to Figure 5, with the magnetic target placed at the origin. The coordinates of the magnetic field sensor are denoted as \((x,y,z)^{T}\), and the distance between the magnetic field sensor and the magnetic target is \(r\). The magnetic target is equivalently represented as a magnetic dipole with a magnetic moment \(\mathbf{M}=(m_{x},m_{y},m_{z})^{T}\). The expression for the magnetic anomaly signal is given as follows:  
\[S=\frac{\mu_{0}}{4\pi r^{5}}\Bigg{[}\Big{(}3x^{2}+3 xy+3 xz-r^{2}\Big{)}m_{x}+ \Big{(}3 xy+3y^{2}+3 yz-r^{2}\Big{)}m_{y}+\Big{(}3 xz+3 yz+3z^{2}-r^{2}\Big{)}m_{ z}\Bigg{]}\,. \tag{7}\]  
Figure 4: Distribution of the total magnetic anomaly field on the observation surface for different angles between the target magnetic moment and the geomagnetic field vector: (**a**) magnetic moment direction \((1,0,0)\); (**b**) magnetic moment direction \((0,1,0)\); (**c**) magnetic moment direction \((0,0,1)\), (**d**) magnetic moment direction \((1,1,1)\).  
By substituting Equation (7) into Equation (6), the magnetic anomaly signal \(S\) detected by the scalar magnetic sensor can be expressed as follows:  
\[S=|\mathbf{H}_{T}|-|\mathbf{H}_{E}|=|\mathbf{H}_{r}|\cos\alpha \tag{8}\]  
which expands to:  
\[\begin{split} S=\frac{\mu_{0}}{4\pi|\mathbf{H}_{E}|^{S}}\Bigg{\{}& \Big{[}\big{[}3x^{2}-r^{2}\big{)}H_{E_{x}}+3 xyH_{E_{y}}+3 xzH_{E_{z}} \Big{]}m_{x}\\ &+\Big{[}3 xyH_{E_{x}}+(3y^{2}-r^{2})H_{E_{y}}+3 yzH_{E_{z}}\Big{]}m _{y}\\ &+\Big{[}3 xzH_{E_{x}}+3 yzH_{E_{y}}+(3z^{2}-r^{2})H_{E_{z}}\Big{]}m _{z}\Bigg{\}}.\end{split} \tag{9}\]  
As seen from the above equation, there are unknown quantities, such as the target position, which prevent the direct calculation of the target magnetic moment by inverting the magnetic anomaly signal. A direct, closed-form linear relationship between the target magnetic moment and the magnetic anomaly signal cannot be established. To address this challenge, a nonlinear model can be used to solve the problem.  
Neural networks have undoubtedly become a crucial tool in this context, as they excel at modeling relationships between data that are difficult to describe with linear models [26]. Therefore, we chose to use a 2D CNN to model the relationship between the target magnetic anomaly signal, the geomagnetic field, and the target magnetic moment. Previous studies have employed CNN to process target data and localize the target [27]. This paper proposes a fitting network based on a 2D CNN to establish the relationship between the target magnetic moment and the magnetic anomaly signal.