A simple overhead contact line defect detection method and system
By augmenting the training set through hybrid pruning, and training a self-supervised model using multi-scale feature contrast loss and dense contrast loss, the model is transformed into a defect detection model. This solves the problem of manual reliance in the inspection of simplified overhead contact lines in high-speed railways and achieves high-precision automated inspection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI RAILWAY BUREAU
- Filing Date
- 2023-04-21
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies rely on manual analysis for defect detection in simplified overhead contact lines of high-speed railways. This results in long response times and is prone to false positives and false negatives, making it difficult to form an effective target detection method. In particular, the detection effect is poor when there are few defect samples and many categories.
A hybrid cropping method is used to augment the simplified contact network images in the training set. Multi-scale feature extraction is performed through a self-supervised model, and a defect detection model is trained using multi-scale feature contrast loss and dense contrast loss, which is then converted into a defect detection model for detection.
It achieves high-precision defect detection results even when target samples are scarce and there are many defect categories, and is suitable for automated inspection of simplified overhead contact lines in high-speed railways.
Smart Images

Figure CN116452549B_ABST
Abstract
Description
A simplified method and system for detecting defects in overhead contact lines Technical Field
[0001] This invention relates to a simplified method and system for detecting defects in overhead contact lines, belonging to the field of image processing technology. Background Technology
[0002] With the continuous advancement of modern technology, high-speed rail construction is progressing rapidly, and the traditional railway overhead contact system has now transitioned to a simplified one. However, as high-speed rail lines expand and become more complex, maintenance becomes increasingly difficult, and defects and malfunctions are occurring more frequently. Therefore, detecting defects such as bird nests, foreign objects, and missing parts, and promptly locating the faults in the overhead contact system are crucial for ensuring the safe operation of high-speed rail.
[0003] For defect detection of the simplified overhead contact system of high-speed railway, the general method is to set up a camera device on the overhead contact system to collect 2C or 4C images. The analysis room analyzes the images, and manual selection is made of possible defects or faults in the images. The images are then compiled and recorded by the maintenance department, and maintenance personnel are dispatched to check them one by one. This method is highly dependent on experienced staff, has a long response time, and is prone to false detections and missed detections.
[0004] In recent years, although many researchers have studied the defect detection problem of simplified overhead contact lines in high-speed railways, the complex and diverse railway operating environment, including a wide variety of defects, and the time-consuming and labor-intensive labeling of defect samples, make it difficult to establish an effective target defect database and defect detection method. Therefore, for defect detection of simplified overhead contact lines, in order to adapt to various types of defect detection, there is an urgent need to design a defect detection method that can maintain good detection results even when target samples are scarce and there are many defect categories. Summary of the Invention
[0005] This invention provides a simplified method and system for detecting defects in overhead contact lines, which solves the problems disclosed in the background art.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0007] A simplified method for detecting defects in overhead contact lines includes:
[0008] Obtain simplified contact network images;
[0009] Simplified catenary images are input into a pre-trained defect detection model to obtain simplified catenary defect detection results. The defect detection model is converted from a trained self-supervised model. When training the self-supervised model, a hybrid cropping method is used to augment the simplified catenary images in the training set. Multi-scale features are extracted from the simplified catenary images. Based on the extracted multi-scale features, multi-scale feature contrast loss and dense contrast loss are used for training.
[0010] The simplified contact network images in the training set are augmented using a hybrid cropping method, including:
[0011] Within a preset number of iterations, a random cropping method is used to crop simplified contact network images from the training set, and the cropped images are used to augment the simplified contact network images in the training set.
[0012] Beyond the preset number of iterations, the parameters of the self-supervised model are updated according to the weights of the self-supervised model. A comparative cropping method is used to correct the position judgment of the cropping box. The simplified catenary image in the training set is cropped according to the cropping box after correction. The cropped image is then used to augment the simplified catenary image in the training set.
[0013] The loss function for a self-supervised model is:
[0014]
[0015]
[0016]
[0017] Where L is the calculated value of the loss function of the self-supervised model, and N M N represents the number of multi-scale feature contrast losses. L L represents the total number of losses. mfc L is the calculated value of the multi-scale feature contrast loss function. dc For global image I q I k The dense contrast loss function between the two is calculated for the global image I. q I k These are different views generated from the same simplified contact wire image through a hybrid cropping method;
[0018] W i W is the weighted weight of the contrast loss for the i-th scale feature. j W is the weighted weight of the feature contrast loss at the j-th scale. k N represents the weighted weights of the contrast loss for the j-th scale feature. m The number of multi-scale features;
[0019] For I q I k The comparison loss function calculation values between them For I q After passing the i-th size feature of the encoder, Indicates with I q For the opposite I k After passing through the i-th dimensional feature of the encoder, T is the temperature hyperparameter. To be with I q The nth I of the negative pair k After passing the i-th size feature of the encoder, K is the length of the negative sample queue;
[0020] For P q and I k The comparison loss function calculation values between them For P q After passing the j-th size feature of the encoder Indicates with P q For the opposite I k After passing the j-th size feature of the encoder Indicates with P q The nth I of the negative pair k After passing the i-th size feature of the encoder, P q For I q Local image, I q The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. q The size of I is obtained. q A local image;
[0021] For P q P k The comparison loss function calculation values between them For P q After passing the k-th size feature of the encoder Indicates with P q For the P that is directly opposite k After passing the k-th size feature of the encoder Indicates with P q The nth P of the negative pair k After passing the k-th size feature of the encoder, P k For I k Local image, I k The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. k The size of I is obtained. kA local image;
[0022] For I q After the encoder's minimum scale features, Indicates with I q For the opposite I k After the encoder's minimum scale features, Indicates with I q The nth I of the negative pair k Minimum-scale features obtained through the encoder.
[0023] The rules for converting a trained self-supervised model into a defect detection model are as follows:
[0024] The key and value sets of the trained self-supervised model and defect detection model are transformed according to the fuzzy matching principle;
[0025] The fuzzy matching principle is as follows: The defect detection model key set C... dk As the standard key set, the key set C of the trained self-supervised model is... uk As a set of matching keys, remove C uk The starting structure name in C uk The remaining key names in C dk Perform a full character match on the keys in the database to obtain key-name matching pairs, and then extract the 'k' from the key-name matching pairs. d and with k u The corresponding v u Save the data into the defect detection model in key-value pair format;
[0026] k d and k u To form a key-name matching pair, k d C dk The key name in the string, k u C uk The key name in the v u These are the values in the set of values of the self-supervised model after training.
[0027] The loss function of the defect detection model is:
[0028] L s =BCE(obj) y ,obj s )+BCE(cls y ,cls s )+IOU(box y ,box s )
[0029] Among them, L sHere, BCE represents the calculated loss function value for the defect detection model, where BCE stands for BCEWithLogitsLoss binary cross-entropy loss function, and obj is the value of the loss function. y This indicates that the defect detection model predicts whether an input image contains defects, obj s cls indicates whether the input image of the defect detection model actually contains defects. y cls represents the defect category predicted by the defect detection model. s For actual defect categories, IOU stands for IOULSws loss function, used to detect predicted bounding boxes. y and real frame box s The overlapping area between them.
[0030] A simplified overhead contact line defect detection system includes:
[0031] The acquisition module acquires simplified contact network images;
[0032] The detection module inputs simplified catenary images into a pre-trained defect detection model to obtain simplified catenary defect detection results. The defect detection model is converted from a trained self-supervised model. When training the self-supervised model, a hybrid cropping method is used to augment the simplified catenary images in the training set. Multi-scale features are extracted from the simplified catenary images. Based on the extracted multi-scale features, multi-scale feature contrast loss and dense contrast loss are used for training.
[0033] In the detection module, a hybrid cropping method is used to augment the simplified contact network images in the training set, including:
[0034] Within a preset number of iterations, a random cropping method is used to crop simplified contact network images from the training set, and the cropped images are used to augment the simplified contact network images in the training set.
[0035] Beyond the preset number of iterations, the parameters of the self-supervised model are updated according to the weights of the self-supervised model. A comparative cropping method is used to correct the position judgment of the cropping box. The simplified catenary image in the training set is cropped according to the cropping box after correction. The cropped image is then used to augment the simplified catenary image in the training set.
[0036] In the detection module, the loss function of the self-supervised model is:
[0037]
[0038]
[0039]
[0040] Where L is the calculated value of the loss function of the self-supervised model, and N M N represents the number of multi-scale feature contrast losses. L L represents the total number of losses. mfc L is the calculated value of the multi-scale feature contrast loss function. dc For global image I q I k The dense contrast loss function between the two is calculated for the global image I. q I k These are different views generated from the same simplified contact wire image through a hybrid cropping method;
[0041] W i W is the weighted weight of the contrast loss for the i-th scale feature. j W is the weighted weight of the feature contrast loss at the j-th scale. k N represents the weighted weights of the contrast loss for the j-th scale feature. m The number of multi-scale features;
[0042] For I q I k The comparison loss function calculation values between them For I q After passing the i-th size feature of the encoder, Indicates with I q For the opposite I k After passing through the i-th dimensional feature of the encoder, T is the temperature hyperparameter. To be with I q The nth I of the negative pair k After passing the i-th size feature of the encoder, K is the length of the negative sample queue;
[0043] For P q and I k The comparison loss function calculation values between them For P q After passing the j-th size feature of the encoder Indicates with P q For the opposite I k After passing the j-th size feature of the encoder Indicates with P q The nth I of the negative pair k After passing the i-th size feature of the encoder, P q For I q Local image, I q The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. q The size of I is obtained.q A local image;
[0044] For P q P k The comparison loss function calculation values between them For P q After passing the k-th size feature of the encoder Indicates with P q For the P that is directly opposite k After passing the k-th size feature of the encoder Indicates with P q The nth P of the negative pair k After passing the k-th size feature of the encoder, P k For I k Local image, I k The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. k The size of I is obtained. k A local image;
[0045] For I q After the encoder's minimum scale features, Indicates with I q For the opposite I k After the encoder's minimum scale features, Indicates with I q The nth I of the negative pair k Minimum-scale features obtained through the encoder.
[0046] In the detection module, the rule for converting the trained self-supervised model into a defect detection model is as follows:
[0047] The key and value sets of the trained self-supervised model and defect detection model are transformed according to the fuzzy matching principle;
[0048] The fuzzy matching principle is as follows: The defect detection model key set C... dk As the standard key set, the key set C of the trained self-supervised model is... uk As a set of matching keys, remove C uk The starting structure name in C uk The remaining key names in C dk Perform a full character match on the keys in the database to obtain key-name matching pairs, and then extract the 'k' from the key-name matching pairs. d and with k u The corresponding v u Save the data into the defect detection model in key-value pair format;
[0049] k d and ku To form a key-name matching pair, k d C dk The key name in the string, k u C uk The key name in the v u These are the values in the set of values of the self-supervised model after training.
[0050] A computer-readable storage medium storing one or more programs, the one or more programs including instructions that, when executed by a computing device, cause the computing device to perform a simplified catenary defect detection method.
[0051] The beneficial effects achieved by this invention are as follows: This invention uses a hybrid cropping method to augment simplified catenary images, extracts multi-scale features from the simplified catenary images, trains an upstream self-supervised model using multi-scale feature contrast loss and dense contrast loss, converts the trained self-supervised model into a downstream defect detection model to be trained, and uses the trained defect detection model to detect the simplified catenary images to be detected, which can obtain high-precision detection results and is suitable for situations where target samples are scarce and there are many defect categories. Attached Figure Description
[0052] Figure 1 is a schematic diagram of a simplified contact wire defect detection method. Detailed Implementation
[0053] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0054] A simplified method for detecting defects in overhead contact lines includes the following steps:
[0055] Step 1: Obtain a simplified contact wire image;
[0056] Step 2: Input the simplified catenary image into the pre-trained defect detection model to obtain the simplified catenary defect detection result; wherein, the defect detection model is converted from the trained self-supervised model. When training the self-supervised model, a hybrid cropping method is used to augment the simplified catenary image in the training set, and multi-scale feature extraction is performed on the simplified catenary image. Based on the extracted multi-scale features, multi-scale feature contrast loss and dense contrast loss are used for training.
[0057] The above method augments simplified catenary images using a hybrid cropping approach, extracts multi-scale features from the simplified catenary images, trains an upstream self-supervised model using multi-scale feature contrast loss and dense contrast loss, and converts the trained self-supervised model into a downstream defect detection model to be trained. The trained defect detection model is then used to detect the simplified catenary images to be tested, achieving high-precision detection results. Furthermore, because the above method involves image augmentation, it is suitable for situations where target samples are scarce. The multi-scale feature extraction module has a large architecture, extracting more complete feature information from the image, and can solve more complex detection problems, making it suitable for situations with a large number of defect categories.
[0058] In the above method, the self-supervised model is a multi-scale dense contrast-enhanced self-supervised network, and the defect detection model is a target detection network compatible with the upstream self-supervised network. The self-supervised model needs to be trained first, and then the trained self-supervised model is transferred to obtain the downstream defect detection model to be trained. The defect detection model is then trained, and the trained defect detection model is used to perform simplified contact network defect detection.
[0059] As shown in Figure 1, a simplified catenary conventional image is used to train the self-supervised model. The simplified catenary conventional image is an unlabeled image. Based on the feature similarity of the images, PCA principal component analysis is used to extract features. The images are then aggregated using the K-means method. The images are classified according to the degree of aggregation and divided into training set and validation set according to a preset ratio.
[0060] During training, a hybrid cropping method is used to augment the simplified contact network images in the training set, as follows:
[0061] 1) Within a preset number of iterations, the simplified contact network images in the training set are cropped using a random cropping method, and the cropped images are used to augment the simplified contact network images in the training set.
[0062] The original image is cropped to a random size and aspect ratio, then the image is adjusted to a set pixel size (800, 800), and the brightness, contrast, grayscale, and flipping degree of the image are adjusted according to a certain probability to create an augmented image of the original image.
[0063] 2) Beyond the preset number of iterations, update the parameters of the self-supervised model according to the weights of the self-supervised model, use the contrastive cropping method to correct the position judgment of the cropping box, crop the simplified catenary image in the training set according to the cropping box after correction, and use the cropped image to augment the simplified catenary image in the training set.
[0064] Within the preset number of iterations, the position of objects in the original image has been initially learned through random cropping. Beyond the preset number of iterations, using this position as the center, the favorability of the central neighborhood is added through histogram changes. Neighborhoods that are consistent with the center pixels are given higher favorability, while those that are not are given lower favorability. The cropping box is biased towards the center and the neighborhoods with high favorability for cropping. Then, the image is adjusted to the set pixel size (800, 800), and the brightness, contrast, grayscale, and flipping degree of the image are adjusted according to a certain probability to serve as an augmented image of the original image.
[0065] Two global images (I) can be generated from the same image after augmentation using a hybrid cropping method. q I k I q I k For two different views, I q I k As input, perform multi-scale feature extraction to obtain I q I k The comparison loss function between them can be performed as follows:
[0066] A1) will I q I k Input to encoder f q N are obtained respectively m = 3 feature maps of different scales are fed into a multilayer perceptron (MLP) with parameters that are not shared between them, and the outputs of each MLP are concatenated according to their dimensions.
[0067] A2) I of different images q I k Multiscale features The samples are fed into the negative sample queue, and the key encoder f... k When initializing the parameters with f q The parameters are kept consistent, and these parameters do not participate in backpropagation; the function of the key encoder is to ensure consistency, that is, to ensure that f q The samples in the data can be obtained from similar or identical f k We obtain sample features to ensure the effectiveness of the comparison.
[0068] A3) As a query representation As Similar sample representation, As Different sample representations, if I q I k If they come from the same image, they are considered a positive pair; otherwise, they are considered a negative pair.
[0069] To ensure and The similarity between them should be as high as possible, while the similarity with other... The similarity between them should be as small as possible, and the global image I of the same image should be as small as possible. q I k The contrast loss function between them is:
[0070]
[0071] in, For I q I k The comparison loss function calculation values between them For I q After encoder f q The i-th size feature, Indicates with I q For the opposite I k After encoder f q The i-th size feature, To be with I q The nth I of the negative pair k After encoder f q The i-th size feature, K is the length of the negative sample queue, N m The number of multi-scale features is T, which is the temperature hyperparameter. This keeps negative samples with higher similarity away from each other, making the resulting representation space more uniform.
[0072] Will I q I k As input, local images P are obtained respectively through the mosaic enhancement method. q P k Specifically: I k The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. k The size of I is obtained. k Local image P k ;I q The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. q The size of I is obtained. q Local image P q Further feature extraction at multiple scales was performed to obtain P. q P k The comparison loss function between them can be performed as follows:
[0073] B1) I q I k The image is split into multiple local images using a jigsaw puzzle method, and the local images are fed into the encoder f. q N were obtained respectivelym = 3 feature maps of different scales are fed into a multilayer perceptron (MLP) with parameters that are not shared between them, and the outputs of each MLP are concatenated according to their dimensions.
[0074] B2) P of different images q I k Multiscale features The samples are fed into the negative sample queue, and the key encoder f... k When initializing the parameters with f q The parameters remain consistent, and the parameters do not participate in backpropagation.
[0075] B3) As a query representation As Similar sample representation, As Different sample representations, if P q I k If they come from the same image, they are considered a positive pair; otherwise, they are considered a negative pair.
[0076] To ensure and The similarity between them should be as high as possible, while the similarity with other... The similarity between them should be as small as possible, and the local images P of the same image should be as close as possible. q With global image I k The contrast loss function between them is:
[0077]
[0078] in, For P q and I k The comparison loss function calculation values between them For P q After encoder f q The j-th size feature, Indicates with P q For the opposite I k After encoder f q The j-th size feature, Indicates with P q The nth I of the negative pair k After encoder f q The i-th size feature.
[0079] B4) P of the same image q P k Multiscale features Insert encoder fq In the middle, the P of different images q P k Multiscale features The samples are fed into the negative sample queue, and the key encoder f... k When initializing the parameters with f q The parameters remain consistent, and the parameters do not participate in backpropagation.
[0080] B5)f q In As a query representation As Similar sample representation, As Different sample representations, if P q P k If they come from the same image, they are considered a positive pair; otherwise, they are considered a negative pair.
[0081] To ensure and The similarity between them should be as high as possible, while the similarity with other... The similarity between them should be as small as possible, and the local images P of the same image should be as close as possible. q P k The contrast loss function between them is:
[0082]
[0083] in, For P q P k The comparison loss function calculation values between them For P q After encoder f q The kth size feature, Indicates with P q For the P that is directly opposite k After encoder f q The kth size feature, Indicates with P q The nth P of the negative pair k After encoder f q The kth dimension feature.
[0084] Will I q I k As input, multi-scale feature extraction is performed. The smallest scale feature, i.e., the general feature map, is fed into a dense perceptron (Dense MLP) to obtain the global image I. q I kThe dense contrastive loss function between the two features is combined with the multi-scale feature contrastive loss function to obtain the loss function of the contrastive loss module, which serves as the total loss function of the model. After iteration, a self-supervised model that can be used for transfer learning is obtained. The process can be as follows:
[0085] C1) I q I k The data is fed into encoder f respectively. q N were obtained respectively m = 3 feature maps of different scales. The feature map of the smallest scale is fed into the dense perceptron. The dense perceptron replaces the linear layer with a convolutional layer and outputs dense feature information.
[0086] C2) will Insert key encoder f k , key encoder f k The parameter initialization is directly copied from f. q The parameters are not involved in backpropagation.
[0087] C3) As a query representation As Similar sample representation, As Different sample representations, if If the feature representations originate from the same image, they are represented as positive pairs; otherwise, they are represented as negative pairs.
[0088] To ensure and The similarity between them should be as high as possible, while the similarity with other... The similarity between them should be as small as possible, and the I of the same image should be as small as possible. q I k The dense contrast loss function between them is:
[0089]
[0090] Among them, L dc For global image I q I k The dense contrast loss function between them is calculated. For I q After encoder f q The smallest scale feature, Indicates with I q For the opposite I k After encoder f q The smallest scale feature, Indicates with I q The nth I of the negative pair k After encoder fq The smallest scale feature.
[0091] When the images in the batch enter f q Then, the multi-scale features of the negative samples of the image are sent to the tail of the negative sample queue. When the length of the negative sample queue reaches its upper limit, the head of the queue is removed, and more negative samples are viewed through queue updates; k The parameter is f q Momentum update, the update formula is:
[0092] m(1-θ q )+mθ k
[0093] Where m is the momentum value, θ q f q Network structure parameters, θ k f k Network structure parameters.
[0094] The encoder, or multi-scale feature extraction module, is the specific network architecture consisting of a 53-layer backbone network, three multilayer perceptrons (MLPs), and one dense perceptron (Dense MLP). The encoder f... q , key encoder f k The architecture remains consistent, f k The parameter is f q According to m(1-θ) q )+mθ k Momentum update, and The encoders are identical, only the sensors they pass through are different.
[0095] C4) Combines the multi-scale feature contrast loss function and the dense contrast loss function to obtain the total loss function, and after iteration, obtains a self-supervised model that can be used for transfer learning.
[0096] The loss function for a self-supervised model is:
[0097]
[0098]
[0099] Where L is the calculated value of the loss function of the self-supervised model, and N M =9 represents the number of multi-scale feature contrast losses, N L =10 represents the total number of losses, L mfc W is the calculated value of the multi-scale feature contrast loss function. i W is the weighted weight of the contrast loss for the i-th scale feature. jW is the weighted weight of the feature contrast loss at the j-th scale. k The weights are the weights for the feature contrast loss at the j-th scale.
[0100] The pre-trained upstream self-supervised model is used for transfer learning and transformed into a downstream defect detection model to be trained. The transformation rule between the two is as follows:
[0101] The key and value sets of the trained self-supervised model and defect detection model are transformed according to the fuzzy matching principle; the fuzzy matching principle is: the key set C of the defect detection model is transformed... dk As the standard key set, the key set C of the trained self-supervised model is... uk As a set of matching keys, remove C uk The starting structure name in C uk The remaining key names in C dk Perform a full character match on the keys in the database to obtain key-name matching pairs, and then extract the 'k' from the key-name matching pairs. d and with k u The corresponding v u Save it to the defect detection model in key-value pair format; k d and k u To form a key-name matching pair, k d C dk The key name in the string, k u C uk The key name in the v u These are the values in the set of values of the self-supervised model after training.
[0102] Specifically, k u ∈C uk Remove the layer names starting with 'encoder_k', and then remove k. u ∈C uk Remove layer names containing 'mlp', and then remove k u ∈C uk The layer structure name starting with 'encoder_q' and k d ∈C dk Perform a full character match on the layer structure name in the middle, and select the matched k u Change to k d and k u The corresponding v u Save the data into the pre-trained model in key-value pair format, and skip any that do not match.
[0103] A defect detection model is trained using simplified contact wire defect images, as detailed below:
[0104] D1) Construct simplified training and validation sets for missing contact network caps, dirty insulators, missing spare busbars, and foreign object defects.
[0105] D2) After adjusting the defect image, it is sent to the defect detection module, and the defect detection model is trained iteratively.
[0106] The loss function of the defect detection model is:
[0107] L s =BCE(obj) y ,obj s )+BCE(cls y ,cls s )+IOU(box y ,box s )
[0108] Among them, L s Here, BCE represents the calculated loss function value for the defect detection model, where BCE stands for BCEWithLogitsLoss binary cross-entropy loss function, and obj is the value of the loss function. y This indicates that the defect detection model predicts whether an input image contains defects, obj s cls indicates whether the input image of the defect detection model actually contains defects. y cls represents the defect category predicted by the defect detection model. s For actual defect categories, IOU stands for IOULSws loss function, used to detect predicted bounding boxes. y and real frame box s The overlapping area between them.
[0109] After training, defect detection can be performed directly to obtain simplified catenary images. The obtained simplified catenary images are then input into the trained defect detection model to obtain simplified catenary defect detection results, specifically the defect category, confidence level, and prediction box.
[0110] The above method can obtain high-precision detection results and is suitable for situations where target samples are scarce or there are many types of defects.
[0111] Based on the same technical solution, this invention also discloses a software system for the above-mentioned method, a simplified contact network defect detection system, comprising:
[0112] The acquisition module acquires simplified contact network images.
[0113] The detection module inputs simplified catenary images into a pre-trained defect detection model to obtain simplified catenary defect detection results. The defect detection model is converted from a trained self-supervised model. When training the self-supervised model, a hybrid cropping method is used to augment the simplified catenary images in the training set. Multi-scale features are extracted from the simplified catenary images. Based on the extracted multi-scale features, multi-scale feature contrast loss and dense contrast loss are used for training.
[0114] In the detection module, a hybrid cropping method is used to augment the simplified contact network images in the training set, including:
[0115] Within a preset number of iterations, a random cropping method is used to crop simplified contact network images from the training set, and the cropped images are used to augment the simplified contact network images in the training set.
[0116] Beyond the preset number of iterations, the parameters of the self-supervised model are updated according to the weights of the self-supervised model. A comparative cropping method is used to correct the position judgment of the cropping box. The simplified catenary image in the training set is cropped according to the cropping box after correction. The cropped image is then used to augment the simplified catenary image in the training set.
[0117] In the detection module, the loss function of the self-supervised model is:
[0118]
[0119]
[0120]
[0121] Where L is the calculated value of the loss function of the self-supervised model, and N M N represents the number of multi-scale feature contrast losses. L L represents the total number of losses. mfc L is the calculated value of the multi-scale feature contrast loss function. dc For global image I q I k The dense contrast loss function between the two is calculated for the global image I. q I k These are different views generated from the same simplified contact wire image through a hybrid cropping method;
[0122] W i W is the weighted weight of the contrast loss for the i-th scale feature. j W is the weighted weight of the feature contrast loss at the j-th scale. k N represents the weighted weights of the contrast loss for the j-th scale feature.m The number of multi-scale features;
[0123] For I q I k The comparison loss function calculation values between them For I q After passing the i-th size feature of the encoder, Indicates with I q For the opposite I k After passing through the i-th dimensional feature of the encoder, T is the temperature hyperparameter. To be with I q The nth I of the negative pair k After passing the i-th size feature of the encoder, K is the length of the negative sample queue;
[0124] For P q and I k The comparison loss function calculation values between them For P q After passing the j-th size feature of the encoder Indicates with P q For the opposite I k After passing the j-th size feature of the encoder Indicates with P q The nth I of the negative pair k After passing the i-th size feature of the encoder, P q For I q Local image, I q The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. q The size of I is obtained. q A local image;
[0125] For P q P k The comparison loss function calculation values between them For P q After passing the k-th size feature of the encoder Indicates with P q For the P that is directly opposite k After passing the k-th size feature of the encoder Indicates with P q The nth P of the negative pair k After passing the k-th size feature of the encoder, P k For I k Local image, I k The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. kThe size of I is obtained. k A local image;
[0126] For I q After the encoder's minimum scale features, Indicates with I q For the opposite I k After the encoder's minimum scale features, Indicates with I q The nth I of the negative pair k After the encoder's minimum scale features, the rules for converting the trained self-supervised model into a defect detection model in the detection module are as follows:
[0127] The key and value sets of the trained self-supervised model and defect detection model are transformed according to the fuzzy matching principle;
[0128] The fuzzy matching principle is as follows: The defect detection model key set C... dk As the standard key set, the key set C of the trained self-supervised model is... uk As a set of matching keys, remove C uk The starting structure name in C uk The remaining key names in C dk Perform a full character match on the keys in the database to obtain key-name matching pairs, and then extract the 'k' from the key-name matching pairs. d and with k u The corresponding v u Save the data into the defect detection model in key-value pair format;
[0129] k d and k u To form a key-name matching pair, k d C dk The key name in the string, k u C uk The key name in the v u These are the values in the set of values of the self-supervised model after training.
[0130] The data processing flow and methods of each module in the above system are consistent, and will not be described again here.
[0131] Based on the same technical solution, the present invention also discloses a computer-readable storage medium storing one or more programs, the one or more programs including instructions that, when executed by a computing device, cause the computing device to perform a simplified contact network defect detection method.
[0132] Based on the same technical solution, the present invention also discloses a computing device, including one or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and configured to be executed by the one or more processors, and the one or more programs include instructions for executing a simplified contact wire defect detection method.
[0133] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0134] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.
[0135] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0136] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0137] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of the claims of the present invention pending approval.
Claims
1. A simplified method for detecting defects in overhead contact lines, characterized in that, include: Obtain simplified contact network images; Simplified catenary images are input into a pre-trained defect detection model to obtain simplified catenary defect detection results. The defect detection model is converted from a trained self-supervised model. During training, a hybrid cropping method is used to augment the simplified catenary images in the training set. Multi-scale feature extraction is performed on the simplified catenary images, and training is conducted using multi-scale feature contrast loss and dense contrast loss. Two global images are generated from the same image after augmentation using the hybrid cropping method. The multi-scale feature contrast loss includes the contrast loss between global images of the same image, the contrast loss between local images and global images of the same image, and the contrast loss between local images and global images of the same image. The local image contrast loss; dense contrast loss is the dense contrast loss between global images of the same image; the simplified contact network images in the training set are augmented using a hybrid cropping method, including: within a preset number of iterations, the simplified contact network images in the training set are cropped using a random cropping method, and the cropped images are used to augment the simplified contact network images in the training set; outside the preset number of iterations, the parameters of the self-supervised model are updated according to the weights of the self-supervised model, the position judgment of the cropping box is corrected using a contrastive cropping method, the simplified contact network images in the training set are cropped according to the cropping boxes after the position is corrected, and the cropped images are used to augment the simplified contact network images in the training set.
2. The simplified contact wire defect detection method according to claim 1, characterized in that, The loss function for a self-supervised model is: ; ; Where L is the calculated value of the loss function of the self-supervised model, and N... M N represents the number of multi-scale feature contrast losses. L L represents the total number of losses. mfc L is the calculated value of the multi-scale feature contrast loss function. dc For global image I q I k The dense contrast loss function between the two is calculated for the global image I. q I k These are different views generated from the same simplified contact wire image through a hybrid cropping method; W i W is the weighted weight of the contrast loss for the i-th scale feature. j W is the weighted weight of the feature contrast loss at the j-th scale. k N represents the weighted weights of the contrast loss for the j-th scale feature. m The number of multi-scale features; For I q I k The comparison loss function calculation values between them For I q After passing the i-th size feature of the encoder, Indicates with I q For the opposite I k After passing through the i-th dimensional feature of the encoder, T is the temperature hyperparameter. To be with I q The nth I of the negative pair k After passing the i-th size feature of the encoder, K is the length of the negative sample queue; For P q and I k The comparison loss function calculation values between them For P q After passing the j-th size feature of the encoder Indicates with P q For the opposite I k After passing the j-th size feature of the encoder Indicates with P q The nth I of the negative pair k After passing the i-th size feature of the encoder, P q For I q Local image, I q The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. q The size of I is obtained. q A local image; For P q P k The comparison loss function calculation values between them For P q After passing the k-th size feature of the encoder Indicates with P q For the P that is directly opposite k After passing the k-th size feature of the encoder Indicates with P q The nth P of the negative pair k After passing the k-th size feature of the encoder, P k For I k Local image, I k The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. k The size of I is obtained. k A local image; For I q After the encoder's minimum scale features, Indicates with I q For the opposite I k After the encoder's minimum scale features, Indicates with I q The nth I of the negative pair k Minimum-scale features obtained through the encoder.
3. The simplified contact wire defect detection method according to claim 1, characterized in that, The rule for converting the trained self-supervised model into a defect detection model is as follows: the key sets and value sets of the trained self-supervised model and the defect detection model are converted according to the fuzzy matching principle; whereby the fuzzy matching principle is: the key set C of the defect detection model is converted... dk As the standard key set, the key set C of the trained self-supervised model is... uk As a set of matching keys, remove C uk The starting structure name in C uk The remaining key names in C dk Perform a full character match on the keys in the database to obtain key-name matching pairs, and then extract the 'k' from the key-name matching pairs. d and with k u The corresponding v u Save it to the defect detection model in key-value pair format; k d and k u To form a key-name matching pair, k d C dk The key name in the string, k u C uk The key name in the v u These are the values in the set of values of the self-supervised model after training.
4. The simplified contact wire defect detection method according to claim 1, characterized in that, The loss function of the defect detection model is: ; among which, L s Here, BCE represents the calculated loss function value for the defect detection model, where BCE stands for BCEWithLogitsLoss binary cross-entropy loss function, and obj is the value of the loss function. y This indicates that the defect detection model predicts whether an input image contains defects, obj s cls indicates whether the input image of the defect detection model actually contains defects. y cls represents the defect category predicted by the defect detection model. s For actual defect categories, IOU stands for IOULSws loss function, used to detect predicted bounding boxes. y and real frame box s The overlapping area between them.
5. A simplified contact wire defect detection system, characterized in that, include: The acquisition module acquires simplified contact network images; The detection module inputs simplified catenary images into a pre-trained defect detection model to obtain simplified catenary defect detection results. The defect detection model is converted from a trained self-supervised model. During training, a hybrid cropping method is used to augment the simplified catenary images in the training set. Multi-scale feature extraction is performed on the simplified catenary images, and training is conducted using multi-scale feature contrast loss and dense contrast loss. Two global images are generated from the same image after augmentation using the hybrid cropping method. The multi-scale feature contrast loss includes the contrast loss between global images of the same image, the contrast loss between local images and the global image of the same image, and the contrast loss between local images of the same image. Dense contrast loss is the dense contrast loss between global images of the same image. In the detection module, a hybrid cropping method is used to augment the simplified contact network images in the training set, including: within a preset number of iterations, a random cropping method is used to crop the simplified contact network images in the training set, and the cropped images are used to augment the simplified contact network images in the training set; outside the preset number of iterations, the parameters of the self-supervised model are updated according to the weights of the self-supervised model, a contrastive cropping method is used to correct the position judgment of the cropping box, the simplified contact network images in the training set are cropped according to the cropping box after the correction position, and the cropped images are used to augment the simplified contact network images in the training set.
6. A simplified contact wire defect detection system according to claim 5, characterized in that, In the detection module, the loss function of the self-supervised model is: ; ; Where L is the calculated value of the loss function of the self-supervised model, and N... M N represents the number of multi-scale feature contrast losses. L L represents the total number of losses. mfc L is the calculated value of the multi-scale feature contrast loss function. dc For global image I q I k The dense contrast loss function between the two is calculated for the global image I. q I k These are different views generated from the same simplified contact wire image through a hybrid cropping method; W i W is the weighted weight of the contrast loss for the i-th scale feature. j W is the weighted weight of the feature contrast loss at the j-th scale. k N represents the weighted weights of the contrast loss for the j-th scale feature. m The number of multi-scale features; For I q I k The comparison loss function calculation values between them For I q After passing the i-th size feature of the encoder, Indicates with I q For the opposite I k After passing through the i-th dimensional feature of the encoder, T is the temperature hyperparameter. To be with I q The nth I of the negative pair k After passing the i-th size feature of the encoder, K is the length of the negative sample queue; For P q and I k The comparison loss function calculation values between them For P q After passing the j-th size feature of the encoder Indicates with P q For the opposite I k After passing the j-th size feature of the encoder Indicates with P q The nth I of the negative pair k After passing the i-th size feature of the encoder, P q For I q Local image, I q The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. q The size of I is obtained. q A local image; For P q P k The comparison loss function calculation values between them For P q After passing the k-th size feature of the encoder Indicates with P q For the P that is directly opposite k After passing the k-th size feature of the encoder Indicates with P q The nth P of the negative pair k After passing the k-th size feature of the encoder, P k For I k Local image, I k The puzzle is divided into several pieces according to a jigsaw puzzle format. Each piece is randomly cropped and adjusted to an I shape. k The size of I is obtained. k A local image; For I q After the encoder's minimum scale features, Indicates with I q For the opposite I k After the encoder's minimum scale features, Indicates with I q The nth I of the negative pair k Minimum-scale features obtained through the encoder.
7. A simplified contact wire defect detection system according to claim 5, characterized in that, In the detection module, the rule for converting the trained self-supervised model into a defect detection model is as follows: the key sets and value sets of the trained self-supervised model and the defect detection model are converted according to the fuzzy matching principle; whereby the fuzzy matching principle is: the key set C of the defect detection model is converted... dk As the standard key set, the key set C of the trained self-supervised model is... uk As a set of matching keys, remove C uk The starting structure name in C uk The remaining key names in C dk Perform a full character match on the keys in the database to obtain key-name matching pairs, and then extract the 'k' from the key-name matching pairs. d and with k u The corresponding v u Save it to the defect detection model in key-value pair format; k d and k u To form a key-name matching pair, k d C dk The key name in the string, k u C uk The key name in the v u These are the values in the set of values of the self-supervised model after training.
8. A computer-readable storage medium for storing one or more programs, characterized in that, The one or more programs include instructions that, when executed by a computing device, cause the computing device to perform any of the methods according to claims 1 to 4.
Citation Information
Patent Citations
Strip steel surface defect detection method based on multi-scale feature extraction
CN111275684A
Method for carrying out defect identification on overhead line system image of railway
CN111951212A
Few-sample target detection method, electronic equipment and computer medium
CN114926622A