Method and system for detecting pressure leakage defect of crimping fitting based on semantic segmentation
Through the detection method based on semantic segmentation, the Unet model and DBSCAN and Zhang-suen algorithms are used for post-processing, and the problem of insufficient recognition accuracy and generalization ability of detecting leakage pressure defects of transmission line crimping metals in the prior art is solved, and higher recognition accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202411951831.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-22
AI Technical Summary
When detecting the leakage pressure defects of the transmission line crimping tool, the prior art has problems of limited identification accuracy and generalization ability, resulting in insufficient accuracy and reliability of the identification results.
Using a detection method based on semantic segmentation, the X-ray image of the crimped metal tool is acquired and preprocessed, and the X-ray data set of the crimped metal tool is constructed, and the Unet semantic segmentation model is used for training. The DBSCAN algorithm is used to denoising the result and the Zhang-suen algorithm are framed, and the crimping ratio is calculated to judge the leakage pressure defect.
It improves the stability and reliability of the model, enhances the capture ability of complex image features, and improves the accuracy and accuracy of defect recognition.
Smart Images

Figure CN119863448A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power equipment detection, and mainly to a method and system for detecting pressure leakage defects in crimping hardware based on semantic segmentation. Background Art
[0002] As the "lifeline" of the power system, transmission lines play an irreplaceable role in ensuring the continuous and reliable transmission of electric energy and maintaining the stable operation of the power grid. As a key component of the transmission line, the tension clamp not only bears all the tension of the conductor, but also serves as a carrier for conducting electricity. Once put into use, it cannot be disassembled. If a poorly crimped tension clamp is used, local heating is very likely to occur under high-load operation, thereby damaging the conductor, causing the tension that the clamp can withstand to decrease, causing the steel strand to corrode, be damaged or even break in the tension clamp, thereby causing power accidents and endangering social security. Therefore, it is very important to inspect the crimping quality of the tension clamp.
[0003] The traditional detection method is based on X-ray detection, which uses the different attenuation characteristics of the collective materials and structures of the inspected equipment to obtain X-ray images. If there are defects in the inspected equipment, the defects can be identified by comparing historical X-ray images or manual judgment. However, this method has great limitations. Since the detection results rely largely on personal subjective judgment, inconsistent diagnostic results are prone to occur, resulting in misjudgment and omission of defects. In addition, the number of tension clamps on the transmission line is huge. Using traditional methods is not only inefficient, but also consumes huge manpower costs.
[0004] For example, the Chinese invention patent with publication number "CN118037643A" discloses a "Deep Learning-Based Method and Device for Detecting Defects in Power Line Crimping Fittings", which specifically discloses "labeling the crimping fittings and the defect categories of the crimping fittings in the historical image dataset of the fittings, and using the IC-YOLOv5 model to perform back-propagation training on the historical image labeling dataset of the fittings, and inputting the current X-ray image of the crimping fittings of the transmission line into the trained X-ray image defect recognition model for defect detection", but this method uses the IC-YOLOv5 model to directly identify defects, and the model has limitations in feature extraction and recognition capabilities, and cannot obtain the crimping ratio, which may not be suitable for the task of detecting underpressure defects in the X-ray images of crimping fittings, resulting in limited recognition accuracy and generalization ability, and insufficient accuracy and reliability of the recognition results. Summary of the invention
[0005] In order to solve the above-mentioned problems existing in the prior art, the present application provides a method and system for detecting pressure leakage defects of crimping fittings based on semantic segmentation.
[0006] The technical solution of this application is as follows:
[0007] On the one hand, the present invention proposes a method for detecting pressure leakage defects of crimping fittings based on semantic segmentation, the method comprising:
[0008] Acquire historical transmission line crimping fittings X-ray images, and preprocess the transmission line crimping fittings X-ray images; construct a crimping fittings X-ray dataset based on the preprocessed transmission line crimping fittings X-ray images;
[0009] Construct a crimped fittings X-ray recognition model, including an input layer, a Unet prediction layer and an output layer, wherein the Unet prediction layer is constructed based on the Unet semantic segmentation model; use the crimped fittings X-ray data set to train the crimped fittings X-ray recognition model to obtain a trained crimped fittings X-ray recognition model; obtain an X-ray image of the power transmission line crimped fittings to be identified, input the X-ray image of the power transmission line crimped fittings into the trained crimped fittings X-ray recognition model to obtain a recognition result;
[0010] The recognition results are post-processed, specifically using the DBSCAN algorithm to denoise the recognition results and using the Zhang-suen algorithm to skeletonize; based on the post-processing results, the pixel lengths of the skeletons of the crimped and non-crimped areas are calculated, and the crimping ratio is obtained according to the pixel length calculation; according to the crimping ratio, the judgment result of the pressure leakage defect of the crimping hardware is obtained.
[0011] Preferably, the preprocessing includes image category labeling and image enhancement, specifically:
[0012] The image category annotation is specifically to input the crimping fittings X-ray image into the annotation tool, select a polygonal box to mark the crimping area between the aluminum tube and the stranded wire and the non-crimping area between the aluminum tube and the stranded wire;
[0013] The image enhancement specifically includes randomly flipping the image with a preset proportional probability, adjusting the image size according to a preset target size range and a zoom ratio range; and performing customized random cropping on the adjusted image to obtain an image-enhanced crimping hardware X-ray image.
[0014] Preferably, the Unet semantic segmentation model includes an encoder and a decoder, and the encoder and the decoder are connected via a skip connection; the encoder includes L convolutional layers for downsampling, which is expressed as:
[0015] D={(x1,y1),...,(x i ,y i ),...,(x N ,y N )}, i = 1, 2, ..., N;
[0016] h l =Relu(W l ·x i +b l ), l = 1, 2, ..., L;
[0017] g l =pool(h l );
[0018] h l+1 =Relu(W l+1 ·x i +b l+1 );
[0019] g l+1 =pool(h l+1 );
[0020] Where D represents the X-ray data set of the crimping fittings; x i represents the X-ray image of the i-th crimping fitting; y i represents the category label of the i-th crimped fitting X-ray image, where the crimped area is 1 and the uncrimped area is 0; l represents the downsampled feature map output by the lth convolutional layer; Relu represents the activation function; W l represents the weight of the lth convolutional layer; b l represents the bias of the lth convolutional layer; pool() represents the pooling layer function; g l represents the pooling layer output of the l-th convolutional layer; i represents the index value of the i-th crimping hardware X-ray image; N represents the total number of crimping hardware X-ray images; l represents the index value of the l-th convolutional layer; L represents the number of convolutional layers;
[0021] The decoder specifically performs upsampling, which is expressed by the formula:
[0022] u l =upsamle(g l );
[0023] k l =Relu(W l ·u l +b l );
[0024] p l =Concat(k l ,h l+1 );
[0025] u l+1 =upsamle(p l );
[0026] k l+1 =Relu(W l+1 ·u l+1 +b l+1 );
[0027] p l+1 =Concat(u l+1 ,h l );
[0028] Where upsample() represents the decoder upsampling function; u l represents the upsampled feature map of the lth convolutional layer; k l represents the upsampled feature map output by the lth convolutional layer; p l represents the connection feature map of the lth convolutional layer; Concat represents the connection function; Concat represents the connection function;
[0029] The prediction results obtained by the Unet semantic segmentation model are expressed as follows:
[0030]
[0031] In the formula, represents the predicted category label of the i-th crimping fitting X-ray image; p L represents the generated connected feature map of the Lth convolutional layer; W L represents the weight of the Lth convolutional layer; b L Represents the bias of the Lth convolutional layer;
[0032] In the process of training the crimping fittings X-ray recognition model using the training set, back propagation is performed based on the joint loss function Loss, which is expressed as follows:
[0033] Loss=Loss CE +Loss D ;
[0034] In the formula, Loss CE Represents the cross entropy loss function; Loss D Represents the Dice coefficient loss function;
[0035] The cross entropy loss function is expressed as follows:
[0036]
[0037] The Dice coefficient loss function is expressed as follows:
[0038]
[0039] In the formula, ε represents the preset smoothing term;
[0040] The weight gradient and bias are updated by calculating the joint loss function through back propagation, which can be expressed as:
[0041]
[0042] In the formula, η represents the learning rate; represents the weight gradient; represents the bias gradient.
[0043] Preferably, the denoising is to use the DBSCAN algorithm to remove noise in the recognition result, specifically:
[0044] Judging the recognition results The image type of each image in , where S represents a set of recognition results; the image types include core points, boundary points and noise points;
[0045] If the image x i The image type is the core point, then a new cluster is created; i As the base point, check the image x within the preset ε area j , where x j represents the jth crimping fitting X-ray image; if the image x j If it has not been visited and is a core point, it will be added to the new cluster and marked as visited; if the image x j If it is a boundary point but is not assigned to any cluster, it is added to the new cluster; until S is an empty set or no new images can be added to any cluster, the denoised recognition result set is obtained.
[0046] Preferably, the skeletonization is specifically to extract the skeleton of the crimping area of the aluminum tube and the stranded wire and the skeleton of the non-crimping area of the aluminum tube and the stranded wire using the Zhang-Suen algorithm, specifically:
[0047] The Zhang-Suen algorithm specifically uses the DBSCAN algorithm to binarize the images in the denoised recognition result set, which can be expressed as:
[0048]
[0049] S'={(x1',...,x i ',...,x' N )};
[0050] In the formula, x i '(a,b) represents the pixel value of the binary image, where a pixel value of 1 represents a foreground pixel and a pixel value of 0 represents a background pixel; x i(a, b) represents the pixel value of the X-ray image of the i-th crimping hardware; x i ' represents the i-th binary crimped fitting X-ray image; S' represents the set of binary crimped fitting X-ray images; T represents a preset fixed threshold; a represents the row index of the pixel value; b represents the column index of the pixel value; P represents the number of rows of the pixel value; Q represents the number of columns of the pixel value;
[0051] The binary processed crimping fittings X-ray image set is filled, and the formula is expressed as:
[0052] F = (S'⊕B)ΘB;
[0053] Where, F represents the set of X-ray images of the crimped fittings after filling; B represents the preset filling range; ⊕ represents the expansion operation; Θ represents the corrosion operation;
[0054] Iteratively retrieve foreground pixels in the filled crimping fitting X-ray image set; wherein the iteration includes a first iteration and a second iteration;
[0055] The first iteration step specifically includes: if the current foreground pixel meets the preset first iteration condition, then the pixel is deleted, specifically marking the current foreground pixel as a background pixel and assigning a value of 0;
[0056] The second iteration step specifically includes: if the current foreground pixel meets the preset second iteration condition, then the pixel is deleted, specifically marking the current foreground pixel as a background pixel and assigning a value of 0;
[0057] The first iteration and the second iteration are performed alternately until the preset termination condition is reached to obtain a skeletonized image, in which the foreground pixels are the skeleton positions and the background pixels are the positions other than the skeleton positions, and the skeletons of the crimped area and the uncrimped area are obtained.
[0058] Preferably, the pixel length of the shortest path between the skeleton of the crimped area and the skeleton of the non-crimped area is calculated to obtain the crimping ratio, specifically:
[0059] A convolution kernel is preset, and 2D convolution is used to extract features to generate a feature map; a feature value position whose feature value is greater than or equal to a preset endpoint threshold is selected from the feature map, and the feature value position is selected as the endpoint position; a skeleton path graph G = (V, E) is constructed according to the endpoint position, wherein the pixel points of the skeleton are the vertex set V, the connection relationship between adjacent vertices is the edge set E, and the weights between vertices are all 1; the endpoint position includes the path starting point and the path end point;
[0060] The Dijkstra algorithm is used to obtain the shortest paths of the skeleton of the crimped area and the skeleton of the uncrimped area. The pixel length of the shortest path corresponding to the skeleton is calculated as follows: If the movement mode of the pixel points on the shortest path is diagonal movement, the pixel length is Otherwise the pixel length is 1.
[0061] Preferably, the crimping ratio is obtained according to the pixel length, which is expressed as:
[0062]
[0063] In the formula, r represents the crimping ratio; s1 represents the pixel length corresponding to the crimping area; s2 represents the pixel length corresponding to the non-crimping area;
[0064] Whether there is a pressure leakage defect is determined based on the crimping ratio. Specifically, if the crimping ratio is less than a preset pressure leakage defect threshold, there is no pressure leakage defect; otherwise, there is a pressure leakage defect.
[0065] On the other hand, the present invention also proposes a crimping hardware leak defect detection system based on semantic segmentation, the system includes a data acquisition module, a recognition model building module, a post-processing module and a result output module, wherein:
[0066] The data acquisition module is used to acquire historical transmission line crimping fittings X-ray images, and preprocess the transmission line crimping fittings X-ray images; construct a crimping fittings X-ray data set based on the preprocessed transmission line crimping fittings X-ray images; and transmit the crimping fittings X-ray data set to the recognition model construction module;
[0067] The recognition model construction module is used to construct a crimped fittings X-ray recognition model, including an input layer, a Unet prediction layer and an output layer, wherein the Unet prediction layer is constructed based on the Unet semantic segmentation model; the crimped fittings X-ray recognition model is trained using the constructed crimped fittings X-ray data set to obtain a trained crimped fittings X-ray recognition model; an X-ray image of a power transmission line crimped fitting to be identified is obtained, and the X-ray image of the power transmission line crimped fittings is input into the trained crimped fittings X-ray recognition model to obtain a recognition result;
[0068] The post-processing module is used to post-process the recognition results, specifically to use the DBSCAN algorithm to denoise the recognition results and use the Zhang-suen algorithm to perform skeletonization; based on the post-processing results, the pixel lengths of the skeletons of the crimped and non-crimped areas are calculated, and the crimping ratio is obtained according to the pixel length calculation; according to the crimping ratio, the judgment result of the pressure leakage defect of the crimping hardware is obtained;
[0069] The result output module is used to display the pressure leakage defect of the crimping hardware.
[0070] On the other hand, the present invention further proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a method for detecting pressure leakage defects in crimping hardware based on semantic segmentation as described in any embodiment of the present invention is implemented.
[0071] On the other hand, the present invention further proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for detecting pressure leakage defects in crimping hardware based on semantic segmentation as described in any embodiment of the present invention.
[0072] Compared with the prior art, the present invention has the following beneficial effects:
[0073] 1) The present invention provides a method and system for detecting pressure leakage defects in crimping fittings based on semantic segmentation. By acquiring historical X-ray images of crimping fittings of power transmission lines and performing preprocessing, a crimping fitting X-ray data set is constructed, thereby improving the efficiency and accuracy of model training and improving the stability and reliability of the model.
[0074] 2) The present invention provides a method and system for detecting pressure leakage defects of crimping hardware based on semantic segmentation. The constructed crimping hardware X-ray recognition model adopts a prediction layer based on Unet, which enhances the generalization ability and adaptability of the model and improves the model's ability to capture complex image features;
[0075] 3) The present invention provides a method and system for detecting pressure leakage defects in crimping hardware based on semantic segmentation, which uses the DBSCAN algorithm for denoising and the improved Zhang-suen algorithm combined with morphology for skeletonization, further improving the precision and reliability of defect identification and improving the accuracy of identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 It is a method flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0077] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0078] The present invention provides the following technical solution: a method and system for detecting pressure leakage defects of crimping hardware based on semantic segmentation.
[0079] Example 1
[0080] See Figure 1 This embodiment provides a method for detecting pressure leakage defects of crimping fittings based on semantic segmentation, and the specific steps include:
[0081] S1. Acquire historical transmission line crimping fittings X-ray images, and preprocess the transmission line crimping fittings X-ray images; construct a crimping fittings X-ray dataset based on the preprocessed transmission line crimping fittings X-ray images;
[0082] S11, the preprocessing includes image category labeling and image enhancement;
[0083] The image category annotation is specifically to input the crimping fittings X-ray image into the annotation tool, select a polygonal box to mark the crimping area between the aluminum tube and the stranded wire and the non-crimping area between the aluminum tube and the stranded wire;
[0084] The image enhancement specifically includes randomly flipping the image with a preset proportional probability, adjusting the image size according to a preset target size range and a zoom ratio range; performing customized random cropping on the adjusted image to obtain an image-enhanced crimping hardware X-ray image;
[0085] In this embodiment, the proportional probability is 0.5, the target size range is (930, 564), and the scaling ratio range is (0.9, 1.1);
[0086] The customized random cropping is specifically to calculate the minimum circumscribed rectangle of all marked areas in the crimped fitting X-ray image, and randomly generate a rectangular cropping area on the crimped fitting X-ray image, wherein the cropping area completely contains the minimum circumscribed rectangle;
[0087] S2. Construct a crimping hardware X-ray recognition model, including an input layer, a Unet prediction layer and an output layer, wherein the Unet prediction layer is constructed based on a Unet semantic segmentation model; the Unet semantic segmentation model includes an encoder and a decoder, and the encoder and the decoder are connected via a jump connection;
[0088] S21, the encoder includes L convolutional layers for downsampling, which is expressed as:
[0089] D={(x1,y1),...,(x i ,y i ),...,(x N ,y N )}, i = 1, 2, ..., N;
[0090] h l =Relu(W l ·x i +bl ), l = 1, 2, ..., L;
[0091] g l =pool(h l );
[0092] h l+1 =Relu(W l+1 ·x i +b l+1 );
[0093] g l+1 =pool(h l+1 );
[0094] Where D represents the X-ray data set of the crimping fittings; x i represents the X-ray image of the i-th crimping fitting; y i represents the category label of the i-th crimped fitting X-ray image, where the crimped area is 1 and the uncrimped area is 0; l represents the downsampled feature map output by the lth convolutional layer; Relu represents the activation function; W l represents the weight of the lth convolutional layer; b l represents the bias of the lth convolutional layer; pool() represents the pooling layer function; g l represents the pooling layer output of the l-th convolutional layer; i represents the index value of the i-th crimping hardware X-ray image; N represents the total number of crimping hardware X-ray images; l represents the index value of the l-th convolutional layer; L represents the number of convolutional layers;
[0095] S22, the decoder specifically performs upsampling, which is expressed by the formula:
[0096] u l =upsamle(g l );
[0097] k l =Relu(W l ·u l +b l );
[0098] p l =Concat(k l ,h l+1 );
[0099] u l+1 =upsamle(p l );
[0100] k l+1 =Relu(W l+1 ·u l+1 +bl+1 );
[0101] p l+1 =Concat(u l+1 ,h l );
[0102] Where upsample() represents the decoder upsampling function; u l represents the upsampled feature map of the lth convolutional layer; k l represents the upsampled feature map output by the lth convolutional layer; p l represents the connection feature map of the lth convolutional layer; Concat represents the connection function; Concat represents the connection function;
[0103] S23. The prediction result obtained by the Unet semantic segmentation model is expressed as:
[0104]
[0105] In the formula, represents the predicted category label of the i-th crimping fitting X-ray image; p L represents the generated connected feature map of the Lth convolutional layer; W L represents the weight of the Lth convolutional layer; b L Represents the bias of the Lth convolutional layer;
[0106] S24. In the process of training the crimping fittings X-ray recognition model using the training set, back propagation is performed based on the joint loss function Loss, which is expressed as:
[0107] Loss=Loss CE +Loss D ;
[0108] In the formula, Loss CE Represents the cross entropy loss function; Loss D Represents the Dice coefficient loss function;
[0109] The cross entropy loss function is expressed as follows:
[0110]
[0111] The Dice coefficient loss function is expressed as follows:
[0112]
[0113] In the formula, ε represents the preset smoothing term;
[0114] S25. Update the weight gradient and bias by calculating the joint loss function through back propagation, which is expressed as:
[0115]
[0116] In the formula, η represents the learning rate; represents the weight gradient; represents the bias gradient;
[0117] S3, using the crimping fittings X-ray data set to train a crimping fittings X-ray recognition model to obtain a trained crimping fittings X-ray recognition model;
[0118] S4, obtaining an X-ray image of the power transmission line crimping fittings to be identified, inputting the X-ray image of the power transmission line crimping fittings into a trained crimping fittings X-ray identification model, and obtaining an identification result;
[0119] S5, post-processing the recognition result, specifically using the DBSCAN algorithm to denoise the recognition result and using the Zhang-suen algorithm to skeletonize the recognition result;
[0120] S51, the denoising specifically comprises removing noise in the recognition result by using the DBSCAN algorithm;
[0121] Judging the recognition results The image type of each image in , where S represents a set of recognition results; the image types include core points, boundary points and noise points;
[0122] The core point is specifically the image x i There are at least P points in the preset ε domain, where P represents the minimum number of images contained in a preset cluster;
[0123] The boundary points are specifically images within the ε area preset by the core points, except for the core points;
[0124] The noise points are specifically images other than core points and boundary points in the recognition result set;
[0125] If the image x i The image type is the core point, then a new cluster is created; i As the base point, check the image x within the preset ε area j , where x j represents the jth crimping fitting X-ray image; if the image x j If it has not been visited and is a core point, it will be added to the new cluster and marked as visited; if the image x jIf it is a boundary point but is not assigned to any cluster, it will be added to the new cluster; until S is an empty set or no new images can be added to any cluster, the denoised recognition result set is obtained;
[0126] In this embodiment, the ε domain is 3, and the minimum number of images P contained in a cluster is 5;
[0127] S52, the skeletonization specifically comprises extracting the skeleton of the crimping area of the aluminum tube and the stranded wire and the skeleton of the non-crimping area of the aluminum tube and the stranded wire by using the Zhang-suen algorithm;
[0128] S521, the Zhang-Suen algorithm specifically uses the DBSCAN algorithm to binarize the images in the denoised recognition result set, which is expressed as:
[0129]
[0130] S'={(x1',...,x i ',...,x' N )};
[0131] In the formula, x i '(a,b) represents the pixel value of the binary image, where a pixel value of 1 represents a foreground pixel and a pixel value of 0 represents a background pixel; x i (a, b) represents the pixel value of the X-ray image of the i-th crimping hardware; x i ' represents the i-th binary crimped fitting X-ray image; S' represents the set of binary crimped fitting X-ray images; T represents a preset fixed threshold; a represents the row index of the pixel value; b represents the column index of the pixel value; P represents the number of rows of the pixel value; Q represents the number of columns of the pixel value;
[0132] In this embodiment, the number of rows of pixel values is 930, and the number of columns of pixel values is 564;
[0133] S522, filling the set of crimping fitting X-ray images after binary processing, which is expressed as:
[0134]
[0135] Where, F represents the set of X-ray images of the crimped fittings after filling; B represents the preset filling range; represents the expansion operation; Θ represents the corrosion operation;
[0136] S523, iteratively searching foreground pixels in the filled crimping fitting X-ray image set; wherein the iteration includes a first iteration and a second iteration;
[0137] The first iteration step specifically includes: if the current foreground pixel meets the preset first iteration condition, then the pixel is deleted, specifically marking the current foreground pixel as a background pixel and assigning a value of 0;
[0138] The second iteration step specifically includes: if the current foreground pixel meets the preset second iteration condition, then the pixel is deleted, specifically marking the current foreground pixel as a background pixel and assigning a value of 0;
[0139] S524, alternately performing the first iteration and the second iteration until a preset termination condition is reached, and obtaining a skeletonized image, wherein the foreground pixels are the skeleton positions, and the background pixels are the positions other than the skeleton positions, and obtaining the skeleton of the crimped area and the skeleton of the non-crimped area;
[0140] S6. Calculate the pixel length of the skeleton of the crimped and uncrimped areas based on the result of post-processing, preset a convolution kernel, use 2D convolution to extract features, and generate a feature map; select a feature value position whose feature value is greater than or equal to a preset endpoint threshold from the feature map, and select the feature value position as the endpoint position; construct a skeleton path graph G=(V, E) according to the endpoint position, wherein the pixel points of the skeleton are the vertex set V, the connection relationship between adjacent vertices is the edge set E, and the weights between vertices are all 1; the endpoint position includes the path starting point and the path end point;
[0141] In this embodiment, the convolution kernel size is set to 3x3, which is expressed as The endpoint threshold is 11;
[0142] S7, using Dijkstra algorithm to obtain the shortest path of the skeleton of the crimped area and the skeleton of the uncrimped area; adding the vertices except the starting point of the path to the queue, and initializing the distance array and the predecessor vertex array;
[0143] Initialize the distance array. For all v∈V, if v=A, then dist[v]=0; if v≠A, then dist[v]=∞; where v represents a vertex in the vertex set V; A represents the starting point of the path; dist[v] represents the shortest path length from the starting point A to the vertex v;
[0144] Initialize the predecessor vertex array. For all v∈V, if v=A, then prev[v]=null; if v≠A, then prev[v]=-1; where prev[v] represents the predecessor vertex of the vth vertex; null represents a null value;
[0145] Select the vertex m with the smallest weight from the starting point of the path from the queue. For all adjacent node vertices z of vertex m, if the path length from vertex m to vertex k is less than dist[k], update the distance array and predecessor vertex array, which can be expressed as:
[0146] dist[k]=min(dist[m],dist[m]+ω mk );
[0147] prev[m]=A;
[0148] prev[k] = m;
[0149] In the formula, ω mk Represents the weight value between vertex m and vertex k; min represents the minimum function;
[0150] Until the queue is empty, get all the path lengths, select the path with the smallest path length as the shortest path length, backtrack according to the corresponding predecessor vertex array, and get the shortest path of the skeleton of the crimped area and the skeleton of the uncrimped area;
[0151] S8. Calculate the pixel length of the shortest path corresponding to the skeleton. Specifically, if the movement mode of the pixel points on the shortest path is diagonal movement, the pixel length is Otherwise the pixel length is 1;
[0152] S9, obtaining a crimping ratio according to the pixel length, which is expressed as:
[0153]
[0154] In the formula, r represents the crimping ratio; s1 represents the pixel length corresponding to the crimping area; s2 represents the pixel length corresponding to the non-crimping area;
[0155] S10. According to the crimping ratio, the judgment result of the pressure leakage defect of the crimping hardware is specifically: if the crimping ratio is less than a preset pressure leakage defect threshold, there is no pressure leakage defect; otherwise, there is a pressure leakage defect.
[0156] Example 2
[0157] This embodiment provides a crimping hardware underpressure defect detection system based on semantic segmentation, the system includes a data acquisition module, a recognition model building module, a post-processing module and a result output module, wherein:
[0158] The data acquisition module is used to acquire historical transmission line crimping fittings X-ray images, and preprocess the transmission line crimping fittings X-ray images; construct a crimping fittings X-ray data set based on the preprocessed transmission line crimping fittings X-ray images; and transmit the crimping fittings X-ray data set to the recognition model construction module;
[0159] The recognition model construction module is used to construct a crimped fittings X-ray recognition model, including an input layer, a Unet prediction layer and an output layer, wherein the Unet prediction layer is constructed based on the Unet semantic segmentation model; the crimped fittings X-ray recognition model is trained using the constructed crimped fittings X-ray data set to obtain a trained crimped fittings X-ray recognition model; an X-ray image of a power transmission line crimped fitting to be identified is obtained, and the X-ray image of the power transmission line crimped fittings is input into the trained crimped fittings X-ray recognition model to obtain a recognition result;
[0160] The post-processing module is used to post-process the recognition results, specifically to use the DBSCAN algorithm to denoise the recognition results and use the Zhang-suen algorithm to perform skeletonization; based on the post-processing results, the pixel lengths of the skeletons of the crimped and non-crimped areas are calculated, and the crimping ratio is obtained according to the pixel length calculation; according to the crimping ratio, the judgment result of the pressure leakage defect of the crimping hardware is obtained;
[0161] The result output module is used to display the pressure leakage defect of the crimping hardware.
[0162] Example 3
[0163] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a method for detecting pressure leakage defects in crimping hardware based on semantic segmentation as described in any embodiment of the present invention is implemented.
[0164] Example 4
[0165] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, a method for detecting pressure leakage defects of crimping fittings based on semantic segmentation as described in any embodiment of the present invention is implemented.
[0166] It is worth noting that the system, electronic device and computer-readable storage medium described in the present invention are based on the same principles as the method described in Example 1, and will not be described in detail here.
[0167] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting pressure leakage defects of crimping fittings based on semantic segmentation, characterized in that: The method comprises: Acquire historical transmission line crimping fittings X-ray images, and preprocess the transmission line crimping fittings X-ray images; construct a crimping fittings X-ray dataset based on the preprocessed transmission line crimping fittings X-ray images; Construct a crimped fittings X-ray recognition model, including an input layer, a Unet prediction layer and an output layer, wherein the Unet prediction layer is constructed based on the Unet semantic segmentation model; use the crimped fittings X-ray data set to train the crimped fittings X-ray recognition model to obtain a trained crimped fittings X-ray recognition model; obtain an X-ray image of the power transmission line crimped fittings to be identified, input the X-ray image of the power transmission line crimped fittings into the trained crimped fittings X-ray recognition model to obtain a recognition result; The recognition results are post-processed, specifically using the DBSCAN algorithm to denoise the recognition results and using the Zhang-suen algorithm to skeletonize; based on the post-processing results, the pixel lengths of the skeletons of the crimped and non-crimped areas are calculated, and the crimping ratio is obtained according to the pixel length calculation; according to the crimping ratio, the judgment result of the pressure leakage defect of the crimping hardware is obtained.
2. According to the method for detecting pressure leakage defects of crimping fittings based on semantic segmentation in claim 1, it is characterized in that: The preprocessing includes image category annotation and image enhancement, specifically: The image category annotation is specifically to input the crimping fittings X-ray image into the annotation tool, select a polygonal box to mark the crimping area between the aluminum tube and the stranded wire and the non-crimping area between the aluminum tube and the stranded wire; The image enhancement specifically includes randomly flipping the image with a preset proportional probability, adjusting the image size according to a preset target size range and a zoom ratio range; and performing customized random cropping on the adjusted image to obtain an image-enhanced crimping hardware X-ray image.
3. According to the method for detecting pressure leakage defects of crimping fittings based on semantic segmentation in claim 1, it is characterized in that: The Unet semantic segmentation model includes an encoder and a decoder, and the encoder and the decoder are connected via a jump connection; the encoder includes L convolutional layers for downsampling, which can be expressed as: D={(x1,y1),...,(x i ,y i ),...,(x N ,y N )},i=1,2,...,N; h l =Relu(W l x i +b l ),l=1,2,...,L; g l =pool(h l ); h l+1 =Relu(W l+1 ·x i +b l+1 ); g l+1 =pool(h l+1 ); Where D represents the X-ray dataset of the crimping fittings; x i represents the X-ray image of the i-th crimping fitting; y i represents the category label of the i-th crimped fitting X-ray image, where the crimped area is 1 and the uncrimped area is 0; h l represents the downsampled feature map output by the lth convolutional layer; Relu represents the activation function; W l represents the weight of the lth convolutional layer; b l represents the bias of the lth convolutional layer; pool() represents the pooling layer function; g l represents the pooling layer output of the l-th convolutional layer; i represents the index value of the i-th crimping hardware X-ray image; N represents the total number of crimping hardware X-ray images; l represents the index value of the l-th convolutional layer; L represents the number of convolutional layers; The decoder specifically performs upsampling, which is expressed by the formula: u l =upsamle(g l ); our l =Railway(W l ·her l +b l ): p l =Concat(k l ,h l+1 ); in l+1 =upasamle(p l ); our l+1 =Railway(W l+1 ·her l+1 +b l+1 ): p l+1 =Concat(u l+1 ,h l ); Where upsample() represents the decoder upsampling function; u l represents the upsampled feature map of the lth convolutional layer; k l represents the upsampled feature map output by the lth convolutional layer; p l Represents the connection feature map of the lth convolutional layer; Concat represents the connection function; The prediction results obtained by the Unet semantic segmentation model are expressed as follows: In the formula, represents the predicted category label of the i-th crimping fitting X-ray image; p L represents the generated connected feature map of the Lth convolutional layer; W L represents the weight of the Lth convolutional layer; b L Represents the bias of the Lth convolutional layer; In the process of training the crimping fittings X-ray recognition model using the training set, back propagation is performed based on the joint loss function Loss, which is expressed as follows: Loss=Loss CE +Loss D ; In the formula, Loss CE Represents the cross entropy loss function; Loss D Represents the Dice coefficient loss function; The cross entropy loss function is expressed as follows: The Dice coefficient loss function is expressed as follows: In the formula, ε represents the preset smoothing term; The weight gradient and bias are updated by calculating the joint loss function through back propagation, which can be expressed as: In the formula, η represents the learning rate; represents the weight gradient; represents the bias gradient.
4. According to the method for detecting pressure leakage defects of crimping fittings based on image recognition according to claim 1, it is characterized in that: The denoising specifically uses the DBSCAN algorithm to remove noise in the recognition result, specifically: Judging the recognition results The image type of each image in , where S represents a set of recognition results; the image types include core points, boundary points and noise points; If the image x i The image type is the core point, then a new cluster is created; i As the base point, check the image x within the preset ε area j , where x j represents the jth crimping fitting X-ray image; if the image x j If it has not been visited and is a core point, it will be added to the new cluster and marked as visited; if the image x j If it is a boundary point but is not assigned to any cluster, it is added to the new cluster; until S is an empty set or no new images can be added to any cluster, the denoised recognition result set is obtained.
5. According to the method for detecting pressure leakage defects of crimping fittings based on semantic segmentation in claim 1, it is characterized in that: The skeletonization specifically uses the Zhang-Suen algorithm to extract the skeleton of the crimping area of the aluminum tube and the stranded wire and the skeleton of the non-crimping area of the aluminum tube and the stranded wire, specifically: The Zhang-Suen algorithm specifically uses the DBSCAN algorithm to binarize the images in the denoised recognition result set, which can be expressed as: S'={(x1',...,x i ',...,x' N )}; In the formula, x i '(a,b) represents the pixel value of the binary image, where a pixel value of 1 represents a foreground pixel and a pixel value of 0 represents a background pixel; x i (a, b) represents the pixel value of the X-ray image of the i-th crimping hardware; x i ' represents the i-th binary crimped fitting X-ray image; S' represents the set of binary crimped fitting X-ray images; T represents a preset fixed threshold; a represents the row index of the pixel value; b represents the column index of the pixel value; P represents the number of rows of the pixel value; Q represents the number of columns of the pixel value; The binary processed crimping fittings X-ray image set is filled, and the formula is expressed as: F = (S'⊕B)ΘB; Where, F represents the set of X-ray images of the crimped fittings after filling; B represents the preset filling range; ⊕ represents the expansion operation; Θ represents the corrosion operation; Iteratively retrieve foreground pixels in the filled crimping fitting X-ray image set; The iteration includes the first step iteration and the second step iteration; The first iteration step specifically includes: if the current foreground pixel meets the preset first iteration condition, then the pixel is deleted, specifically marking the current foreground pixel as a background pixel and assigning a value of 0; The second iteration step specifically includes: if the current foreground pixel meets the preset second iteration condition, then the pixel is deleted, specifically marking the current foreground pixel as a background pixel and assigning a value of 0; The first iteration and the second iteration are performed alternately until the preset termination condition is reached to obtain a skeletonized image, in which the foreground pixels are the skeleton positions and the background pixels are the positions other than the skeleton positions, and the skeletons of the crimped area and the uncrimped area are obtained.
6. The method for detecting pressure leakage defects of crimping fittings based on semantic segmentation according to claim 5 is characterized in that: The pixel length of the shortest path between the skeleton of the crimped area and the skeleton of the non-crimped area is calculated to obtain the crimping ratio, which is: A convolution kernel is preset, and 2D convolution is used to extract features to generate a feature map; a feature value position whose feature value is greater than or equal to a preset endpoint threshold is selected from the feature map, and the feature value position is selected as the endpoint position; a skeleton path graph G = (V, E) is constructed according to the endpoint position, wherein the pixel points of the skeleton are the vertex set V, the connection relationship between adjacent vertices is the edge set E, and the weights between vertices are all 1; the endpoint position includes the path starting point and the path end point; The Dijkstra algorithm is used to obtain the shortest paths of the skeleton of the crimped area and the skeleton of the uncrimped area. The pixel length of the shortest path corresponding to the skeleton is calculated as follows: If the movement mode of the pixel points on the shortest path is diagonal movement, the pixel length is Otherwise the pixel length is 1.
7. The method for detecting pressure leakage defects of crimping fittings based on semantic segmentation according to claim 6 is characterized in that: The crimping ratio is obtained according to the pixel length and is expressed as: In the formula, r represents the crimping ratio; s1 represents the pixel length corresponding to the crimping area; s2 represents the pixel length corresponding to the non-crimping area; Whether there is a pressure leakage defect is determined based on the crimping ratio. Specifically, if the crimping ratio is less than a preset pressure leakage defect threshold, there is no pressure leakage defect; otherwise, there is a pressure leakage defect.
8. A crimping hardware leak defect detection system based on semantic segmentation, characterized in that: The system includes a data acquisition module, a recognition model building module, a post-processing module and a result output module, wherein: The data acquisition module is used to acquire historical transmission line crimping fittings X-ray images, and preprocess the transmission line crimping fittings X-ray images; construct a crimping fittings X-ray data set based on the preprocessed transmission line crimping fittings X-ray images; and transmit the crimping fittings X-ray data set to the recognition model construction module; The recognition model construction module is used to construct a crimped fittings X-ray recognition model, including an input layer, a Unet prediction layer and an output layer, wherein the Unet prediction layer is constructed based on the Unet semantic segmentation model; the crimped fittings X-ray recognition model is trained using the constructed crimped fittings X-ray data set to obtain a trained crimped fittings X-ray recognition model; an X-ray image of a power transmission line crimped fitting to be identified is obtained, and the X-ray image of the power transmission line crimped fittings is input into the trained crimped fittings X-ray recognition model to obtain a recognition result; The post-processing module is used to post-process the recognition results, specifically to use the DBSCAN algorithm to denoise the recognition results and use the Zhang-suen algorithm to perform skeletonization; based on the post-processing results, the pixel lengths of the skeletons of the crimped and non-crimped areas are calculated, and the crimping ratio is obtained according to the pixel length calculation; according to the crimping ratio, the judgment result of the pressure leakage defect of the crimping hardware is obtained; The result output module is used to display the pressure leakage defect of the crimping hardware.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method for detecting pressure leakage defects of crimping fittings based on semantic segmentation is implemented as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a method for detecting pressure leakage defects of crimping fittings based on semantic segmentation is implemented as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Defect detection method and device for crimping fitting of power transmission line based on deep learning
CN118037643A
Cited By
Intelligent detection system and detection method for cornua cervi pantotrichum wax sheet proportion
CN121280314A
A smart detection system and method for proportion of pilose antler wax tablets
CN121280314B
X-ray nondestructive testing method for crimping quality of strain clamp of power transmission line
CN122084658A