A model training method, a fault identification method and system

CN122888321APending Publication Date: 2026-10-09YUNNAN POWER GRID CO LTD ELECTRIC POWER RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611076448.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0004]本发明申请提供了一种模型训练方法、故障识别方法及系统,以解决如何优化训练好的模型的性能的技术问题

Benefits of technology

本发明申请提供了一种模型训练方法、故障识别方法及系统,本发明申请通过自编码器解码器的多个第一层级输出层输出不同粒度的重构特征,并将其除最终输出层外的重构特征与样本图像共同构成多层级真样本,同时生成器的多个第二层级输出层输出不同粒度的生成特征作为多层级假样本,将真/假样本按层级对应输入判别器进行分层监督。这种多层级特征对齐机制使得判别器能够在从粗粒度到细粒度的多个尺度上对生成特征进行逐层校验,生成器被强制在每一层级都产生正确的特征表达,从而有效保留了微小缺陷的局部细节特征,避免了现有技术中仅依赖最终输出层单一监督导致微小特征被当作噪声滤除的问题,可以更好地优化目标模型的性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122888321A_ABST
    Figure CN122888321A_ABST
Patent Text Reader

Abstract

The application provides a model training method, a fault identification method and a system. A to-be-trained model comprises a self-encoder, a discriminator and a generator. The self-encoder comprises a decoder. The method comprises the following steps: obtaining a sample image with a hierarchical structured label. The hierarchical structured label comprises a plurality of sub-labels, and each sub-label corresponds to a level. The self-encoder is pre-trained to obtain reconstruction features of different granularities. The hierarchical structured label is input into the generator to obtain generated features of different granularities and serve as multi-level fake samples. The reconstruction features output by each first level output layer except the final output layer are extracted and combined with the sample image to form multi-level real samples. The hierarchical structured label is input into the discriminator according to the levels to obtain a discrimination loss and a classification loss of each level, which are used for parameter updating of the generator and the discriminator to obtain a target model. The application can optimize the performance of the trained target model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention application relates to the field of generative adversarial networks, and more particularly to a model training method, a fault identification method, and a system. Background Technology

[0002] In industrial applications such as defect detection in power distribution equipment (e.g., power poles), due to the scarcity of real defect samples and the small inter-class differences, Generative Adversarial Networks (GANs) and their variants, such as Auxiliary Classifier Variational Autoencoder Generative Adversarial Neural Networks (AC-VAEGANs), are often used for few-shot data augmentation. To more accurately control the attributes of generated samples, model training typically incorporates a classification-aided mechanism, inputting image label information as conditional features into the network. In these practical applications, fault categories often do not possess a single attribute but rather exhibit a rigorous hierarchical structure. Therefore, effectively utilizing this structured hierarchical classification information to guide model training and enhance the expressive power of generated samples in high-dimensional feature spaces is the core research background of current conditional generative models in the field of few-shot data augmentation.

[0003] Existing classification-assisted generation models typically employ single supervision at the final output layer or additional multimodal semantic supplementation at different network layers of the generator when processing the aforementioned hierarchical fault data. However, from the perspective of underlying logical consistency, this approach contains an irreconcilable contradiction: relying solely on the weighted summation of global classification and true / false judgment signals at the final output layer makes it difficult for the network to capture multi-scale hierarchical semantics. This makes the local features of minute defects (such as small cracks in insulators) easily filtered out as high-frequency noise during the denoising process, failing to effectively widen the feature space distance between appearance-similar subclasses in cases with few samples. Therefore, in scenarios with few samples, the model struggles to controllably learn multi-scale fine-grained features using hierarchical labels, which affects the model's training effect and performance at the end of training. Summary of the Invention

[0004] This invention application provides a model training method, a fault identification method, and a system to solve the technical problem of how to optimize the performance of a trained model.

[0005] To address the aforementioned technical problems, this invention provides a model training method, wherein the model to be trained includes an autoencoder, a discriminator, and a generator; wherein the autoencoder includes a decoder, the decoder includes multiple first-level output layers; and the generator includes multiple second-level output layers. The model training method includes: Obtain sample images with hierarchical structured labels; wherein, the hierarchical structured labels include multiple sub-labels, and each sub-label corresponds to a hierarchy; The autoencoder is pre-trained based on sample images to obtain reconstructed features of different granularities output by each first-level output layer. The hierarchical structured labels are input into the generator to obtain the generated features of different granularities output by each second-level output layer, which are then used as multi-level fake samples. Extract the reconstructed features from the outputs of each first-level output layer except the final output layer, and combine them with the sample images to form multi-level real samples; input the multi-level real samples and multi-level fake samples into the discriminator according to their level correspondence; Based on the output of the discriminator, the discriminant loss and classification loss of each level are obtained; the parameters of the generator and discriminator are updated using the discriminant loss and classification loss to obtain the target model.

[0006] As a preferred embodiment, the decoder includes three first-level output layers, which are arranged in order of output granularity from coarse to fine: a first decoding layer, a second decoding layer, and the final output layer. The multi-level true samples include three levels, wherein the first level true samples are composed of the reconstructed features output by the first decoding layer, the second level true samples are composed of the reconstructed features output by the second decoding layer, and the third level true samples are composed of the sample images.

[0007] The plurality of second-level output layers are arranged in order of increasing output granularity, including a first generation layer, a second generation layer, and an image generation layer; the first generation layer is used to output coarse-grained features, the second generation layer is used to output fine-grained features, and the image generation layer is used to output the final generated image.

[0008] As a preferred embodiment, the method for obtaining the classification loss includes: The sub-labels corresponding to each level are compared with the classification results output by the discriminator at the corresponding level, and the classification loss of each level is obtained based on the comparison results.

[0009] As a preferred embodiment, the discriminator includes multiple hierarchical branches, with each hierarchical branch corresponding to a different level; each hierarchical branch includes a shared feature extraction network, a true / false discrimination network, and a classification network; The shared feature extraction network is used to extract features from real or fake samples input to the branch level to obtain shared features; the true / false discrimination network and the classification network are used to perform true / false discrimination and classification based on the shared features, respectively.

[0010] As a preferred embodiment, the step of updating the parameters of the generator and discriminator using discriminant loss and classification loss includes: In each of the aforementioned hierarchical branches, the parameters of the classification network are updated using the classification loss, the parameters of the true / false discrimination network are updated using the discrimination loss, and the parameters of the shared feature extraction network are updated using the weighted result of the classification loss and the discrimination loss.

[0011] As a preferred embodiment, the step of inputting hierarchical structured tags into the generator includes: Input the sample image into a preset variational autoencoder to obtain the variational autoencoder encoding; The random noise, the variational autoencoder encoding, and the hierarchical structured label are fused together and then input into the generator.

[0012] As a preferred embodiment, the parameter update method for the generator includes: At each level, the adversarial loss of the generator at the corresponding level is determined based on the discriminant loss at the discriminator level. The classification loss of the generator at the corresponding level is determined based on the classification loss of the discriminator level; The total classification loss is obtained by weighted summing of the classification losses of the generator at each level. The local network parameters corresponding to each level in the generator are updated based on the adversarial loss of the generator at each level, and the overall network parameters of the generator are updated based on the total classification loss.

[0013] Accordingly, this application also provides a fault identification method for power distribution towers, comprising: obtaining a trained target model by employing the model training method described in any of the above embodiments; acquiring an image of the power distribution tower to be identified; inputting the image to be identified into the target model; and obtaining a fault identification result.

[0014] Accordingly, this application also provides a model training system, wherein the model to be trained includes an autoencoder, a discriminator, and a generator; wherein the autoencoder includes a decoder, the decoder includes multiple first-level output layers; and the generator includes multiple second-level output layers. The model training system includes an image acquisition module, a pre-training module, a generator input module, a discriminator input module, and a parameter update module; wherein, The image acquisition module is used to acquire sample images with hierarchical structured labels; wherein, the hierarchical structured labels include multiple sub-labels, and each sub-label corresponds to a hierarchy; The pre-training module is used to pre-train the autoencoder based on sample images to obtain reconstructed features of different granularities output by each first-level output layer. The generator input module is used to input hierarchical structured labels into the generator to obtain generation features of different granularities output by each second-level output layer and use them as multi-level fake samples. The discriminator input module is used to extract the reconstructed features of each first-level output layer except the final output layer and combine them with the sample image to form a multi-level real sample; the multi-level real sample and the multi-level fake sample are input into the discriminator according to the level correspondence; The parameter update module is used to obtain the discrimination loss and classification loss of each level based on the output of the discriminator; and to update the parameters of the generator and discriminator through the discrimination loss and classification loss to obtain the target model.

[0015] As a preferred embodiment, the decoder includes three first-level output layers, which are arranged in order of output granularity from coarse to fine: a first decoding layer, a second decoding layer, and the final output layer. The multi-level true samples include three levels, wherein the first level true samples are composed of the reconstructed features output by the first decoding layer, the second level true samples are composed of the reconstructed features output by the second decoding layer, and the third level true samples are composed of the sample images.

[0016] The plurality of second-level output layers are arranged in order of increasing output granularity, including a first generation layer, a second generation layer, and an image generation layer; the first generation layer is used to output coarse-grained features, the second generation layer is used to output fine-grained features, and the image generation layer is used to output the final generated image.

[0017] As a preferred embodiment, the method for obtaining the classification loss includes: The sub-labels corresponding to each level are compared with the classification results output by the discriminator at the corresponding level, and the classification loss of each level is obtained based on the comparison results.

[0018] As a preferred embodiment, the discriminator includes multiple hierarchical branches, with each hierarchical branch corresponding to a different level; each hierarchical branch includes a shared feature extraction network, a true / false discrimination network, and a classification network; The shared feature extraction network is used to extract features from real or fake samples input to the branch level to obtain shared features; the true / false discrimination network and the classification network are used to perform true / false discrimination and classification based on the shared features, respectively.

[0019] As a preferred embodiment, the parameter update module updates the parameters of the generator and discriminator using discriminant loss and classification loss, including: In each of the aforementioned hierarchical branches, the parameter update module updates the parameters of the classification network using the classification loss, updates the parameters of the true / false discrimination network using the discrimination loss, and updates the parameters of the shared feature extraction network using the weighted result of the classification loss and the discrimination loss.

[0020] As a preferred embodiment, the generator input module inputs hierarchical structured tags into the generator, including: The generator input module inputs the sample image into a preset variational autoencoder to obtain the variational autoencoder encoding; The random noise, the variational autoencoder encoding, and the hierarchical structured label are fused together and then input into the generator.

[0021] As a preferred embodiment, the parameter update method for the generator includes: At each level, the adversarial loss of the generator at the corresponding level is determined based on the discriminant loss at the discriminator level. The classification loss of the generator at the corresponding level is determined based on the classification loss of the discriminator level; The total classification loss is obtained by weighted summing of the classification losses of the generator at each level. The local network parameters corresponding to each level in the generator are updated based on the adversarial loss of the generator at each level, and the overall network parameters of the generator are updated based on the total classification loss.

[0022] Accordingly, this invention application also provides a fault identification system for power distribution towers, including a model training module and a fault identification module; wherein, The model training module uses the model training method described above to obtain a trained target model. The fault identification module is used to acquire the image of the power distribution tower to be identified, input the image to be identified into the target model, and obtain the fault identification result.

[0023] Accordingly, this application also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the model training method or the fault identification method for power distribution towers.

[0024] Accordingly, this application also provides a computer-readable storage medium, which includes a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the model training method or the fault identification method for power distribution towers.

[0025] Compared with the prior art, this invention application has the following beneficial effects: This invention provides a model training method, a fault identification method, and a system. The invention utilizes multiple first-level output layers of an autoencoder decoder to output reconstructed features of different granularities. These reconstructed features, excluding the final output layer, are combined with sample images to form multi-level true samples. Simultaneously, multiple second-level output layers of the generator output generated features of different granularities as multi-level false samples. The true / false samples are input into a discriminator according to their corresponding levels for hierarchical supervision. This multi-level feature alignment mechanism enables the discriminator to perform layer-by-layer verification of generated features at multiple scales, from coarse to fine granular. The generator is forced to produce correct feature representations at each level, effectively preserving the local details of minor defects. This avoids the problem in existing technologies where relying solely on the final output layer for supervision leads to the filtering out of minor features as noise, thus better optimizing the performance of the target model.

[0026] Furthermore, the hierarchical structured labels in this invention application include multiple sub-labels, each corresponding to a level, and the discriminator classifies according to the corresponding level. This means that each level only needs to process classification tasks that match the granularity of that level. Compared to the existing technology that stacks all hierarchical classification tasks in the final output layer for global classification, this divide-and-conquer strategy can more finely distinguish samples that are similar in appearance but belong to different subclasses under conditions of few samples, effectively widening the distance between different categories in the high-dimensional feature space and enhancing the model's fine-grained feature expression capability. Attached Figure Description

[0027] Figure 1 This is a flowchart illustrating an embodiment of the model training method provided in this invention application.

[0028] Figure 2 This is a schematic diagram of the model structure of one embodiment of the model to be trained provided in this application.

[0029] Figure 3 This is a schematic diagram of an embodiment of the model training system provided in this application. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] Example 1 Please refer to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the model training method provided in this invention application.

[0032] In this embodiment, the schematic diagram of the model structure of the model to be trained is as follows: Figure 2 As shown. The model to be trained includes at least an autoencoder (AE), a discriminator, and a generator; the autoencoder includes a decoder, which includes multiple first-level output layers; the generator includes multiple second-level output layers.

[0033] Specifically, the overall training process in this embodiment can be divided into three core stages: the first stage is the pre-training stage of the preset variational autoencoder (VAE), which uses real samples to pre-train the VAE and learn the latent spatial representation of high-dimensional data; the second stage is the pre-training stage of the autoencoder of the model to be trained, which independently pre-trains the autoencoder based on sample images to enable it to acquire the ability to reconstruct multi-level features of real samples; the third stage is the multi-level joint adversarial training stage, which uses the pre-trained autoencoder as the teacher model and the generator as the student model, and jointly trains the generator and discriminator through truncated hierarchical guidance and adversarial mechanism to finally obtain the target model.

[0034] Regarding the multi-layer structure of the decoder, in some preferred embodiments, the decoder includes three first-level output layers, which are arranged in order of output granularity from coarse to fine: a first decoding layer, a second decoding layer, and the final output layer. The multi-level true samples include three levels, wherein the first level true samples are composed of the reconstructed features output by the first decoding layer, the second level true samples are composed of the reconstructed features output by the second decoding layer, and the third level true samples are composed of the sample images.

[0035] Accordingly, the multi-level true samples include three levels, where the first-level true samples are composed of the reconstructed features output by the first decoding layer, the second-level true samples are composed of the reconstructed features output by the second decoding layer, and the third-level true samples are composed of the sample images (i.e., the original real images). It should be specifically noted that the reconstructed samples output by the final output layer (third layer) of the autoencoder's decoder are deliberately excluded during the construction of true samples. The core logic is as follows: The autoencoder serves only as a teacher model to guide the generator to converge quickly. Its first two layers of output guide the generator to perform dimensionality reduction and noise reduction optimization according to a specific feature path. However, in order to prevent the autoencoder's own reconstruction capability from limiting the learning upper limit of the generative adversarial network, the original real images are directly used as real samples to guide the discriminator's highest layer. This ensures that the model ultimately learns the most essential real sample distribution, rather than simply fitting the autoencoder's transformation output.

[0036] Regarding the multi-layer structure of the generator, preferably, the plurality of second-level output layers include a first generation layer, a second generation layer, and an image generation layer in order of output granularity from coarse to fine; the first generation layer is used to output coarse-grained features, the second generation layer is used to output fine-grained features, and the image generation layer is used to output the final generated image.

[0037] In this embodiment, the generator not only outputs the final image, but also uses the coarse-grained feature map output by its first generation layer and the fine-grained feature map output by its second generation layer as intermediate layer outputs, which are used by the subsequent discriminator to perform discrimination and classification according to the corresponding layers.

[0038] Figure 1 The model training method shown includes steps S101 to S105; each step is described in detail below: Step S101: Obtain a sample image with hierarchical structured labels; wherein, the hierarchical structured labels include multiple sub-labels, and each sub-label corresponds to a level.

[0039] Specifically, the sample images acquired in this embodiment can be defect image data of power distribution towers labeled with structured digital tags. The hierarchical structured tags are represented in the form of multi-digit numbers, with each digit corresponding to a different level of the equipment system architecture.

[0040] For example, the label "123" can represent system category 1, device subcategory 2, and specific sub-fault 3, respectively.

[0041] This embodiment does not use the traditional single image label, but instead splits the structured digital label into multiple independent integer sub-labels, and strictly aligns each sub-label to different multimodal semantic levels of the model.

[0042] Based on the above-mentioned label splitting, this embodiment adopts an asymmetric data processing and input mechanism for the generator and discriminator / autoencoder ends.

[0043] Specifically, at the generator end: In this embodiment, no additional multimodal semantic supplementation is performed at different network layers of the generator. The generator only obtains label information once at the initial input end, that is, the unsplit integer label is used as a pure classification condition feature, which is fused with random noise and directly used as the input of the generator. At this stage, the label only serves as a classification guide and does not carry any additional complex semantic meaning.

[0044] This highly modular design allows the generator to directly generate target samples end-to-end according to the specified labels by only needing random noise and set labels as input during the inference stage.

[0045] At the discriminator and autoencoder ends: the split integer sub-labels are strictly aligned with the network modules that introduce the feature pyramid concept according to the hierarchical order: the first sub-label corresponds to the bottom coarse-grained feature level, the second sub-label corresponds to the middle feature level, and so on. Each sub-label is used as an independent classification label for the corresponding level for supervised learning.

[0046] By employing the aforementioned label-by-label splitting and asymmetric data processing mechanism, the model can be forced to learn fine-grained features at different levels in scenarios with few samples, and the distance between appearance-similar subclass samples in the high-dimensional feature space can be controlled to increase. At the same time, the generator does not need to process complex multi-level semantics and can generate samples based solely on the input noise and integer labels, which reduces the learning burden and inference complexity of the generator and makes the learning difficulty of the discriminator and the generator tend to be balanced.

[0047] Step S102: Pre-train the autoencoder based on the sample images to obtain the reconstructed features of different granularities output by each first-level output layer.

[0048] Following the sample images with hierarchical structured labels obtained in step S101, this embodiment first performs the AE pre-training stage. In this stage, the autoencoder is trained independently as a teacher model. Its encoder encodes the sample images into the latent space, and the decoder decodes and reconstructs them layer by layer through a 3-layer structure.

[0049] Specifically, the first decoding layer of the decoder outputs the reconstruction features of the rough outline information of the analog sample, the second decoding layer outputs the reconstruction features of the fine information such as texture, and the final output layer outputs the complete reconstructed sample.

[0050] Encoder pre-training aims to acquire the ability to reconstruct multi-level features from real samples, enabling each output layer of the decoder to extract multi-scale reconstructed features from coarse to fine granular.

[0051] During encoder pre-training, the encoder's loss function is the reconstruction loss, which measures the difference between the input sample and the reconstructed sample, as shown in the following formula: ; In the formula, x is the input sample of the autoencoder. To reconstruct the sample, For reconstruction loss.

[0052] By minimizing this loss function, each decoding layer of the AE gradually learns to reconstruct the feature representation of the input image at different granularities, providing a multi-level source of features from real samples for the subsequent joint adversarial training stage.

[0053] Step S103: Input the hierarchical structured labels into the generator to obtain the generated features of different granularities output by each second-level output layer and use them as multi-level fake samples.

[0054] During the joint adversarial training phase, the generator acts as a student model, receiving input and generating multi-scale features layer by layer.

[0055] In some preferred embodiments, the step of inputting hierarchical structured tags into the generator includes: Input the sample image into a preset variational autoencoder to obtain the variational autoencoder encoding; The random noise, the variational autoencoder encoding, and the hierarchical structured label are fused together and then input into the generator.

[0056] In this embodiment, the variational autoencoder encoding can be represented as vae_z, which carries the distribution information of real samples in the latent space and is used to impose prior constraints on the generator's input. Random noise (denoted as z), the encoded vae_z, and the hierarchical structured labels converted to integers (denoted as label_float) are fused, and the fused joint feature vector is input into the generator. Here, the labels received by the generator are unsplit integer hierarchical labels, used only as pure classification conditional features to guide the generation direction, without carrying complex hierarchical semantics.

[0057] The generator contains three progressively advancing deconvolutional modules that sequentially generate three levels of output: the first generation layer outputs coarse-grained semantic features (layer1_output), corresponding to the generation result at the structural topology level; the second generation layer outputs fine-grained semantic features (layer2_output), corresponding to the generation result at the texture detail level; and the image generation layer outputs the final generated image (layer3_output). The intermediate feature maps output from the first and second generation layers, along with the final generated image output from the image generation layer, together constitute multi-level fake samples. These fake samples are then aligned with multi-level real samples and input into the discriminator.

[0058] Compared to traditional generative adversarial networks (GANs) that only perform global discrimination on the final generated image, which is prone to mode collapse or over-smoothing by treating minor defects (such as insulator cracks) as high-frequency noise when processing complex fault images, this embodiment forces the generator to output intermediate layer features and accept independent supervision. In essence, it constructs constraint paths for structural topology (coarse-grained), texture details (fine-grained), and the complete image within the network. This hierarchical adversarial mechanism forces the generator to first learn the system architecture class at the shallow feature level, and then focus on specific sub-fault textures at the deep feature level, thereby significantly improving the realism and detail preservation rate of the generated minor defects.

[0059] Step S104: Extract the reconstructed features of each first-level output layer except the final output layer and combine them with the sample images to form multi-level real samples; input the multi-level real samples and multi-level fake samples into the discriminator according to their level correspondence.

[0060] Based on the output features of each layer of the decoder, this embodiment adopts a unique truncated true sample construction mechanism: extract the first two layers of the AE decoder (i.e., the coarse contour reconstruction features output by the first decoding layer and the detailed texture reconstruction features output by the second decoding layer), and combine them with the original sample image to form a multi-level true sample.

[0061] Specifically, the first-level true samples are composed of the reconstructed features output by the first decoding layer, corresponding to the true reference at the coarse-grained feature level; the second-level true samples are composed of the reconstructed features output by the second decoding layer, corresponding to the true reference at the fine-grained feature level; and the third-level true samples are composed of the original sample images themselves, corresponding to the true reference at the final image level.

[0062] The fully reconstructed samples output by the final output layer (third layer) of the decoder are not included in the real samples. The reason is that if the final reconstructed output of the autoencoder is used as the guide for the highest layer of the discriminator, the upper limit of the model will be limited to the reconstruction capability of the autoencoder. The reconstruction error of the autoencoder itself will be transmitted to the upper limit of the generation quality of the generative adversarial network, resulting in the generator ultimately learning only an approximation of the autoencoder reconstruction distribution, rather than the original distribution of the real samples.

[0063] By replacing the final output of the autoencoder with the original real image and retaining only the intermediate features of the first two layers of the autoencoder as real samples to guide the lower levels, the multi-scale feature guidance capability of the autoencoder is utilized to accelerate the convergence speed of the generator in the early stage, and the limitation of the autoencoder reconstruction error on the generation quality of the generative adversarial network in the traditional joint model is completely broken.

[0064] In some preferred embodiments, the discriminator includes multiple hierarchical branches, each corresponding to a different level; each hierarchical branch includes a shared feature extraction network, a true / false discrimination network, and a classification network; wherein, the shared feature extraction network is used to extract features from the true or false samples input to the hierarchical branch to obtain shared features; the true / false discrimination network and the classification network are used to perform true / false discrimination and classification based on the shared features, respectively.

[0065] In this embodiment, the discriminator internally incorporates three hierarchical branches (branch1, branch2, and branch3) based on the feature pyramid concept, respectively processing real / fake sample inputs at three feature levels. Each hierarchical branch includes a shared feature extraction network, a real / fake discrimination network, and a classification network.

[0066] Specifically, the shared feature extraction network is composed of a Convolutional Neural Network (CNN), used to perform dimensionality reduction and abstraction of high-dimensional features from real or fake samples input to this level branch, obtaining a shared feature tensor. Within the same level branch, the real / fake judgment task and the classification task share the same feature extraction network—that is, bottom-level feature extraction is shared, while top-level tasks are decoupled. After being flattened, the extracted shared feature tensor is simultaneously fed into two parallel task heads (i.e., two independent fully connected layer networks): the real / fake judgment network (adversarial task head) maps the shared feature into a single-channel scalar, used to output the real / fake score (Real / Fake logit); the classification network (classification task head) maps the shared feature into a multi-channel vector, used to output the classification result corresponding to this level. The number of channels output by the classification task head specifically corresponds to the total number of categories corresponding to the numerical sub-labels handled by that level.

[0067] For example, if the first layer (layer1) is responsible for identifying the system's broad category, and there are three possible subcategories within that category, then the classification task head for this layer will output three channels. The value of each channel represents the confidence score (unnormalized probability) of the input feature belonging to the corresponding specific category. Through this design, each layer branch only needs to focus on and solve a simple, local, few-class classification problem corresponding to that layer, significantly reducing the difficulty of multimodal semantic parsing.

[0068] The multi-level fake samples (the generated features of the three levels output in step S103) and multi-level real samples (the outputs of the first two layers of the autoencoder and the sample images) are input into the corresponding level branches of the discriminator according to their respective levels. That is, the real / fake samples of the first level are input into the first level branch (branch1) of the discriminator, the real / fake samples of the second level are input into the second level branch (branch2), and the real / fake samples of the third level are input into the third level branch (branch3). Thus, the discriminator performs independent real / fake discrimination and level classification on the generated results at three scales: coarse-grained, fine-grained, and complete image.

[0069] Step S105: Based on the output of the discriminator, obtain the discrimination loss and classification loss for each level; update the parameters of the generator and discriminator using the discrimination loss and classification loss to obtain the target model.

[0070] Based on the output of each branch, this step calculates the loss and updates the parameters at each level.

[0071] Regarding the method for obtaining classification loss, in some preferred embodiments, the method for obtaining classification loss includes: comparing the sub-labels (i.e., the independent integer labels of each level after bit splitting) corresponding to each level with the classification results output by the discriminator at the corresponding level, and obtaining the classification loss of each level based on the comparison results.

[0072] Specifically, the classification network of each branch of the discriminator outputs a classification logit for the features input to that level, compares the classification logit with the corresponding sub-label (true class) of that level, and calculates the cross-entropy loss: ; In the formula, For the cross-entropy loss mentioned above, CE is the cross-entropy loss function. For the discriminator to the first Classification logit based on bit label prediction The first after splitting the real label Bit.

[0073] Regarding the adversarial loss of each level of the discriminator, the real / fake discrimination network of each level of the discriminator outputs the true / fake logit for the input real and fake samples respectively, and calculates the adversarial loss accordingly: ; In the formula, For the discriminator Layer-level resistance losses, The true / false loss is calculated once for each of the three levels of output of the discriminator (two intermediate feature layers and the final image layer). For the Sigmoid function; For the discriminator The layer provides true / false logit values ​​for real samples. For the discriminator The layer provides true / false logit values ​​for real and generated samples, and BCE is the binary cross-entropy loss function.

[0074] Furthermore, the total loss of the discriminator is the sum of the classification loss and the adversarial loss mentioned above, specifically: ; In the formula, This is the total loss of the discriminator.

[0075] Preferably, updating the parameters of the generator and discriminator using discriminant loss and classification loss includes: In each of the aforementioned hierarchical branches, the parameters of the classification network are updated using the classification loss, the parameters of the true / false discrimination network are updated using the discrimination loss, and the parameters of the shared feature extraction network are updated using the weighted result of the classification loss and the discrimination loss.

[0076] Regarding the parameter update method for the discriminator, in some preferred embodiments, a hierarchical dynamic update strategy is adopted in each of the aforementioned layer branches: First, the classification loss of that layer is used to perform local gradient updates on the parameters of the classification network (classification task head) of that layer; then, the discriminant loss of that layer is used to perform local gradient updates on the parameters of the true / false discrimination network (adversarial task head) of that layer; finally, the weighted result of the classification loss and the discriminant loss is used to perform overall gradient updates on the parameters of the shared feature extraction network (shared CNN). This hierarchical update strategy, which involves independent local updates of the task heads and comprehensive updates of the shared layers, ensures that the learning of the two tasks, classification and true / false discrimination, is targeted, while also enabling the shared feature extraction network to take into account the gradient signals of both tasks and extract general features valuable for both classification and true / false discrimination.

[0077] Regarding the parameter update method for the generator, in some preferred schemes, the generator's loss function is organically combined with multi-level adversarial loss (BCE) and classification loss (CE), and the update process adopts an asymmetric optimization evolution strategy of "locally dependent on discrimination, globally focused on classification". The parameter update method for the generator includes: At each level, the adversarial loss of the generator at the corresponding level is determined based on the discriminant loss at the discriminator level. The classification loss of the generator at the corresponding level is determined based on the classification loss of the discriminator level; The total classification loss is obtained by weighted summing of the classification losses of the generator at each level. The local network parameters corresponding to each level in the generator are updated based on the adversarial loss of the generator at each level, and the overall network parameters of the generator are updated based on the total classification loss.

[0078] Specifically, at each level, the adversarial loss of the generator at that level is determined based on the true / false logit of the generator's output fake samples by the discriminator's corresponding level's real / false discrimination network: ; In the formula, For generators at the hierarchy The losses in the fight, For the generator The layer provides a true or false logit for the generated image.

[0079] Then, based on the adversarial loss of that level, the local network parameters in the generator corresponding to that level (i.e., the parameters of the deconvolution module that generates the output of that layer) are updated respectively.

[0080] The classification loss of the generator at the corresponding level is determined based on the classification logit output by the classification network at the corresponding level of the discriminator.

[0081] ; In the formula, For the generator at the corresponding level The classification loss, CE, physically characterizes the information entropy difference between the model's predicted class probability distribution and the true label distribution. By maximizing the logarithm of the predicted probability of the correct class, the CE loss imposes an exponential penalty on misclassification. For the generator Layer output for the first Classification logit based on bit label prediction The first after splitting the real label Bit.

[0082] The classification loss of the generator at each level is weighted and summed to obtain the total classification loss: ; In the formula, Indicates classification loss in stage The dynamic weighting coefficients.

[0083] The overall network parameters of the generator are updated based on the total classification loss described above.

[0084] Regarding the aforementioned dynamic weight coefficients, they are not fixed during training but are adjusted in stages as training progresses. In the early stages of training, the weight of the adversarial loss (BCE) is relatively high to accelerate the generator's learning of the basic distribution of real samples and force the outputs of each layer to align with the features of the corresponding layer of the adversarial loss (AE). As training deepens, the weight of the classification loss (CE) gradually increases, enabling the model to further enhance its precise control over hierarchical semantics based on its mastery of basic generation capabilities. This dynamic weight evolution strategy achieves a smooth transition of the model from convergence guided by AE to autonomous adversarial learning in GANs.

[0085] Experiments show that the aforementioned asymmetric optimization strategy, which combines local dependency discrimination (BCE-driven local parameters) and global classification-driven global parameters (CE-driven global parameters), can effectively accelerate the convergence of generative adversarial networks and significantly enhance the generation quality of multimodal semantic information.

[0086] After multiple rounds of iterative training through steps S101 to S105, training ends when the discrimination loss and classification loss converge to the preset conditions, yielding the trained target model. This target model can generate multi-level classification images with higher fidelity and more complete detail retention under conditions of few samples, making it suitable for industrial application scenarios requiring high-fidelity, few-sample generation, such as defect detection in power distribution network equipment.

[0087] Accordingly, this application also provides a fault identification method for power distribution towers, comprising: obtaining a trained target model by employing the model training method described in any of the above embodiments; acquiring an image of the power distribution tower to be identified; inputting the image to be identified into the target model; and obtaining a fault identification result.

[0088] Accordingly, such as Figure 3 As shown, this invention application also provides a model training system 300, wherein the model to be trained includes an autoencoder, a discriminator, and a generator; wherein the autoencoder includes a decoder, the decoder includes multiple first-level output layers; and the generator includes multiple second-level output layers. The model training system 300 includes an image acquisition module 301, a pre-training module 302, a generator input module 303, a discriminator input module 304, and a parameter update module 305; wherein... The image acquisition module 301 is used to acquire sample images with hierarchical structured labels; wherein, the hierarchical structured labels include multiple sub-labels, and each sub-label corresponds to a hierarchy; The pre-training module 302 is used to pre-train the autoencoder based on sample images to obtain reconstructed features of different granularities output by each first-level output layer. The generator input module 303 is used to input hierarchical structured labels into the generator to obtain generation features of different granularities output by each second-level output layer and use them as multi-level fake samples. The discriminator input module 304 is used to extract the reconstructed features of each first-level output layer except the final output layer and combine them with the sample image to form a multi-level real sample; and input the multi-level real sample and the multi-level fake sample into the discriminator according to the level correspondence. The parameter update module 305 is used to obtain the discrimination loss and classification loss of each level based on the output of the discriminator; and to update the parameters of the generator and discriminator through the discrimination loss and classification loss to obtain the target model.

[0089] As a preferred embodiment, the decoder includes three first-level output layers, which are arranged in order of output granularity from coarse to fine: a first decoding layer, a second decoding layer, and the final output layer. The multi-level true samples include three levels, wherein the first level true samples are composed of the reconstructed features output by the first decoding layer, the second level true samples are composed of the reconstructed features output by the second decoding layer, and the third level true samples are composed of the sample images.

[0090] The plurality of second-level output layers are arranged in order of increasing output granularity, including a first generation layer, a second generation layer, and an image generation layer; the first generation layer is used to output coarse-grained features, the second generation layer is used to output fine-grained features, and the image generation layer is used to output the final generated image.

[0091] As a preferred embodiment, the method for obtaining the classification loss includes: The sub-labels corresponding to each level are compared with the classification results output by the discriminator at the corresponding level, and the classification loss of each level is obtained based on the comparison results.

[0092] As a preferred embodiment, the discriminator includes multiple hierarchical branches, with each hierarchical branch corresponding to a different level; each hierarchical branch includes a shared feature extraction network, a true / false discrimination network, and a classification network; The shared feature extraction network is used to extract features from real or fake samples input to the branch level to obtain shared features; the true / false discrimination network and the classification network are used to perform true / false discrimination and classification based on the shared features, respectively.

[0093] As a preferred embodiment, the parameter update module 305 updates the parameters of the generator and discriminator using the discriminant loss and classification loss, including: In each of the hierarchical branches, the parameter update module 305 updates the parameters of the classification network using the classification loss, updates the parameters of the true / false discrimination network using the discrimination loss, and updates the parameters of the shared feature extraction network using the weighted result of the classification loss and the discrimination loss.

[0094] As a preferred embodiment, the generator input module 303 inputs hierarchical structured tags into the generator, including: The generator input module 303 inputs the sample image into a preset variational autoencoder to obtain variational autoencoder encoding; The random noise, the variational autoencoder encoding, and the hierarchical structured label are fused together and then input into the generator.

[0095] As a preferred embodiment, the parameter update method for the generator includes: At each level, the adversarial loss of the generator at the corresponding level is determined based on the discriminant loss at the discriminator level. The classification loss of the generator at the corresponding level is determined based on the classification loss of the discriminator level; The total classification loss is obtained by weighted summing of the classification losses of the generator at each level. The local network parameters corresponding to each level in the generator are updated based on the adversarial loss of the generator at each level, and the overall network parameters of the generator are updated based on the total classification loss.

[0096] Accordingly, this invention application also provides a fault identification system for power distribution towers, including a model training module and a fault identification module; wherein, The model training module uses the model training method described above to obtain a trained target model. The fault identification module is used to acquire the image of the power distribution tower to be identified, input the image to be identified into the target model, and obtain the fault identification result.

[0097] Accordingly, this application also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the model training method or the fault identification method for power distribution towers.

[0098] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal, connecting various parts of the terminal via various interfaces and lines.

[0099] The memory can be used to store the computer program. The processor implements various functions of the terminal by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0100] Accordingly, this application also provides a computer-readable storage medium, which includes a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the model training method or the fault identification method for power distribution towers.

[0101] Wherein, if the modules of the device / terminal equipment / system integration are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0102] Compared with the prior art, this invention application has the following beneficial effects: This invention provides a model training method, a fault identification method, and a system. The invention utilizes multiple first-level output layers of an autoencoder decoder to output reconstructed features of different granularities. These reconstructed features, excluding the final output layer, are combined with sample images to form multi-level true samples. Simultaneously, multiple second-level output layers of the generator output generated features of different granularities as multi-level false samples. The true / false samples are input into a discriminator according to their corresponding levels for hierarchical supervision. This multi-level feature alignment mechanism enables the discriminator to perform layer-by-layer verification of generated features at multiple scales, from coarse to fine granular. The generator is forced to produce correct feature representations at each level, effectively preserving the local details of minor defects. This avoids the problem in existing technologies where relying solely on the final output layer for supervision leads to the filtering out of minor features as noise, thus better optimizing the performance of the target model.

[0103] Furthermore, the hierarchical structured labels in this invention application include multiple sub-labels, each corresponding to a level, and the discriminator classifies according to the corresponding level. This means that each level only needs to process classification tasks that match the granularity of that level. Compared to the existing technology that stacks all hierarchical classification tasks in the final output layer for global classification, this divide-and-conquer strategy can more finely distinguish samples that are similar in appearance but belong to different subclasses under conditions of few samples, effectively widening the distance between different categories in the high-dimensional feature space and enhancing the model's fine-grained feature expression capability.

[0104] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A model training method, characterized in that, The model to be trained includes an autoencoder, a discriminator, and a generator; The autoencoder includes a decoder, and the decoder includes multiple first-level output layers; The generator includes multiple second-level output layers; The model training method includes: Obtain sample images with hierarchical structured labels; wherein, the hierarchical structured labels include multiple sub-labels, and each sub-label corresponds to a hierarchy; The autoencoder is pre-trained based on sample images to obtain reconstructed features of different granularities output by each first-level output layer. The hierarchical structured labels are input into the generator to obtain the generated features of different granularities output by each second-level output layer, which are then used as multi-level fake samples. Extract the reconstructed features from the outputs of each first-level output layer except the final output layer, and combine them with the sample images to form multi-level real samples; input the multi-level real samples and multi-level fake samples into the discriminator according to their level correspondence; Based on the output of the discriminator, the discriminant loss and classification loss of each level are obtained; the parameters of the generator and discriminator are updated using the discriminant loss and classification loss to obtain the target model.

2. The model training method as described in claim 1, characterized in that, The decoder includes three first-level output layers, which are arranged in order of output granularity from coarse to fine: a first decoding layer, a second decoding layer, and the final output layer. The multi-level true samples include three levels, wherein the first level true samples are composed of the reconstructed features output by the first decoding layer, the second level true samples are composed of the reconstructed features output by the second decoding layer, and the third level true samples are composed of the sample images. The plurality of second-level output layers are arranged in order of increasing output granularity, including a first generation layer, a second generation layer, and an image generation layer; the first generation layer is used to output coarse-grained features, the second generation layer is used to output fine-grained features, and the image generation layer is used to output the final generated image.

3. The model training method as described in claim 1, characterized in that, The method for obtaining the classification loss includes: The sub-labels corresponding to each level are compared with the classification results output by the discriminator at the corresponding level, and the classification loss of each level is obtained based on the comparison results.

4. The model training method as described in claim 1, characterized in that, The discriminator includes multiple hierarchical branches, each corresponding to a different level; each hierarchical branch includes a shared feature extraction network, a true / false discrimination network, and a classification network. The shared feature extraction network is used to extract features from real or fake samples input to the hierarchical branches to obtain shared features; the true / false discrimination network and the classification network are used to perform true / false discrimination and classification based on the shared features, respectively.

5. The model training method as described in claim 4, characterized in that, The parameter update of the generator and discriminator using discriminant loss and classification loss includes: In each of the aforementioned hierarchical branches, the parameters of the classification network are updated using the classification loss, the parameters of the true / false discrimination network are updated using the discrimination loss, and the parameters of the shared feature extraction network are updated using the weighted result of the classification loss and the discrimination loss.

6. The model training method as described in claim 1, characterized in that, The step of inputting hierarchical structured tags into the generator includes: Input the sample image into a preset variational autoencoder to obtain the variational autoencoder encoding; The random noise, the variational autoencoder encoding, and the hierarchical structured label are fused together and then input into the generator.

7. The model training method as described in claim 1, characterized in that, The parameter update method for the generator includes: At each level, the adversarial loss of the generator at the corresponding level is determined based on the discriminant loss at the discriminator level. The classification loss of the generator at the corresponding level is determined based on the classification loss of the discriminator level; The total classification loss is obtained by weighted summing of the classification losses of the generator at each level. The local network parameters corresponding to each level in the generator are updated based on the adversarial loss of the generator at each level, and the overall network parameters of the generator are updated based on the total classification loss.

8. A method for fault identification of power distribution towers, characterized in that, include: The trained target model is obtained by using the model training method described in any one of claims 1 to 7; The image of the power distribution tower to be identified is obtained, and the image is input into the target model to obtain the fault identification result.

9. A model training system, characterized in that, The model to be trained includes an autoencoder, a discriminator, and a generator; the autoencoder includes a decoder, which includes multiple first-level output layers; the generator includes multiple second-level output layers. The model training system includes an image acquisition module, a pre-training module, a generator input module, a discriminator input module, and a parameter update module; wherein, The image acquisition module is used to acquire sample images with hierarchical structured labels; wherein, the hierarchical structured labels include multiple sub-labels, and each sub-label corresponds to a hierarchy; The pre-training module is used to pre-train the autoencoder based on sample images to obtain reconstructed features of different granularities output by each first-level output layer. The generator input module is used to input hierarchical structured labels into the generator to obtain generation features of different granularities output by each second-level output layer and use them as multi-level fake samples. The discriminator input module is used to extract the reconstructed features of each first-level output layer except the final output layer and combine them with the sample image to form a multi-level real sample; the multi-level real sample and the multi-level fake sample are input into the discriminator according to the level correspondence; The parameter update module is used to obtain the discrimination loss and classification loss of each level based on the output of the discriminator; and to update the parameters of the generator and discriminator through the discrimination loss and classification loss to obtain the target model.

10. A fault identification system for power distribution towers, characterized in that, It includes a model training module and a fault identification module; among which, The model training module uses the model training method described in any one of claims 1 to 7 to obtain a trained target model; The fault identification module is used to acquire the image of the power distribution tower to be identified, input the image to be identified into the target model, and obtain the fault identification result.