Insulator defect sample generation method, related device and defect detection method
By using the generative model of encoder-decoder and discriminator in the insulator defect sample generation method, combined with attention mechanism and other technical means, the problem of poor defect sample generation quality in the existing methods is solved, and higher quality insulator defect sample generation is achieved, and the performance of the detection network is improved.
Patent Information
- Application Number
- CN202411852851.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-07
AI Technical Summary
The existing insulator defect sample generation methods have the problems of overfitting and poor quality of generated samples, and it is difficult to effectively simulate the texture, shape and appearance of real defects.
A method of insulator defect sample generation is proposed, and a defect sample generation model constructed by encoder-decoder and discriminator is used to generate more diverse and authentic defect samples by introducing attention mechanisms, spatial and classification controls, random variations and layer-based synthesis.
It effectively improves the accuracy, authenticity and diversity of insulator defect samples, and significantly improves the performance of insulator defect detection network.
Smart Images

Figure CN119579575A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a sample generation method, and specifically to an insulator defect sample generation method and related devices, and a defect detection method. Background Art
[0002] Insulators play a vital role in substations and are the key to ensuring the safe and stable operation of power systems. At present, the use of deep learning models for insulator defect detection has become a conventional detection method. However, the insulator defect detection model needs to be trained based on a large number of insulator defect samples. However, due to the relatively low frequency of insulator defects, the number of defect samples collected in a short period of time is limited, and it is very difficult to obtain defective insulator samples.
[0003] At present, the generation methods of insulator defect samples mainly retain the traditional image synthesis method and GAN-based generation method, such as Tw_cycle_GAN and defect-GAN, etc. However, these methods still have some shortcomings. For example, when generating defect samples, the model will fall into mode collapse, resulting in overfitting; or it cannot fully simulate the texture, shape and appearance of real defects, resulting in differences between the generated samples and the real defects, and the quality of the generated defect samples is poor. Summary of the invention
[0004] The present application aims to solve the technical problems that the existing insulator defect sample generation method has overfitting and the quality of the generated defect samples is poor, and provides an insulator defect sample generation method and related devices, and a defect detection method.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions: This application proposes a method for generating an insulator defect sample, comprising: Acquire multiple non-defective images of insulators; Inputting a plurality of insulator non-defective images into a defective sample generation model to generate insulator defective samples; The defect sample generation model includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, a hierarchical synthesis module, and a discriminator; In the encoder-decoder, the encoder includes multiple groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes multiple groups of sequentially connected convolutional layers and upsampling modules; an attention mechanism is added between the convolutional layers and downsampling modules of the encoder; an adaptive noise insertion module is provided in each convolutional layer of the encoder and the decoder for introducing random defects; The output end of the spatial and classification control diagram module is connected to an encoder-decoder for adding a preset type of defect to a preset position; The defect foreground module is connected to the output end of the encoder-decoder and is used to extract the layer of the defect part from the defect image output by the encoder-decoder; The layered synthesis module is used to synthesize the layers of the extracted defective parts on multiple insulator non-defective images to generate insulator defect samples; The discriminator is used to distinguish the generated insulator defect samples from the actual insulator defect samples, and identify the defect type.
[0006] Furthermore, the adding of the preset type of defects to the preset position includes: By providing an attribute control map to the encoder-decoder , adding a preset type of defect to a preset position; wherein, and are the horizontal and vertical coordinates of the added defect position respectively.
[0007] Furthermore, the attribute control map is added by SPADE normalization.
[0008] Furthermore, the attention mechanism includes a channel attention mechanism and a spatial attention mechanism.
[0009] Furthermore, the discriminator adopts the discriminator network architecture in StarGAN.
[0010] Furthermore, the loss function used in the defect sample generation model training includes: The loss function of the generator is:
[0011] The generator includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, and a hierarchical synthesis module; is the loss function of the generator, To combat the loss function, is a hyperparameter, is the error domain category classification loss, is a hyperparameter; The loss function of the discriminator is:
[0012] in, is the loss function of the discriminator, is a hyperparameter, is the ground-truth domain classification loss.
[0013] Further,
[0014]
[0015]
[0016] in, For the real sample distribution, expect, To predict the defect category, is the real defect label, is the distribution of real insulator defect samples, Under the generated insulator defect sample distribution, expect, is the target defect label, To generate the distribution of insulator defect samples, For the expectation of real data, is the probability distribution on the source domain given by the generator, is the expectation for the generated insulator defect samples, For the generator.
[0017] In a second aspect, the present application proposes an insulator defect sample generation system, comprising: An acquisition module, used for acquiring a plurality of insulator non-defect images; A generation module, used for inputting a plurality of insulator non-defective images into a defective sample generation model to generate insulator defective samples; The defect sample generation model includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, a hierarchical synthesis module, and a discriminator; In the encoder-decoder, the encoder includes multiple groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes multiple groups of sequentially connected convolutional layers and upsampling modules; an attention mechanism is added between the convolutional layers and downsampling modules of the encoder; an adaptive noise insertion module is provided in each convolutional layer of the encoder and the decoder for introducing random defects; The output end of the spatial and classification control diagram module is connected to an encoder-decoder for adding a preset type of defect to a preset position; The defect foreground module is connected to the output end of the encoder-decoder and is used to extract the layer of the defect part from the defect image output by the encoder-decoder; The layered synthesis module is used to synthesize the layers of the extracted defective parts on multiple insulator non-defective images to generate insulator defect samples; The discriminator is used to distinguish the generated insulator defect samples from the actual insulator defect samples, and identify the defect type.
[0018] In a third aspect, the present application proposes an electronic device, comprising: a memory and one or more processors; the memory is coupled to the processor; wherein the memory stores computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the steps of the above-mentioned insulator defect sample generation method.
[0019] In a fourth aspect, the present application proposes an insulator defect detection method, comprising: Using the above-mentioned insulator defect sample generation method, an insulator defect sample is generated; The insulator defect detection model is trained using multiple normal samples and generated insulator defect samples; The insulator image is input into the trained insulator defect detection model to obtain the insulator defect detection result.
[0020] Compared with the prior art, this application has the following beneficial effects: The present application proposes a method for generating defective samples of insulators. Through a defective sample generation model, defective samples of insulators are generated from non-defective images of insulators. The defective sample generation model is constructed based on an encoder-decoder and a discriminator. The encoder-decoder, a spatial and classification control diagram module, a defect foreground module, and a hierarchical synthesis module constitute a generator. The generator introduces style vectors, attention mechanisms, spatial and classification control, random changes, and layer-based synthesis, which can effectively improve the accuracy, authenticity, and diversity of insulator defect sample generation, and generate insulator defects while retaining the style and appearance of the provided background. The discriminator can be used to judge true and false samples and predict the defect type of the generated defective samples. The generator and the discriminator compete with each other and are continuously optimized. Therefore, the sample generation method of the present application can generate insulator defect samples with more authenticity, accuracy, and diversity, thereby further significantly improving the performance of the insulator defect detection network in the substation.
[0021] The present application also proposes an insulator defect sample generation system, an electronic device and an insulator defect detection method, which have all the advantages of the above-mentioned insulator defect sample generation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0023] Figure 1A schematic diagram of the first process of the method for generating defect samples of insulators of the present application; Figure 2 Schematic diagram of generating a model for a defect sample; Figure 3 Schematic diagram of the principle of the discriminator D; Figure 4 This is a schematic diagram of the insulator defect sample detection results generated in an embodiment of the present application; Figure 5 A schematic diagram of the insulator defect sample generation system of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0025] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0026] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0027] In the description of the embodiments of the present application, it should be noted that if the terms "upper", "lower", "horizontal", "inner", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, or the orientation or position relationship in which the invented product is usually placed when used. It is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0028] In addition, if the term "horizontal" appears, it does not mean that the component must be absolutely horizontal, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", which does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0029] In the description of the embodiments of the present application, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0030] In order to detect and deal with insulator defects in a timely manner, the use of deep learning models for defect detection has become a conventional method. However, this method faces a significant challenge: it is extremely difficult to obtain insulator defect samples. Since insulators themselves have high durability, self-repair and elimination mechanisms, and strict manufacturing processes, quality control and operation and maintenance, they can operate stably for a long time under harsh environmental conditions and maintain a low defect rate. Therefore, insulator defects are not common. Therefore, it is almost impossible to collect a sufficient number of defect samples in a short period of time. In order to overcome this problem, using deep learning technology to generate a large number of realistic defective insulator images has become a very promising solution.
[0031] At present, the methods for generating insulator defect samples are mainly divided into traditional image synthesis methods and methods based on generative adversarial networks. Among them, although traditional image synthesis methods can generate some defect samples, they usually rely on image processing and computer graphics technology, and need to generate defect samples through manual design or algorithm. They may not be able to accurately simulate the real texture, shape and appearance of insulator defects, resulting in obvious visual differences between the generated samples and the real defects. In addition, since traditional methods often generate defect samples based on preset templates or algorithms, the generated samples may be limited in diversity and cannot cover all possible defect types and forms. The method based on generative adversarial networks can generate more realistic and diverse image samples through adversarial training of generators and discriminators. However, generative adversarial networks may have mode collapse problems during training, that is, the generator only generates a few defect samples and cannot cover all possible defect types and forms. In addition, although generative adversarial networks can generate realistic image samples, they may still be insufficient in simulating some details of real defects, such as the texture, shape and appearance of defects may be slightly different from real defects. Furthermore, the training process of the generative adversarial network is relatively complex and unstable, requiring careful parameter adjustment and a large amount of computing resources. The generative adversarial network also has poor adaptability to small sample data and is prone to overfitting or underfitting problems.
[0032] Based on the above situation, the present application proposes an insulator defect sample generation method and related devices, and a defect detection method. The present application is described in detail below in conjunction with embodiments and drawings.
[0033] like Figure 1 As shown, it is a first flow chart of the method for generating defect samples of insulators of the present application, which may include: S101, acquiring a plurality of non-defective images of insulators.
[0034] In practical applications, non-defective images of insulators can be obtained through on-site photography, online collection, or existing image databases. In order to ensure the diversity and authenticity of the generated samples, the collected images can cover a variety of situations such as different angles, lighting conditions, and background environments. At the same time, the acquired images can also be pre-processed, such as cropping, scaling, and normalization, to eliminate irrelevant factors in the image and improve the efficiency and accuracy of subsequent processing.
[0035] S102, inputting a plurality of insulator non-defective images into a defective sample generation model to generate insulator defective samples.
[0036] This application can generate insulator samples with various defects through the calculation and reasoning of the defect sample generation model. This model is built based on deep learning technology, which can automatically learn the characteristics and laws of insulator defects and generate realistic defect samples. By adjusting the parameters and settings of the model, defect samples of different types and severity can be generated to meet the needs of different application scenarios.
[0037] like Figure 2 As shown, it is a schematic diagram of a defect sample generation model. The defect sample generation model may include an encoder-decoder, a spatial and classification control map module, a defect foreground module, a hierarchical synthesis module, and a discriminator; In the encoder-decoder, the encoder includes multiple groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes multiple groups of sequentially connected convolutional layers and upsampling modules; an attention mechanism is added between the convolutional layers and downsampling modules of the encoder; and an adaptive noise insertion module is provided in each convolutional layer of the encoder and the decoder to introduce random defects. The encoder-decoder is the core part of the defect sample generation model, which converts the input non-defective image into an image with defects. The encoder gradually extracts high-level features of the image through multiple groups of convolutional layers and downsampling modules, and adds an attention mechanism between the convolutional layers and downsampling modules to focus on important areas and details in the image. The decoder gradually restores the extracted features to images through multiple groups of convolutional layers and upsampling modules, and sets an adaptive noise insertion module in each convolutional layer to introduce random defects and increase the diversity and fidelity of the generated samples.
[0038] The output end of the spatial and classification control diagram module is connected to the encoder-decoder, which is used to add the preset type of defects to the preset position. The spatial and classification control diagram module is used to control the type and position of the defects, generate the corresponding spatial and classification control diagram according to the preset defect type and position information, and pass it as input to the encoder-decoder, and the encoder-decoder can add the specified type of defects at the specified position according to the information of the control diagram.
[0039] The defect foreground module is connected to the output of the encoder-decoder and is used to extract the defective part layer from the defective image output by the encoder-decoder. Through a series of image processing techniques, such as threshold segmentation and edge detection, the defective part is separated from the background to generate a layer containing only the defect. In this way, this layer can be synthesized onto other non-defective images to generate more defective samples.
[0040] The layered synthesis module is used to synthesize the extracted defective layer onto multiple insulator non-defective images to generate insulator defect samples. The layered synthesis module is responsible for synthesizing the extracted defective layer onto multiple non-defective images. The defective layer can be merged with the background image according to preset synthesis rules, such as position, size, angle, etc., to generate defective insulator samples. By adjusting the synthesis rules, defective samples in different scenes and angles can be generated, thereby improving the diversity and practicality of the generated samples.
[0041] The discriminator is used to distinguish the true and false between the generated insulator defect samples and the actual insulator defect samples, and identify the defect type. The discriminator is a module used to evaluate the quality of the generated samples. By distinguishing the true and false between the generated insulator defect samples and the actual insulator defect samples, and identifying the defect type, the fidelity and diversity of the generated samples are evaluated. The output of the discriminator can be used as a feedback signal for the training of the generation model to guide the continuous optimization and improvement of the model to generate more realistic defect samples.
[0042] like Figure 2 As shown, it is a second flow chart of the method for generating insulator defect samples of the present application, which may include: S201, construct an insulator dataset.
[0043] 2000 insulator image samples were collected, including 1900 normal samples and 10 defective samples. LabelImg annotation software was used to annotate the defective samples in the insulator dataset, and the data was rotated and cropped. The defect types can include string drop, breakage, shed contamination, self-explosion, etc.
[0044] When it is necessary to train the defect sample generation model, 90% of the data set can be used for model training and 10% for model testing. This ratio can also be adjusted according to the training situation.
[0045] S202, constructing a defect sample generation model.
[0046] The defect sample generation model structure of the present application includes two parts: a generator G and a discriminator D. The generator generates images that are as realistic as possible based on the collected defect data to deceive the discriminator, which determines the authenticity of the samples generated by the generator G and the type of generated defects. The generator and the discriminator are continuously optimized through mutual competition and confrontation, and ultimately the defect sample generation model generates high-quality images with defects.
[0047] In this embodiment, in the encoder-decoder structure, the encoder includes four groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes four groups of sequentially connected convolutional layers and upsampling modules. The encoder first extracts features from the input image, and then decodes it to the original image size through the decoder. In addition, in order to improve the realism and diversity of defect-generated images, the attention mechanism, spatial and classification control, random changes, and layer-based synthesis are introduced in the generator G.
[0048] (1) Channel attention and spatial attention are added to the convolutional layer and downsampling module of the encoder. Channel attention focuses on the importance of different feature channels, and the spatial attention mechanism focuses on the importance of positions in the feature map, enabling the model to learn defect features faster and more accurately.
[0049] In practical applications, channel attention is a mechanism that focuses on the importance distribution of feature map channels in convolutional neural networks. By assigning different weights to each channel, it emphasizes the channels that contribute most to the task and suppresses irrelevant or redundant channels, thereby improving the performance of the model. In the process of convolution downsampling, the channel attention mechanism can be applied after the convolution layer to weight the feature map output by the convolution layer in the channel dimension to highlight the channel features that are important to the task. Spatial attention is a mechanism that focuses on the importance distribution of the spatial dimension of the feature map. By weighting specific spatial positions in the feature map, it highlights the areas that contribute most to the task and suppresses irrelevant or redundant areas to improve the performance of the model. The spatial attention mechanism can also be applied after the convolution layer to weight the feature map output by the convolution layer in the spatial dimension to highlight the spatial areas that are important to the task. In practical applications, channel attention and spatial attention can be used in combination to improve the overall performance of the model. For example, the channel attention and spatial attention modules are connected in series to form a hybrid attention module. In the process of convolution downsampling, the channel attention module can be first applied to weight the feature map in the channel dimension, and then the spatial attention module can be applied to weight the feature map in the spatial dimension. This can simultaneously emphasize the channel features and spatial regions that are important to the task, further improving the segmentation effect of the model.
[0050] (2) Spatial and classification control chart module: Different types of defects can exist in different locations of normal samples. In the introduced spatial and classification control method, an attribute control map is mapped to Provided to the generator G, a specific type of defect is added to a specific location, where , indicating the existence of defects at the corresponding position, and C represents the number of defect categories. SPADE normalization is applied to the network and fed back into each block of the decoder of the generator G, enabling the model to generate defects of specific types and locations.
[0051] (3) An adaptive noise insertion module is added to each block of the encoder-decoder architecture to inject Gaussian noise into the feature map after each convolution block to produce defect samples with higher diversity.
[0052] (4) In the defect foreground module and the layered synthesis module, a layer-based synthesis method is adopted to add a defect foreground layer to the provided normal sample to generate the final defect sample. The background and texture information of the image are considered when generating defects, thereby generating defect samples with specific appearance.
[0053] (5) The discriminator D in this application uses the same network architecture as the discriminator in StarGAN. Figure 3The figure shows the principle diagram of the discriminator D. The generated insulator defect samples and the real defect sample images are input into the discriminator D to distinguish the authenticity of the images and classify the domain (defect type) to which the images belong.
[0054] In addition, it should be noted that in StarGAN, the discriminator is mainly responsible for distinguishing whether the input image is real or generated by the generator, and determining the target domain to which the image belongs. The discriminator is mainly composed of convolutional layers, which are used to extract the features of the input image. Common activation functions such as ReLU are applied after the convolutional layer to increase the nonlinear expression ability of the network. The discriminator can complete the two tasks of true and false discrimination and domain classification at the same time. Therefore, its output part usually contains multiple branches, corresponding to different loss functions. The loss functions used usually include: Adversarial loss: It is the core of the adversarial competition between the discriminator and the generator. The discriminator tries to minimize the misclassification rate of generated images, while the generator tries to maximize the acceptance rate of generated images.
[0055] Domain classification loss: For real images, the discriminator also needs to minimize the error rate of image domain classification to ensure that it can accurately determine the target domain to which the image belongs.
[0056] In this embodiment, the loss function used in the defect sample generation model training process is specifically: In order to ensure the authenticity of the generated image, adversarial loss is used, where E represents the expected value of the distribution function. represents the distribution of real samples, w represents the distribution of generated samples, The bigger, the The larger it is, the more accurately the discriminator can identify real samples as real samples. The bigger, the The smaller it is, the better the discriminator can correctly distinguish false samples.
[0057]
[0058] In this application, a target defect label e∈ is also set In order to make the generated defects consistent with the target category, a category classification loss is imposed, which mainly consists of two items: Optimize D by classifying the real defect samples into the corresponding categories e', By optimizing G to generate defect samples of target category e, represents the real defect sample, To predict the defect category.
[0059]
[0060]
[0061] Using reconstruction loss Helps preserve the content of the input image as much as possible. p represents a real defect sample, Denotes the generated defective sample. In this application, L1 loss is used as the reconstruction loss. The parameters are continuously adjusted through this error to generate data that is closer to the real sample.
[0062]
[0063] in, Represents the expected value of the distribution function.
[0064] The final loss functions of the generator G and the discriminator D are:
[0065]
[0066] in, The empirical values of the hyperparameters are 2.0, 5.0, and 5.0 respectively.
[0067] S203, model training and evaluation.
[0068] The defect sample generation model constructed based on this application is trained and tested. First, different insulator defect samples are generated, and then the generated insulator defect samples are tested. The results are as follows: Figure 4 As shown, it can be seen that the present application can generate relatively realistic defect samples.
[0069] 90% of the images in the constructed classification dataset are used for training. All images are resized to 128×128 for training. The Adam optimizer is used. = 0.5, = 0.999, the learning rate of training is arrive . Set the batch size to 4 and the total number of training iterations to 2000. is the first-order moment attenuation coefficient, is the second-order moment attenuation coefficient.
[0070] S204, defect sample generation result analysis.
[0071] In order to evaluate the training effect of the model, this application uses the initial distance FID evaluation model to evaluate the authenticity of the synthetic defect samples. The model uses the pre-trained Inception network to extract the features of the generated samples and the real samples. The mean and covariance of the generated samples and the real samples are calculated for the extracted feature distribution. The formula of this method is:
[0072] in, g and r represent the generated image and the real image respectively, and represents the mean of their respective eigenvectors, and represents the covariance matrix of the respective eigenvectors, and Tr represents the trace of the matrix.
[0073] The lower the FID score, the better the authenticity of the generated insulator defect sample. As shown in Table 1: Table 1. FID evaluation results.
[0074]
[0075] The first row (first part) of the "Methods" column is the direct synthesis method, and the first row (second part) of the "Methods" column is the image-to-image translation method. Due to the lack of defect training samples, the results of the direct synthesis method are not ideal. In contrast, the image-to-image translation method can generate defects with significantly better quality. The FID evaluation results of the insulator defect sample generation method based on the generative adversarial network in this application are significantly better, indicating that the samples it generates are closer to the real samples, showing its advantages in defect generation.
[0076] The ablation experiment in Table 2 further demonstrates the effectiveness of the present invention.
[0077] Table 2 Comparison of ablation experiments
[0078] The attention mechanism proposed in this application achieves more precise attention to defect images, and by combining spatial and classification control (SCC), it can converge and generate defect samples with quality comparable to existing methods. Layered synthesis (LWC) can significantly improve the realism of synthesis. Adaptive noise injection (ANI) and additional spatial constraint (SC) training can also improve defect synthesis performance. These proposed components are proven to complement each other, enabling defect generation to achieve state-of-the-art defect generation quality.
[0079] like Figure 5 FIG. 1 is a schematic diagram of a system for generating defect samples of insulators of the present application, which may include: An acquisition module, used for acquiring a plurality of insulator non-defect images; A generation module, used for inputting a plurality of insulator non-defective images into a defective sample generation model to generate insulator defective samples; The defect sample generation model includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, a hierarchical synthesis module, and a discriminator; In the encoder-decoder, the encoder includes multiple groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes multiple groups of sequentially connected convolutional layers and upsampling modules; an attention mechanism is added between the convolutional layers and downsampling modules of the encoder; an adaptive noise insertion module is provided in each convolutional layer of the encoder and the decoder for introducing random defects; The output end of the spatial and classification control diagram module is connected to an encoder-decoder for adding a preset type of defect to a preset position; The defect foreground module is connected to the output end of the encoder-decoder and is used to extract the layer of the defect part from the defect image output by the encoder-decoder; The layered synthesis module is used to synthesize the layers of the extracted defective parts on multiple insulator non-defective images to generate insulator defect samples; The discriminator is used to distinguish the generated insulator defect samples from the actual insulator defect samples, and identify the defect type.
[0080] It should be noted that in the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of each module is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another device, or some features can be ignored or not executed. The module described as a separate component may or may not be physically separated. The component displayed as a module may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0081] In addition, each module in each embodiment of the present invention may be integrated into a processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0082] An embodiment of the present application also provides an electronic device, which may include one or more processors, a memory, and a communication interface.
[0083] The memory, the communication interface and the processor are coupled, for example, the memory, the communication interface and the processor may be coupled together via a bus.
[0084] The communication interface is used for data transmission with other devices. The memory stores computer program code. The computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the steps of the above-mentioned insulator defect sample generation method.
[0085] Wherein, the processor can be a processor or a controller, for example, a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the present disclosure. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessors, and the like. The processor can be used to support electronic devices to execute the method steps provided in the above embodiments.
[0086] The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The above bus may be divided into an address bus, a data bus, a control bus, etc.
[0087] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned insulator defect sample generation method are implemented.
[0088] The computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.
[0089] For the description of the relevant parts of the insulator defect sample generation system, electronic device, and computer-readable storage medium provided in the embodiments of the present application, please refer to the detailed description of the corresponding parts in the insulator defect sample generation method provided in the embodiments of the present application, which will not be repeated here. In addition, the parts of the above technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.
[0090] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating insulator defect samples, characterized in that: include: Acquire multiple non-defective images of insulators; Inputting a plurality of insulator non-defective images into a defective sample generation model to generate insulator defective samples; The defect sample generation model includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, a hierarchical synthesis module, and a discriminator; In the encoder-decoder, the encoder includes multiple groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes multiple groups of sequentially connected convolutional layers and upsampling modules; an attention mechanism is added between the convolutional layers and downsampling modules of the encoder; an adaptive noise insertion module is provided in each convolutional layer of the encoder and the decoder for introducing random defects; The output end of the spatial and classification control diagram module is connected to an encoder-decoder for adding a preset type of defect to a preset position; The defect foreground module is connected to the output end of the encoder-decoder and is used to extract the layer of the defect part from the defect image output by the encoder-decoder; The layered synthesis module is used to synthesize the layers of the extracted defective parts on multiple insulator non-defective images to generate insulator defect samples; The discriminator is used to distinguish the generated insulator defect samples from the actual insulator defect samples, and identify the defect type.
2. The method for generating insulator defect samples according to claim 1, characterized in that: The step of adding a preset type of defect to a preset position includes: By providing an attribute control map to the encoder-decoder , adding a preset type of defect to a preset position; wherein, and are the horizontal and vertical coordinates of the added defect position respectively.
3. The method for generating insulator defect samples according to claim 2, characterized in that: The attribute control map is added by SPADE normalization.
4. The method for generating insulator defect samples according to claim 1, characterized in that: The attention mechanism includes a channel attention mechanism and a spatial attention mechanism.
5. The method for generating insulator defect samples according to claim 1, characterized in that: The discriminator adopts the discriminator network architecture in StarGAN.
6. The method for generating insulator defect samples according to claim 1, characterized in that: The loss function used in the defect sample generation model training includes: The loss function of the generator is: The generator includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, and a hierarchical synthesis module; is the loss function of the generator, To combat the loss function, is a hyperparameter, is the error domain category classification loss, is a hyperparameter; The loss function of the discriminator is: in, is the loss function of the discriminator, is a hyperparameter, is the ground-truth domain classification loss.
7. The method for generating insulator defect samples according to claim 6, characterized in that: in, For the real sample distribution, expect, To predict the defect category, is the real defect label, is the distribution of real insulator defect samples, Under the generated insulator defect sample distribution, expect, is the target defect label, To generate the distribution of insulator defect samples, For the expectation of real data, is the probability distribution on the source domain given by the generator, is the expectation for the generated insulator defect samples, For the generator.
8. An insulator defect sample generation system, characterized in that: include: An acquisition module, used for acquiring a plurality of insulator non-defect images; A generation module, used for inputting a plurality of insulator non-defective images into a defective sample generation model to generate insulator defective samples; The defect sample generation model includes an encoder-decoder, a spatial and classification control map module, a defect foreground module, a hierarchical synthesis module, and a discriminator; In the encoder-decoder, the encoder includes multiple groups of sequentially connected convolutional layers and downsampling modules, and the decoder includes multiple groups of sequentially connected convolutional layers and upsampling modules; an attention mechanism is added between the convolutional layers and downsampling modules of the encoder; an adaptive noise insertion module is provided in each convolutional layer of the encoder and the decoder for introducing random defects; The output end of the spatial and classification control diagram module is connected to an encoder-decoder for adding a preset type of defect to a preset position; The defect foreground module is connected to the output end of the encoder-decoder and is used to extract the layer of the defect part from the defect image output by the encoder-decoder; The layered synthesis module is used to synthesize the layers of the extracted defective parts on multiple insulator non-defective images to generate insulator defect samples; The discriminator is used to distinguish the generated insulator defect samples from the actual insulator defect samples, and identify the defect type.
9. An electronic device, characterized in that: include: A memory, one or more processors; the memory is coupled to the processor; wherein the memory stores a computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the steps of the insulator defect sample generation method according to any one of claims 1 to 7.
10. A method for detecting insulator defects, characterized in that: include: Using the insulator defect sample generation method according to any one of claims 1 to 7 to generate an insulator defect sample; The insulator defect detection model is trained using multiple normal samples and generated insulator defect samples; The insulator image is input into the trained insulator defect detection model to obtain the insulator defect detection result.