Subway water leakage identification method based on infrared image
By optimizing the YOLOv8 model, including correcting the small target positioning loss and introducing adaptive small target penalty items, the problem of insufficient detection performance of YOLOv8 in subway water leakage identification is solved, significantly improving the detection accuracy and improving the ability to identify leakage water.
Patent Information
- Application Number
- CN202510643861.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-05-19
AI Technical Summary
When identifying water leakage in subways, YOLOv8 has limited detection performance for small targets (such as fine cracks and water-stained edges), mainly due to the low pixel proportion, high positioning sensitivity and imbalance in gradient contribution.
A subway leak recognition method based on infrared images is proposed. Through model optimization steps, including data set construction, preprocessing, annotation, training and verification, especially in the object detection task, the positioning loss of small target Lloc is corrected to Lˊloc, the optimized YOLOv8 model is obtained, and an adaptive small target penalty term (DSOP) is introduced to improve the detection accuracy of small targets.
The detection accuracy of small targets is significantly improved, especially in identifying fine cracks and water-stained edges, and the model's ability to identify subway water leakage is improved, reducing potential risks and losses.
Smart Images

Figure CN120163972A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of infrared imaging, and particularly to a method for identifying subway water leakage based on infrared images. Background Art
[0002] With the rapid development of urban rail transit, the problem of subway water seepage and leakage has gradually emerged, bringing many serious hazards. Water seepage and leakage will erode the concrete structure inside the subway, cause steel corrosion, reduce the strength and durability of the structure, shorten the service life of subway facilities, and increase the cost of large-scale maintenance and reconstruction. Long-term water seepage and leakage may also cause potential safety hazards such as electrical equipment short circuits and failures.
[0003] As a typical representative of one-stage algorithms, the YOLO series of algorithms occupies an important position in the field of object detection. Its uniqueness lies in transforming object detection into a regression problem, greatly improving the detection efficiency. The latest YOLOv8 further optimizes on the basis of inheriting the advantages of its predecessors and has significant improvements in model architecture and training strategies. It can achieve faster detection speed while ensuring relatively high detection accuracy. For the subway water seepage and leakage detection scenario, its efficient detection ability can quickly and accurately identify the water seepage and leakage areas, provide key information for subway operation and maintenance in a timely manner, reduce potential risks and losses caused by water seepage and leakage, and meet the requirements of real-time and accurate detection in the complex subway environment. However, there are also some deficiencies, such as: When detecting small targets (such as fine cracks and water stain edges of subway water seepage and leakage), the performance is limited due to the following reasons: a. Low pixel ratio, with extremely few effective features of small targets in the image, which are easily submerged by background noise; b. High positioning sensitivity, and a slight position deviation (such as a few pixel offsets) will cause a significant drop in IoU; c. Unbalanced gradient contribution, where the gradients of large targets dominate the training process and the positioning errors of small targets are ignored. Summary of the Invention
[0004] To solve the deficiencies in the above-mentioned prior art solutions, the present invention provides a method for identifying subway water leakage based on infrared images.
[0005] The object of the present invention is achieved through the following technical solutions: A method for identifying subway water leakage based on infrared images, including model optimization; the model optimization includes the following steps: (A1) Collect infrared images of subway water seepage and leakage to construct a dataset; (A2) Preprocess the dataset: remove noise and enhance the water leakage part; (A3) Label the preprocessed images, mark the edges of the water leakage areas, convert the labeling results into a YOLO-format dataset, and divide it into a training set, a validation set, and a test set; (A4) In the object detection task, the localization loss L of small objects is loc corrected to Lˊ loc , and the optimized YOLOv8 model is obtained; , ; S is the object area, A img is the area of the image, α and γ are coefficients, β is the attenuation rate, epoch is the current round, T0 is the initial stage threshold, and T is the adaptive threshold; (A5) Use the training set to train the optimized model and use the validation set to validate the trained model; (A6) Use the test set to test the finally determined model.
[0006] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention solves the problem of small object detection when YOLOv8 is applied to seepage water recognition, proposes an adaptive small object penalty term, and significantly improves the detection accuracy of small objects through multi-dimensional collaborative optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Referring to the accompanying drawings, the disclosure of the present invention will become easier to understand. It is easy for those skilled in the art to understand that these drawings are only used to illustrate the technical solutions of the present invention and are not intended to limit the protection scope of the present invention. In the figures: Figure 1 is a schematic flowchart of the subway leakage recognition method based on infrared images according to the present invention; Figure 2 is the subway leakage recognition result using the method of the present invention Figure 1 ; Figure 3 is the subway leakage recognition result using the method of the present invention Figure 2 ; Figure 4 is the subway leakage recognition result using the method of the present invention Figure 3 ; Figure 5 is the subway leakage recognition result using the method of the present invention Figure 4 ; Figure 6 is the subway leakage recognition result using the method of the present invention Figure 5 . DETAILED DESCRIPTION OF THE INVENTION
[0008] Figures 1-6The following description and the following embodiments describe alternative specific embodiments of the present invention to teach those skilled in the art how to implement and reproduce the present invention. To explain the technical solution of the present invention, some conventional aspects have been simplified or omitted. Those skilled in the art should understand that variations or substitutions derived from these specific embodiments will fall within the scope of the present invention. Those skilled in the art should understand that the following features can be combined in various ways to form multiple variations of the present invention. Thus, the present invention is not limited to the following alternative specific embodiments, but is only defined by the claims and their equivalents.
[0009] Embodiment 1.
[0010] The subway leakage identification method based on infrared images according to the embodiment of the present invention includes model optimization, as Figure 1 shown, the model optimization includes the following steps: (A1) Collect infrared images of subway seepage and leakage to construct a data set; (A2) Preprocess the data set: remove noise and enhance the leakage part; (A3) Label the preprocessed images, mark the edges of the leakage areas, convert the labeling results into a data set in YOLO format, and divide it into a training set, a validation set, and a test set; (A4) In the object detection task, correct the positioning loss L loc of small objects to Lˊ loc to obtain an optimized YOLOv8 model; , ; where S is the target area, A img is the area of the image, α and γ are coefficients, β is the attenuation rate, epoch is the current round, T0 is the initial stage threshold, and T is the adaptive threshold; (A5) Use the training set to train the optimized model, and use the validation set to validate the trained model; (A6) Use the test set to test the finally determined model.
[0011] To improve the recognition accuracy, further, in step (A1), the Mosaic data augmentation method is used to expand the subway seepage and leakage data set.
[0012] To improve the recognition accuracy, further, in step (A2), median filtering is used to remove noise, and histogram equalization is used to enhance the leakage part, so that the distinction between the leakage part and the background becomes larger.
[0013] To improve the recognition accuracy, further, in step (A3), labelme is used for annotation, and the ratio of the divided training set, validation set, and test set is 7:2:1.
[0014] To improve the recognition accuracy, further, in the model training of step (A5), during the training process, according to the set parameters, through the Adam optimizer in the backpropagation algorithm combined with momentum and adaptive learning rate, the weights and biases of the model are continuously adjusted to reduce the loss function values of the model, and the model converges continuously. The parameters include the learning rate and the number of iterations.
[0015] To improve the recognition accuracy, further, in the model validation of step (A5), the performance of the model is evaluated. If the performance does not meet the expectation, the parameters of the model are adjusted. The parameters include the batch size, and the learning rate is dynamically adjusted using cosine annealing until the performance meets the expectation.
[0016] Example 2.
[0017] An application example of the subway leakage recognition method based on infrared images according to Embodiment 1 of the present invention.
[0018] In this application example, as Figure 1 shown, the model optimization includes the following steps: (A1) Use an infrared instrument to collect infrared images of water leakage, construct a data set, and expand the subway water leakage data set using the Mosaic data augmentation method.
[0019] Mosaic data augmentation greatly enriches the data diversity and enhances the generalization ability of the model by randomly cropping, scaling, and splicing four different images.
[0020] (A2) Preprocess the data set. First, apply median filtering to the infrared images for denoising. Median filtering selects a square region with side length k centered on the current pixel (i,j) (used as the reference point for determining the filtering window): .
[0021] .
[0022] MedianFilter(I,k) represents the output value at position (I,k) after applying median filtering to image I. represents all those that make The set of x that obtains the minimum value. (x, y) are the coordinates of any point within the window, used to traverse all pixels within the window. k is generally a positive integer and is the side length (odd) of the filtering window, used to control the size of the filtering range. [k / 2] is the radius of the window, used to ensure window symmetry. By sorting the pixel values within the window and taking the median value as the new value of the current pixel, the median m is calculated, effectively removing interference such as salt-and-pepper noise.
[0023] Use histogram equalization to enhance the leaky part. Histogram equalization maps the original histogram to a uniform distribution U(0, 1), and its probability density transformation is: 。
[0024] Where W(z) represents the objective function or output variable, and its value is determined by the product of the fractions on the right side. H(u) is the probability density function (PDF) or weight function, describing the distribution or contribution intensity of u. CDF(z) is the cumulative distribution function, and P total is the normalization factor, , z and L are the gray levels (i.e., the pixel intensity values obtained by the image, such as L = 256 for an 8-bit image). G(z) is the number of pixels (frequency) of gray level z in the histogram. Usually , used to ensure that the result is within a reasonable range.
[0025] Then define the enhanced contrast gain coefficient C enh = var(T(I)) / var(I).
[0026] Where var(T(I)) is the variance of the enhanced image T(I), reflecting the degree of dispersion (contrast) of the pixel values, and var(I) is the variance of the original image I, representing the initial contrast. By stretching the histogram distribution of the image, there is a greater distinction between the leak and the background.
[0027] (A3) Label the preprocessed image with labelme, accurately label the edge of the leaky area for image segmentation, and finally convert the labeling result into a dataset in yolo format and divide it into a training set, a validation set, and a test set, with a division ratio of 7:2:1.
[0028] (A4) In the object detection task, in order to better adapt to small object detection, this patent proposes a Dynamic Small-Object Penalty (DSOP), which significantly improves the detection accuracy of small objects through multi-dimensional collaborative optimization.
[0029] , 。
[0030] S is the target area (pixel area), A img is the area of the image, α and γ are coefficients, β is the attenuation rate, T0 is the initial stage threshold, and T is the adaptive threshold.
[0031] The global coefficient α of the small target penalty intensity ranges from 0.1 to 1, directly controlling the additional loss weight for small targets. The value needs to balance the following contradictions: If α is too large: it overly amplifies the gradient of small targets, which may lead to insufficient learning of large / medium targets by the model and unstable training.
[0032] If α is too small: the optimization effort for small targets is insufficient, making it difficult to improve the problem of missed detections.
[0033] For the dynamic weight mechanism: The size-sensitive factor (1 - S / T 2 ), when the target area S is less than the threshold T, generates a positive penalty term , and the smaller the target, the greater the penalty weight.
[0034] Image scale normalization can eliminate the influence of images with different resolutions and ensure that the penalty term is independent of the input size.
[0035] The adaptive threshold T dynamically adjusts the threshold according to the training stage: The initial stage threshold T0 is relatively large (loose detection, determining the looseness of the early training stage), and it decays exponentially as the training progresses, gradually focusing on smaller targets. The adjustment coefficient γ ranges from [0, 1] to control the attenuation amplitude. Experiments have found that the larger the value, the more drastic the threshold change. Β is the attenuation rate (empirical value range 0.01 - 0.5) used to determine the rate of threshold decrease. The larger the value, the faster the attenuation (quickly focusing on small targets), and epoch is the current round.
[0036] Table 1. Table of different target parameters.
[0037] .
[0038] In Table 1, the smaller the target, the larger the correction amount, and the higher the gradient weight during backpropagation, forcing the model to pay more attention to small target localization. It can be seen that the correction of the present invention solves the problem that the gradient of small targets is overwhelmed by large targets in object detection, and is especially suitable for enhancing the localization accuracy of fine cracks and water stain edges in subway leakage detection.
[0039] Table 2. Comparison table of the processing results of the present invention and existing models.
[0040] .
[0041] As shown in Table 2, in this way, the model pays more attention to the positioning accuracy of small targets during training, thereby improving the small target detection accuracy.
[0042] (A5)Use the training set to train the optimized YOLOv8 model. During the training process, according to the set parameters such as the learning rate and the number of iterations, the Adam optimizer in the backpropagation algorithm combines momentum and adaptive learning rate: .
[0043] .
[0044] Among them, m t represents the momentum (gradient weighted average) at the current moment. g t is the gradient at the current moment (obtained by backpropagation calculation). v t is the weighted average of the square of the gradient at the previous moment (used to adjust the learning rate). is the corrected momentum, which solves the deviation caused by m0 = 0 at the initial moment (t is small). is the corrected weighted average of the square of the gradient. Similarly, the initial deviation is eliminated. w t is the updated model parameter.
[0045] The momentum decay coefficients β1 and β2 are close to 0.9. β1 controls the decay speed of the first moment (momentum). The larger it is, the more persistent the influence of the historical gradient. β2 controls the decay speed of the second moment (square of the gradient). The larger it is, the smoother the change of the adaptive learning rate. η is the global learning rate, which determines the overall step size of parameter update. is the numerical stability term to prevent division by zero errors and make close to 10 -8 , t is the number of training steps (number of iterations), used for bias correction. Continuously adjust the weights and biases of the model to gradually reduce the loss function value of the model and make the model converge. Use the validation set to verify the trained model, and evaluate the performance of the model according to indicators such as the loss value, accuracy, and recall rate on the validation set. If the model performance does not meet the expected requirements, adjust the hyperparameters of the model, such as the batch size, and use cosine annealing to dynamically adjust the learning rate η(t)=η max ·cos(π·t / T decay ).
[0046] Among them, η(t) is the dynamic learning rate at the training step t, η max is the initial maximum learning rate (peak value), and T decayAnnealing cycle (half-cycle length). A relatively high learning rate can be maintained at the initial stage of training for rapid convergence, and then the learning rate can be slowed down in the later stage to avoid overfitting. Or further expand the dataset and then retrain and validate until the model performance meets the requirements.
[0047] In the post-processing stage of the model, Soft NMS is used to replace traditional NMS. Instead of directly deleting the detection boxes with high overlap, Soft NMS attenuates the scores of the detection boxes according to the overlap degree, and the formula is: 。
[0048] where Si is the confidence score of the i-th detection box b i and M is the candidate detection box with the highest score currently, and b i is the i-th candidate detection box to be processed, and IoU is the intersection over union function. IoU(M, b i ) is used to measure the overlap degree between the reference box M and the candidate box b i , and T1 is the preset overlap threshold. This can retain more possible small target detection results, and then the final detection boxes are obtained through threshold screening, thereby improving the detection effect of small targets and reducing false detection and missed detection situations, providing strong guarantee for the accurate detection of subway leakage.
[0049] (A6) Use the test set to test the finally determined model to obtain the detection effect evaluation of the model in the subway leakage scenario, and ensure that the model can accurately and efficiently detect the subway leakage situation, providing reliable technical support for the safe operation and maintenance of the subway.
[0050] Use the above optimized model to identify the collected infrared images, and the identification results are as Figures 2-6 shown, where the label represents the class name and confidence, and the confidence represents the probability estimate of the model that there is a target object water in the current detection box, ranging from [0, 1], and is used to reflect the degree of confidence of the model in this detection result.
Claims
1. A method for identifying subway water leakage based on infrared images, including model optimization; characterized in that: The model optimization comprises the following steps: (A1) Collect infrared images of subway water leakage to build a data set; (A2) Preprocess the dataset: remove noise and enhance the leaky part; (A3) Annotate the preprocessed image, mark the edge of the leaking area, convert the annotation result into a YOLO format dataset, and divide it into training set, validation set and test set; (A4) In the target detection task, the localization loss of small targets is L loc Corrected to Lˊ loc , obtain the optimized YOLOv8 model; , ; S is the target area, A img is the area of the image, α and γ are coefficients, β is the decay rate, epoch is the current round, T0 is the initial stage threshold, and T is the adaptive threshold; (A5) Use the training set to train the optimized model, and use the validation set to validate the trained model; (A6) Use the test set to test the final model.
2. The identification method according to claim 1, characterized in that: In step (A1), the Mosaic data enhancement method is used to expand the subway water leakage dataset.
3. The identification method according to claim 1, characterized in that: In step (A2), median filtering is used to remove noise, and histogram equalization is used to enhance the leaking part.
4. The identification method according to claim 1, characterized in that: In step (A3), labelme is used for annotation, and the ratio of the training set, validation set, and test set is 7:2:
1.
5. The identification method according to claim 1, characterized in that: In the model training of step (A5), during the training process, according to the set parameters, the Adam optimizer in the back propagation algorithm is combined with momentum and adaptive learning rate to continuously adjust the weights and biases of the model so that the loss function value of the model decreases and the model continues to converge. The parameters include learning rate and number of iterations.
6. The identification method according to claim 1, characterized in that: In the model validation of step (A5), the performance of the model is evaluated. If the performance does not meet expectations, the parameters of the model are adjusted, including the batch size, and the learning rate is dynamically adjusted using cosine annealing until the performance reaches expectations.
Citation Information
Patent Citations
Remote sensing image change detection quality evaluation method based on target area distribution characteristics
CN114708222A
Power transmission line fault detection method based on super-resolution preprocessing and improved YOLOv5x
CN114743084A
Infrared gas detection and gas contour automatic identification method
CN116452529A
Infrared ship target detection method based on improved yolov7
CN117152691A
Battery cell anomaly detection method and device, storage medium and electronic equipment
CN119417808A