Underground target detection method and system based on reverse gain and TNN mobile terminal deployment
By optimizing the YOLOv5 model and combining it with TNN mobile deployment, the problem of insufficient real-time detection capability in existing ground-penetrating radar detection technology has been solved, enabling rapid generation and push of retest reports, significantly improving detection efficiency and data loop speed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-03-10
AI Technical Summary
Existing ground-penetrating radar-based underground target detection technologies suffer from insufficient real-time detection capabilities, excessively long data loop cycles, and strong subjectivity and limited recognition capabilities in manual interpretation, resulting in high false alarm and missed detection rates, and failing to meet the timeliness requirements of engineering scenarios such as municipal roads.
A method for underground target detection based on inverse gain and TNN mobile deployment is adopted. By optimizing the structure and loss function of the target detection model YOLOv5, the TNN model is deployed on mobile devices. Combined with the preprocessing of ground penetrating radar data and real-time AI target detection, real-time detection and quantization processing are achieved.
It achieves real-time underground target detection with a screen latency of <150ms, and reduces the report generation time from ≥24 hours to <1 minute, significantly improving detection efficiency and data loop speed, and reducing project downtime by more than 98%.
Smart Images

Figure CN121640432A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a kind of underground target detection method, more particularly to a kind of underground target detection method based on reverse gain and TNN mobile end deployment, and further relates to the underground target detection system using the underground target detection method based on reverse gain and TNN mobile end deployment. BACKGROUND
[0002] The existing underground target detection technology based on ground penetrating radar (GPR) generally adopts the offline operation mode of "field collection - indoor post-processing". After the field engineer completes the original B-scan data collection of municipal roads and other scenes using the GPR equipment, the data storage medium needs to be taken back to the indoor workstation, and the manual image interpretation is carried out by the interpretation personnel with professional experience the next day or later. Through naked eye identification of hyperbolic feature and manual annotation of target position such as cavity and pipeline, the detection report is finally issued. The whole field-in-indoor closed-loop process involves multiple links such as data export, transmission, manual interpretation and report compilation, and the total time consumption usually reaches 2 people x 1 working day or more, and the operation efficiency is low.
[0003] The traditional mode has two core bottlenecks: first, it cannot realize the real-time detection capability of "collection and detection simultaneously", and the target identification is seriously lagging behind the data collection process. The field engineer cannot dynamically adjust the measurement line layout, collection parameters or key review suspicious areas according to the real-time detection results, which increases the potential risk of missed detection; second, the data closed-loop cycle is too long, and it usually takes ≥24 hours from collection completion to report issuance. For municipal road detection and emergency rescue and other time-sensitive engineering scenes, long time stagnation seriously affects the construction progress and decision efficiency. In addition, manual interpretation is highly subjective, has poor consistency, and has limited ability to identify low-resolution, deep weak signal targets, and the missed detection rate and false alarm rate are difficult to effectively control. SUMMARY
[0004] The technical problem to be solved by the present application is to provide an underground target detection method based on reverse gain and TNN mobile end deployment, aiming to realize the real-time detection capability of "collection and detection simultaneously", and to provide a basis for quickly generating and pushing a retest report, so as to effectively improve the detection efficiency and data closed-loop speed. On this basis, an underground target detection system using the underground target detection method based on reverse gain and TNN mobile end deployment is further provided.
[0005] To this end, the present application provides an underground target detection method based on reverse gain and TNN mobile end deployment, comprising the following steps: Step S1, using ground penetrating radar for field collection, after obtaining ground penetrating radar data, disabling data augmentation, and using a random gradient descent optimizer, cosine annealing scheduling, total training round setting and early stopping strategy for model training, obtaining a target detection model YOLOv5; Step S2, optimizing the structure and loss function of the target detection model YOLOv5, the optimization process includes anti-aliasing and resolution enhancement of Backbone, detection head simplification and introduction of shape constraint of loss function; Step S3, based on the optimized target detection model YOLOv5, realizing the mobile end deployment of the TNN model; Step S4, pre-processing the ground penetrating radar data through the TNN model mobile end; Step S5, realizing real-time AI target detection and quantization processing.
[0006] Further improvement of the application is that the step S1 includes the following sub-steps: Step S101, using a ground penetrating radar with an 880MHz antenna to perform ground penetrating radar scanning, the sampling time window of the ground penetrating radar is 62.5ns, and an original underground target B-scan image is obtained; Step S102, selecting 10000 B-scan images verified by re-measurement and drilling, adopting a method of frame selecting hyperbolic vertex region to label the B-scan images, and storing them in XML format, wherein the B-scan images include 6200 hollow images and 3800 pipeline images; Step S103, dividing the B-scan images into a training set and a verification set according to a random ratio, and scaling the B-scan images to a 224x224 grayscale image input, disabling data augmentation including rotation and flipping to maintain the original radar reflection characteristics; Step S104, adopting a random gradient descent algorithm to update the model weight through a random sample gradient, and adapting the ground penetrating radar image target detection task; Step S105, setting an initial learning rate, and adopting cosine annealing dynamic scheduling in the training process to gradually reduce the learning rate according to a cosine curve, realizing the convergence of the later training; Step S106, setting the total training round, and enabling an early stopping mechanism, when the performance of the verification set does not improve for a preset continuous number of rounds, the training is terminated to prevent overfitting and reserve the optimal model parameters.
[0007] Further improvement of the application is that the step S2 includes the following sub-steps: Step S201: First, replace the first stride=2 convolution of the object detection model YOLOv5 with information-free dropout downsampling SPD-Conv; then, use the ConvNeXt Block convolution module only in the feature layer and deeper feature layers of feature map P3 / 8×, reducing the original 7×7 depth convolution to 5×5, which effectively covers a 25 cm×25 cm real area; finally, insert a sub-pixel convolution between feature map P2 / 4× and feature map P3 / 8×. Step S202: Remove the detection layers of feature maps P4 / 16× and P5 / 32×, retaining only feature maps P2 / 4× and P3 / 8×, and reduce the anchor frame size using the formulas P2: {3×3, 5×5, 7×7} px → actual {15 cm, 25 cm, 35 cm} and P3: {5×5, 7×7, 9×9} px → actual {25 cm, 35 cm, 45 cm}. Step S203: Using the formula L_curv = 1 - ρ(pred_curve, template_hyperbola), a new shape consistency loss function, CurvatureLoss, is added to the original loss of the YOLOv5 target detection model. Then, by calculating the normalized cross-correlation between the predicted box centerline response and the pre-generated hyperbolic template, geometric shape deviation is quantified as an error term. Finally, the curvature loss is incorporated into the total loss L = L_CIoU + 0.5 * L_curv + L_cls + L_obj with a weight of 0.5. This forces the network to output a prediction conforming to the hyperbolic shape without compromising positioning accuracy, thus suppressing clutter false alarms. Here, L_curv represents the newly added shape consistency loss function CurvatureLoss; ρ is the normalized cross-correlation; pred_curve represents the one-dimensional response sequence extracted from the predicted box output by the model; template_hyperbola represents the discrete hyperbolic template pre-generated according to the medium velocity; L_CIoU... L_cls represents the boundary regression loss; L_obj represents the cross-entropy of the target type described in the predicted bounding box; L_obj represents the confidence error that the predicted bounding box contains an object. Step S204: Disable Mosaic enhancement and enable the ElasticTransform operator of the image enhancement library Albumentations to simulate hyperbolic deformation caused by medium disturbance and synchronously map the bounding boxes. At the same time, increase the batch size to BatchSize≥64.
[0008] A further improvement of the present invention is that step S201 includes the following sub-steps: Step S2011: Replace the first stride=2 convolution with no information dropdown SPD-Conv, downsample the 224×224 feature map to 112×112, and expand the number of channels to 4 times. The remaining two downsampling convolutions maintain stride=2. Step S2012: Only use large kernel convolution to adjust ConvNeXt Block in feature map P3 / 8× and deeper feature layers, reducing the original 7×7 depth convolution to 5×5, which effectively covers a 25cm×25cm real area. In step S2013, a sub-pixel convolution is inserted between feature map P2 / 4×(56×56) and feature map P3 / 8×(28×28). First, feature map P3 is upscaled by 1×1, and then it is upsampled back to 112×112 by PixelShuffle 2× super-resolution. The feature residuals are added to feature map P2 to achieve virtual super-resolution within the network to suppress aliasing.
[0009] A further improvement of the present invention is that step S3 includes the following sub-steps: Step S301: Use the model export script export.py of the object detection model YOLOv5 to export the improved model weights in ONNX Open Neural Network Exchange format with non-default parameter subset version opset=11 and input size 1×2×224×224. Step S302: In the Docker container, call the onnx2tnn conversion tool of the TNN neural network inference framework to force the 16-bit floating-point precision and the model optimization parameter optimize to generate a TNN model protocol file yolov5s.tnnproto and a TNN model weight file yolov5s.tnnmodel with a fixed input shape. Step S303: The TNN dynamic link library libTNN.so, compiled using TNN release-v0.4.0, is integrated into the Android development tool; the Kotlin layer completes model loading and initialization through the TNN image classifier initialization interface TNNImageClassifier.init(). Step S304: Implement the zero-memory copy inference process in the independent thread loadToDraw.tnnAIDetect, convert the camera preview stream YUV sampling format to RGB image format, and call the TNN neural network inference framework to complete single-frame forward inference.
[0010] A further improvement of the present invention is that step S3 further includes step S305, which is used to overlay the detection results on the screen in real time, mark holes with red boxes and mark pipelines with blue boxes, and only display targets with confidence scores higher than a preset confidence threshold, wherein the preset confidence threshold refers to a pre-set confidence threshold with a value of 0.1-0.9.
[0011] A further improvement of the present invention is that step S4 includes the following sub-steps: Step S401: Perform adaptive nonlinear gain on the real-time acquired ground-penetrating radar single-channel data through the Java local interface; Step S402: Define the input parameters of the Java native interface. Define the arrayTraces parameter as a two-dimensional float array float[j][i], where j=0…19, representing a total of 20 data tracks; i=0…599, representing 600 sampling points for each data track; define the zeroLev parameter as the cutoff sampling point number of the ground direct wave; and define the order parameter as the order of the polynomial fitting. Step S403: Perform calculations on the Native side to implement the inverse gain algorithm process. The Native side refers to the C / C++ code layer called through the JAVA native interface. Step S404: Perform a single-threaded computational efficiency test. Step S405: Verify the data processing effect.
[0012] A further improvement of the present invention is that step S403 includes the following sub-steps: Step S4031: Copy the original 20×600 ground-penetrating radar data matrix to the OpenCV matrix object, and pad with zeros horizontally to 2400 points; Step S4032: Perform a horizontal fast Fourier transform on each data point to obtain the complex spectrum ftr; Step S4033: Construct an analytical signal operator h, set the amplitude of the DC and Nyquist components to 1, the amplitude of the positive frequency components to 2, and the amplitude of the negative frequency components to 0, to realize the equivalent frequency domain operation of the Hilbert transform, which is used to extract the signal envelope. Step S4034: Multiply the complex spectrum ftr with the operator h in the frequency domain and then perform an inverse fast Fourier transform to obtain the envelope matrix ht by taking the modulus. Step S4035: Sample the envelope matrix ht point by point along the measurement path and calculate the average to obtain the 600×1 dimension average energy decay curve decaycurve; Step S4036: After taking the base-10 logarithm of the average energy decay curve decaycurve, use third-order polynomial least squares fitting to solve the coefficient matrix A[0…3], such that log10(E(z))≈A0+A1·z+A2·z²+A3·z³ holds true, z=0…599; Step S4037: The fitted polynomial is inversely calculated using the natural exponent, and the inverse gain curve is obtained using the formula expower(z)=10^(poly(z)), where poly(z) refers to the polynomial function value. Step S4038: Find the maximum value max_expower among the 600 points, and calculate the normalization ratio point by point using the formula gain(z)=max_expower / expower(z); Step S4039: Write the gain array arrayGain[chn][i] back to the Java / Kotlin layer via the Java native interface.
[0013] A further improvement of the present invention is that step S5 includes the following sub-steps: Step S501: Run TNN inference in real time on each frame of B-scan image and display the detection results on the screen in an overlay manner; Step S502: Display the detection targets that are higher than the preset confidence threshold; Step S503: Upload the JPEG image of the detection result to the cloud server via HTTP protocol to achieve data synchronization; In step S5404, after receiving the image, the cloud server generates an AI retest report. The AI retest report includes information such as the confidence level, category, planar location, and burial depth estimation of the detected target. After the data collection is completed, the report is sent to the mobile terminal of the on-site engineer via push service within a preset time.
[0014] This invention also provides an underground target detection system based on inverse gain and TNN mobile terminal deployment, which employs the underground target detection method based on inverse gain and TNN mobile terminal deployment as described above, and includes: The data acquisition and model training module uses ground-penetrating radar for field data collection. After acquiring the ground-penetrating radar data, data augmentation is disabled, and the model is trained using a stochastic gradient descent optimizer, cosine annealing scheduling, total training rounds setting, and early stopping strategy to obtain the target detection model YOLOv5. The target detection model optimization module optimizes the structure and loss function of the YOLOv5 target detection model. The optimization process includes Backbone anti-aliasing and resolution enhancement, detection head simplification, and introducing shape constraints into the loss function. The TNN model mobile deployment module is based on the optimized target detection model YOLOv5 to enable mobile deployment of the TNN model. The mobile GPR data preprocessing module preprocesses ground-penetrating radar data on the mobile device using a TNN model. The real-time AI target detection and quantization module enables real-time AI target detection and quantization processing.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: First, data acquisition and model training are performed, and the structure and loss function of the target detection model YOLOv5 are optimized; then, based on the optimized target detection model YOLOv5, the TNN model is deployed on a mobile device, and the ground penetrating radar data is preprocessed through the TNN model on the mobile device; finally, real-time AI target detection and quantization processing are achieved, thereby enabling real-time AI detection of GPR ground penetrating radar on a mobile device based on the TNN framework.
[0016] Testing revealed that during on-site data collection, the screen latency was less than 150ms, with red / blue boxes indicating the target. The confidence threshold was adjustable from 0.10 to 0.90, enabling real-time detection capabilities of "collecting and testing immediately," completely replacing manual interpretation. Detection data was uploaded to the cloud server in real time via HTTP protocol. The cloud server automatically generated a retest report containing information such as confidence level and burial depth and pushed it to the mobile terminal of the on-site engineer. This provided a foundation for the rapid generation and delivery of retest reports, reducing report issuance time from ≥24 hours under existing technologies to <1 minute. The total time spent on fieldwork and office work was reduced from 2 people × 1 working day to 0.1 people × 1 hour, and project downtime was reduced by more than 98%, significantly improving detection efficiency and data loop speed. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the workflow of one embodiment of the present invention. Detailed Implementation
[0018] In the description of this invention, the term "several" means one or more; the term "multiple" means two or more; the terms "greater than," "less than," and "exceeding" are all understood to exclude the stated number; and the terms "above," "below," and "within" are all understood to include the stated number. The terms "first," "second," etc., are understood to be used only to distinguish identical or similar technical feature names, and should not be construed as implying / indicating the relative importance of the technical features, the number of technical features, or the sequential relationship between the technical features.
[0019] The preferred embodiments of the present invention will now be described in further detail with reference to the accompanying drawings.
[0020] like Figure 1 As shown, this embodiment provides an underground target detection method based on inverse gain and TNN mobile terminal deployment, including the following steps: Step S1: Use ground-penetrating radar to collect data in the field. After obtaining the ground-penetrating radar data, disable data augmentation and use stochastic gradient descent optimizer, cosine annealing scheduling, total training rounds setting and early stopping strategy to train the model and obtain the target detection model YOLOv5. Step S2 involves optimizing the structure and loss function of the target detection model YOLOv5. The optimization process includes Backbone anti-aliasing and resolution enhancement, detection head simplification, and introducing shape constraints into the loss function. Step S3: Based on the optimized target detection model YOLOv5, deploy the TNN model on mobile devices; Step S4: Preprocess the ground-penetrating radar data using the TNN model mobile terminal; Step S5 enables real-time AI target detection and quantization processing.
[0021] Step S1 in this embodiment includes the following sub-steps: Step S101: Use a ground-penetrating radar with an 880MHz antenna to perform a ground-penetrating radar scan. The sampling window of the ground-penetrating radar is 62.5ns, and the original B-scan image of the underground target is obtained. Step S102: Select 10,000 B-scan images that have been retested and verified by drilling, annotate the B-scan images by selecting the hyperbola vertex region, and store them in XML format. The B-scan images include 6,200 cavity images and 3,800 pipeline images. Step S103: Divide the B-scan image into training and validation sets at a random ratio, and scale the B-scan image to a 224×224 grayscale input, corresponding to samples × traces, 1cm / sample, 5cm / trace, that is, the physical resolution corresponds to 1 cm / sample × 5 cm / trace. Disable data augmentation including rotation and flipping to preserve the original radar reflection characteristics; the random ratio can be adjusted according to the actual situation and needs, and the default is a 7:3 ratio for dividing the training and validation sets; Step S104: The stochastic gradient descent (SGD) algorithm is used to update the model weights through random sample gradients to adapt to the ground penetrating radar image target detection task. Step S105: Set the initial learning rate and use cosine annealing for dynamic scheduling during training to make the learning rate gradually decay according to the cosine curve, thereby achieving fine convergence in the later stage of training; the initial learning rate is 0.01 by default and can be adjusted according to the actual situation and needs. Step S106: Set the total number of training epochs and enable the early-stop mechanism. Training will terminate when the validation set performance does not improve within a preset number of consecutive epochs to prevent overfitting and retain the optimal model parameters. The default total number of training epochs is 150 epochs, which fully traverses the training data to ensure the model fully learns the characteristics of underground cavities and pipeline targets in ground-penetrating radar images. The default number of consecutive epochs is 20 epochs. If the validation set performance does not improve within 20 consecutive training epochs (i.e., the performance metrics are no longer optimized), the training process will terminate early, and the current optimal model parameters will be retained. The 20 consecutive training epochs represent the patience value of the early-stop mechanism, used to balance the sufficiency of model training with the risk of overfitting. Of course, in practice, these two parameters can be adjusted according to actual conditions and needs.
[0022] In step S103 of this embodiment, data augmentation including rotation and flipping is disabled because the hyperbolic shape of the underground target has physical determinism. Augmentation would change the curvature and lead to false feature learning. Therefore, the original radar reflection characteristics are maintained to ensure physical interpretability.
[0023] Since underground targets (cavities and pipelines) exhibit a true hyperbolic shape on B-scan, conventional rotation and flipping would alter the curvature of the hyperbola, causing the network to learn false features. Therefore, this embodiment abandons data augmentation to preserve physical interpretability.
[0024] In this embodiment, GPR refers to Ground Penetrating Radar; B-scan is a two-dimensional longitudinal profile image, with the horizontal axis representing the antenna movement distance and the vertical axis representing the electromagnetic wave travel time (which can be converted into depth), used to visually display the location, burial depth, and shape of underground targets. Point targets exhibit a hyperbolic trajectory on the B-scan, which is one of the characteristics of underground targets.
[0025] Step S2 in this embodiment includes the following sub-steps: Step S201: First, replace the first stride=2 convolution of the object detection model YOLOv5 with information-free dropout downsampling SPD-Conv; then, use the ConvNeXt Block convolution module only in the feature layer and deeper feature layers of feature map P3 / 8×, reducing the original 7×7 depth convolution to 5×5, which effectively covers a 25 cm×25 cm real area; finally, insert a sub-pixel convolution between feature map P2 / 4× and feature map P3 / 8×. Step S202: Remove the detection layers of feature maps P4 / 16× and P5 / 32×, retaining only feature maps P2 / 4× and P3 / 8×, and reduce the anchor frame size using the formulas P2: {3×3, 5×5, 7×7} px → actual {15 cm, 25 cm, 35 cm} and P3: {5×5, 7×7, 9×9} px → actual {25 cm, 35 cm, 45 cm}. Step S203, using the formula L_curv = 1 - ρ(pred_curve, The template_hyperbola adds a shape consistency loss function, CurvatureLoss, to the existing loss function of the YOLOv5 object detection model. It then quantifies geometric shape deviations as error terms by calculating the normalized cross-correlation between the predicted bounding box centerline response and the pre-generated hyperbolic template. Finally, the curvature loss is incorporated into the total loss L = L_CIoU + 0.5 * L_curv + L_cls + L_obj with a weight of 0.5. This forces the network to output a prediction conforming to a hyperbolic shape without excessively suppressing positioning accuracy, thus suppressing clutter false alarms. Here, L_curv represents the newly added shape consistency loss function CurvatureLoss, used to normalize the cross-correlation between the response on the predicted bounding box centerline and the pre-generated hyperbolic template, and then uses 1 − ρ as the error to force the network to output a "hyperbolic" shape. ρ is the normalized cross-correlation, pred_curve represents the one-dimensional response sequence extracted from the predicted bounding box output by the model, and template_hyperbola represents the discrete hyperbolic template (width 20) pre-generated according to the medium velocity. cm (depth 0-1m); L_CIoU represents the boundary regression loss, which is a combination of center point distance + aspect ratio + IoU, allowing the predicted box to fit the outer bounding box of the true hyperbola faster and more accurately; L_cls represents the cross entropy (BCE) of the target type in the predicted box; L_obj represents the confidence error of the predicted box containing an object, also using cross entropy (BCE), pulling the confidence of the anchor box containing the target toward 1, and pushing the confidence of the box without the target toward 0. Step S204: Disable Mosaic enhancement and enable the ElasticTransform operator of the image enhancement library Albumentations to simulate hyperbolic deformation caused by medium disturbance and synchronously map the bounding boxes. At the same time, increase the batch size to BatchSize≥64.
[0026] In this embodiment, SPD-Conv refers to the combination of Space-to-Depth + Conv, which is a downsampling method without information loss. The design of step S201 is to suppress the aliasing effect caused by sparse sampling of ground penetrating radar and enhance hyperbolic details. The YOLOv5 Backbone is improved in three stages, corresponding to steps S2011 to S2013 respectively.
[0027] Step S203 in this embodiment addresses the pain points of hyperbolic wing loss and difficulty in distinguishing between real targets and clutter arcs at low resolution. It adds CurvatureLoss (L_curv = 1 - ρ) to the original YOLOv5 loss. By calculating the normalized cross-correlation between the predicted box centerline response and the pre-generated hyperbolic template, geometric shape deviation is quantified as an error term. Finally, the curvature loss is incorporated into the total loss L = L_CIoU + 0.5*L_curv + L_cls + L_obj with a weight of 0.5. This forces the network to output predictions conforming to the hyperbolic shape without compromising positioning accuracy, thereby suppressing false alarms caused by clutter.
[0028] In this embodiment, step S204 addresses the sparse sampling and inhomogeneous medium characteristics of GPR data by employing three training techniques to improve the robustness and convergence stability of the model. First, the default Mosaic data augmentation of the YOLOv5 object detection model is disabled to avoid further stretching and blurring after stitching together multiple sparsely sampled images (5cm / px), which would degrade hyperbolic features. Then, the ElasticTransform operator from the Albumentations image enhancement library is used to apply elastic deformation to the input B-scan with a 50% probability, simulating the local distortion of the hyperbola caused by inhomogeneous underground medium, thus improving adaptability to real deformation. Finally, the batch size is increased to BatchSize ≥ 64, which alleviates the problem of sparse positive anchor boxes (effective target boxes) at low resolution, stabilizes gradient estimation, improves training efficiency, and enhances model convergence stability.
[0029] In the data augmentation step S204, an "elastic deformation" layer is added to the input 224×224 GPR B-scan image to simulate the slight distortion of the hyperbola caused by inhomogeneity in the underground medium. This allows the network to learn these "distorted arcs" in advance, thereby improving the robustness of L_curv. This can be represented in pseudocode as follows: import albumentations as A transform = A.ElasticTransform( alpha=10, # Deformation intensity, per pixel sigma=8, # Gaussian kernel width, controls deformation smoothness alpha_affine=0, # Do not perform global affine mapping p=0.5) # 50% chance to trigger In this design, the ElasticTransform operator has alpha=10 to control the maximum displacement to approximately 10 px (the actual displacement of a 50 cm × 10 cm region's edge is about 5 cm); sigma=8 to smooth the displacement field and avoid jagged artifacts; deformation is applied only to the image, and the bounding boxes are simultaneously remapped using the same displacement field to ensure box-arc consistency. The result is that the hyperbola seen by the network during training is no longer "standard symmetry," but rather a version with local stretching / compression / bending, forcing L_curv to focus only on the "approximate curvature" and no longer overfitting the ideal template, thus resulting in lower false alarms in real-world media velocity perturbation scenarios.
[0030] More specifically, step S201 in this embodiment includes the following sub-steps: Step S2011: Replace the first stride=2 convolution with a no-information dropdown sampling SPD-Conv (Space-to-Depth + 3×3 no-strut convolution), downsampling the 224×224 feature map to 112×112. The space is halved but all original pixels are retained, and the number of channels is expanded to 4 times. The remaining two downsampling convolutions maintain stride=2 to prevent the number of channels from exploding and to ensure that the 112×112 layer becomes the highest resolution and most information-dense base layer in the subsequent feature pyramid. Step S2012: Only use large kernel convolution to adjust ConvNeXt Block in feature map P3 / 8× and deeper feature layers, reducing the original 7×7 depth convolution to 5×5, which effectively covers a 25cm×25cm real area. In step S2013, a sub-pixel convolution is inserted between feature map P2 / 4×(56×56) and feature map P3 / 8×(28×28). First, feature map P3 is upsampled by 1×1 to reserve channels for subsequent upsampling. Then, the PixelShuffle 2× super-resolution upsampling is performed to return it to 112×112, achieving 2x super-resolution. The feature residuals are added to feature map P2 to achieve virtual super-resolution within the network to suppress aliasing.
[0031] The reason for designing step S2012 in this embodiment is that feature map P3 corresponds to a 28×28 feature map (equivalent to 5cm / px), with moderate semantics and details, which is suitable for large kernels to capture the overall shape of the hyperbola; the convolution depth is reduced to 5×5, which is equivalent to covering a 25cm×25cm real area, which can completely wrap the main body of the hyperbola, while avoiding the excessive smoothing effect of 7×7. Finally, depth convolution is performed, with each channel convolved independently, which is computationally efficient and preserves the independence of cross-channel features.
[0032] Experiments show that after improving the structure and loss function of the YOLOv5 target detection model in step S2, the mAP@0.5 on 224×224 data decreased from 71.2% to 76.5%, and the false alarm rate decreased by 3.9%.
[0033] Step S3 in this embodiment is used to convert the optimized target detection model YOLOv5 into TNN format and integrate it into the Android terminal to realize real-time on-site detection of municipal road GPR data, replacing the traditional manual post-interpretation.
[0034] Step S3 in this embodiment includes the following sub-steps: Step S301: Use the model export script export.py of the object detection model YOLOv5 to export the improved model weights in the ONNX open neural network exchange format with a non-default parameter operator set version opset=11 and an input size of 1×2×224×224, ensuring operator compatibility and dual-channel input adaptation. Step S302: In the Docker container, call the onnx2tnn conversion tool of the TNN neural network inference framework to force 16-bit floating-point precision (FP16) and the model optimization parameter optimize to generate a TNN model protocol file yolov5s.tnnproto and a TNN model weight file yolov5s.tnnmodel with a fixed input shape. Step S303: The TNN dynamic link library libTNN.so, compiled using TNN release-v0.4.0, is integrated into the Android development tool (Android Studio project); the Kotlin layer completes model loading and initialization through the TNN image classifier initialization interface TNNImageClassifier.init(); TNN refers to Tencent Neural Network, an open-source mobile inference framework that supports FP16 quantization and cross-platform deployment; Step S304 involves implementing a zero-memory copy inference process in the independent thread loadToDraw.tnnAIDetect. This process converts the camera preview stream's YUV sampling format to RGB image format and calls the TNN neural network inference framework to complete single-frame forward inference. Testing showed that on the Snapdragon 778G platform in FP16 single-threaded mode, the time taken was 19.8 ms, which meets real-time requirements.
[0035] Preferably, step S3 in this embodiment further includes step S305, which is used to implement the on-demand inspection function. Step S305 is used to overlay the detection results on the screen in real time. When the field engineer or robot pushes the GPR antenna, the detection results can be overlaid on the screen in real time, including marking holes with red boxes and marking pipelines with blue boxes. In addition, only targets with confidence scores higher than the preset confidence score threshold are displayed. The preset confidence score threshold refers to the pre-set confidence score threshold, which has a value of 0.1-0.9.
[0036] In this embodiment, step S4 is used to compensate for deep energy attenuation through adaptive nonlinear gain compensation on the native side before performing TNN inference on the Android side, thereby improving the signal-to-noise ratio of deep targets and significantly improving the detection confidence of the YOLO target detection model.
[0037] Step S4 in this embodiment includes the following sub-steps: Step S401: Adaptive nonlinear gain is performed on the real-time collected ground penetrating radar single-channel data through the Java native interface to compensate for the problem of deep target echo inundation caused by the exponential decay of underground high-frequency energy with depth. The Java native interface can be abbreviated as JNI interface, i.e. Java Native Interface. In this embodiment, the computeExpowerOfInverseAmplitudeDecay() interface is preferred. Step S402: Define the input parameters of the Java native interface. Define the arrayTraces parameter as a two-dimensional float array float[j][i], where j=0…19, representing a total of 20 data channels; i=0…599, representing 600 sampling points per data channel, used to correspond to the original B-scan block; define the zeroLev parameter as the cutoff sample number of the ground direct wave. In this embodiment, the zeroLev parameter is set to 80 by default because the gain of samples 0–79 is kept at 1 to avoid over-amplification of the direct wave; define the order parameter as the order of the polynomial fitting. In this embodiment, the order parameter is set to 3 by default to balance fitting accuracy and computational load. Step S403: Perform calculations on the Native side to implement the inverse gain algorithm process. The Native side refers to the C / C++ code layer called through the JAVA native interface. Step S404: Perform a single-threaded computational efficiency test. For example, on the Snapdragon 778G platform (ARM-A78@2.4 GHz), a single-threaded test showed that processing 600 sampling points × 20 data channels took 0.93 ms, which meets the requirement of a 50 Hz real-time acquisition frame rate. Step S405 verifies the data processing effect. Tests show that, compared to traditional linear + exponential gain, the reverse energy gain in this embodiment improves the signal-to-noise ratio of the deep 40–60 ns cavity hyperbolic region by approximately 8 dB, increases the YOLOv5-TNN detection confidence from 0.39 to 0.75, and reduces the false negative rate by 46%.
[0038] Furthermore, step S403 in this embodiment includes the following sub-steps: Step S4031: Copy the original 20×600 ground-penetrating radar data matrix to the OpenCV matrix object, and pad with zeros horizontally to 2400 points; Step S4032: Perform a horizontal Fast Fourier Transform (FFT) on each data point to obtain the complex spectrum ftr; Step S4033: Construct an analytical signal operator h, set the amplitude of the DC and Nyquist components to 1, the amplitude of the positive frequency components to 2, and the amplitude of the negative frequency components to 0, to realize the equivalent frequency domain operation of the Hilbert transform, which is used to extract the signal envelope. Step S4034: Multiply the complex spectrum ftr with the frequency domain operator h and then perform inverse fast Fourier transform (inverse FFT) to obtain the envelope matrix ht by taking the modulus. Step S4035: Sample the envelope matrix ht point by point along the measurement path and calculate the average to obtain the 600×1 dimension average energy decay curve decaycurve; Step S4036: After taking the base-10 logarithm of the average energy decay curve decaycurve, use third-order polynomial least squares fitting to solve the coefficient matrix A[0…3], such that log10(E(z))≈A0+A1·z+A2·z²+A3·z³ holds true, z=0…599; Step S4037: The fitted polynomial is inversely calculated using the natural exponent, and the inverse gain curve is obtained using the formula expower(z)=10^(poly(z)), where poly(z) refers to the polynomial function value. Step S4038: Find the maximum value max_expower among the 600 points, and calculate the normalization ratio point by point using the formula gain(z)=max_expower / expower(z) to ensure that the deep gain is ≥1 and the shallow gain is ≈1. Step S4039: Write the gain array arrayGain[chn][i] back to the Java / Kotlin layer via the Java native interface for subsequent path-by-path dot product to complete real-time gain compensation.
[0039] In step S5 of this embodiment, the GPR acquisition and analysis APP based on the TNN framework achieves "on-demand collection and testing" on-site and generates test reports within minutes through real-time detection and cloud collaboration, significantly reducing project downtime.
[0040] Specifically, step S5 in this embodiment includes the following sub-steps: Step S501: Run TNN inference in real time on each frame of B-scan image and display the detection results on the screen in an overlay manner, including marking holes with red boxes and marking pipelines with blue boxes, to replace the mode of manual judgment after the fact in the existing technology. Step S502: Display detection targets that are higher than the preset confidence threshold, block false detections with low confidence, and balance detection sensitivity and false alarm rate; In step S503, during the data collection process, the APP uploads the JPEG image (approximately 220kB per image) of the detection result (marked with a red box and / or a blue box) to the cloud server via the HTTP protocol. Under the 4G network environment, the average uplink latency is approximately 480ms, which enables fast data synchronization. In step S5404, after receiving the image, the cloud server generates an AI retest report. The report includes information such as the confidence level, category (cavity / pipeline), planar location, and estimated burial depth of the detected target. After data collection, the report is sent to the field engineer's mobile terminal via push service within a preset time. The preset time can be adjusted according to actual conditions and needs; the default is 30 seconds.
[0041] This embodiment reduces the report issuance time from the traditional 24 hours to 1 hour and 1 minute, and shortens the total time from fieldwork to officework from 2 people × 1 working day to 0.1 people × 1 hour.
[0042] This embodiment automatically generates AI retest reports on a cloud server (in the cloud). This refers to the use of a Win32 compatibility layer (Wine) built into a Linux container at the cloud service layer. The COM component Word.Application (an automation interface provided by Microsoft Word) is registered, and the CMyWord class calls Word.Application via CreateDispatch to achieve a headless background driver. More specifically, based on a compliant .dotx template containing pre-built bookmarks, an automatic mapping mechanism of template-bookmark-JSON three fields ensures that users can change the layout without writing any code, enabling automatic background writing operations in Word. In the CMyWord class, C represents the Class class, and MyWord represents "My Word Operation Tool," used to encapsulate all Word operation code; CreateDispatch refers to the creation function in the MFC library (Microsoft Foundation Classes); and Word.Application refers to the programming interface of the Word program.
[0043] This embodiment also provides an underground target detection system based on inverse gain and TNN mobile terminal deployment, which adopts the underground target detection method based on inverse gain and TNN mobile terminal deployment as described above, and includes: The data acquisition and model training module uses ground-penetrating radar for field data collection. After acquiring the ground-penetrating radar data, data augmentation is disabled, and the model is trained using a stochastic gradient descent optimizer, cosine annealing scheduling, total training rounds setting, and early stopping strategy to obtain the target detection model YOLOv5. The target detection model optimization module optimizes the structure and loss function of the YOLOv5 target detection model. The optimization process includes Backbone anti-aliasing and resolution enhancement, detection head simplification, and introducing shape constraints into the loss function. The TNN model mobile deployment module is based on the optimized target detection model YOLOv5 to enable mobile deployment of the TNN model. The mobile GPR data preprocessing module preprocesses ground-penetrating radar data on the mobile device using a TNN model. The real-time AI target detection and quantization module enables real-time AI target detection and quantization processing.
[0044] Compared with the prior art, the beneficial effects of the present invention are as follows: First, data acquisition and model training are performed, and the structure and loss function of the target detection model YOLOv5 are optimized; then, based on the optimized target detection model YOLOv5, the TNN model is deployed on a mobile device, and the ground penetrating radar data is preprocessed through the TNN model on the mobile device; finally, real-time AI target detection and quantization processing are achieved, thereby enabling real-time AI detection of GPR ground penetrating radar on a mobile device based on the TNN framework.
[0045] Testing revealed that during on-site data collection, the screen latency was less than 150ms, with red / blue boxes indicating the target. The confidence threshold was adjustable from 0.10 to 0.90, enabling real-time detection capabilities of "collecting and testing immediately," completely replacing manual interpretation. Detection data was uploaded to the cloud server in real time via HTTP protocol. The cloud server automatically generated a retest report containing information such as confidence level and burial depth and pushed it to the mobile terminal of the on-site engineer. This provided a foundation for the rapid generation and delivery of retest reports, reducing report issuance time from ≥24 hours under existing technologies to <1 minute. The total time spent on fieldwork and office work was reduced from 2 people × 1 working day to 0.1 people × 1 hour, and project downtime was reduced by more than 98%, significantly improving detection efficiency and data loop speed.
[0046] Therefore, this embodiment can achieve real-time, intelligent, and cloud-based underground target detection by ground penetrating radar (GPR) while keeping hardware costs unchanged.
[0047] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A method for underground target detection based on reverse gain and TNN mobile terminal deployment, characterized in that, The method comprises the following steps: Step S1, using ground penetrating radar for field collection, after obtaining ground penetrating radar data, disabling data augmentation, and using a random gradient descent optimizer, cosine annealing scheduling, total training round setting, and early stopping strategy for model training, obtaining a target detection model YOLOv5; Step S2, optimizing the structure and loss function of the target detection model YOLOv5, the optimization process includes Backbone anti-aliasing and resolution enhancement, detection head simplification, and loss function shape constraint; Step S3, based on the optimized target detection model YOLOv5, realizing the mobile end deployment of the TNN model; Step S4, preprocessing the ground penetrating radar data through the TNN model mobile end; Step S5, realizing real-time AI target detection and quantization processing.
2. The underground target detection method based on reverse gain and TNN mobile terminal deployment according to claim 1, characterized in that, The step S1 comprises the following sub-steps: Step S101, using a ground penetrating radar with an 880MHz antenna for ground penetrating radar scanning, the sampling time window of the ground penetrating radar is 62.5ns, and an original underground target B-scan image is obtained; Step S102, selecting 10000 B-scan graphs verified by re-measurement and drilling, labeling the B-scan graphs by selecting the double curve vertex region, and storing them in XML format, wherein the B-scan graphs include 6200 empty graphs and 3800 pipeline graphs; Step S103, dividing the B-scan graphs into a training set and a validation set according to a random ratio, and scaling the B-scan graphs to a 224x224 grayscale image input, disabling data augmentation including rotation and flipping to maintain the original radar reflection characteristics; Step S104, using a stochastic gradient descent algorithm to update the model weight through a random sample gradient, and adapting to the ground penetrating radar image target detection task; Step S105, setting an initial learning rate, and using cosine annealing dynamic scheduling in the training process to gradually reduce the learning rate according to the cosine curve, realizing the convergence of the later training; Step S106, setting the total training round, and enabling the early stopping mechanism, when the performance of the validation set does not improve for a preset number of consecutive rounds, the training is terminated to prevent overfitting and retain the optimal model parameters. 3.The underground target detection method based on reverse gain and TNN mobile terminal deployment of claim 1, wherein, The step S2 comprises the following sub-steps: Step S201, first replace the first stride=2 convolution of the target detection model YOLOv5 with a non-information loss SPD-Conv down-sampling; then, only use the convolution module ConvNeXt Block in the feature layer of the feature map P3 / 8x and deeper feature layers, reduce the original 7x7 deep convolution to 5x5, and equivalently cover a real area of 25cmx25cm; finally, insert a sub-pixel convolution Sub-pixel Conv between the feature map P2 / 4x and the feature map P3 / 8x; Step S202, remove the detection layers of feature map P4 / 16x and feature map P5 / 32x, only keep feature map P2 / 4x and feature map P3 / 8x, and reduce the anchor box scale by formula P2: {3x3, 5x5, 7x7} px -> actual {15 cm, 25 cm, 35 cm} and P3: {5x5, 7x7, 9x9} px -> actual {25 cm, 35 cm, 45 cm}; Step S203, by formula L_curv = 1-ρ(pred_curve, template_hyperbola), add a shape consistency loss function CurvatureLoss to the original loss of the target detection model YOLOv5, and then calculate the normalized cross-correlation between the predicted box center line response and the pre-generated hyperbolic template, to quantify the geometric shape deviation as an error term; finally, the curvature loss is integrated into the total loss L = L_CIoU + 0.5*L_curv + L_cls + L_obj with a weight of 0.5, which does not suppress the positioning accuracy, but forces the network to output a prediction that conforms to the hyperbolic shape to suppress false alarms; wherein, L_curv represents the newly added shape consistency loss function CurvatureLoss; p is the normalized cross-correlation, pred_curve represents a one-dimensional response sequence extracted from the inside of the predicted box output by the model; template_hyperbola represents a discrete hyperbolic template pre-generated according to the medium speed; L_CIoU represents the boundary regression loss; L_cls represents the cross entropy of the target type of the predicted box; L_obj represents the confidence error of the predicted box containing the object; Step S204, disable Mosaic enhancement, enable the ElasticTransform operator of the image enhancement library Albumentations to simulate the hyperbolic deformation caused by medium disturbance and simultaneously map the labeled box, and increase the batch size BatchSize to BatchSize >= 64.
4. The underground target detection method based on reverse gain and TNN mobile terminal deployment of claim 3, wherein, In the step S201, the following sub-steps are included: Step S2011, replace the first stride=2 convolution with a SPD-Conv without information loss, downsample the 224x224 feature map to 112x112, and expand the channel number to 4 times, and the remaining two downsampling keep stride=2 convolution; Step S2012, only use large kernel convolution adjustment ConvNeXt Block in feature map P3 / 8x and deeper feature layers, reduce the original 7x7 deep convolution to 5x5, which is equivalent to covering a 25cmx25cm real area; Step S2013, a sub-pixel convolution Sub-pixel Conv is inserted between the feature map P2 / 4×(56×56) and the feature map P3 / 8×(28×28), the feature map P3 is first up-sampled by 1×1, then is up-sampled to 112×112 by a rearrangement operation PixelShuffle 2× super-resolution, and is added with the feature residual of the feature map P2, so as to realize virtual super-resolution in the network to suppress aliasing effects.
5. The method of claim 1 to 4, wherein, The step S3 comprises the following sub-steps: Step S301, a model export script export.py of a target detection model YOLOv5 is used to export the improved model weight into an ONNX open neural network exchange format with a non-default parameter operator set version opset=11 and an input size 1×2×224×224; Step S302, an onnx2tnn conversion tool of a TNN neural network inference framework is called in a Docker container, 16-bit floating point precision is forcibly opened, and a model optimization parameter optimize is generated to generate a TNN model protocol file yolov5s.tnnproto and a TNN model weight file yolov5s.tnnmodel with fixed input shape; Step S303, a TNN dynamic link library libTNN.so compiled by using a TNN release-v0.4.0 version is integrated into an Android development tool; a model loading and initialization are completed by a TNN image classifier initialization interface TNNImageClassifier.init() in a Kotlin layer; Step S304, a zero memory copy inference process is realized in an independent thread loadToDraw.tnnAIDetect, a camera preview stream YUV sampling format is converted into an RGB image format, and a single-frame forward inference is completed by calling a TNN neural network inference framework.
6. The underground target detection method based on reverse gain and TNN mobile terminal deployment of claim 5, wherein, The step S3 further comprises a step S305 for superimposing a detection result on a screen in real time, identifying a hole by a red frame, identifying a pipeline by a blue frame, and displaying only a target with a confidence higher than a preset confidence threshold, the preset confidence threshold being a preset confidence threshold and taking a value of 0.1-0.
9.
7. The method of claim 1 to 4, wherein, The step S4 comprises the following sub-steps: Step S401, adaptive nonlinear gain is performed on real-time collected ground penetrating radar single-channel data through a Java native interface; Step S402, an input parameter of the Java native interface is defined, an arrayTraces parameter is defined as a two-dimensional float array float[j][i], wherein j=0…19, indicating 20 channels of data; i=0…599, indicating 600 sampling points for each channel of data; a zeroLev parameter is defined as a ground direct wave cutoff sample point sequence number; and an order parameter is defined as a polynomial fitting order; Step S403, a calculation is performed on a Native side to realize a reverse gain algorithm process, the Native side indicating a C / C++ code layer called through the JAVA native interface; Step S404, a single-threaded actual measurement operation efficiency is obtained. Step S405, the data processing effect is verified.
8. The underground target detection method based on reverse gain and TNN mobile terminal deployment of claim 7, wherein, The step S403 includes the following sub-steps: Step S4031, copy the original ground penetrating radar data matrix of 20*600 to the OpenCV matrix object, and zero-fill to 2400 points horizontally; Step S4032, perform a horizontal fast Fourier transform on each data to obtain a complex frequency spectrum ftr; Step S4033, construct an analytic signal operator h, set the direct current and Nyquist component amplitude to 1, the positive frequency component amplitude to 2, and the negative frequency component to 0, to realize the equivalent frequency domain operation of Hilbert transform, for extracting the signal envelope; Step S4034, multiply the complex frequency spectrum ftr with the operator h frequency domain, and then perform an inverse fast Fourier transform to obtain an envelope matrix ht; Step S4035, sample and average the envelope matrix ht along the channel direction point by point to obtain a 600*1-dimensional average energy decay curve decaycurve; Step S4036, take the base-10 logarithm of the average energy decay curve decaycurve, and then use a 3rd-order polynomial least squares fitting to solve the coefficient matrix A[0…3], so that log10(E(z))≈A0+A1·z+A2·z²+A3·z³ is established, z=0…599; Step S4037, calculate the reverse gain curve through the formula expower(z)=10^(poly(z)) by inversely calculating the fitting polynomial by natural exponent; Step S4038, find the maximum value max_expower in the 600 points, and calculate the normalized ratio point by point through the formula gain(z)=max_expower / expower(z); Step S4039, write the gain array arrayGain[chn][i] back to the Java / Kotlin layer through the Java native interface.
9. The method of claim 1 to 4, wherein, The step S5 includes the following sub-steps: Step S501, run TNN inference on each B-scan image in real time, and display the detection results on the screen in superimposed manner; Step S502, display the detection targets higher than the preset confidence threshold; Step S503, upload the JPEG picture of the detection results to the cloud server through the HTTP protocol to realize data synchronization; Step S5404, after receiving the picture, the cloud server generates an AI retest report, and the information of the AI retest report includes the confidence, category, plane position and burial depth estimation information of the detection target; and after the acquisition is completed, the AI retest report is sent to the mobile terminal of the on-site engineer through the push service within a preset time. 10.A system for detecting underground targets based on reverse gain and TNN mobile terminal deployment, characterized in that, The underground target detection method based on reverse gain and TNN mobile terminal deployment according to any one of claims 1 to 9 is adopted, and includes: A data acquisition and model training module, which uses ground penetrating radar for field acquisition, disables data augmentation after acquiring ground penetrating radar data, and uses a stochastic gradient descent optimizer, cosine annealing scheduling, total training round setting and early stopping strategy to train the model to obtain a target detection model YOLOv5; The target detection model optimization module optimizes the structure and loss function of the target detection model YOLOv5, and the optimization process includes backbone anti-aliasing and resolution enhancement, detection head simplification, and shape constraint introduced into the loss function. The TNN model mobile terminal deployment module is based on the optimized target detection model YOLOv5 and realizes the TNN model mobile terminal deployment. The mobile terminal GPR data preprocessing module preprocesses the ground penetrating radar data through the TNN model mobile terminal. The real-time AI target detection and quantification module realizes real-time AI target detection and quantification processing.