Detection and Classification of Multi-Magnetic Targets Using Mask-RCNN

To detect the shape of a small magnetic target in the shallow underground layer, this article proposes a recognition method based on Mask-RCNN. Firstly, using COMSOL software and MATLAB software to establish the database of magnetic targets model under different shapes and orientations, which greatly enriched the diversity of the training data set. Then, the ${G}_{\mathrm {zz}}$ component of the magnetic gradient tensor matrix is selected to highlight the shape features of the magnetic target, and the contour image is generated. The experimental data set is created by using the deep learning annotation tool Labelme. Finally, Resnet101 is used as the backbone network and feature pyramid network (FPN) structure is used to extract features. The regional recommendation network (RPN) is trained end-to-end to create regional recommendations for each feature map. The detection results of 200 test images show that the average detection accuracy of the method is 97%, and the recall rate is 94%. The simulation results show that the recognition accuracy and robustness of the method are improved.


I. INTRODUCTION
As an important geophysical method, magnetic anomaly detection has been widely used in the exploration of large underground or underwater abnormal targets [1]- [3]. However, it is not accurate enough to detect the shape and attitude of small magnetic targets such as underground ferromagnetic pipes [4], [5] and unexploded ordnance [6], [7], but it has important practical value. The accurate identification of underground pipelines provides an important basis for pipeline maintenance and construction, and the accurate judgment of unexploded ordnance helps to reduce the damage risk. At present, the magnetic gradient tensor method has been widely used. It contains rich information of magnetic targets, which makes it possible to detect the shape and attitude of small-scale magnetic targets. So far, researchers have proposed many methods of magnetic localization. Wynn [8] proposed a method to estimate the position and magnetic moment of the target by using five independent equations of the magnetic gradient tensor. Nara et al. [9] proposed a closed formula of magnetic target location based on the magnetic vector and its spatial gradient, using the magnetic The associate editor coordinating the review of this manuscript and approving it for publication was Michael Lyu. gradient tensor matrix to solve the location information of the target. Carrubba et al. [10] studied the features of the magnetic gradient tensor contraction and proposed a scalar triangulation (STAR) target location method. However, they assume that the equivalent surface of tensor contraction is an ellipsoid, which leads to the aspheric error of the method. Carrubba et al. [11] and Yin et al. [12] respectively proposed particle swarm optimization algorithm and adaptive fuzzy c-means clustering method to solve the problem of multiple dipole positioning in space.
The above methods only find the location of magnetic targets, and cannot clearly show the contour shape and other characteristics of the magnetic target. When it comes to the detection of near-field magnetic targets, these methods will not be applicable. In recent years, machine learning methods have been applied to magnetic anomaly recognition, which reduces the dependence on signal accuracy and avoids complex theoretical derivations. Zheng et al. [13] uses singular value decomposition (SVD) to extract magnetic anomaly signal features and uses the support vector machine (SVM) to classify magnetic source targets. In the same year, Zheng et al. [14] used 2D-AVMD to decompose the magnetic anomaly signal, extracted the hog features of the signal, and deployed the SVM method to classify and recognize the two kinds of cylinder and disk magnetic targets respectively. However, the above two methods are only suitable for the case that there is only one magnetic target in the measurement area, and the target size is large. Compared with traditional machine learning methods, the deep neural network (DNN) method has been widely used in target detection due to its strong feature extraction ability and autonomous learning ability [15]. According to the existing research, the popular target detection algorithms Fast-RCNN [16], Faster-RCNN [17], YOLO [18], and SSD [19] can only roughly calculate the target position through the boundary box, and cannot accurately extract the contour and shape information. Therefore, it is necessary to recognize the contour and shape of magnetic targets with high accuracy for water pipes and unexploded ordnance, which means that the above methods cannot meet the requirements. He et al. [20] proposed the Mask-RCNN, which can integrate target detection and instance segmentation into a single framework.
Based on the above background, this article proposes a method to detect and classify small magnetic targets in shallow underground layers using Mask-RCNN. The G zz component of the magnetic gradient tensor is selected as the data source, and the Labelme annotation tool is used to construct the data set. The Mask-RCNN algorithm is combined with the ResNet101 feature extraction network. It can effectively recognize the shape of underground magnetic targets by accurately identifying the category of underground magnetic targets and marking the target area with a contour box.

A. MAGNETIC GRADIENT TENSOR
Generally, the magnetic field signal detected by magnetic anomaly is the total geomagnetic field or vector field. Compared with the geomagnetic total field and vector field measurement, the magnetic gradient tensor is less affected by the temporal and spatial variation of the earth's magnetic field and can provide more information to better reflect the shape and position of the underground small-scale magnetic target [21]. Generally, the magnetic field data of magnetic anomaly detection is the magnetic field vector B, and the magnetic gradient tensor is the spatial rate of change of the three components of the magnetic field vector in the three mutually orthogonal directions, which contains nine elements in total. The formula is as follow: The geomagnetic field and magnetic anomalies caused by ferromagnetic substances do not contain a static magnetic field that conducts current. According to Maxwell's magnetostatic equations, the curl and divergence of the magnetic field disappear. It can be seen that the magnetic gradient tensor matrix G is a symmetric matrix, and the trace is zero, that is, 5 elements out of 9 elements are independent.
The magnetic gradient tensor usually uses the planar cross structure to calculate the magnetic gradient tensor information of a predetermined position [22]. The calculation formula is shown in (2) FIG. 1 shows the contour map of each component of the magnetic gradient tensor of a magnetic target. The component of G zz can better reflect the contour shape of the magnetic target and have a higher resolution. Therefore, we choose the G zz component as the main magnetic signal to establish the data set.

B. MASK-RCNN
Mask-RCNN [20] is proposed based on the framework of Faster-RCNN, which effectively combines target detection with target recognition. The basic idea is to extend the Faster-RCNN, add a branch to Faster-RCNN, and optimize the framework. The Mask-RCNN framework consists of three modules, as shown in FIG. 2. First, the backbone network extracted feature maps from input images. Second, feature maps outputted from the backbone were sent to the region proposal network (RPN) to generate regions of interest (RoIs). Third, RoIs outputted from RPN were mapped to extract the corresponding target features in the shared feature maps, and subsequently output to the FC and the fully convolutional network (FCN), respectively, for target classification and instance segmentation. This process generated the classification scores, bounding boxes, and segmentation masks.
FNP [23] (feature pyramid network) mainly solves the problem of multi-scale target detection. FNP obtains four sets of feature maps through a bottom-up convolution neural network. In order to solve the problem that the features of different layers of convolution neural network differ greatly, FNP uses top-down and horizontal connection methods to fuse these four different feature maps, so that each layer of the fused network has deep and shallow features. The results prove that the combination of ResNet and FNP can achieve a good detection effect, so the combination of ResNet-101 and FPN is used in the Mask-RCNN in this article. RPN (Regional Recommendation Network) was first proposed in the Faster-RCNN network, the structure of RPN is shown in FIG. 3. It is used to generate possible target candidate regions and solves the problem of more time to generate detection frames. RPN is a Feature Map generated by a convolutional neural network, which generates multiple anchors on the scale of the original image, and classifies and regresses the generated anchors. RPN uses a sliding window mechanism, and each sliding window can predict k anchors. The RPN classification of anchors needs to be divided into a foreground anchor and background anchor, which is only a two-class classification, so there will be 2k scores in the regression layer. At the same time, the position of the anchor needs to be regressed. Each anchor has 4 coordinates, so there will be 4k outputs. In the Feature Map network, RPN generates a total of 5 anchors of different scales, each of which is divided into three different scales, so k = 15. The loss function of RPN is the sum of classification loss and regression loss.
In order to ensure the accuracy of detection or segmentation and the pixels in the original image are completely aligned with the pixels in the Feature Map, Mask-RCNN uses RoI Align instead of RoI in Faster-RCNN, which avoids the quantization of the RoI boundary or bin. Use bilinear interpolation algorithm when expanding Feature Map, then perform maximum or average pooling on these features, and finally realize the function of adjusting the proposal to a uniform size [24]. Finally, the loss function of Mask-RCNN is as follows: where L cls is the classification loss function, L box is the prediction box loss function, and L mask is the mask loss function.

III. TRAINING MASK-RCNN MODEL
This section describes the datasets, training settings of network parameters, evaluation criteria, and comparison results with the traditional magnetic positioning method. All training and evaluation experiments were implemented on an Nvidia GeForce RTX 2060 GPU, with 6 GB memory. The TensorFlow-GPU version is installed by Anaconda 3 platform and runs under Windows 10 system.

A. DATA SET MAKING
In this study, we used COMSOL software to interact with MATLAB software to randomly generate parameters such as position, direction, and depth, and simulate L, rectangular, spherical, and concave magnetic targets under different parameters.
The background ambient magnetic field is 53000 nT, and the inclination and deflection angles are set to −60 • and −9 • , respectively. Measure the magnetic field vector data of 100 × 100 grid measurement points in the plane, extract the G zz components, and generate contour maps as samples. In order to meet the diversity of shape recognition of magnetic targets in a complex environment, L, concave, spherical, cuboid, and coexisting data sets are collected. The sample-set in this article contains four types of samples as shown in FIG. 4(a)-(d).  In FIG. 4(a)-(b), the magnetic anomaly of a single magnetic source target and two magnetic targets are obvious, and there is basically no mutual interference. In FIG. 4(c), when the two magnetic targets are relatively close, the magnetic fields interfere with each other. In FIG. 4(d), when the two magnetic targets have a large difference in depth, the magnetic target closer to the detection plane will show stronger magnetic anomalies.
The image annotation tool Labelme was used to annotate the experimental data to generate mask images of strawberries. These mask images were then used to calculate the reverse loss in the model training and optimization of the model parameters. In addition, the performance of the trained model for instance segmentation was evaluated by comparing the annotated mask images with the prediction results of the mask. The ripe and unripe fruit regions of the image were labeled, and the remaining region defaults to the background. The labeled L and spherical target data sets are shown in FIG. 5.

B. TRAINING OF RECOGNITION NETWORK
A total of 1000 sample images were collected, including 800 as the training set, 100 as the verification set, and 100 as the test set. The model was trained for 9 generations and To evaluate the performance of the model, precision, recall rate, AP, and missing rate are used as evaluation indexes.
where TP represents a positive sample that is correctly classified in the algorithm, FP represents a positive sample of the misclassified, and FN represents a negative sample of the misclassified.
After calculation, the precision of the model is 97%, the recall rate is 94%, the mAP is 93.4%, the F1 score is 95%. The AP values of multiple categories are shown in FIG. 6. Therefore, the training model has excellent detection performance.

IV. EXPERIMENTAL RESULTS AND ANALYSIS
In order to verify the effectiveness of the Mask-RCNN method in identifying the shape of small magnetic targets, we separately performed tests with a single magnetic target, two magnetic targets separated by magnetic anomalies, two magnetic targets with close distances, and two different depths. The four conditions of the magnetic target are detected. FIG. 7 and FIG. 8 show the detection results of a single magnetic target and two magnetic targets with obvious magnetic anomalies on site. The proposed method can accurately identify the magnetic target and show the shape of the target.
When two magnetic targets are relatively close, the magnetic anomalous fields generated on the measuring surface will overlap each other, so that the contours of the magnetic targets will overlap or be missing. Using the trained Mask-RCNN model, it can accurately detect the shape of each magnetic target, showing the strong robustness of the model, as shown in FIG. 9.
When there are multiple magnetic targets in the measurement area with a large difference in depth, the deeper magnetic target is often affected by the magnetic anomalous field generated by the shallower magnetic target. Only shallow VOLUME 8, 2020  magnetic targets can be found in the contour map of the total field or gradient field of the measurement plane, and the shape of the deeper magnetic target is not clear enough. Because deep learning has good image feature learning capabilities, the Mask-RCNN model trained in this article can accurately identify magnetic targets with large depth differences. The recognition results are shown in FIG. 10.
The method proposed in this article provides a new idea for identifying shallow magnetic targets underground, but the current model still has some problems. First, the training set sample types are limited, and the types of magnetic target shapes included are not enough. In further research, we will  add more samples of the magnetic target shape to train the model. Secondly, the Mask-RCNN proposed in this article can only locate the horizontal position of the magnetic target, and the current algorithm cannot extract the depth of the magnetic target. In the future, we will use more effective feature extraction methods to identify the depth information of magnetic targets.

V. CONCLUSION
This article proposes a Mask-RCNN-based method to automatically detect and recognize the shape of small magnetic targets in shallow underground layers. The detection results of 100 detected images show that the average detection accuracy is 97%, the recall rate is 94%, and the average detection speed of one image on the GPU is 0.35s. The simulation results show that the model has a good segmentation effect in different shapes, different depths, different distances, and other complex magnetic target distribution scenes. The proposed magnetic target shape recognition method has demonstrated robust and accurate results. In future research, the depth and magnetic moment of the magnetic target will be obtained by combining the numerical analysis method. XUQING WU (Member, IEEE) received the B.S. degree in system control from the University of Science and Technology Beijing, the M.S. degree in computer science from Carleton University, and the Ph.D. degree in computer science from the University of Houston. Since 2015, he has been an Assistant Professor of Computer Information System with the University of Houston. His research interests include scientific machine learning, data analytics, and subsurface sensing. VOLUME 8, 2020