A method, system, device, and medium for detecting defects in insulators
By constructing an insulator image dataset and training it with an improved Deeplab v3+ network, a semantic segmentation method for insulators combining residual learning units and attention modules is developed. This method addresses the issues of low detection accuracy and low automation in existing technologies, achieving higher accuracy and automation in insulator detection.
Patent Information
- Application Number
- CN202310553464.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-16
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2043-05-16
AI Technical Summary
Existing insulator defect detection methods rely on manual fault diagnosis, resulting in low accuracy and low automation of detection results.
An insulator image dataset was constructed and divided into training, validation, and test sets. An improved Deeplab v3+ network was used for training, and semantic segmentation of insulators was performed by combining residual learning unit layers and attention modules. The state of the insulators was determined by gray-level gradient analysis.
This improved the accuracy of insulator positioning and detection results, and achieved a higher degree of automation.
Smart Images

Figure CN116523894B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of insulator defect detection technology, and in particular to an insulator defect detection method, system, equipment and medium. Background Technology
[0002] In power systems, insulators are widely used insulating components in distribution lines. However, during operation, they are gradually deteriorated due to long-term exposure to factors such as air pollution, lightning strikes, electrical loads, mechanical stress, and external damage, eventually becoming zero-value insulators. If insulators have defects, they can easily cause flashover accidents, leading to line tripping. This poses a significant threat to the insulation design of the lines and the safe operation of the power system. Therefore, detecting whether insulators have defects is of great importance.
[0003] When arcing marks appear on the surface of the sheds of a porcelain insulator, it indicates that the insulator may have experienced flashover burns, lightning overvoltage, or other phenomena, and its insulation performance may have been compromised. Continued operation poses a risk of breakdown, necessitating replacement. Fault diagnosis is typically performed manually after images are captured by a camera mounted on a drone.
[0004] However, fault diagnosis through manual methods can easily lead to low accuracy of test results and low automation. Summary of the Invention
[0005] This invention provides an insulator defect detection method, system, device, and medium, which solves the technical problems of existing insulator defect detection methods that rely on manual fault diagnosis, which easily leads to low accuracy of detection results and low degree of automation.
[0006] The present invention provides a method for detecting insulator defects, comprising:
[0007] Obtain the insulator image dataset to be identified, and construct the corresponding training set, validation set, and test set using the insulator image dataset within a preset ratio range;
[0008] The training set and the validation set are used to train the preset initial insulator semantic segmentation model to determine the target insulator semantic segmentation model;
[0009] Multiple insulator segmentation images corresponding to the test set are obtained through the target insulator semantic segmentation model;
[0010] The insulator state corresponding to the segmented insulator image is determined based on the grayscale gradient of the segmented insulator image.
[0011] Optionally, before the steps of obtaining the insulator image dataset to be identified, using the insulator image dataset within a preset ratio range, and constructing the corresponding training set, validation set, and test set, the method further includes:
[0012] Obtain multiple images of insulators to be identified;
[0013] The insulator images are labeled using a semantic segmentation and annotation tool to generate corresponding labeled insulator images;
[0014] The insulator labeled images are converted into preset formats to generate corresponding insulator converted images;
[0015] The insulator image dataset is constructed using all the insulator images and all the insulator converted images.
[0016] Optionally, the step of training a preset initial insulator semantic segmentation model using the training set and the validation set to determine the target insulator semantic segmentation model includes:
[0017] Based on the insulator image dataset, determine the loss function formula corresponding to the preset initial insulator semantic segmentation model;
[0018] The initial insulator semantic segmentation model is trained using the training set, and the training loss function value corresponding to the training set is calculated using the loss function formula.
[0019] The initial insulator semantic segmentation model is updated using the training loss function value to generate an intermediate insulator semantic segmentation model;
[0020] If the training loss function value meets the preset training value, then the validation set is used to validate the semantic segmentation model of the intermediate insulator.
[0021] If the verification loss function value corresponding to the verification set satisfies the preset verification value, then the intermediate insulator semantic segmentation model at the current time is taken as the target insulator semantic segmentation model.
[0022] Optionally, the loss function formula includes a first loss function formula and a second loss function formula; the step of determining the loss function formula corresponding to the preset initial insulator semantic segmentation model based on the insulator image dataset includes:
[0023] Based on the insulator image dataset, determine the classification label corresponding to the initial insulator semantic segmentation model;
[0024] Determine whether the category label is a preset label type;
[0025] If so, then the first loss function formula shall be used as the loss function formula corresponding to the initial insulator semantic segmentation model;
[0026] If not, then the second loss function formula shall be used as the loss function formula corresponding to the initial insulator semantic segmentation model.
[0027] Optionally, the target insulator semantic segmentation model includes multiple residual learning unit layers and an attention module; the step of obtaining multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model includes:
[0028] The test images in the test set are convolved by the residual learning unit layer to generate the corresponding initial insulator detection images.
[0029] The attention module is used to denoise the initial insulator detection image to generate the corresponding intermediate insulator detection image.
[0030] The dimensions of the initial low-order features corresponding to the detection images of the intermediate insulators are adjusted by an autoencoder neural network to generate the corresponding target low-order features.
[0031] The initial high-order features corresponding to the detection image of the intermediate insulator are subjected to dilated convolution to generate the corresponding target high-order features.
[0032] The target high-order features and target low-order features are fused to construct the corresponding insulator segmentation image.
[0033] Optionally, the step of determining the insulator state corresponding to the segmented insulator image based on the grayscale gradient of the segmented insulator image includes:
[0034] The segmented insulator images are converted to grayscale using a weighted average method to generate corresponding initial insulator processed images.
[0035] The initial insulator processing images are noise-filtered using a median filter to generate corresponding intermediate insulator processing images.
[0036] Histogram equalization is used to enhance the images of the intermediate insulators to generate corresponding processed images of the target insulators.
[0037] Based on the grayscale gradient corresponding to the target insulator processed image, the insulator state corresponding to the insulation segmentation image is determined.
[0038] Optionally, the insulator state includes a first insulator state and a second insulator state; the step of determining the insulator state corresponding to the insulation segmentation image based on the grayscale gradient corresponding to the target insulator processed image includes:
[0039] The gray-level gradient corresponding to the processed image of the target insulator is calculated using the gray-level co-occurrence matrix method, and the corresponding gray-level co-occurrence matrix is generated.
[0040] Obtain the contrast, energy transformation value, and entropy corresponding to the gray-level co-occurrence matrix;
[0041] Determine whether the contrast, the energy transformation value, and the entropy all meet the corresponding preset thresholds;
[0042] If so, the first insulator state is taken as the insulator state corresponding to the insulation segmentation image;
[0043] If not, then the second insulator state is taken as the insulator state corresponding to the insulation segmentation image.
[0044] The present invention also provides an insulator defect detection system, comprising:
[0045] The training set, validation set, and test set construction module is used to obtain the insulator image dataset to be identified, and to construct the corresponding training set, validation set, and test set using the insulator image dataset within a preset ratio range.
[0046] The target insulator semantic segmentation model determination module is used to train a preset initial insulator semantic segmentation model using the training set and the validation set, and determine the target insulator semantic segmentation model.
[0047] An insulator segmentation image acquisition module is used to acquire multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model;
[0048] The insulator state determination module is used to determine the insulator state corresponding to the segmented insulator image based on the grayscale gradient corresponding to the segmented insulator image.
[0049] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of implementing any of the above-described insulator defect detection methods.
[0050] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements any of the above-described insulator defect detection methods.
[0051] As can be seen from the above technical solutions, the present invention has the following advantages:
[0052] This invention acquires a dataset of insulator images to be identified, and constructs corresponding training, validation, and test sets within a preset proportion. Then, it uses the training and validation sets to train a preset initial insulator semantic segmentation model to determine the target insulator semantic segmentation model. Multiple segmented insulator images corresponding to the test set are obtained using the target insulator semantic segmentation model. Finally, based on the grayscale gradient of the segmented insulator images, the insulator state corresponding to each segmented image is determined. This solves the technical problem of existing insulator defect detection methods relying on manual fault diagnosis, which easily leads to low accuracy and low automation. By using the target insulator semantic segmentation model to identify insulator images, the accuracy of insulator localization and detection results is improved. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a flowchart of the steps of an insulator defect detection method provided in Embodiment 1 of the present invention;
[0055] Figure 2 This is a flowchart of the steps of an insulator defect detection method provided in Embodiment 2 of the present invention;
[0056] Figure 3 This is a structural block diagram of an insulator defect detection system provided in Embodiment 3 of the present invention. Detailed Implementation
[0057] This invention provides an insulator defect detection method, system, device, and medium to address the technical problems of existing insulator defect detection methods that rely on manual fault diagnosis, which easily leads to low accuracy of detection results and low automation.
[0058] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0059] Please see Figure 1 , Figure 1 This is a flowchart illustrating the steps of an insulator defect detection method provided in Embodiment 1 of the present invention.
[0060] The present invention provides a method for detecting insulator defects, comprising:
[0061] Step 101: Obtain the insulator image dataset to be identified. Within a preset ratio range, use the insulator image dataset to construct the corresponding training set, validation set, and test set.
[0062] An insulator image dataset refers to a dataset constructed by annotating and converting multiple insulator images to be identified, resulting in all converted insulator images and all insulator images.
[0063] The preset ratio range refers to the ratio range that should be selected when constructing the training set, validation set and test set using the insulator image dataset. Usually, the insulator image dataset is randomly divided into the training set, validation set and test set in a ratio of 8:1:1.
[0064] In this embodiment of the invention, multiple images of insulators to be identified are acquired using a high-resolution camera mounted on a drone, and semantic segmentation and annotation tools are used to annotate each insulator image, generating corresponding annotated insulator images. The annotated insulator images are then converted to a preset format to generate corresponding converted insulator images. An insulator image dataset is constructed using all insulator images and all converted insulator images. After acquiring the dataset of insulator images to be identified, each insulator image in the dataset is matched one-to-one with its corresponding converted insulator image, and the dataset is randomly divided into a training set, a validation set, and a test set in an 8:1:1 ratio.
[0065] Step 102: Train the preset initial insulator semantic segmentation model using the training set and validation set to determine the target insulator semantic segmentation model.
[0066] The preset initial insulator semantic segmentation model refers to the insulator semantic segmentation model based on the Deeplab v3+ network, with the backbone using a ResNet 101 network with added SE attention modules, thus constructing an improved Deeplab v3+ network.
[0067] In this embodiment of the invention, a loss function formula corresponding to a preset initial insulator semantic segmentation model is determined based on an insulator image dataset. The initial insulator semantic segmentation model is trained using a training set, and the training loss function value corresponding to the training set is calculated using the loss function formula. The initial insulator semantic segmentation model is updated using the training loss function value to generate an intermediate insulator semantic segmentation model. If the training loss function value meets a preset training value, the intermediate insulator semantic segmentation model is validated using a validation set. If the validation loss function value corresponding to the validation set meets a preset validation value, the intermediate insulator semantic segmentation model at the current time is used as the target insulator semantic segmentation model.
[0068] Step 103: Obtain multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model.
[0069] In this embodiment of the invention, the target insulator semantic segmentation model includes multiple residual learning unit layers and an attention module. The residual learning unit layers convolve test images within the test set to generate corresponding initial insulator detection images. The attention module denoises the initial insulator detection images to generate corresponding intermediate insulator detection images. An autoencoder neural network adjusts the dimensions of the initial low-order features corresponding to the intermediate insulator detection images to generate corresponding target low-order features. The initial high-order features corresponding to the intermediate insulator detection images are dilated and convolved to generate corresponding target high-order features. The target high-order features and target low-order features are then fused to construct the corresponding insulator segmentation image.
[0070] Step 104: Determine the insulator state corresponding to the segmented insulator image based on the grayscale gradient.
[0071] In this embodiment of the invention, a weighted average method is used to perform grayscale processing on the insulator segmentation images to generate corresponding initial insulator processing images. A median filter is then used to filter noise from the initial insulator processing images to generate corresponding intermediate insulator processing images. Histogram equalization is then used to enhance the images of the intermediate insulators to generate corresponding target insulator processing images. Finally, based on the grayscale gradient corresponding to the target insulator processing image, the insulator state corresponding to the insulator segmentation image is determined.
[0072] In this embodiment of the invention, a dataset of insulator images to be identified is acquired, and within a preset proportion, the dataset is used to construct corresponding training, validation, and test sets. Then, the training and validation sets are used to train a preset initial insulator semantic segmentation model to determine the target insulator semantic segmentation model. Multiple segmented insulator images corresponding to the test set are obtained using the target insulator semantic segmentation model. Finally, based on the grayscale gradient of the segmented insulator images, the insulator state corresponding to each segmented image is determined. This solves the technical problem that existing insulator defect detection methods rely on manual fault diagnosis, which easily leads to low accuracy and low automation. By using the target insulator semantic segmentation model to identify insulator images, the accuracy of insulator localization and detection results is improved.
[0073] Please see Figure 2 , Figure 2 This is a flowchart illustrating the steps of an insulator defect detection method provided in Embodiment 2 of the present invention.
[0074] Another insulator defect detection method provided by the present invention includes:
[0075] Step 201: Obtain the insulator image dataset to be identified. Within a preset ratio range, use the insulator image dataset to construct the corresponding training set, validation set, and test set.
[0076] Furthermore, the following sub-steps S11-S14 are included before step 201:
[0077] S11. Obtain multiple images of insulators to be identified.
[0078] S12. Use a semantic segmentation annotation tool to annotate the insulator images to generate corresponding annotated insulator images.
[0079] S13. Convert the insulator label images to preset formats respectively, and generate corresponding insulator conversion images.
[0080] S14. Construct an insulator image dataset using all insulator images and all converted insulator images.
[0081] In this embodiment of the invention, N images of insulators to be identified are obtained, and an insulator image set I = {I1, I2, I3, ..., I...} is constructed using all the insulator images. N The insulator images in image set I were labeled using the semantic segmentation and annotation tool Labelme, resulting in labeled insulator images. A JSON dataset J = {J1, J2, J3, ..., J...} containing semantic annotations was then constructed using all the labeled insulator images. NThe insulator labeled images in dataset J are uniformly converted into PNG format to obtain the corresponding converted insulator images. An image set P = {P1, P2, P3, ..., P} is constructed using all the converted insulator images. N Images in image sets I and P are matched one-to-one and randomly divided into training, validation, and test sets in an 8:1:1 ratio for training, validation, and testing of the initial insulator semantic segmentation model.
[0082] Step 202: Based on the insulator image dataset, determine the loss function formula corresponding to the preset initial insulator semantic segmentation model.
[0083] Furthermore, the loss function formula includes a first loss function formula and a second loss function formula, and step 202 may include the following sub-steps S21-S24:
[0084] S21. Based on the insulator image dataset, determine the classification label corresponding to the initial insulator semantic segmentation model.
[0085] S22. Determine whether the category label is a preset label type.
[0086] S23. If so, then the first loss function formula shall be used as the loss function formula corresponding to the initial insulator semantic segmentation model.
[0087] S24. If not, then the second loss function formula shall be used as the loss function formula corresponding to the initial insulator semantic segmentation model.
[0088] The preset label type refers to the case where the initial insulator semantic segmentation model has only one classification label, i.e., the initial insulator semantic segmentation model is in a binary classification state.
[0089] In this embodiment of the invention, the learning rate of the initial insulator semantic segmentation model is set to lr = 0.001, and the weight decay is set to weight_decay = 0.0001. The loss function is set to the cross-entropy loss function. The classification label corresponding to the initial insulator semantic segmentation model is determined.
[0090] When the initial insulator semantic segmentation model has only one classification label, i.e., the classification label is a preset label type, the model only needs to distinguish between foreground and background. For the prediction of each pixel, the initial insulator semantic segmentation model only has probabilities p and 1-p. Therefore, the expression of the first loss function formula is:
[0091]
[0092] Among them, y i p is the sign function of the sample, 1 for the positive class and 0 for the negative class; iThis represents the probability that the model predicts the sample to be of the positive class.
[0093] When a model has more than one classification label, it falls under the category of multi-class classification, meaning the classification labels are not of the preset label type. The loss function calculation for multi-class classification is actually an extension of binary classification; the expression for the second loss function is:
[0094]
[0095] Where M represents the number of label categories; y ic p is a sign function for the sample; its value is 1 when sample i belongs to the classification label c, and 0 otherwise. ic This represents the probability that the model predicts sample i as class label c.
[0096] Step 203: Train the initial insulator semantic segmentation model using the training set, and calculate the training loss function value corresponding to the training set using the loss function formula.
[0097] In this embodiment of the invention, the initial insulator semantic segmentation model is trained using a training set, and the training loss function value corresponding to each image in the training set is calculated using the loss function formula corresponding to the initial insulator semantic segmentation model.
[0098] Step 204: Update the initial insulator semantic segmentation model using the training loss function value to generate the intermediate insulator semantic segmentation model.
[0099] In this embodiment of the invention, the training loss function value is applied to the initial insulator semantic segmentation model to obtain an intermediate insulator semantic segmentation model.
[0100] Step 205: If the training loss function value meets the preset training value, then the semantic segmentation model of the intermediate insulator is validated using the validation set.
[0101] In this embodiment of the invention, it is determined whether the training loss function value meets the preset training value, that is, whether the training loss function value is less than the preset critical value. If yes, the intermediate insulator semantic segmentation model is verified using a validation set. If no, the process jumps to the step of training the initial insulator semantic segmentation model using a training set and calculating the training loss function value corresponding to the training set using the loss function formula, until the training loss function value meets the preset training value.
[0102] Step 206: If the validation loss function value corresponding to the validation set satisfies the preset validation value, then the intermediate insulator semantic segmentation model at the current moment is taken as the target insulator semantic segmentation model.
[0103] In this embodiment of the invention, it is determined whether the verification loss function value corresponding to the verification set meets the preset verification value, that is, whether the verification loss function value is less than the preset critical value. If yes, the intermediate insulator semantic segmentation model at the current moment is used as the target insulator semantic segmentation model; if no, the process jumps to the step of training the initial insulator semantic segmentation model with the training set and calculating the training loss function value corresponding to the training set using the loss function formula, until the verification loss function value meets the preset training value.
[0104] Step 207: Obtain multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model.
[0105] Furthermore, the target insulator semantic segmentation model includes multiple residual learning unit layers and an attention module, and step 207 may include the following sub-steps S31-S35:
[0106] S31. The test images in the test set are convolved through the residual learning unit layer to generate the corresponding initial insulator detection images.
[0107] S32. The initial insulator detection images are denoised using the attention module to generate corresponding intermediate insulator detection images.
[0108] S33. Adjust the dimensions of the initial low-order features corresponding to the detection images of intermediate insulators using an autoencoder neural network to generate the corresponding target low-order features.
[0109] S34. Perform dilated convolution on the initial high-order features corresponding to the intermediate insulator detection image to generate the corresponding target high-order features.
[0110] S35. The target high-order features and target low-order features are fused to construct the corresponding insulator segmentation image.
[0111] Residual Networks (ResNet) address the performance degradation caused by increasing depth by introducing a deep residual learning framework. Its residual structure is as follows:
[0112] H(x i+1 )=x i +F(x i W i )
[0113] Where, x i H(x) represents the input. i+1 ) represents the output, F(x) i W i ) represents the residual.
[0114] Through recursion, the feature expression of any deep unit L can be obtained:
[0115]
[0116] To learn a nonlinear optimal mapping H(x), the ResNet model splits the learning process into two parts: learning the residual function F(x,W), and then learning H(x) through a simple mapping. i+1 )=x i +F(x i W i Additionally, ResNet achieves this by adding a Short Connection to the feedforward network, skipping one or more layers with different strides to merge with the main path. The output of this structure is as shown in the feature expression of any deep unit L. If the input and output dimensions are different, a linear projection W needs to be added. s :
[0117]
[0118] Therefore, ResNet 101 uses a three-layer residual learning unit layer with 1*1 convolutions. In particular, 1*1 convolutions are used before and after the middle 3*3 convolutions. This dimensionality reduction and subsequent dimensionality increase operation reduces computational complexity.
[0119] The attention module uses the SE attention module, which consists of a global average pooling layer, a first fully connected layer, a ReLU activation layer, a second fully connected layer, and a Sigmoid activation layer. The first fully connected layer reduces the number of feature channels by a scaling factor. After activation by the ReLU activation layer, the number of feature channels increases again through the second fully connected layer, resulting in weights equal to the number of feature channels. Each weight is used to weight a corresponding feature channel. Then, the weights are normalized to between 0 and 1 by the gates of the Sigmoid activation layer. Finally, a scaling operation applies the normalized weights to the features of each feature channel.
[0120] Assuming an input image of H×W×C, it is stretched to 1×1×C through a global pooling layer and a fully connected (FC) layer, and then multiplied with the original image, assigning weights to each channel. In the denoising task, each noise point is assigned a weight, automatically removing low-weight noise points and retaining high-weight noise points, thus improving network runtime and reducing parameter computation.
[0121] The input image is processed by a ResNet 101 network with an added SE attention module to extract features, resulting in two outputs: high-order features and low-order features. High-order features have a resolution ratio of 16 between the input and output, while low-order features have a ratio of 4. The high-order features undergo five different operations within the ASPP (Atrous Spatial Pyramid Pooling) module, yielding five different outputs. These operations include one 1×1 convolution, three dilated convolutions with different ratios, and one ImagePooling (global average pooling followed by upsampling to the original size). Convolutions extract features locally, while ImagePooling extracts features globally, resulting in multi-scale features. The ASPP module adds Atrous Convolution to Spatial Pyramid Pooling to reduce feature loss.
[0122] Assuming variable 'a' is used to measure the expansion factor of dilated convolution, the relationship between the actual kernel size after expansion and the original kernel size is shown in the following equation:
[0123] K = K0 + (k-1)(a-1)
[0124] Where k is the original kernel size, a is the dilation rate, and K0 and K are the actual kernel sizes before and after dilation, respectively.
[0125] After feature fusion and 1×1 convolution, the five outputs of the ASPP module are upsampled by 4 times (bilinear interpolation) to obtain the target high-order features with a resolution ratio of 4 between the input and output. Then, they are connected with the target low-order features obtained by adjusting the dimensions in the encoder network through 1×1 convolution. After the two features are fused, a 3×3 convolution is used to further fuse the features. Finally, it is upsampled by 4 times (bilinear interpolation) to obtain a segmentation prediction with a resolution ratio of 1 between the input and output, which is the same size as the original image.
[0126] In this embodiment of the invention, a semantic segmentation model for target insulators is used to perform semantic segmentation on images in the test set, thereby segmenting insulators from the original images. Specifically, a three-layer residual learning unit layer convolves the test images in the test set, performing dimensionality reduction followed by dimensionality increase to reduce computational complexity and generate corresponding initial insulator detection images. An SE attention module is used to denoise the initial insulator detection images, assigning weights to each noise point, automatically removing low-weight noise points and retaining high-weight noise points, improving network runtime and reducing parameter calculations, generating corresponding intermediate insulator detection images. An autoencoder neural network is used to adjust the dimensions of the initial low-order features corresponding to the intermediate insulator detection images to generate corresponding target low-order features. The initial high-order features corresponding to the intermediate insulator detection images are then subjected to dilated convolution to generate corresponding target high-order features. The target high-order features and target low-order features are fused, and then further fused using a 3×3 convolution. Finally, the images are upsampled by a factor of 4 (bilinear interpolation) to obtain a resolution ratio of 1 between the input and output, i.e., a segmentation prediction with the same size as the original image, resulting in the corresponding insulator segmentation image.
[0127] Step 208: Determine the insulator state corresponding to the segmented insulator image based on the grayscale gradient.
[0128] Further, step 208 may include the following sub-steps S41-S44:
[0129] S41. The insulator segmentation images are converted to grayscale using a weighted average method to generate the corresponding initial insulator processed images.
[0130] S42. Use a median filter to perform noise filtering on the initial insulator processing images to generate corresponding intermediate insulator processing images.
[0131] S43. Histogram equalization is used to enhance the images of the intermediate insulators to generate corresponding processed images of the target insulators.
[0132] S44. Determine the insulator state corresponding to the insulation segmentation image based on the grayscale gradient corresponding to the target insulator processed image.
[0133] In this embodiment of the invention, porcelain insulators are generally located in an open-air environment, and the images are always against a background of trees, farmland, roads, buildings, etc. On the other hand, the images are also affected by noise such as light and electromagnetic interference. These interferences can be reduced, but they are unavoidable. Therefore, image preprocessing is performed on the acquired images to reduce noise interference and improve image contrast, laying the foundation for rapid and accurate identification of defects in porcelain insulators. Image preprocessing consists of three steps: grayscale conversion, image denoising, and image enhancement.
[0134] The weighted average method is used to perform grayscale processing on the segmented insulator images to generate corresponding initial processed insulator images. The specific expression is shown in the following formula:
[0135] gray=R×0.299+G×0.587+B×0.114
[0136] Where gray is an integer between 0 and 255, representing the gray level at that point; R represents the red pixel in the initial insulator processing image; G represents the green pixel in the initial insulator processing image; and B represents the blue pixel in the initial insulator processing image.
[0137] Median filters are used to filter noise from the initial insulator processing images, generating corresponding intermediate insulator processing images. The median filter is a non-linear smoothing technique. Its main idea is to set the grayscale value of each pixel to the median of the grayscale values of all pixels within a certain neighborhood window. Median filtering selects the pixel values of a pixel in a digital image or sequence and its surrounding neighboring pixels (an odd number of pixels in total), sorts these pixel values, and then uses the pixel value at the median position as the current pixel value, making the surrounding pixel values closer to the true value, thereby eliminating isolated noise points.
[0138] Histogram equalization is used to enhance the images of intermediate insulators, generating corresponding processed images of target insulators. Histogram equalization is a method to enhance image contrast. Its main idea is to redistribute the histogram distribution of an image into an approximately uniform distribution using a cumulative distribution function, thereby enhancing image contrast. To expand the brightness range of the original image, a mapping function is needed to evenly map the pixel values of the original image to the new histogram. Since an image is composed of individual pixels, image histogram equalization is solved using a discrete form of the cumulative distribution function. The mapping method during histogram equalization is as follows:
[0139]
[0140] Among them, S k This refers to the value of the current gray level after being mapped by the cumulative distribution function, where n is the sum of the pixels in the image. j L is the number of pixels at the current gray level, and L is the total number of gray levels in the image.
[0141] Finally, based on the grayscale gradient corresponding to the processed image of the target insulator, the state of the insulator corresponding to the segmented image is determined.
[0142] Furthermore, the insulator state includes a first insulator state and a second insulator state, and step S44 may include the following sub-steps S441-S445:
[0143] S441. The gray-level gradient corresponding to the image of the target insulator is calculated using the gray-level co-occurrence matrix method, and the corresponding gray-level co-occurrence matrix is generated.
[0144] S442. Obtain the contrast, energy transformation value and entropy corresponding to the gray-level co-occurrence matrix.
[0145] S443. Determine whether the contrast, energy transformation value and entropy all meet the corresponding preset thresholds.
[0146] S444. If so, then the first insulator state is taken as the insulator state corresponding to the insulation segmentation image.
[0147] S445. If not, then the second insulator state is taken as the insulator state corresponding to the insulation segmentation image.
[0148] The first insulator state refers to the insulator surface not being dirty or having black spots caused by arc burning, when the contrast, energy transformation value, and entropy all meet the corresponding preset thresholds.
[0149] The second insulator state refers to the situation where any one or all of the contrast, energy transformation value, and entropy fail to meet the corresponding preset threshold, and the corresponding insulator disc surface is dirty or has black spots caused by electric arc burning.
[0150] In this embodiment of the invention, the gray-level co-occurrence matrix (GLCM) method is used to calculate the gray-level gradient corresponding to the processed image of the target insulator, generating the corresponding GLCM. The GLCM refers to a common method for describing texture by studying the spatial correlation characteristics of gray levels. Since texture is formed by the repeated occurrence of gray-level distributions in space, there will be a certain gray-level relationship between two pixels separated by a certain distance in the image space, i.e., the spatial correlation characteristics of gray levels in the image.
[0151] The common way to express the gray-level co-occurrence matrix is as follows: Let the gray-level image matrix be G1. The joint probability distribution of two pixel pairs with gray values i and j that are located at a distance of (Δx, Δy) is called the gray-level co-occurrence matrix. That is, the value of each pixel (i, j) in the matrix is equal to the number of pixel pairs that meet the corresponding conditions. If the gray levels in the image are divided into n levels, then the joint probability distribution can be represented by an n*n order gray-level co-occurrence matrix M(Δx, Δy). As shown below, image G1 is a 4*4 gray-level co-occurrence matrix with four gray levels. When (Δx, Δy) is (1, 0), the gray-level co-occurrence matrix p formed at this time is:
[0152]
[0153]
[0154] In addition, there are 14 statistical measures calculated based on the gray-level co-occurrence matrix: energy, entropy, contrast, uniformity, correlation, variance, sum-mean, sum-variance, sum-entropy, difference-variance, difference-mean, difference-entropy, relevant information measure, and maximum correlation coefficient. Based on the texture characteristics of the cracks, contrast, energy, and entropy are selected to determine whether cracks exist on the disk surface.
[0155] The distribution of the contrast metric matrix values and the extent of local variations in an image reflect its sharpness and the depth of texture grooves. Deeper texture grooves result in greater contrast and a sharper image; conversely, lower contrast values indicate shallower grooves and a blurrier image.
[0156]
[0157] Energy transformation reflects the uniformity of gray-level distribution and the coarseness of texture in an image. If the element values of the gray-level co-occurrence matrix are similar, the energy is smaller, indicating a finer texture; if some values are large while others are small, the energy value is larger. A large energy value indicates a more uniform and regularly varying texture pattern.
[0158]
[0159] Entropy reflects the randomness of the amount of information contained in an image. Entropy is at its maximum when all values in the co-occurrence matrix are equal or when pixel values exhibit the greatest randomness; therefore, the entropy value indicates the complexity of the image's gray-level distribution, and the larger the entropy value, the more complex the image.
[0160]
[0161] Based on the contrast value, energy value, and entropy value calculated from the gray-level co-occurrence matrix, and based on a pre-set appropriate threshold, it is determined whether the contrast, energy transformation value, and entropy all meet the corresponding preset threshold. This can eliminate interference caused by cracks on the insulator disc surface and reflected sunlight, accurately determine whether there is dirt or black spots on the insulator disc surface due to arc burning, and thus determine the insulator state corresponding to the insulation segmentation image, that is, determine the insulator state corresponding to the insulator image to be identified.
[0162] In this embodiment of the invention, a dataset of insulator images to be identified is obtained. Within a preset ratio range, the dataset is used to construct corresponding training, validation, and test sets. Based on the insulator image dataset, a preset loss function formula corresponding to the initial insulator semantic segmentation model is determined. The initial insulator semantic segmentation model is trained using the training set, and the training loss function value corresponding to the training set is calculated using the loss function formula. The initial insulator semantic segmentation model is updated using the training loss function value to generate an intermediate insulator semantic segmentation model. If the training loss function value meets the preset training value, the intermediate insulator semantic segmentation model is validated using the validation set. If the validation loss function value corresponding to the validation set meets the preset validation value, the intermediate insulator semantic segmentation model at the current moment is used as the target insulator semantic segmentation model. Multiple insulator segmentation images corresponding to the test set are obtained through the target insulator semantic segmentation model, that is, the insulator images are segmented into insulator disks using the target insulator semantic segmentation model to obtain the corresponding insulator segmentation images. Then, the insulator segmentation images are preprocessed, that is, grayscale processing, median filtering, and histogram equalization are performed on the insulator segmentation images to obtain the target insulator processed image. Next, the gray-level gradient corresponding to the processed image of the target insulator is calculated using the gray-level co-occurrence matrix method, generating the corresponding gray-level co-occurrence matrix. The contrast (Con), energy transformation value (Asm), and entropy (Ent) corresponding to the gray-level co-occurrence matrix are obtained. It is then determined whether the contrast (Con), energy transformation value (Asm), and entropy (Ent) satisfy the following conditions: Con < 0.15, Asm < 0.055, and Ent > 3.2. If these conditions are met, it indicates that the insulator in the image has an arc burning defect; if not, it indicates that the insulator in the image does not have an arc burning defect.
[0163] Please see Figure 3 , Figure 3 This is a structural block diagram of an insulator defect detection system provided in Embodiment 3 of the present invention.
[0164] The training set, validation set, and test set construction module 301 is used to obtain the insulator image dataset to be identified, and to construct the corresponding training set, validation set, and test set using the insulator image dataset within a preset ratio range.
[0165] The target insulator semantic segmentation model determination module 302 is used to train the preset initial insulator semantic segmentation model using a training set and a validation set to determine the target insulator semantic segmentation model.
[0166] The insulator segmentation image acquisition module 303 is used to acquire multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model.
[0167] The insulator state determination module 304 is used to determine the insulator state corresponding to the segmented image based on the grayscale gradient of the segmented image.
[0168] Optionally, the system also includes:
[0169] The insulator image acquisition module is used to acquire multiple insulator images to be identified.
[0170] The insulator labeled image generation module is used to annotate insulator images using a semantic segmentation annotation tool to generate corresponding insulator labeled images.
[0171] The insulator conversion image generation module is used to convert insulator labeled images into preset formats and generate corresponding insulator conversion images.
[0172] The insulator image dataset construction module is used to construct an insulator image dataset using all insulator images and all converted insulator images.
[0173] Optionally, the target insulator semantic segmentation model determination module 302 includes:
[0174] The loss function formula determination module is used to determine the loss function formula corresponding to the preset initial insulator semantic segmentation model based on the insulator image dataset.
[0175] The initial insulator semantic segmentation model training module is used to train the initial insulator semantic segmentation model using the training set and to calculate the training loss function value corresponding to the training set using the loss function formula.
[0176] The intermediate insulator semantic segmentation model generation module is used to update the initial insulator semantic segmentation model using the training loss function value and generate the intermediate insulator semantic segmentation model.
[0177] The intermediate insulator semantic segmentation model verification module is used to verify the intermediate insulator semantic segmentation model using a verification set if the training loss function value meets the preset training value.
[0178] The target insulator semantic segmentation model determination submodule is used to determine the target insulator semantic segmentation model if the verification loss function value corresponding to the verification set satisfies the preset verification value.
[0179] Optionally, the loss function formula includes a first loss function formula and a second loss function formula. The loss function formula determination module can perform the following steps:
[0180] Based on the insulator image dataset, determine the classification label corresponding to the initial insulator semantic segmentation model;
[0181] Determine if the category label is a preset label type;
[0182] If so, the first loss function formula will be used as the loss function formula corresponding to the initial insulator semantic segmentation model;
[0183] If not, then the second loss function formula will be used as the loss function formula corresponding to the initial insulator semantic segmentation model.
[0184] Optionally, the target insulator semantic segmentation model includes multiple residual learning unit layers and an attention module, and the insulator segmentation image acquisition module 303 includes:
[0185] The initial insulator detection image generation module is used to convolve the test images in the test set through residual learning unit layers to generate the corresponding initial insulator detection images.
[0186] The intermediate insulator detection image generation module is used to denoise the initial insulator detection image using the attention module to generate the corresponding intermediate insulator detection image.
[0187] The target low-order feature generation module is used to adjust the dimensions of the initial low-order features corresponding to the intermediate insulator detection images through an autoencoder neural network to generate the corresponding target low-order features.
[0188] The target high-order feature generation module is used to perform dilated convolution on the initial high-order features corresponding to the intermediate insulator detection image to generate the corresponding target high-order features.
[0189] The insulator segmentation image acquisition submodule is used to fuse the target's high-order features with the target's low-order features to construct the corresponding insulator segmentation image.
[0190] Optionally, the insulator state determination module 304 includes:
[0191] The initial insulator processing image generation module is used to perform grayscale processing on the segmented insulator images using a weighted average method to generate the corresponding initial insulator processing images.
[0192] The intermediate insulator processing image generation module is used to perform noise filtering on the initial insulator processing image using a median filter to generate the corresponding intermediate insulator processing image.
[0193] The target insulator image generation module is used to perform image enhancement on intermediate insulators using histogram equalization to generate corresponding target insulator images.
[0194] The insulator state determination submodule is used to determine the insulator state corresponding to the insulation segmentation image based on the grayscale gradient corresponding to the target insulator processing image.
[0195] Optionally, the insulator state includes a first insulator state and a second insulator state. The insulator state determination submodule can perform the following steps:
[0196] The gray-level gradient corresponding to the processed image of the target insulator is calculated using the gray-level co-occurrence matrix method, and the corresponding gray-level co-occurrence matrix is generated.
[0197] Obtain the contrast, energy transformation value, and entropy corresponding to the gray-level co-occurrence matrix;
[0198] Determine whether the contrast, energy transformation value, and entropy all meet the corresponding preset thresholds;
[0199] If so, the first insulator state is taken as the insulator state corresponding to the insulation segmentation image;
[0200] If not, then the second insulator state will be used as the insulator state corresponding to the insulation segmentation image.
[0201] This invention also provides an electronic device, which includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor performs the insulator defect detection method as described in any of the above embodiments.
[0202] The memory can be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. The memory has storage space for program code used to perform any of the method steps described above. For example, the storage space for program code may include individual program codes for implementing the various steps in the methods described above. This program code can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact discs (CDs), memory cards, or floppy disks. The program code may be compressed, for example, in a suitable form. When run by a computing processing device, this code causes the computing processing device to perform the various steps in the insulator defect detection method described above.
[0203] This invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the insulator defect detection method as described in any of the above embodiments.
[0204] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0205] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0206] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0207] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0208] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0209] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting defects in insulators, characterized in that, include: Obtain the insulator image dataset to be identified, and construct the corresponding training set, validation set, and test set using the insulator image dataset within a preset ratio range; The training set and the validation set are used to train the preset initial insulator semantic segmentation model to determine the target insulator semantic segmentation model; Multiple insulator segmentation images corresponding to the test set are obtained through the target insulator semantic segmentation model; The insulator state corresponding to the segmented insulator image is determined based on the grayscale gradient corresponding to the segmented insulator image. The target insulator semantic segmentation model includes multiple residual learning unit layers and an attention module; The step of obtaining multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model includes: The test images in the test set are convolved by the residual learning unit layer to generate the corresponding initial insulator detection images. The attention module is used to denoise the initial insulator detection image to generate the corresponding intermediate insulator detection image. The dimensions of the initial low-order features corresponding to the detection images of the intermediate insulators are adjusted by an autoencoder neural network to generate the corresponding target low-order features. The initial high-order features corresponding to the detection image of the intermediate insulator are subjected to dilated convolution to generate the corresponding target high-order features. The target high-order features and target low-order features are fused to construct the corresponding insulator segmentation image.
2. The insulator defect detection method according to claim 1, characterized in that, Before the steps of acquiring the insulator image dataset to be identified, using the insulator image dataset within a preset ratio range, and constructing the corresponding training set, validation set, and test set, the method further includes: Obtain multiple images of insulators to be identified; The insulator images are labeled using a semantic segmentation and annotation tool to generate corresponding labeled insulator images; The insulator labeled images are converted into preset formats to generate corresponding insulator converted images; The insulator image dataset is constructed using all the insulator images and all the insulator converted images.
3. The insulator defect detection method according to claim 1, characterized in that, The step of training a preset initial insulator semantic segmentation model using the training set and the validation set to determine the target insulator semantic segmentation model includes: Based on the insulator image dataset, determine the loss function formula corresponding to the preset initial insulator semantic segmentation model; The initial insulator semantic segmentation model is trained using the training set, and the training loss function value corresponding to the training set is calculated using the loss function formula. The initial insulator semantic segmentation model is updated using the training loss function value to generate an intermediate insulator semantic segmentation model; If the training loss function value meets the preset training value, then the validation set is used to validate the semantic segmentation model of the intermediate insulator. If the verification loss function value corresponding to the verification set satisfies the preset verification value, then the intermediate insulator semantic segmentation model at the current time is taken as the target insulator semantic segmentation model.
4. The insulator defect detection method according to claim 3, characterized in that, The loss function formula includes a first loss function formula and a second loss function formula; the step of determining the loss function formula corresponding to the preset initial insulator semantic segmentation model based on the insulator image dataset includes: Based on the insulator image dataset, determine the classification label corresponding to the initial insulator semantic segmentation model; Determine whether the category label is a preset label type; If so, then the first loss function formula shall be used as the loss function formula corresponding to the initial insulator semantic segmentation model; If not, then the second loss function formula shall be used as the loss function formula corresponding to the initial insulator semantic segmentation model.
5. The insulator defect detection method according to claim 1, characterized in that, The step of determining the insulator state corresponding to the segmented insulator image based on the grayscale gradient of the segmented insulator image includes: The segmented insulator images are converted to grayscale using a weighted average method to generate corresponding initial insulator processed images. The initial insulator processing images are noise-filtered using a median filter to generate corresponding intermediate insulator processing images. Histogram equalization is used to enhance the images of the intermediate insulators to generate corresponding processed images of the target insulators. Based on the grayscale gradient corresponding to the target insulator processed image, the insulator state corresponding to the insulator segmentation image is determined.
6. The insulator defect detection method according to claim 5, characterized in that, The insulator state includes a first insulator state and a second insulator state; the step of determining the insulator state corresponding to the segmented insulator image based on the grayscale gradient corresponding to the target insulator processed image includes: The gray-level gradient corresponding to the processed image of the target insulator is calculated using the gray-level co-occurrence matrix method, and the corresponding gray-level co-occurrence matrix is generated. Obtain the contrast, energy transformation value, and entropy corresponding to the gray-level co-occurrence matrix; Determine whether the contrast, the energy transformation value, and the entropy all meet the corresponding preset thresholds; If so, the first insulator state is taken as the insulator state corresponding to the insulator segmentation image; If not, then the second insulator state is taken as the insulator state corresponding to the insulator segmentation image.
7. An insulator defect detection system, characterized in that, include: The training set, validation set, and test set construction module is used to obtain the insulator image dataset to be identified, and to construct the corresponding training set, validation set, and test set using the insulator image dataset within a preset ratio range. The target insulator semantic segmentation model determination module is used to train a preset initial insulator semantic segmentation model using the training set and the validation set, and determine the target insulator semantic segmentation model. An insulator segmentation image acquisition module is used to acquire multiple insulator segmentation images corresponding to the test set through the target insulator semantic segmentation model; An insulator state determination module is used to determine the insulator state corresponding to the segmented insulator image based on the grayscale gradient corresponding to the segmented insulator image. The target insulator semantic segmentation model includes multiple residual learning unit layers and an attention module; The insulator segmentation image acquisition module includes: The initial insulator detection image generation module is used to convolve the test images in the test set through the residual learning unit layer to generate the corresponding initial insulator detection images. The intermediate insulator detection image generation module is used to denoise the initial insulator detection image through the attention module to generate the corresponding intermediate insulator detection image; The target low-order feature generation module is used to adjust the dimensions of the initial low-order features corresponding to the intermediate insulator detection image through an autoencoder neural network to generate the corresponding target low-order features. The target high-order feature generation module is used to perform dilated convolution on the initial high-order features corresponding to the intermediate insulator detection image to generate the corresponding target high-order features; The insulator segmentation image acquisition submodule is used to fuse the target high-order features with the target low-order features to construct the corresponding insulator segmentation image.
8. An electronic device, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the insulator defect detection method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the insulator defect detection method as described in any one of claims 1-6.
Citation Information
Patent Citations
Rice tillering stage weed segmentation identification method based on improved coding and decoding network
CN113610035A
Method and system for detecting appearance quality of printed matter
CN113706464A