Diffusion model-based target detection method, device and system for crimping and voltage leakage defects of power transmission line hardware fitting, and medium
By training images of transmission line fitting crimp defects using a diffusion model for noise addition and denoising, and combining ResNet-18 and DifNet models, the problems of training data dependence and insufficient generalization ability of deep learning models in transmission line fitting crimp defect detection are solved, achieving high accuracy and robust defect detection.
Patent Information
- Application Number
- CN202511536997.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-27
AI Technical Summary
Existing deep learning models for detecting crimping defects in power transmission line fittings suffer from high training data costs, large annotation errors, limited generalization ability, and false positives and false negatives, making it difficult to guarantee the accuracy and consistency of detection.
A diffusion model-based approach is adopted, which generates an image sequence with gradually increasing noise by adding and removing noise from the original defect images. The diffusion model is trained using the Unet network model, and the defect region is labeled and detected by combining ResNet-18 and DifNet models, thereby improving the robustness and adaptability of the model.
It significantly improved the accuracy and robustness of defect identification, achieving an accuracy of 98% and an AP50 index of 92.34%, and enhanced the model's detection capabilities in complex backgrounds and with multiple types of defects.
Smart Images

Figure CN121582142A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of identifying quality defects in crimping of transmission line fittings, specifically a method, device, system, and medium for detecting leakage defects in crimping of transmission line fittings based on a diffusion model. Background Technology
[0002] The crimping quality of tension clamps and splicing pipes in transmission lines is crucial to line safety. Numerous line breaks have occurred nationwide due to poor crimping quality. Once the process is out of control, problems such as crimping position deviations are difficult to detect, thus jeopardizing line safety. Therefore, it is essential to identify defects in the crimping quality of transmission line hardware before a fault occurs. This will reduce or even eliminate line safety problems caused by poor crimping quality, and improving the safety and stability of the lines has significant social implications.
[0003] Currently, the technology for identifying quality defects in crimping of transmission line fittings mainly relies on X-ray inspection methods. X-ray technology, because it can penetrate metal materials and generate clear images of their internal structures, can effectively detect all types of crimping defects, such as cracks, porosity, and inclusions. In recent years, with the increasing demands for safety and reliability in power systems, large power companies such as the State Grid and China Southern Power Grid have widely adopted visualization inspection technology based on X-ray data imaging. This technology not only provides high-resolution images but also enables precise analysis and location of defects through digital processing.
[0004] However, despite the significant advantages of X-ray technology in defect detection, subsequent image analysis and defect assessment still largely rely on manual operation. This manual assessment process is not only time-consuming but also susceptible to subjective influences, making it difficult to guarantee the accuracy and consistency of the results. To overcome this problem, recent research has begun to explore the introduction of deep learning technology to automate the processing of X-ray images and defect assessment by constructing intelligent image recognition models. For example, defect recognition systems based on the YOLO-Nano target detection model have been applied in practical inspections. The YOLO-Nano model, with its lightweight and efficient characteristics, can significantly reduce computational resource consumption while maintaining high detection accuracy, making it suitable for real-time inspection scenarios.
[0005] Despite this, existing deep learning models still face several technical bottlenecks in practical applications. First, model training relies heavily on labeled data, but acquiring high-quality labeled data is costly, and the labeling process itself can introduce errors. Second, deep learning models may exhibit false positives or false negatives when faced with complex backgrounds or multiple types of defects, especially when defect morphology is diverse or image quality is poor. Furthermore, the models have limited generalization ability, making it difficult to adapt to detection requirements in different environments and on different devices. Therefore, further improving the robustness and adaptability of deep learning models remains an important direction for current research. Summary of the Invention
[0006] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a method, device, system, and medium for detecting leakage defects in transmission line fittings based on a diffusion model. This method fully utilizes the characteristics of the defect area and considers the amount of data and the accuracy of target detection, thereby significantly improving the accuracy and robustness of defect identification.
[0007] A method for detecting leakage voltage defects in transmission line fittings based on a diffusion model includes the following steps:
[0008] Obtain and classify original defect images: Obtain images of transmission line hardware crimping from the inspection report and classify them into images with and without leakage defects;
[0009] Noise addition during diffusion process: Noise is added to the classified images with and without leakage defects to generate an image sequence with gradually increasing noise until the images are completely converted into noisy images;
[0010] Reverse process denoising and model training: Based on the generated noisy image, the noise is predicted and denoised using the Unet network model. The loss function between the predicted noise and the original noise is calculated, and the model parameters are adjusted to train the diffusion model.
[0011] Generate new defect images: Use a trained diffusion model to generate new defect images from random noise in reverse;
[0012] Construct a defect model training set and train a defect recognition model: LabelImg is used to annotate the defect regions of the original defect image, the defect image and the generated defect image, generating a VOC format annotation file, and converting it into a COCO format dataset to obtain a defect model training set. The DifNet defect recognition model is then trained using the constructed defect model training set.
[0013] Image preprocessing and classification: The images to be detected are normalized and input into the ResNet-18 model, which outputs defective and defect-free images;
[0014] Defect region detection: For defective images, several initial defect coordinates are randomly generated and input into the DifNet defect recognition model. The model predicts noise and restores the real defect coordinates by noise reduction. Coordinates with confidence > 0.5 are selected as defect region annotation results.
[0015] Furthermore, the noise addition during the diffusion process specifically includes:
[0016] During the diffusion process, noise is gradually added to transform the original image into a simple noise distribution. This process can be viewed as a Markov chain, where a small amount of noise is added to the data at each step, eventually causing the data to completely lose its original features and become pure noise. The formula is as follows:
[0017] ;
[0018] ...;
[0019] ;
[0020] in, This represents the generated noisy image. It is an activation function. It is randomly generated Gaussian noise. It is a gradually decreasing diffusion coefficient. This is the original image.
[0021] Furthermore, the reverse denoising process specifically includes:
[0022] During the reverse process, the model gradually recovers the original data state from a noisy state. The reverse process is also a Markov chain, where each step removes a portion of the noise, ultimately generating high-quality data samples. The formula is as follows:
[0023]
[0024] The Unet network is a model used to predict noise, and `classify` indicates whether the original image has defects, based on the noise data. Inverse generation of noise data ;
[0025] After predicting the noise using a model, the noise is removed from the image to obtain the denoised image. The formula is expressed as follows:
[0026] ;
[0027] ...;
[0028] ;
[0029] in This refers to noise data generated during the diffusion process. The noise data predicted by the model. This is consistent with the meaning in the diffusion process.
[0030] Furthermore, the loss function between the predicted noise and the original noise is:
[0031] ;
[0032] in Noise generated during the diffusion process, This is the noise predicted for the reverse process.
[0033] A target detection device for leakage faults in transmission line fittings based on a diffusion model, comprising:
[0034] The module for acquiring and classifying original defect images is used to obtain images of transmission line fittings crimping from the inspection report and classify them into images with and without leakage defects.
[0035] The diffusion process noise-adding module is used to add noise to the classified images with and without leakage pressure defects, generating an image sequence with gradually increasing noise until the images are completely converted into noisy images.
[0036] The reverse process denoising and model training module is used to predict and denoise noise based on the generated noisy image using the Unet network model, calculate the loss function between the predicted noise and the original noise, and adjust the model parameters to train the diffusion model.
[0037] The module for generating new defect images is used to generate new defect images from random noise using a trained diffusion model.
[0038] A defect model training set is constructed and a defect recognition model module is trained. This module uses the LabelImg tool to annotate the defect regions of the original defect image, the defect image, and the generated defect image, generating a VOC format annotation file and converting it into a COCO format dataset to obtain the defect model training set. The constructed defect model training set is then used to train the DifNet defect recognition model.
[0039] The image preprocessing and classification module is used to normalize the images to be detected, input them into the ResNet-18 model, and output defective and defect-free images.
[0040] The defect region detection module is used to randomly generate several initial defect coordinates for defective images, input them into the DifNet defect recognition model, predict noise and denoise to restore the real defect coordinates, and select coordinates with confidence > 0.5 as the defect region annotation results.
[0041] Furthermore, the noise addition during the diffusion process specifically includes:
[0042] During the diffusion process, noise is gradually added to transform the original image into a simple noise distribution. This process can be viewed as a Markov chain, where a small amount of noise is added to the data at each step, eventually causing the data to completely lose its original features and become pure noise. The formula is as follows:
[0043] ;
[0044] ...;
[0045] ;
[0046] in, This represents the generated noisy image. It is an activation function. It is randomly generated Gaussian noise. It is a gradually decreasing diffusion coefficient. This is the original image.
[0047] Furthermore, the noise addition during the diffusion process specifically includes: the noise reduction during the reverse process specifically includes:
[0048] During the reverse process, the model gradually recovers the original data state from a noisy state. The reverse process is also a Markov chain, where each step removes a portion of the noise, ultimately generating high-quality data samples. The formula is as follows:
[0049]
[0050] The Unet network is a model used to predict noise, and `classify` indicates whether the original image has defects, based on the noise data. Inverse generation of noise data ;
[0051] After predicting the noise using a model, the noise is removed from the image to obtain the denoised image. The formula is expressed as follows:
[0052] ;
[0053] ...;
[0054] ;
[0055] in This refers to noise data generated during the diffusion process. The noise data predicted by the model. This is consistent with the meaning in the diffusion process.
[0056] Furthermore, the loss function between the predicted noise and the original noise is:
[0057] ;
[0058] in Noise generated during the diffusion process, This is the noise predicted for the reverse process.
[0059] A target detection system for leakage faults in transmission line fittings based on a diffusion model, characterized in that it includes: a computer-readable storage medium and a processor;
[0060] The computer-readable storage medium is used to store executable instructions;
[0061] The processor is used to read executable instructions stored in the computer-readable storage medium and execute the diffusion model-based method for detecting leakage defects in transmission line fittings.
[0062] A non-transitory computer-readable storage medium is characterized in that it stores a computer program thereon, which, when executed by a processor, implements the aforementioned diffusion model-based method for detecting leakage defects in transmission line fittings.
[0063] Overall, compared with existing technologies, the technical solutions conceived in this invention fully utilize the characteristics of defective regions and consider the expansion of datasets, greatly improving the accuracy and robustness of defective region identification, specifically in the following aspects:
[0064] (1) Considering that the number of images of transmission line fitting crimping defects is insufficient to train the target detection model, this invention makes full use of the diffusion model to expand the defect images in the dataset.
[0065] (2) The present invention uses the ResNet-18 model to classify the images to be detected and uses the DifNet model to annotate the defect regions, achieving an accuracy of 98% and an AP50 index of 92.34%, respectively. Attached Figure Description
[0066] Figure 1 This is a schematic diagram of the diffusion model training in an embodiment of the present invention;
[0067] Figure 2 This is a schematic diagram of the structure of the ResNet18 model according to an embodiment of the present invention;
[0068] Figure 3 This is a schematic diagram of the training of the DifNet model according to an embodiment of the present invention;
[0069] Figure 4This is a flowchart illustrating how the present invention uses the ResNet-18 model and the DifNet model to detect images.
[0070] Figure 5 This is a flowchart of a method for detecting leakage defects in transmission line fittings based on a diffusion model, according to an embodiment of the present invention. Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0072] The first aspect of this invention provides a method for detecting leakage defects in transmission line fittings based on a diffusion model. First, an original defect image is acquired. Then, a diffusion model is trained through two steps: adding noise and removing noise. Next, a new defect image is generated using the trained diffusion model. The generated defect image and the original image are labeled and used to train a ResNet-18 model and a DifNet defect recognition model. The specific steps are described below (e.g., ...). Figure 5 (as shown)
[0073] Step 1: Obtain and classify original defect images: Obtain images of transmission line fittings crimped from the inspection report and classify them into images with and without leakage defects; specifically, obtain images of transmission line fittings crimped in real-world scenarios (i.e., original images), classify the images according to whether they have or do not have leakage defects, and mark them accordingly.
[0074] Step 2: Gradually add noise to the original image to generate a sequence of images with gradually increasing noise, until the image is completely transformed into a noisy image.
[0075] like Figure 1 As shown, during the diffusion process, noise is gradually added to transform the original image into a simple noise distribution (such as a Gaussian distribution). This process can be viewed as a Markov chain, where a small amount of noise is added to the data at each step, eventually causing the data to completely lose its original features and become pure noise. The formula is expressed as follows:
[0076]
[0077] ...
[0078]
[0079] in, This represents the generated noisy image. It is an activation function (usually tanh or sigmoid). It is randomly generated Gaussian noise. It is a gradually decreasing diffusion coefficient. This is the original image.
[0080] Step 3: Denoise the noisy image sequence obtained during the diffusion process in the reverse process to restore the original image. That is, from the noisy data... Gradually recover the original data .
[0081] During the reverse engineering process, the model gradually recovers the original data state from a noisy state. The reverse engineering process is also a Markov chain, where each step attempts to remove some noise, ultimately generating high-quality data samples. Its formula is as follows:
[0082]
[0083] The Unet network is used to predict noise, and `classify` indicates whether the original image has defects. Thus, from the noisy data... The reverse generation of noise data .
[0084] Meanwhile, to improve model performance, 10% of the class data will be randomly discarded during the reverse engineering process. The sampling formula at this time is as follows:
[0085]
[0086] After predicting the noise using a model, removing the noise from the image yields the denoised image, expressed by the following formula:
[0087]
[0088] ...
[0089]
[0090] in This refers to noise data generated during the diffusion process. The noise data predicted by the model. This aligns with the meaning in the diffusion process. This yields a denoised sequence that restores the original data from the noise.
[0091] In the reverse process, the Unet network model is used for noise prediction. Initially, it is close to random prediction, so its effect is not good. This invention calculates the loss function by comparing the predicted noise with the original noise and adjusts the model parameters.
[0092] The key to training the model lies in determining the loss function. The main task of the diffusion model is to recover the original data from the noisy data. Therefore, the commonly used loss function is the mean squared error between the two, and its calculation formula is as follows:
[0093]
[0094] in, This is noise data generated during the diffusion process in step one. It is the noise data predicted during the reverse process of step two.
[0095] Step 4: After training the diffusion model with real data, use the diffusion model again to generate new defect images from random noise.
[0096] This process is similar to the previous reverse process, but at this point, the initial noise data of this invention... It is not obtained during the diffusion process, but is generated randomly, and its formula is expressed as follows:
[0097]
[0098] ...
[0099]
[0100] in This represents randomly generated noise data; the other symbols have the same meaning as above.
[0101] Step 5: Manually annotate the defect areas in the original defect image from Step 1 and the new defect image generated in Step 4 using the LabelImg annotation tool.
[0102] This invention annotates defect images for subsequent training of the defect detection model. The annotated images come from two sources: approximately 200 X-ray images of transmission line fittings collected in real-world scenarios, and 1000 images generated using a diffusion model. All images are in PNG format.
[0103] The goal of data annotation is to label the bounding boxes of defects in the image, specifically including: 1. The rectangular bounding box of each defect. 2. Labeling each defect with '1' to indicate that it is defective.
[0104] The LabelImg tool is used to annotate bounding boxes. After the data is annotated, a VOC format record file is generated, which is then converted into a COCO format file.
[0105] Step 6: Normalize the images to be detected, input them into the ResNet-18 model, and output defective and defect-free images.
[0106] For the image to be detected, this invention first uses the ResNet-18 model to determine whether the image has defects. ResNet (Residual Network) is one of the commonly used deep neural network architectures, and its residual learning framework makes it possible to train very deep networks. In particular, the ResNet-18 model, with its 18-layer network structure, maintains high accuracy while also having a fast computation speed.
[0107] The training and test sets of the ResNet-18 model consist of X-ray images of power transmission line fittings collected from real-world scenes. The training set contains 122 defective images and 518 normal images; the test set contains 22 defective images and 98 normal images; and the validation set contains 31 defective images and 129 normal images.
[0108] Step 7: For defective images, randomly generate 100 initial defect coordinates and input them into the DifNet defect recognition model. By predicting noise and denoising to restore the real defect coordinates, select coordinates with confidence > 0.5 as the defect area annotation results.
[0109] This invention implements a method for classifying images of transmission line fitting crimping based on the ResNet-18 model. The model training process includes steps 1.1 and 1.2. Figure 2 This is a schematic diagram of the ResNet-18 model structure.
[0110] Step 1.1: Perform image scaling, data augmentation, and data normalization.
[0111] Before inputting image data into the network, some preprocessing is required to achieve better training results. First, the image is scaled to 160*160 pixels. Then, random rotation, flipping, and cropping operations are used to enhance the diversity of training data and improve the generalization ability of the model. Finally, the pixel values of the image are normalized to the range of [0, 1] to facilitate subsequent model training.
[0112] Step 1.2: Calculate the loss function based on the difference between the image labels predicted by the model and the correct labels, and adjust the model parameters accordingly.
[0113] The processed image data is forward-propagated through a ResNet-18 model to extract high-level features. The output feature map of the ResNet-18 model is then mapped to specific categories through fully connected layers. Finally, the softmax function is used to transform the network output into probability distributions for each category, thereby determining the final category of the image.
[0114]
[0115] Where X is the image data processed in step 1.1, This represents the model's prediction results.
[0116] Then, the loss is calculated using the cross-entropy loss function, and the model parameters are adjusted:
[0117]
[0118] in The true label for the i-th image. The labels predicted by the ResNet-18 model.
[0119] The ResNet model in this invention achieves 98% accuracy on the test set for image classification tasks (number of correct predictions out of defect-free images / number of defect-free predictions).
[0120] After determining that an image has a defect, DifNet is used to detect the defect region. The training set consists of X-ray images of power transmission line fittings collected from real scenes and defect images generated using the diffusion model. The training set contains 1175 defect images; the test set contains 19 defect images; and the validation set contains 19 defect images.
[0121] like Figure 3 As shown, the training process of the DifNet model of the present invention includes steps 2.1 to 2.3.
[0122] Step 2.1: For each labeled defect image, the present invention first adds noise to the defect coordinates to generate a noise coordinate sequence.
[0123] Since different images have different numbers of defects, the corresponding number of defect coordinates also varies. Therefore, during the diffusion process, this invention needs to expand the defect coordinates of each image to 100 (far greater than the theoretical number of defects per image). The expanded coordinate data is generated using a random function.
[0124] During the forward pass, noise is continuously added to the defect coordinates until they become completely noise, generating a series of noisy coordinates in the process. , , ,……, , The formula for the diffusion process is as follows:
[0125]
[0126] ...
[0127]
[0128] in, This indicates the generated noisy coordinates. It is an activation function (usually tanh or sigmoid). It's Gaussian noise. It is a gradually decreasing diffusion coefficient. These are the original coordinates.
[0129] Step 2.2: For the noisy coordinate sequence obtained in Step 2.1, use the DifNet model to predict the noise, progressively denoise, and reconstruct the correct coordinates. The formula is as follows:
[0130]
[0131] Here, DifNet is a model used to predict noise, and image represents the defect image data corresponding to the defect coordinates.
[0132] After predicting the noise using the model, removing the noise from the coordinates yields the denoised coordinates, expressed by the following formula:
[0133]
[0134] ...
[0135]
[0136] in This refers to noise data generated during the diffusion process. The noise data predicted by the model. This aligns with the meaning during the diffusion process. Thus, this invention obtains a denoised coordinate sequence for recovering the original data from noise.
[0137] Step 2.3: In the reverse process, this invention uses the DifNet network model for noise prediction. Initially, it is close to random prediction, so its effect is not good. This invention calculates the loss function by comparing the predicted noise with the original noise and adjusts the model parameters.
[0138] Model training is used to adjust the parameters of the DifNet model to achieve better reconstruction results. The key to training the model lies in determining the loss function. The main task of the diffusion model is to recover the original data from the noisy data; therefore, the commonly used loss function is the mean squared error between the two, and its calculation formula is as follows:
[0139]
[0140] in, This is noise data generated during the diffusion process in step one. It is the noise data predicted during the reverse process of step two.
[0141] The DifNet model in this invention achieves an AP50 index (average accuracy when the cross-union ratio is greater than 50%) and an AP index (mean AP index from 50% to 95%) on the test set for defect detection tasks. Furthermore, when the training set is reduced to 500 images, the trained model achieves an AP50 index of 93% and an AP index of 45.5% on the test set. This demonstrates that using images from the diffusion model can improve the model's accuracy at high cross-union ratios.
[0142] like Figure 4 As shown below, the process of using the ResNet-18 model and DifNet to detect images is described, including steps 3.1 and 3.2.
[0143] Step 3.1: After normalizing the image (same as step 1 in the ResNet-18 model training instructions), use the ResNet-18 model to predict its category.
[0144] Step 3.2: For images predicted as defective, randomly generate 100 defect coordinates and use DifNet to denoise them until the true defect coordinates are restored. Select images with a confidence score greater than 0.5, label and count them.
[0145] The process uses a defect detection dataset for testing, where the classification model has 99% accuracy on the test set. Since the dataset is consistent, DifNet's performance is consistent with previous results.
[0146] Another aspect of the present invention provides a target detection device for leakage faults in transmission line fittings based on a diffusion model, comprising:
[0147] The module for acquiring and classifying original defect images is used to obtain images of transmission line fittings crimping from the inspection report and classify them into images with and without leakage defects.
[0148] The diffusion process noise-adding module is used to add noise to the classified images with and without leakage pressure defects, generating an image sequence with gradually increasing noise until the images are completely converted into noisy images.
[0149] The reverse process denoising and model training module is used to predict and denoise noise based on the generated noisy image using the Unet network model, calculate the loss function between the predicted noise and the original noise, and adjust the model parameters to train the diffusion model.
[0150] The module for generating new defect images is used to generate new defect images from random noise using a trained diffusion model.
[0151] A defect model training set is constructed and a defect recognition model module is trained. This module uses the LabelImg tool to annotate the defect regions of the original defect image, the defect image, and the generated defect image, generating a VOC format annotation file and converting it into a COCO format dataset to obtain the defect model training set. The constructed defect model training set is then used to train the DifNet defect recognition model.
[0152] The image preprocessing and classification module is used to normalize the images to be detected, input them into the ResNet-18 model, and output defective and defect-free images.
[0153] The defect region detection module is used to randomly generate several initial defect coordinates for defective images, input them into the DifNet defect recognition model, predict noise and denoise to restore the real defect coordinates, and select coordinates with confidence > 0.5 as the defect region annotation results.
[0154] Another aspect of the present invention provides a target detection system for leakage defects in crimped fittings of transmission lines based on a diffusion model, comprising: a computer-readable storage medium and a processor;
[0155] The computer-readable storage medium is used to store executable instructions;
[0156] The processor is used to read executable instructions stored in the computer-readable storage medium and execute the target detection method for leakage pressure defects in transmission line fittings based on the diffusion model described in the first aspect.
[0157] In another aspect, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the target detection method for leakage pressure defects in transmission line fittings based on a diffusion model as described in the first aspect.
[0158] 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.
[0159] 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, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0160] 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, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0161] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A diffusion model-based target detection method for detecting a compression leakage defect of a power transmission line hardware, characterized in that, Includes the following steps: Obtain and classify original defect images: Obtain images of transmission line hardware crimping from the inspection report and classify them into images with and without leakage defects; Noise addition during diffusion process: Noise is added to the classified images with and without leakage defects to generate an image sequence with gradually increasing noise until the images are completely converted into noisy images; Reverse process denoising and model training: Based on the generated noisy image, the noise is predicted and denoised using the Unet network model. The loss function between the predicted noise and the original noise is calculated, and the model parameters are adjusted to train the diffusion model. Generate new defect images: Use a trained diffusion model to generate new defect images from random noise in reverse; Construct a defect model training set and train a defect recognition model: LabelImg is used to annotate the defect regions of the original defect image, the defect image and the generated defect image, generating a VOC format annotation file, and converting it into a COCO format dataset to obtain a defect model training set. The constructed defect model training set is then used to train the DifNet defect recognition model. Image preprocessing and classification: The images to be detected are normalized and input into the ResNet-18 model, which outputs defective and defect-free images; Defect region detection: For defective images, several initial defect coordinates are randomly generated and input into the DifNet defect recognition model. The model predicts noise and denoises to restore the real defect coordinates. Coordinates with a confidence score > 0.5 are selected as the defect region annotation results.
2. The method of claim 1, wherein, The noise addition during the diffusion process specifically includes: During the diffusion process, noise is gradually added to transform the original image into a simple noise distribution. This process can be viewed as a Markov chain, where a small amount of noise is added to the data at each step, eventually causing the data to completely lose its original features and become pure noise. The formula is as follows: ; ……; ; wherein, denotes the generated noise image, is an activation function, is a randomly generated Gaussian noise, is a stepwise decreasing diffusion coefficient, is the original image.
3. The method of claim 1, wherein, The noise addition during the diffusion process specifically includes: The noise removal during the reverse process specifically includes: During the reverse process, the model gradually recovers the original data state from a noisy state. The reverse process is also a Markov chain, where each step removes a portion of the noise, ultimately generating high-quality data samples. The formula is as follows: ; Wherein, the Unet network is a model for predicting noise, classify represents whether the original picture has defects, and the noise data is reversely generated from the noise data ; After predicting the noise using a model, the noise is removed from the image to obtain the denoised image. The formula is expressed as follows: ; ……; ; wherein is the noise data generated during the diffusion process, is the noise data predicted by the model, is consistent with the meaning during the diffusion process.
4. The method of claim 1, wherein, The loss function between the predicted noise and the original noise is: ; wherein noise generated for the diffusion process, noise predicted for the inverse process.
5. A device for detecting a target of a compression leakage defect of a power transmission line fitting based on a diffusion model, characterized by, include: The module for acquiring and classifying original defect images is used to obtain images of transmission line fittings crimping from the inspection report and classify them into images with and without leakage defects. The diffusion process noise-adding module is used to add noise to the classified images with and without leakage pressure defects, generating an image sequence with gradually increasing noise until the images are completely converted into noisy images. The reverse process denoising and model training module is used to predict and denoise noise based on the generated noisy image using the Unet network model, calculate the loss function between the predicted noise and the original noise, and adjust the model parameters to train the diffusion model. A new defect picture generation module is configured to generate a new defect picture in reverse from random noise using the trained diffusion model; A defect model training set construction and defect recognition model training module is configured to label the defect area of the original defect picture and the generated defect picture using a LabelImg tool, generate a VOC format annotation file, and convert it into a COCO format dataset, thereby obtaining a defect model training set, and train the DifNet defect recognition model using the constructed defect model training set; A picture preprocessing and classification module is configured to normalize the to-be-detected picture and input it into a ResNet-18 model to output a defective picture and a non-defective picture; A defect area detection module is configured to randomly generate a plurality of initial defect coordinates for the defective picture, input them into the DifNet defect recognition model, predict the noise and restore the real defect coordinates by denoising, and select the coordinates with a confidence level greater than 0.5 as the defect area labeling result.
6. The apparatus of claim 5, wherein, The diffusion process noise adding specifically includes: During the diffusion process, the original image is gradually converted into a simple noise distribution by adding noise step by step. This process is regarded as a Markov chain, and a small amount of noise is added to the data at each step, so that the data completely loses its original features and becomes pure noise. The formula is as follows: ; ……; ; wherein, denotes the generated noise image, is an activation function, is a randomly generated Gaussian noise, is a stepwise decreasing diffusion coefficient, is the original image.
7. The apparatus of claim 5, wherein, The reverse process denoising specifically includes: During the reverse process, the model gradually recovers the original data state from the noise state. The reverse process is also a Markov chain, and a portion of the noise is removed at each step, and finally a high-quality data sample is generated. The formula is as follows: ; Wherein, the Unet network is a model for predicting noise, classify represents whether the original picture has defects, and the noise data is reversely generated from the noise data ; After predicting the noise through the model, the noise is removed from the picture to obtain a denoised picture. The formula is as follows: ; ……; ; wherein is noise data generated during the diffusion process, is noise data predicted by the model, is consistent with the meaning during the diffusion process.
8. The apparatus of claim 5, wherein, The loss function of the predicted noise and the original noise is: ; wherein noise generated for the diffusion process, noise predicted for the inverse process.
9. A diffusion model-based target detection system for detecting a compression leakage defect of a power transmission line hardware, characterized by, It includes: A computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is configured to read the executable instructions stored in the computer-readable storage medium and execute the diffusion model-based transmission line hardware pressure joint pressure leakage defect target detection method of any one of claims 1-4.
10. A non-transitory computer-readable storage medium, comprising: A computer program is stored thereon, which is executed by a processor to implement the diffusion model-based transmission line hardware pressure joint pressure leakage defect target detection method of any one of claims 1-4.