Method for detecting cracks in oil and gas transmission pipeline

The multi-scale knowledge distillation network with a crack simulation module and enhanced loss function addresses the lack of abnormal data in pipeline crack detection, improving detection accuracy and robustness.

CN120318554APending Publication Date: 2025-07-15CHANGZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510310446.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

The existing crack detection algorithm in oil and gas conveying pipelines lacks sufficient abnormal image data, resulting in poor generalization ability of training models and low detection accuracy.

Method used

A multi-scale knowledge distillation network is adopted to generate anomaly image data through the crack simulation module, and feature comparison learning is performed using the teacher model and two student models. Combining the Euclidean distance and cosine loss function optimization training process, the feature extraction of anomaly regions is enhanced.

Benefits of technology

It significantly improves the accuracy and robustness of crack detection in the inner wall of the oil and gas conveying pipeline, and improves the generalization ability and detection efficiency of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318554A_ABST
    Figure CN120318554A_ABST
Patent Text Reader

Abstract

The invention relates to the field of pipeline crack detection, in particular to a method for detecting cracks in an oil and gas transmission pipeline. Comprising the steps that a multi-scale knowledge distillation network is built and trained; the network comprises a teacher model, a student model I and a student model II; in a training process, an image in an internal-crack-free pipeline image set is directly input into a student model I, is enhanced into an internal-crack pipeline image through a crack simulation module, and then is input into a student model II; the student model I and the student model II respectively carry out comparative learning on the multi-scale features of the input images and the multi-scale features extracted by the pre-trained teacher model; and inputting a to-be-detected pipeline inner wall image into the trained multi-scale knowledge distillation network, calculating comparison difference values between the student model I and the teacher model as well as between the student model II and the teacher model, averaging, comparing with a threshold value, and judging whether the pipeline has an internal crack or not. According to the method, the problem of weak model generalization ability caused by few training samples is solved, and crack detection in the oil and gas transmission pipeline can be better realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of pipeline crack detection, and particularly to a method for detecting cracks inside an oil and gas transportation pipeline. Background Art

[0002] With the continuous prosperity of the global economy and the continuous expansion of the scope of human activities, the demand for energy is increasing day by day. To ensure the stable supply of energy, it is required to ensure the safe and stable operation of oil and gas transportation pipelines. Traditional inspection of oil and gas transportation pipelines mainly relies on manual patrol, but this method has many deficiencies. Manual patrol is not only time-consuming and laborious with low efficiency, but also the long-term work is prone to fatigue, increasing the risk of missed inspection. More importantly, once a failure occurs in an oil and gas transportation pipeline, it may trigger serious safety accidents, posing a huge threat to the environment and the safety of people's lives and property, and also having an adverse impact on the urban economic benefits.

[0003] In recent years, with the rapid development of deep learning technology, significant progress has been made in the technology of detecting cracks in oil and gas transportation pipelines. The automation and intelligence of oil and gas transportation pipeline detection have been gradually realized, providing strong technical support for improving the detection efficiency and ensuring pipeline safety.

[0004] Although the existing crack detection algorithms have made remarkable progress in terms of accuracy and inference speed, there are still deficiencies in the detection of cracks inside oil and gas transportation pipelines. The main reason is the lack of sufficient abnormal image data (inner crack pipeline images). In the existing datasets for detecting cracks inside oil and gas transportation pipelines, the abnormal samples usually account for a relatively small proportion, and these abnormal samples are indispensable data in the training process. This leads to poor generalization ability of the trained network model and low detection accuracy.

[0005] Therefore, it is urgent to solve the above technical problems. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a method for detecting cracks inside an oil and gas transportation pipeline, which solves the problem of weak generalization ability of the model caused by few training samples and can better realize the detection of inner wall cracks of oil and gas transportation pipelines.

[0007] To solve the above technical problem, the technical solution of the present invention is: A method for detecting cracks inside an oil and gas transportation pipeline, comprising:

[0008] Building a multi-scale knowledge distillation network and training it; wherein, the multi-scale knowledge distillation network includes a teacher model, a student model one, and a student model two;

[0009] During the training process, the images in the pipeline image set without internal cracks are directly input into Student Model 1 and the pre-trained Teacher Model. After being enhanced by the crack simulation module into pipeline images with internal cracks, they are input into Student Model 2. Student Model 1 and Student Model 2 respectively compare the multi-scale features of their input images with the multi-scale features extracted by the pre-trained Teacher Model for contrastive learning;

[0010] Input the inner wall image of the pipeline to be detected into the trained multi-scale knowledge distillation network, calculate the average difference between the contrast difference of Student Model 1 and the Teacher Model and the contrast difference of Learning Model 2 and the Teacher Model, and compare it with the threshold to determine whether there are cracks on the inner wall of the oil and gas transportation pipeline.

[0011] Furthermore, the specific working process of the crack simulation module is as follows:

[0012] Step a, randomly generate Gaussian noise and multiply it element by element with the original image;

[0013] Step b, randomly generate a texture map from the texture dataset and multiply it element by element with the generated map in Step a;

[0014] Step c, invert the randomly generated Gaussian noise and multiply it element by element with the original image;

[0015] Step d, finally add the two generated maps in Step c and Step b to obtain the final effect diagram.

[0016] Furthermore, the formula representation of the specific working process of the crack simulation module is:

[0017] I a =(β(M⊙I n ))⊙(1 - β)A)+(1 - M)⊙I n

[0018] where I a represents the simulated crack pipeline image, ⊙ represents vector dot product, M represents the randomly generated two-dimensional noise, β represents the transparency factor, A represents the texture image randomly selected from the texture dataset; I n represents the pipeline image without internal cracks.

[0019] Furthermore, Student Model 1 and Student Model 2 respectively compare the multi-scale features of their input images with the multi-scale features extracted by the pre-trained Teacher Model for contrastive learning; specifically:

[0020] Student Model 1 compares the multi-scale features extracted by its encoding part with the multi-scale features extracted by the encoding part of the pre-trained Teacher Model for contrastive learning;

[0021] The student model two performs contrastive learning by comparing the multi-scale features restored by its decoding part with the multi-scale features extracted by the encoding part of the pre-trained teacher model.

[0022] Furthermore, the calculation formula for the contrast difference between any one of the student model one and the student model two and the teacher model is:

[0023]

[0024] In the formula, I m represents the image input to the student model, represents the squared value of the difference between the student model and the teacher model at the coordinate pixel (i, j) of the k-th layer feature map, represents the difference of the cosine loss function between the student model and the teacher model at the pixel (i, j) of the k-th layer feature map; K represents the total number of layers of the feature map of the image; h k This represents the width of the k-th layer feature map, and the length of the k-th layer feature map; represents the contrast difference between the student model and the teacher model in the multi-scale feature map.

[0025] Furthermore, during the training process, the calculation formula for the loss function is:

[0026]

[0027] represents the cosine loss function, represents the Euclidean loss function.

[0028] After adopting the above technical solutions, the present invention has the following beneficial effects:

[0029] 1. Design a crack simulation module to increase the data of abnormal images, thereby solving the problem of fewer abnormal samples and effectively solving the problem of weak generalization ability.

[0030] 2. Add a different student model to the basic multi-scale knowledge distillation module, and can better highlight the effect of abnormal recognition, thereby improving its efficiency and solving the problem of lack of rich feature extraction;

[0031] 3. The newly added student model two can better pull the difference of the original student module one, further solving the problem of weak generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 is a flowchart of the method for detecting cracks in the oil and gas transmission pipeline of the present invention;

[0033] Figure 2It is the framework diagram of the multi-scale knowledge distillation network of the present invention during the training process;

[0034] Figure 3 It is the framework diagram of the multi-scale knowledge distillation network of the present invention during the process of detecting cracks in the pipeline;

[0035] Figure 4 It is the flowchart of the crack simulation module of the present invention for enhancing the image of the pipeline without internal cracks;

[0036] Figure 5 It is the ROC curve diagram of the multi-scale knowledge distillation network of the present invention during the training process;

[0037] Figure 6 It is the ROC curve diagram of the traditional network architecture during the training process. Detailed implementation manners

[0038] In order to make the content of the present invention easier to be clearly understood, the following further describes the present invention in detail according to specific embodiments and in conjunction with the accompanying drawings.

[0039] As Figures 1 to 3 shown, a method for detecting cracks in an oil and gas transportation pipeline includes:

[0040] Build a multi-scale knowledge distillation network and train it; wherein, the multi-scale knowledge distillation network includes a teacher model, a student model one, and a student model two;

[0041] During the training process, the images in the pipeline inner wall image set without internal cracks are directly input into the student model one and the pre-trained teacher model. After being enhanced by the crack simulation module into pipeline inner wall images with internal cracks, they are input into the student model two. The student model one and the student model two respectively compare and learn the multi-scale features of their input images with the multi-scale features extracted by the pre-trained teacher model;

[0042] Input the inner wall image of the pipeline to be detected into the trained multi-scale knowledge distillation network, calculate the average difference between the comparison difference of the student model one and the teacher model and the comparison difference of the learning model two and the teacher model, and compare it with the threshold value to determine whether there are cracks on the inner wall of the oil and gas transportation pipeline.

[0043] Among them, the pipeline inner wall image without internal cracks refers to the pipeline inner wall image without cracks on the inner wall. The pipeline inner wall image with internal cracks refers to the pipeline inner wall image with cracks on the inner wall.

[0044] A more specific method for detecting cracks in an oil and gas transportation pipeline includes:

[0045] In the first step, use the training data set as the input. First, adjust the dimensions, number of channels, and size of the input images; among them, the images in the training data set are pipeline inner wall images without internal cracks;

[0046] Step 2: Design a crack simulation module, which is used to perform a data augmentation operation on the input image, that is, artificially simulate the normal image of the inner wall of the pipeline without cracks into an abnormal image of the inner wall of the pipeline with cracks. In this way, since the feature representations are different, it is possible to highlight the feature representations of the abnormal regions, so as to better identify whether it is abnormal.

[0047] As Figure 4 shown, the specific working process of the crack simulation module is as follows:

[0048] Step a, randomly generate Gaussian noise and multiply it element by element with the original image;

[0049] Step b, randomly generate a texture map from the texture dataset and multiply it element by element with the generated map in step a;

[0050] Step c, invert the randomly generated Gaussian noise and multiply it element by element with the original image. The effect of this is to better simulate the abnormal and normal edge information;

[0051] Step d, finally add the two generated maps in step c and step b to obtain the final effect diagram;

[0052] The formula is: I a =(β(M⊙I n ))⊙(1 - β)A)+(1 - M)⊙I n

[0053] where I a represents the simulated crack pipeline image, ⊙ represents the vector dot product, M represents the randomly generated two-dimensional noise, β represents the transparency factor, A represents the texture image randomly selected from the texture dataset; I n represents the pipeline image without internal cracks.

[0054] To solve the problem of insufficient abnormal samples in the training dataset, diverse texture information in the DTD texture dataset is utilized to simulate and generate different types of abnormal regions. By fusing with the content of the original image, it ensures that the abnormal regions are more natural and realistic in visual effects, thereby improving the diversity and authenticity of abnormal samples. This simulation strategy significantly enhances the model's ability to identify abnormal regions and further improves the accuracy and robustness of anomaly detection.

[0055] Step 3: Build a multi-scale knowledge distillation network. The backbone uses the resnet18 network, which can further enhance the information content of its feature extraction.

[0056] The multi-scale knowledge distillation network has three models, namely the teacher model, student model one, and student model two. The teacher model is a large model that is already well-established. We only use the teacher model to train the two student models. Let the two student models learn the feature representations of the teacher model. This can make the feature representations of the normal regions behind similar, but the feature representations of the abnormal regions are significantly different, which is beneficial for subsequent anomaly detection operations. Among them, student model one mainly uses its encoding part, and both the encoding part and the decoding part of student model two are used.

[0057] Step 4: Train student model one and student model two.

[0058] Among them, during training, the crack simulation module designed in the second step is added to student model two. The images in the training dataset are directly input into student model one, and after being enhanced by the crack simulation module into internal crack pipeline images, they are then input into student model two.

[0059] Student model one performs contrastive learning by comparing the multi-scale features extracted from its encoding part with the multi-scale features extracted from the encoding part of the pre-trained teacher model; student model two performs contrastive learning by comparing the multi-scale features restored by its decoding part with the multi-scale features extracted from the encoding part of the pre-trained teacher model.

[0060] The difference between the student model and the teacher model in the abnormal region of the image is relatively large. Because when training, the student model learns the normal region part of the teacher model, the difference in the normal region part is relatively small. At this time, student model two learns the normal region part of the teacher during restoration. When encountering abnormal images, the abnormal region of the teacher model will be more prominent in student model two, making the difference in the abnormal region of student model one more prominent, thus preventing missed detections.

[0061] Therefore, student model two is used to guide student model one, and this can be done for feature maps of different scales. The differences of feature maps of different scales are also combined together and then the average value is calculated to obtain the contrast difference. In this way, the differences can be more prominent while weakening the normal region, so as to achieve a better purpose of identifying anomalies (cracks on the inner wall of the pipeline). In traditional network architectures (with only one teacher model and one student model), the difference similarity value in the abnormal region may be relatively small, making it unable to effectively identify the anomaly, and thus its efficiency is also low and it cannot well express its detection effect. To solve this problem, in this embodiment, an additional student model, namely student model two, is added to guide the original student module and also weaken the difference in the normal region part.

[0062] During the training process, a loss function that combines Euclidean distance and cosine distance metrics is used. By adopting this metric method, the abnormal regions can be more prominent, while the normal regions will not be overly prominent. Moreover, the difference between normal regions can be reduced, so that a prominent abnormal region can be obtained more smoothly and better, and a final abnormal score can be obtained more effectively, thereby enabling better judgment and discrimination of abnormalities.

[0063] Loss function The calculation formula is:

[0064]

[0065] represents the cosine loss function, represents the Euclidean loss function, and λ is the parameter value that combines these two loss functions.

[0066] Step 5: Input the inner wall image of the pipeline to be detected into the trained multi-scale knowledge distillation network, and calculate the difference between the multi-scale feature representations (feature maps) of the two student models and the multi-scale feature representation of the teacher model respectively. The formula is:

[0067]

[0068] In the formula, I m represents the image input into the student model, represents the squared value of the difference between the student model and the teacher model at the coordinate pixel (i, j) of the feature map at the k-th layer, represents the difference between the cosine loss functions of the student model and the teacher model at the pixel (i, j) of the feature map at the k-th layer; K represents the total number of layers of the feature map of the image; h k This represents the width of the feature map at the k-th layer, and the length of the feature map at the k-th layer;

[0069] represents the comparison difference between the student model and the teacher model in the multi-scale feature maps.

[0070] Then calculate the mean value of the comparison differences between the two student models and the teacher model, and compare it with the threshold. According to the comparison result, determine whether there is a crack. The threshold is a fixed value, which can be 0.5, etc.

[0071] Specifically, in the detection of cracks in oil and gas transmission pipelines, due to the small number of samples of its abnormal image data, the commonly used network generally does not perform well. Because of the small number of samples and labels, etc., it is easy to cause problems such as weak generalization ability and poor effect in the trained network model. This embodiment uses data augmentation operations, which is an operation to simulate abnormalities on normal images (inner wall images of pipelines without cracks) to solve the problem of fewer abnormal data samples. Here, a new reconstruction network model is added and used as the second student model. The reason for adding this model is that in traditional knowledge distillation, the difference between the abnormal area and the normal area is relatively small, so it is not possible to detect the abnormal part well. To solve this problem, the newly added student model (the second student model) and the initial student model (the first student model) jointly learn from the teacher model. This method solves the above-mentioned problem (the difference between the abnormal area and the normal area is relatively small), and also solves the problem of lack of rich features. In this embodiment, a second student model different from the original first student model is added to the network structure. During testing, the difference between the feature representation of the abnormal area in its decoding part and the feature representation of the abnormal area in the teacher network is amplified, so that the abnormal area can be more prominent. Combining the difference between the feature representation in the initial first student model and the feature representation of the teacher, and taking the average value, can better highlight the abnormal area. In this way, some small probability events are avoided (in the traditional network architecture (only one teacher model and one student model), during testing, the difference between the feature representations of the two abnormal areas is likely to be small. Although the probability of occurrence is very small, there is still a possibility of occurrence). During training, the input data of the newly added second student model is different from that of the teacher model, but during testing, the newly added second student model is a trained model, so its input data will no longer pass through the crack simulation module. Here, the difference between the feature representations of the normal areas in the student model and the teacher model is relatively small, so the difference size is used to highlight the abnormal area. This enables the entire model to better detect oil and gas transmission pipelines with internal cracks.

[0072] The multi-scale knowledge distillation network in this embodiment is compared with the traditional network architecture (only one teacher model and one student model) in the same oil and gas transmission pipeline internal crack dataset and the same experimental environment. The detection accuracy effect is determined by comparing the AUROC values. The AUROC value of the multi-scale knowledge distillation network in the above embodiment is: 95.89%; the AUROC value of the traditional network architecture (only one teacher model and one student model) is: 89.39%, and the detection accuracy is finally increased by 6.5%.

[0073] Based on the above-mentioned ideal embodiments of the present invention as inspiration, through the above description, relevant staff can completely make various changes and modifications without departing from the technical idea of this invention. The technical scope of this invention is not limited to the content in the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. A method for detecting cracks in an oil and gas transportation pipeline, characterized in that it includes: Construct and train a multi-scale knowledge distillation network; among them, the multi-scale knowledge distillation network includes a teacher model, a first student model, and a second student model; During the training process, the images in the crack-free pipeline image set are directly input into the first student model and the pre-trained teacher model. After being enhanced by the crack simulation module into crack-containing pipeline images, they are input into the second student model. The first student model and the second student model respectively perform comparative learning on the multi-scale features of their input images and the multi-scale features extracted by the pre-trained teacher model; Input the inner wall image of the pipeline to be detected into the trained multi-scale knowledge distillation network, calculate the average difference between the comparison difference between the first student model and the teacher model and the comparison difference between the second learning model and the teacher model, and compare it with the threshold value to judge whether there are cracks in the inner wall of the oil and gas transportation pipeline.

2. The method for detecting cracks in an oil and gas transportation pipeline according to claim 1, characterized in that The specific working process of the crack simulation module is as follows: Step a, randomly generate Gaussian noise and multiply it element by element with the original image; Step b, randomly generate a texture map from the texture data set and multiply it element by element with the generated map in step a; Step c, invert the randomly generated Gaussian noise and multiply it element by element with the original image; Step d, finally add the two generated maps in step c and step b to obtain the final effect image.

3. The method for detecting cracks in an oil and gas transportation pipeline according to claim 2, characterized in that The formula representation of the specific working process of the crack simulation module is: I a = (β(M⊙I n )⊙(1 - β)A)+(1 - M)⊙I n Where I a represents the simulated cracked pipeline image, ⊙ represents the vector dot product, M represents the randomly generated two-dimensional noise, β represents the transparency factor, and A represents the texture image randomly selected from the texture dataset; I n represents the pipeline image without internal cracks.

4. The method for detecting cracks in an oil and gas transportation pipeline according to claim 1, characterized in that The first student model and the second student model respectively perform comparative learning on the multi-scale features of their input images and the multi-scale features extracted by the pre-trained teacher model; specifically: The first school model performs comparative learning on the multi-scale features extracted by its encoding part and the multi-scale features extracted by the encoding part of the pre-trained teacher model; The second student model performs comparative learning on the multi-scale features restored by its decoding part and the multi-scale features extracted by the encoding part of the pre-trained teacher model.

5. The method for detecting cracks in an oil and gas transportation pipeline according to claim 1, characterized in that The calculation formula for the comparison difference between any one of the first student model and the second student model and the teacher model is: Wherein, I m represents the image input to the student model, represents the square value of the difference between the student model and the teacher model at the pixel (i, j) of the feature map at the k-th layer, represents the difference of the cosine loss function between the student model and the teacher model at the pixel (i, j) of the feature map at the k-th layer; K represents the total number of layers of the feature map of the image; h k This represents the width of the feature map at the k-th layer, and the length of the feature map at the k-th layer; l e (I m ) represents the comparison difference between the student model and the teacher model in the multi-scale feature map.

6. The method for detecting cracks in an oil and gas transportation pipeline according to claim 1, characterized in that During the training process, the loss function is calculated as follows: represents the cosine loss function, represents the Euclidean loss function.