Transformer-based substation inspection model training method and device, terminal equipment and storage medium based on hierarchical freezing and knowledge distillation

By employing a layered freezing and knowledge distillation approach, incremental training samples are constructed using missed and false detection data. This approach locks the feature extraction and spatial coding network weights of the substation inspection model and combines them with prior models for timed supervised training. This solves the resource consumption and catastrophic forgetting problems in model iteration optimization in intelligent substation inspection, thereby improving the generalization ability and detection accuracy of equipment defect identification.

CN123178980APending Publication Date: 2026-11-27CYG SUNRI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611630777.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-21
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies for intelligent substation inspection suffer from problems such as the need for extensive computing and storage resources for model iteration and optimization, making them difficult to implement. Meanwhile, conventional incremental learning schemes suffer from catastrophic forgetting, large annotation workload, and low efficiency in on-site sample annotation.

Method used

By employing a layered freezing and knowledge distillation approach, incremental training samples are constructed by acquiring missed and false detection data. The weight parameters of the feature extraction and spatial encoding networks are locked, and timed supervised training is performed in conjunction with prior models to achieve iterative model updates and alleviate catastrophic forgetting and sample imbalance problems.

Benefits of technology

It improves the generalization ability and detection accuracy of substation equipment defect identification, reduces the consumption of computing power and storage resources, and enhances the model's autonomous high-frequency closed-loop iteration capability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178980A_ABST
    Figure CN123178980A_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of intelligent inspection and training of power equipment, and provides a substation inspection model training method and device based on hierarchical freezing and knowledge distillation, terminal equipment and a storage medium, which comprises: obtaining detection data output by a substation inspection model when the substation inspection model inspects a power transformation device; constructing incremental training sample data according to the detection data and preset first power sample data; locking weight parameters of a feature extraction network and a spatial coding network of the current substation inspection model to obtain a target inspection model with fixed backbone parameters; performing periodic supervision training on the target inspection model according to a prior model and the incremental training sample data to obtain an updated target inspection model; the above method completes model iteration update under the premise of retaining original general recognition prior features of the power equipment, alleviates the problems of catastrophic forgetting, class sample imbalance and prediction drift caused by incremental training, and improves the generalization ability and detection precision of substation equipment defect identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent inspection and training technology for power equipment, and particularly relates to a method, device, terminal equipment and storage medium for training substation inspection models based on hierarchical freezing and knowledge distillation. Background Technology

[0002] In the scenario of intelligent substation inspection, the on-site environment and equipment operating conditions are complex and changeable. Inspection images are prone to changes in lighting and equipment obstruction. Artificial Intelligence (AI) models will continuously generate missed and false detection samples during continuous operation on-site. Existing technologies mostly adopt the full retraining method for iterative optimization of the model. That is, each time the model is updated, the entire base dataset and the incremental samples collected on-site need to be merged and retrained as a whole. This method requires a lot of computing power and storage resources, which is difficult to implement on edge devices in substations. At the same time, if only a small number of on-site samples are used to directly fine-tune the model, catastrophic forgetting can easily occur, causing the model to lose its original ability to identify various types of power equipment. Conventional incremental learning schemes have the problems of large annotation workload and low efficiency of on-site sample annotation. Summary of the Invention

[0003] This application provides a method, apparatus, terminal equipment, and storage medium for training a substation inspection model based on hierarchical freezing and knowledge distillation. It can complete the iterative update of the model while retaining the original general identification prior features of power equipment, alleviate the problems of catastrophic forgetting, class sample imbalance, and prediction drift caused by incremental training, and improve the generalization ability and detection accuracy of substation equipment defect identification.

[0004] In a first aspect, embodiments of this application provide a method for training a substation inspection model based on hierarchical freezing and knowledge distillation, including: The system acquires the detection data output by the substation inspection model during the inspection of substation equipment; the detection data includes missed detection data and false detection data. Incremental training sample data is constructed based on the detection data and the preset first power sample data; By locking the weight parameters of the feature extraction network and spatial coding network of the current substation inspection model, a target inspection model with fixed backbone parameters is obtained. The target inspection model is subjected to timed supervised training based on the prior model and incremental training sample data to obtain the updated target inspection model; wherein, the prior model is the substation inspection model trained based on the full power sample data; the first power sample data is the sample data selected from the full power sample data.

[0005] In this embodiment, missed and false detection data generated by the substation inspection model are acquired, and incremental training sample data is constructed by combining them with preset first power sample data. The weight parameters of the feature extraction network and spatial coding network of the substation inspection model are locked to fix the backbone feature capabilities. Then, using the prior model trained from the full power sample, timed supervised training is performed on the target inspection model with fixed backbone parameters to complete the model iterative update. This scheme uses the prior model to provide global prior constraints, and with the parameter locking strategy, it retains the general visual features of power equipment. At the same time, it forms incremental samples based on actual missed and false detections on site to achieve model adaptation, effectively improving the catastrophic forgetting, sample class imbalance and prediction drift phenomena in the incremental training process, and improving the generalization performance and detection accuracy of substation equipment defect identification.

[0006] In one possible implementation of the first aspect, incremental training sample data is constructed based on the detection data and preset power sample data, including: Obtain the first correction data and the second correction data corresponding to the detection data; wherein, the first correction data is the data for correcting false detection data; and the second correction data is the data for correcting false negative detection data. Calculate the intersection-union ratio (IUGR) between the first detection box corresponding to the first corrected data and the second detection box corresponding to the detection data; If the crossover ratio is greater than the preset threshold, the first corrected data, the second corrected data, and the detection data are fused to obtain the detection sample data. Incremental training sample data is constructed based on the detection sample data and the first power sample data.

[0007] In this embodiment, after verifying the false detection correction data by cross-interaction and comparison threshold, the false detection and missed detection correction data are fused with the detection data, and the incremental training samples are generated by combining them with existing power samples. This can filter out invalid correction labels, improve the labeling reliability of incremental samples, reduce interference from erroneous samples, and effectively improve the detection performance of the power defect model after incremental training.

[0008] In one possible implementation of the first aspect, incremental training sample data is constructed based on the detection sample data and the first power sample data, including: Clustering of the test sample data yields various different sample clustering types; The detection sample data is cropped according to the sample clustering type to obtain the sub-detection sample dataset corresponding to each clustering type; Multiple subsample detection datasets and the first power sample data are combined to obtain incremental training sample data.

[0009] In this embodiment of the application, by clustering the detection samples and cropping them according to the cluster type to obtain the sub-detection sample dataset, and then combining it with the existing power samples to generate incremental training samples, it is possible to achieve local focus on the defect target, enrich the small target samples, and improve the model's learning effect on various power defects.

[0010] In one possible implementation of the first aspect, the detection sample data is clustered to obtain several different sample clustering types, including: Extract the center coordinates, length, and width of the detection frame corresponding to each detection sample data; Construct a feature matrix based on the center coordinates, length, and width of each detection box; Calculate the weighted distance between different detection sample data based on the feature matrix; Clustering is performed based on multiple weighted distances to obtain various sample clustering types.

[0011] In this embodiment, sample clustering is completed by extracting the center coordinates, length and width of the detection box to construct a feature matrix and calculating the weighted distance. This enables automatic grouping based on the spatial and scale characteristics of the defective target, providing a reliable basis for subsequent local cropping to generate sub-samples.

[0012] In one possible implementation of the first aspect, the target inspection model is subjected to timed supervised training based on a prior model and incremental training sample data to obtain an updated target inspection model, including: At a set time interval, the target hash value of the preset database is calculated; the preset database stores incremental training sample data. Compare the target hash value with the historical hash value of the preset database at the previous moment; If the target hash value is different from the historical hash value, the target inspection model will be trained under timed supervision based on the incremental training sample data in the preset data.

[0013] In this embodiment, by periodically comparing the current and historical hash values ​​of the sample database, supervised training is only initiated when the incremental training samples change, thus avoiding meaningless repetitive training, saving computing power at the edge, and improving the execution efficiency of timed training.

[0014] In one possible implementation of the first aspect, the target inspection model is subjected to timed supervised training based on incremental training sample data, including: The ratio between each sub-detection sample dataset and the incremental training sample dataset is calculated. Weights are assigned to the sub-detection sample dataset based on different ratios to obtain weighted sub-detection sample data. The sub-test data and the first power sample data are then recorded as the incremental training sample data. The target inspection model is subjected to timed supervised training based on the incremental training sample data.

[0015] In this embodiment of the application, by statistically analyzing the proportion of each sub-detection sample dataset and assigning weights, supervised training is carried out. This balances the gradient contributions of different types of defect samples, alleviates the sample imbalance problem, and improves the target inspection model's ability to identify scarce power defects.

[0016] In one possible implementation of the first aspect, the target inspection model is subjected to timed supervised training based on the incremental training sample data, including: For each training sample in the incremental training sample data, the training sample is input into the prior model to obtain the first detection result; The training samples are input into the target inspection model to obtain the second detection result; The first loss is calculated based on the first and second test results; The second loss is calculated based on the positions of the predicted detection box corresponding to the second detection result and the actual detection box corresponding to the training sample. The third loss is calculated based on the predicted sample category corresponding to the second detection result, the actual sample category corresponding to the training sample, and the weight assignment corresponding to the training sample. Calculate the total loss corresponding to the first loss, the second loss, and the third loss; If the total loss does not converge, the target inspection model will continue to be trained based on the incremental training sample data until the total loss converges, and the updated target inspection model will be obtained.

[0017] In this embodiment, the first loss is calculated by combining the output of the prior model, the second loss is calculated by the bounding box position, and the third loss is calculated by the class information with sample weights to obtain the total loss. The model is then iteratively trained until convergence. This approach can transfer prior model knowledge, take into account both the accuracy of bounding box regression and the class imbalance problem, and effectively improve the power defect detection effect of the updated target inspection model.

[0018] Secondly, embodiments of this application provide a substation inspection model training device based on hierarchical freezing and knowledge distillation, including: The data acquisition module is used to acquire the detection data output by the substation inspection model when inspecting substation equipment; the detection data includes missed detection data and false detection data. The training sample construction module is used to construct incremental training sample data based on the detection data and the preset first power sample data. The network parameter fixing module is used to lock the weight parameters of the feature extraction network and spatial coding network of the current substation inspection model, so as to obtain a target inspection model with fixed backbone parameters. The timed training module is used to perform timed supervised training on the target inspection model based on the prior model and incremental training sample data to obtain the updated target inspection model. The prior model is a substation inspection model trained based on the full power sample data. The first power sample data is sample data selected from the full power sample data.

[0019] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the substation inspection model training method based on hierarchical freezing and knowledge distillation as described in any of the first aspects above.

[0020] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the substation inspection model training method based on hierarchical freezing and knowledge distillation as described in any of the first aspects above.

[0021] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the substation inspection model training method based on hierarchical freezing and knowledge distillation described in any of the first aspects above.

[0022] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a flowchart illustrating the training method for a substation inspection model based on hierarchical freezing and knowledge distillation provided in this application embodiment. Figure 2 This is a schematic diagram of the process for constructing incremental training sample data provided in the embodiments of this application. Figure 1 ; Figure 3 This is a schematic diagram of the process for constructing incremental training sample data provided in the embodiments of this application; Figure 4 This is a schematic diagram of the process for clustering sample data provided in the embodiments of this application; Figure 5This is a schematic diagram of the process for timed training of the target inspection model as proposed in the embodiments of this application; Figure 6 This is a schematic diagram of the process for timed training of the target inspection model as proposed in the embodiments of this application; Figure 7 This is a schematic diagram of the process for timed training of the target inspection model as proposed in the embodiments of this application; Figure 8 This is a system architecture diagram of the substation inspection model training based on hierarchical freezing and knowledge distillation provided in the embodiments of this application; Figure 9 This is a schematic diagram of the data entry-level encrypted cache and index structure provided in an embodiment of this application; Figure 10 This is a flowchart of the on-site semi-automatic bounding box correction, model back-annotation, and matching filtering to obtain complete labels provided in the embodiments of this application; Figure 11 This is a diagram of the multi-model logical isolation + independent snapshot storage structure provided in the embodiments of this application; Figure 12 This is a flowchart of the substation directional enhancement + weighted DBSCAN clustering pruning process provided in the embodiments of this application; Figure 13 This is a diagram of the hierarchical frozen network structure of the CNN backbone and encoder based on the Transformer architecture detection model provided in this application embodiment; Figure 14 This is a flowchart of the global teacher + adaptive equilibrium KD distillation loss calculation provided in the embodiments of this application; Figure 15 This is a flowchart of the nighttime mutex lock time-sharing serial distillation scheduling execution provided in the embodiments of this application; Figure 16 This is a structural block diagram of the substation inspection model training device based on hierarchical freezing and knowledge distillation provided in the embodiments of this application; Figure 17 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0025] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0026] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0027] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0028] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0029] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0030] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0031] In the scenario of intelligent substation inspection, the on-site environment and equipment operating conditions are complex and changeable. Inspection images are prone to changes in lighting and equipment obstruction. During the continuous operation of the AI ​​model on-site, it will continuously generate missed and false detection samples. Existing technologies mostly adopt the full retraining method to iteratively optimize the model. That is, each time the model is updated, the entire base dataset and the incremental samples collected on-site need to be merged and retrained as a whole. This method requires a lot of computing power and storage resources, which is difficult to implement on the edge devices of substations. At the same time, if only a small number of on-site samples are used to directly fine-tune the model, catastrophic forgetting can easily occur, causing the model to lose its original ability to identify various types of power equipment. Conventional incremental learning schemes have the problems of large annotation workload and low efficiency of on-site sample annotation.

[0032] To address the aforementioned technical issues, this application provides a substation inspection model training method based on hierarchical freezing and knowledge distillation. Utilizing the substation's idle computing power at night, a closed-loop system is constructed, consisting of an in-plant data preparation terminal, a local substation server, and a terminal closed-loop application terminal. Entry-level encrypted binary caching enables the storage of classified power images without plaintext. A semi-automatic labeling mechanism, combining on-site personnel's local bounding box correction with server-side model back-labeling and Intersection over Union (IoU) matching filtering fusion, generates complete training samples.

[0033] By leveraging the aggregation hash snapshot verification of the sub-model, training is automatically skipped when no new samples are added. Weighted clustering with white space pruning and dual pipeline simulation of lighting and jitter are used to complete the composite data augmentation of dense small targets. The Transformer detection model is subjected to layered freezing of the backbone and encoder of the Convolutional Neural Network (CNN), and only the decoder detection head is fine-tuned. Combined with class adaptive loss equalization weighting and knowledge distillation regularization of the global freezing teacher model, a joint total loss is formed to suppress overfitting, catastrophic forgetting and class bias in small sample training. Then, the incremental fine-tuning, verification and automatic weight deployment of multiple models are completed serially by a nighttime timed scheduling thread with a global mutex lock. The traditional day-long full-scale retraining iteration in the plant is compressed to a few hours at night, reducing the overhead of annotation, bandwidth and central computing power, and realizing autonomous high-frequency closed-loop iteration of the substation field model.

[0034] See Figure 1 This is a flowchart illustrating the substation inspection model training method based on hierarchical freezing and knowledge distillation provided in this application embodiment. It is intended as an example and not a limitation. The method may include the following steps: S101, acquire the detection data output by the substation inspection model for inspecting substation equipment; the detection data includes missed detection data and false detection data.

[0035] In this embodiment, the substation inspection inference model performs equipment inspection and identification tasks at the substation site, performs target detection on the substation equipment images collected by cameras and inspection robots, and the output detection result data includes two types of abnormal samples: missed detection data (real equipment defects / targets that the model did not identify) and false detection data (defects that do not actually exist, but the model incorrectly identifies the defect target). These two types of samples are the input sources for the subsequent on-site self-learning closed loop.

[0036] For example, in a substation intelligent inspection closed-loop self-learning system, the inspection terminal collects images of substation equipment such as switchgear, indicator lights, and panel display screens with distorted images. These images are then fed into a deployed detection model for inference. The model's output predicted bounding boxes and categories are compared with the actual equipment status on-site to identify missed and false detection samples. Missed detections occur when the image actually has a defect but the model does not output a corresponding detection box, while false detections occur when the image is defect-free but the model incorrectly outputs a defect detection box. The original images of the missed and false detection samples, along with the model's original inference results, are uploaded to the substation's local server for subsequent local manual correction and model back-annotation matching fusion to generate complete labels.

[0037] For example, if a fault indicator light on the switchgear lights up, and the fault indicator light actually exists in the inspection image, but the model does not detect it, a missed detection data will be generated; if the stain on the equipment cabinet is incorrectly identified by the model as an oil leakage defect and a defect alarm box is output, a false detection data will be generated. Both types of samples will be stored in the defect library as raw material for nighttime incremental self-learning.

[0038] S102, construct incremental training sample data based on the detection data and the preset first power sample data.

[0039] In this embodiment, the missed and false detection data (new samples on site) output by the inspection are combined with the first power sample data (i.e., the standard sample of the base in the plant) prepared in advance. After a series of processing such as labeling and data augmentation, an incremental training sample dataset is generated that can be used for incremental fine-tuning of the model. This dataset is used to iteratively optimize the inspection model locally in the substation, without having to send it back to the plant for full retraining.

[0040] In one embodiment, see Figure 2 This is a schematic diagram of the process for constructing incremental training sample data provided in the embodiments of this application. Figure 1 ,like Figure 2 As shown, step S102 includes: S201, acquire the first correction data and the second correction data corresponding to the detection data; wherein, the first correction data is the data for correcting false detection data; and the second correction data is the data for correcting false detection data.

[0041] In this embodiment, two types of manual correction information are obtained for the inspection output detection data (false detection and missed detection samples). The first correction data is specifically used to correct false detection data, marking that targets misidentified by the model should be deleted. The second correction data is specifically used to correct missed detection data, supplementing the real defect targets that the model did not identify. These two types of correction data are only used for local annotation and do not need to be fully annotated on the entire image. They are the input for generating complete training labels in the future.

[0042] For example, after the substation terminal uploads the detection samples, including false positives and false negatives, to the local server, the field operator only performs local bounding boxes on the problematic targets to obtain corrected data. For false positives, the first corrected data is generated, marking the detection boxes that were incorrectly output by the model and need to be removed. For false negatives, the second corrected data is generated, supplementing the actual target boxes that did not detect defects in the model. These two types of local corrected data, along with the original data... Figure 1 The data is then uploaded, and the server calls the current substation inspection model to perform back-annotation inference on the original image.

[0043] S202, calculate the intersection-union ratio between the first detection box corresponding to the first corrected data and the second detection box corresponding to the detection data.

[0044] In this embodiment, the IoU (Intersection over Union) ratio between the first detection box of the first correction data (manually corrected boxes for false detections) and the second detection box of the inspection detection data output (false detection prediction boxes originally output by the model) is calculated. By measuring the degree of box overlap, it is determined whether the false detection boxes that need to be deleted by manual marking are the same target as the model output boxes, thus providing a basis for subsequent filtering of false detection boxes.

[0045] S203, if the crossover ratio is greater than the preset threshold, the first corrected data, the second corrected data, and the detection data are fused to obtain the detection sample data.

[0046] In this embodiment, when the intersection-union ratio of the manually labeled false detection correction box (first detection box) and the false detection prediction box (second detection box) output by the model exceeds a set threshold, it means that the two point to the same target. At this time, the first correction data corresponding to the false detection, the second correction data corresponding to the missed detection, and the original detection image data are fused with labels to generate detection sample data with complete annotations, which are used to construct incremental training samples in the future.

[0047] For example, after obtaining an intersection-union ratio greater than a preset threshold, it is confirmed that the manually marked and deleted false detection boxes match the model output false detection boxes. Therefore, the false detection second detection box output by the model is removed, the manually drawn missing target boxes in the second correction data are retained, and the correct detection boxes obtained by the model back-annotation in the remaining areas on the original image that have not been manually intervened are retained. The original image, the boxes after removing false detections, and the manually drawn missing detection boxes are integrated together to generate a fully annotated detection sample data and stored in the encrypted defect library.

[0048] For example, in an image, the model misidentifies a stain on the cabinet as an oil leak defect and outputs a false detection box. On-site personnel select the stain to generate the first correction data. At the same time, there is a panel display screen with a distorted screen that the model did not detect in the image. The staff draws the damaged box to obtain the second correction data. The IoU between the two boxes related to the false detection is calculated to be 0.7, which is greater than the preset threshold of 0.5. Therefore, the false detection box of oil leak defect output by the model is removed, and the manually drawn box of the distorted screen of the panel display screen is retained. The detection boxes correctly identified by the model, such as the indicator lights of the equipment in the image, are also retained. These are then fused with the original image to obtain a set of detection sample data with complete labels, which is used for subsequent incremental training.

[0049] S204, Construct incremental training sample data based on the detection sample data and the first power sample data.

[0050] In this embodiment, the detection sample data with complete labels obtained through label fusion (samples after on-site missed / false detection processing) is combined with the first power sample data (power samples at the plant base) that has been pre-issued. After data augmentation and other processing, incremental training sample data that can be used for incremental fine-tuning of the substation's local model is generated, without having to send a large number of on-site images back to the plant for full retraining.

[0051] In the above method, after verifying the false detection correction data by cross-interval comparison threshold, the false detection and missed detection correction data are fused with the detection data, and incremental training samples are generated by combining them with existing power samples. This can filter out invalid correction labels, improve the labeling reliability of incremental samples, reduce interference from erroneous samples, and effectively improve the detection performance of the power defect model after incremental training.

[0052] In one embodiment, see Figure 3 This is a schematic diagram of the process for constructing incremental training sample data provided in the embodiments of this application, such as... Figure 3 As shown, step S204 includes: S301 clusters the test sample data to obtain various different sample clustering types.

[0053] In this embodiment, the field detection sample data that has been fully annotated is clustered based on the spatial location and size of the targets in the samples, resulting in multiple different sample cluster types. This is mainly used to process dense small targets such as indicator lights on substation switchgear, preparing for subsequent data augmentation with white space cropping.

[0054] In one embodiment, see Figure 4 This is a schematic diagram of the process for clustering sample data provided in the embodiments of this application, such as... Figure 4 As shown, step S301 includes: S401, extract the center coordinates, length, and width of the detection box corresponding to each detection sample data.

[0055] In this embodiment of the application, the geometric parameters of each detection bounding box, namely the center coordinates, length and width of the box, are parsed from the detection sample data that has completed label fusion. The position and size information of each target are obtained, and features are constructed as the input basis for the subsequent dense small target weighted clustering algorithm.

[0056] S402, construct a feature matrix based on the center coordinates, length, and width of each detection box.

[0057] In this embodiment, the center coordinates, length, and width of each detection box extracted earlier are used to organize the geometric information of all labeled targets into a four-dimensional feature matrix. Each row of the matrix corresponds to a set of features of a detection box. This matrix serves as the input to a weighted clustering algorithm for clustering small, dense targets in the substation. For example, the center x-coordinate, center y-coordinate, length, and width of each detection box are combined into a four-dimensional feature row vector. The row vectors of all detection boxes are then concatenated to construct the feature matrix. The number of rows in the matrix equals the total number of detection boxes, and the number of columns is fixed at four.

[0058] S403 calculates the weighted distance between different detection sample data based on the feature matrix.

[0059] In this embodiment, the four-dimensional feature matrix of the detection boxes has been constructed. The weighted distance between each pair of detection boxes is calculated. This distance takes into account both the spatial location and size of the target, and is used to measure the similarity of different power equipment targets, providing a metric for clustering dense small targets. The formula for calculating the weighted distance is as follows:

[0060] in, For the sample With sample Weighted distance between them; This is a spatial location weighting coefficient used to cluster dense targets that are physically adjacent into one class; This is the target size weighting coefficient, used to constrain the differences in target size within a cluster and prevent targets with significantly different sizes from clustering together. and The configuration is preset according to the distribution characteristics of substation equipment.

[0061] S404 performs clustering based on multiple weighted distances, resulting in various sample clustering types.

[0062] In this embodiment, based on all weighted distances calculated from pairwise detection boxes, a clustering algorithm is executed to group substation equipment detection boxes that are spatially close and similar in size into the same category, thus dividing several sample clustering types to distinguish dense small target areas from other target areas, preparing for subsequent data augmentation with white space cropping.

[0063] For example, the weighted distance between all pairs of detection boxes is used as the similarity metric input to the clustering algorithm. The smaller the weighted distance, the higher the similarity between the two targets. The algorithm divides all detection boxes into different clusters based on their distance. Each cluster corresponds to a sample clustering type. Subsequently, whitespace-based cropping is performed on the target regions corresponding to each cluster type.

[0064] For example, in a switch cabinet image, there are two indicator light detection boxes that are close to each other and similar in size, and a panel display screen distorted image detection box that is farther away and larger in size. After calculation, the weighted distance between the indicator lights is small, while the weighted distance between the indicator lights and the panel display screen distorted image is large. After clustering, two types of sample clusters are obtained: one is the dense target cluster of indicator lights in the switch cabinet, and the other is the independent target cluster of the panel display screen distorted image. Subsequently, only the dense target cluster area of ​​indicator lights is filled out and cropped to generate enlarged sub-images to expand the training samples of small targets. The panel display screen distorted image cluster is not cropped because the targets are sparse.

[0065] In the above method, sample clustering is completed by extracting the center coordinates, length and width of the detection box to construct a feature matrix and calculating the weighted distance. It can automatically group the samples based on the spatial and scale characteristics of the defective target, providing a reliable basis for subsequent local cropping to generate sub-samples.

[0066] S302, the detection sample data is cropped according to the sample clustering type to obtain the sub-detection sample dataset corresponding to each clustering type.

[0067] In this embodiment, according to the already divided sample clustering types, the original detection sample image is cropped with a white space. Each cluster corresponds to a cropped local image, generating its own sub-detection sample dataset, which enlarges dense small targets and solves the problem that targets such as substation indicator lights occupy too small a proportion in the original image.

[0068] For example, for each sample clustering type, the bounding area of ​​all detection boxes under that cluster is obtained, and the cropping area is determined by expanding outward with a preset filling ratio. The image of that area is cropped on the original detection sample image, and the corresponding annotation box in the area is retained at the same time to generate the sub-detection sample dataset corresponding to that clustering type.

[0069] For example, clustering yields dense target clusters of indicator lights on switch cabinets and distorted target clusters of display screens. All detection boxes within the indicator light clusters are selected, and the boxes are expanded outwards to fill the white space, creating cropping boxes. A partial image of the switch cabinet panel is cropped from the original image, retaining the labels of each indicator light, resulting in a sub-detection sample dataset corresponding to the indicator lights. If the distorted display screen clusters are large, cropping may be unnecessary or minimal. The cropped sub-detection samples will be used in conjunction with the original image. Figure 1 It participates in the composite enhancement of light and lens shake, expanding the effective training samples for small targets.

[0070] S303 combines multiple subsample detection datasets and the first power sample data to obtain incremental training sample data.

[0071] In this embodiment of the application, the multi-group sub-detection sample dataset (locally magnified small target sub-image) generated after clustering and pruning is merged and integrated with the preset first power sample data (plant base sample), and then processed accordingly to finally generate incremental training sample data for fine-tuning the local model of the substation.

[0072] For example, the sub-detection sample datasets output by each cluster type, together with the original detection sample data, are merged with the first power sample data, which is the base image-labeled sample issued in the factory. Then, after undergoing dual pipeline image enhancement processing for light changes and lens shake, all samples are encrypted and written into the binary cache in the form of entries to form complete incremental training sample data for use in nighttime stratified freezing and knowledge distillation training.

[0073] For example, three sub-detection samples are obtained by clustering and cropping the indicator lights of the switch cabinet. These samples are then combined with the first power base sample in the factory, which contains indicator lights, screen distortion on the panel display, and switch cabinet defects. After brightness and affine transformation enhancement, an incremental training sample dataset is formed, which is used for incremental fine-tuning of the model to improve the model's ability to identify tiny indicator light defects in the original image.

[0074] In the above method, by clustering the detection samples and cropping them according to the cluster type to obtain the sub-detection sample dataset, and then combining it with the existing power samples to generate incremental training samples, it is possible to achieve local focus on the defect target, enrich the small target samples, and improve the model's learning effect on various power defects.

[0075] S103, the weight parameters of the feature extraction network and spatial coding network of the current substation inspection model are locked to obtain a target inspection model with fixed backbone parameters.

[0076] In this embodiment, the weight parameters of the feature extraction network (CNN backbone network) and spatial coding network (Transformer encoder) in the current substation inspection Transformer detection model are locked and frozen. During training, these two parameters are no longer updated, and only the subsequent output branches are retained for training, resulting in a target inspection model with fixed backbone parameters. This preserves the general visual features of power equipment learned from the base in the plant and avoids catastrophic forgetting caused by incremental training with small samples.

[0077] For example, during the model training phase, the gradients of the feature extraction network and spatial coding network parameters are set to 0. During backpropagation, the weights of these two networks are not calculated or updated. Only the parameters of the decoder detection head are allowed to participate in the gradient update, generating a target inspection model with fixed backbone parameters. At the same time, it supports selective unfreezing of a small number of shallow blocks of the Transformer encoder in the configuration file to adapt to extremely complex scenarios.

[0078] For example, the Transformer model for substation inspection consists of three parts: a CNN backbone feature extraction network, a Transformer encoder spatial encoding network, and a decoder detection head. After the locking operation is performed, the weights of the CNN backbone used to extract the outline texture of switchgear and panel display screens, as well as the weights of the Transformer encoder for spatial feature encoding, are all fixed. Only the classification and regression parameters of the detection head are allowed to be updated in subsequent incremental training. This not only preserves the basic features of various power equipment originally learned by the model, but also adjusts the decision boundary for defect judgment based only on incremental samples from the field, thus alleviating the overfitting and forgetting of old features caused by small sample training.

[0079] S104, The target inspection model is subjected to timed supervised training based on the prior model and incremental training sample data to obtain the updated target inspection model; wherein, the prior model is the substation inspection model trained based on the full power sample data; the first power sample data is the sample data selected from the full power sample data.

[0080] In this embodiment, a prior model (a high-precision teacher model trained on the full power sample in the plant) is used as a reference for knowledge distillation. Combined with the incremental training sample data constructed earlier, timed supervised training is carried out on the target inspection model that has been frozen on the main line during the idle period at night in the substation to obtain the iteratively updated inspection model. The first power sample data is a subset that is selected and simplified from the full power sample used to train the prior model and distributed to the local substation as the basic prior data for on-site fine-tuning.

[0081] The above method uses a prior model to provide global prior constraints, and a parameter locking strategy to retain the general visual features of power equipment. At the same time, incremental samples are formed based on actual missed and false detections in the field to achieve model adaptation. This effectively improves the catastrophic forgetting, sample class imbalance and prediction drift phenomena in the incremental training process, and enhances the generalization performance and detection accuracy of substation equipment defect identification.

[0082] In one embodiment, see Figure 5 This is a schematic diagram of the process for timed training of the target inspection model provided in this application embodiment, as follows: Figure 5 As shown, step S104 includes: S501, at a set time, calculate the target hash value of the preset database; wherein, the preset database stores incremental training sample data.

[0083] In this embodiment, when the preset nighttime training time is reached, a target hash value (aggregated hash snapshot) is calculated on the preset database storing incremental training sample data. This is used to determine whether the incremental training sample data in the database has been added or modified, thereby deciding whether to execute the current round of model training, so as to avoid performing invalid training and wasting computing power when there are no sample changes.

[0084] For example, when the configured nighttime training time arrives, the system reads all the structured sample records of the points associated with the current model in the preset database, aggregates the sample entries and annotation information, and calculates the target hash value corresponding to the model. For example, the preset database stores incremental training samples of switch cabinet indicator lights and panel display screen distortion defects. When the scheduled training time is 2 a.m., the system aggregates all the sample file information corresponding to the model to calculate the MD5 target hash value.

[0085] S502, compare the target hash value with the historical hash value of the preset database at the previous moment.

[0086] In this embodiment, the newly calculated target hash value at a given time interval is compared with the historical hash snapshot of the previous round stored in the preset database to determine whether the content of the database storing incremental training samples has changed, which serves as the basis for deciding whether to start model training.

[0087] For example, the historical hash value from the previous moment is read from the local persistent storage, and the target hash value calculated this time is compared with it bit by bit. If the two are equal, it means that the incremental training sample data has not been added or modified, and the current round of training is skipped directly; if the two are not equal, it means that there are new samples in the database after the handling of missed detections and false detections, and the subsequent supervised training process needs to be carried out.

[0088] For example, if the historical hash snapshot saved after the previous training round is MD5-A, the target hash value of the preset database will be recalculated during the night training time. If no new defect samples are added on site, the hash will still be MD5-A. If the two are consistent, training will be skipped, and GPU resources will be released for daytime inspection. If new samples of panel display screen malfunction or damage are added on site, the database content will change, and the newly calculated target hash will be MD5-B, which is inconsistent with the historical hash MD5-A. In this case, distillation training based on the prior model will continue.

[0089] S503, if the target hash value is different from the historical hash value, then the target inspection model is subjected to timed supervised training based on the incremental training sample data in the preset data.

[0090] In this embodiment of the application, if the target hash value calculated this time is inconsistent with the historical hash value, it means that new samples have been added to the incremental training sample database or the original samples have been modified. At this time, the timed supervised training process is triggered, and the incremental training samples in the database are used to train and update the target inspection model that has been frozen in the main trunk.

[0091] In the above method, by periodically comparing the current and historical hash values ​​of the sample database, supervised training is only started when the incremental training samples change, avoiding meaningless repeated training, saving computing power at the edge, and improving the execution efficiency of timed training.

[0092] In one embodiment, see Figure 6 This is a schematic diagram of the second step in the implementation of this application for timed training of the target inspection model. Figure 6 As shown, step S503 includes: S601, Calculate the ratio between each sub-detection sample dataset and the incremental training sample data.

[0093] In this embodiment, the number of samples in each sub-detection sample dataset is counted and compared with the total number of samples in the entire incremental training sample dataset to obtain the proportion of each type of cropped sub-sample in the entire training sample. The sampling weight can then be set based on this proportion to avoid excessive numbers of cropped sub-samples for a particular type of small target causing training bias and to ensure a balanced distribution of training samples. For example, the number of samples in each sub-detection sample dataset is counted separately, and then the total number of samples in the incremental training sample data is counted. The ratio is obtained by dividing the number of samples in each sub-detection sample dataset by the total number of samples. This ratio is used as the basis for calculating the sample sampling weight. During the training process, the probability of each type of sample being selected to participate in the iteration is adjusted according to the ratio to suppress the excessive influence of the category with a large number of samples on the training.

[0094] For example, the incremental training sample data contains a total of 2000 samples, of which 400 are sub-detection samples corresponding to the indicator light cluster, 200 are sub-detection samples corresponding to the panel display screen distortion cluster, and the remaining 1400 are original images and the first power sample in the factory. The calculated ratio of indicator light sub-samples is 0.2, and the ratio of panel display screen distortion sub-samples is 0.1. During training, weighted sampling is performed based on these two ratios to prevent a large number of cropped indicator light sub-samples from dominating the training, and to ensure that the model still has the ability to identify defects in other equipment such as panel display screen distortion and switch cabinets.

[0095] S602, assign weights to the sub-detection sample dataset according to different ratios to obtain assigned sub-detection sample data.

[0096] In this embodiment, based on the previously calculated proportion of each sub-detection sample dataset in the incremental training samples, sampling weights are assigned to each type of sub-detection sample dataset, resulting in weighted sub-detection sample data. This weighted data is used to balance the sampling probability of each type of sample during training, preventing excessively high proportions of certain cropped sub-samples that could lead to model training bias. The specific calculation formula is as follows:

[0097] The `clip` function is used to limit the upper and lower bounds of the weights to prevent gradient explosion. When there are no missed / false detections (no new cases) or a small number of new cases in a certain category, its... Relatively small, thus assigning a higher weight. Protect the existing features of the category from being overwhelmed by the massive number of newly added categories; for categories that surge in the field, appropriately reduce their weight to balance the discourse power of each category during backpropagation. Each defect category c (the clustering type corresponding to the sub-detection sample dataset) is configured with a factory-based baseline sample size. (i.e., the first power sample data), and before each night training session, the total number of actual samples for that category is calculated. (Existing base stock + new on-site stock) (i.e., incremental training sample data).

[0098] For example, the larger the ratio of the sub-detection sample dataset, the more samples of that class there are, and the smaller the weight is assigned. The smaller the ratio, the larger the weight is assigned. The weight information is bound to the corresponding sub-detection sample dataset to generate assigned sub-detection sample data. The weight is used in the training sampling process to control the probability of each class of sample being selected into the batch.

[0099] For example, the indicator light subsample ratio is 0.2, which is a relatively high sample proportion, so it is assigned a weight of 0.5. The panel display screen distorted screen subsample ratio is 0.1, which is a relatively small sample number, so it is assigned a weight of 1.0. By binding the weights with the sample data, two sets of assigned sub-detection sample data are obtained. During training sampling, the sampling probability of the indicator light clipping subsample is reduced and the sampling probability of the panel display screen distorted screen subsample is increased to avoid the model overfitting the small target of the indicator light and maintain the model's balance in recognizing various power defects.

[0100] S603, and the sub-assignment detection sample data and the first power sample data are recorded as the assignment increment training sample data.

[0101] In this embodiment, various assigned sub-detection sample data carrying sampling weight information are integrated with the first power sample data with its own basic sampling weight. All samples are uniformly collected and marked as assigned incremental training sample data. When reading samples during training, each sample carries its own weight parameters for the weighted sampling logic to call during the training process.

[0102] For example, weighted indicator lights and panel display screen distortion sub-detection samples are combined with the first power samples of switch cabinets and panel display screen distortion issued in the factory and used as the whole as incremental training sample data. During training, sample batches are extracted according to the weights bound to each sample. This not only utilizes the small target sub-samples obtained from on-site trimming to optimize defect identification, but also relies on the first power sample to retain the general characteristics of power equipment.

[0103] S604, perform timed supervised training on the target inspection model based on the incremental training sample data.

[0104] In this embodiment, incremental training sample data with pre-configured sampling weights are used to conduct supervised training on the target inspection model of the frozen backbone network at a preset time interval. The sampling probabilities of various samples are balanced by the weights inherent in the samples to complete the model parameter update.

[0105] For example, the incremental training sample data is loaded and weighted sampling is performed according to the weights bound to the samples to generate training batches. During the training process, the weights of the feature extraction network and spatial coding network are kept locked. Knowledge distillation is performed in combination with the prior model, and only the parameters of the detection head are updated.

[0106] For example, the incremental training sample data includes weighted indicator lights, panel display screen malfunction sub-samples, and first power samples. During training, the probability of selecting excessively numerous indicator light sub-samples is reduced, and the sampling opportunity of scarce samples is increased. Supervised training is completed in a timed window at night to update the target inspection model and avoid the model from being biased towards a certain type of defect target.

[0107] In the above method, supervised training is carried out after statistically analyzing the proportion of each sub-detection sample dataset and assigning weights. This balances the gradient contributions of different types of defect samples, alleviates the sample imbalance problem, and improves the target inspection model's ability to identify scarce power defects.

[0108] In one embodiment, see Figure 7 This is a schematic diagram of the process for timed training of the target inspection model as proposed in the embodiments of this application, such as... Figure 7 As shown, step S604 includes: S701, for each training sample in the incremental training sample data, input the training sample into the prior model to obtain the first detection result.

[0109] In this embodiment, each training sample in the incremental training sample data is fed into the prior model (the teacher model trained in the factory) for inference, and the first detection result is output. This result includes the predicted box position and category probability, which is used for subsequent knowledge distillation to provide soft label supervision information for the target inspection model.

[0110] For example, during the training phase, the prior model is set to evaluation mode, all weights are frozen and no parameter updates are performed, and each image in the incremental training samples is sequentially input into the prior model. After feature extraction, detection and decoding, the first detection result containing bounding boxes and class confidence is output, and this detection result is saved as a reference soft label for distillation.

[0111] For example, a training sample of indicator light defects in a switch cabinet is input into the prior model. The prior model infers and outputs the first detection result, which includes the coordinates of the predicted bounding box of the indicator light defect and the softening probability distribution of various defects. This result does not participate in backpropagation, but is only used to constrain the learning of the target inspection model to ensure that the prior knowledge learned in the factory is not lost during on-site fine-tuning.

[0112] S702, input the training samples into the target inspection model to obtain the second detection result.

[0113] In this embodiment, the same incremental training sample is input into the target inspection model (student model) whose backbone has been frozen, and the second detection result is output through inference to obtain the current prediction output of the model. This is used to compare with the first detection result of the prior model, calculate the distillation loss, and complete the parameter update.

[0114] For example, the target inspection model is kept in training mode, the weights of the feature extraction network and the spatial coding network are kept locked, and only the detection head participates in the forward operation. The training sample image that is exactly the same as the input prior model is sent into the target inspection model. After forward inference decoding, a second detection result containing the predicted box coordinates and the probabilities of various defect categories is obtained.

[0115] For example, when the same sample image of a switch cabinet with a faulty indicator light is input into the target inspection model, a second detection result is obtained. The model outputs the defect location and category probability predicted by itself. Subsequently, the second detection result and the first detection result output by the prior model are fed into the loss function to calculate the classification and regression loss. Backpropagation is only performed on the detection head for updates.

[0116] S703, calculate the first loss based on the first and second test results.

[0117] In this embodiment, a first loss is calculated based on the first detection result output by the prior model and the second detection result output by the target inspection model. This loss is the knowledge distillation loss (KL divergence), which is used to measure the difference between the student model output and the teacher prior model output and to guide the parameter iteration of the target inspection model.

[0118] For example, the softening category probability and bounding box regression information of the first detection result are extracted, and the prediction probability and prediction box corresponding to the second detection result are extracted. The category distillation loss is calculated using KL divergence and combined with the bounding box regression loss to form the first loss. This loss represents the output deviation between the target inspection model and the prior model.

[0119] For example, in the defect sample of the indicator light of the switch cabinet, the first detection result is the softening probability distribution and box position output by the prior model, and the second detection result is the predicted output of the target inspection model. Substituting the two into the loss formula, the first loss, i.e., the distillation loss, is calculated. The larger the loss value, the greater the deviation between the output of the target inspection model and the prior teacher model. Subsequently, relying on backpropagation, the first loss is used to constrain the updating of only the parameters of the detection head part, so that the student model is aligned with the output of the teacher model.

[0120] S704, calculate the second loss based on the position of the predicted detection box corresponding to the second detection result and the actual detection box corresponding to the training sample.

[0121] In this embodiment, the positional deviation between the predicted detection box in the second detection result output by the target inspection model and the actual detection box labeled by the training sample is compared to calculate the second loss, which is the box regression loss of supervised training, and is used to constrain the model's predicted box to be as close as possible to the real labeled box.

[0122] For example, the predicted detection box coordinates in the second detection result are extracted, and the ground truth values ​​of the actual detection boxes pre-labeled in the training sample are extracted. The L1 loss or cross-union loss is used to calculate the position and width / height deviation between the two boxes to obtain the second loss, which only participates in the parameter update of the detection head. For example, in the switch cabinet sample, the actual detection box marks the true position of the fault indicator light. The predicted box output by the target inspection model has a small offset. The predicted box and the true box are substituted into the box regression loss to calculate the second loss. The larger the offset, the higher the value of the second loss. The training reduces this loss, prompting the model's predicted box to continuously approach the truly labeled defect position.

[0123] S705, calculate the third loss based on the predicted sample category corresponding to the second detection result, the actual sample category corresponding to the training sample, and the weight assignment corresponding to the training sample.

[0124] In this embodiment, the sample category predicted by the target inspection model, the true labeled category of the training sample, and the pre-assigned weights of the sample are combined to calculate the third loss, namely the classification loss with sample weights, which is used to weigh the contribution of different samples to the training and balance the classification learning effect of various defects.

[0125] For example, the predicted class probability of the second detection result and the real sample class of the training sample are extracted, the weights bound to the training sample are read and assigned, the weights are introduced into the cross-entropy loss function, and the third loss is obtained by weighted calculation; the larger the weight of the sample, the higher the contribution of the loss caused by the classification error.

[0126] For example, the weight of the indicator light subsample is assigned to 0.5, and the weight of the panel display screen malfunction subsample is assigned to 1.0. When the panel display screen malfunction sample makes a category prediction error, it will generate a larger third loss. The training will prioritize correcting the classification bias of scarce samples to avoid the indicator light samples with a high proportion of numbers dominating the classification learning, so that the model can take into account the classification and recognition of various power defects.

[0127] S706, calculate the total loss corresponding to the first loss, the second loss, and the third loss.

[0128] In this embodiment, the first loss from knowledge distillation, the second loss from box regression, and the third loss from classification with sample weights are weighted and summed according to their respective weight coefficients to obtain the total loss used for model training. This total loss drives backpropagation to update the target inspection model parameters. The specific calculation formula is as follows:

[0129] in, This is the distillation temperature coefficient. and These represent the softening category probabilities for teachers and students, respectively. and For students, predict the bounding box and the true bounding box. and Predict the class and the actual class for students. , , The weights for each loss parameter are set. Indicates weight by category Weighted cross-entropy loss.

[0130] S707 If the total loss does not converge, continue to train the target inspection model based on the incremental training sample data until the total loss converges, and obtain the updated target inspection model.

[0131] In this embodiment, if the calculated total loss has not yet reached the convergence condition, the target inspection model is iteratively trained using the incremental training sample data. Forward inference, calculation of various losses, and backpropagation to update the detection head parameters are repeatedly performed until the total loss converges, and finally the updated target inspection model is output.

[0132] For example, a convergence criterion for the total loss is set, such as the decrease in the total loss over multiple consecutive iterations being less than a preset threshold. If the convergence criterion is not met, the process is repeated: weighted sampling of samples, prior model inference to obtain the first detection result, target inspection model inference to obtain the second detection result, calculation of the first, second, and third losses respectively, and synthesis of the total loss. Backpropagation only updates the detection head parameters, and this process is repeated. Training stops when the change in the total loss meets the convergence requirement, and the updated target inspection model is saved. For example, if the total loss is 0.223 in the initial training phase, and the total loss continues to decrease in each iteration, convergence is determined when the change in the total loss is less than 0.005 for 10 consecutive iterations. Training stops, and the updated substation inspection model is obtained for subsequent on-site defect inference. If the loss fluctuates significantly and does not meet the convergence criterion, the training process is repeated by reading incremental training samples.

[0133] In the above method, the first loss is calculated by combining the output of the prior model, the second loss is calculated by the bounding box position, and the third loss is calculated by the class information with sample weights to obtain the total loss. The method is then iteratively trained until convergence. This method can transfer prior model knowledge, take into account the accuracy of bounding box regression and the problem of class imbalance, and effectively improve the power defect detection effect of the updated target inspection model.

[0134] See Figure 8 This is a system architecture diagram of the substation inspection model training based on hierarchical freezing and knowledge distillation provided in the embodiments of this application, as shown below. Figure 8 As shown, it includes: 1) In-plant data preparation end The factory completes the preparation of the basic dataset: screening standard base images, labeling cleaning power equipment samples (i.e., the first power sample data), then encrypting them, and sending the base data package to the local server of the substation to provide basic prior samples to the site. The site does not need to save all the massive full samples.

[0135] 2) Substation local server It is divided into two main sub-processes: sample storage and timed training. Sample reception and addition: Receive encrypted base station data packets from within the factory and save them as .dat binary files; at the same time, collect missed and falsely detected samples generated during on-site inspections, encrypt and add them to the sample library.

[0136] Nighttime scheduled training assembly line: A task is triggered at night to perform MD5 snapshot verification of the sub-model (i.e., hash comparison to determine whether the sample library has been updated; if not, training is skipped).

[0137] For substation-oriented enhancement, weighted DBSCAN clustering and cropping are performed: clustering of samples, local image cropping to generate small target subsamples (i.e., subsample datasets), image enhancement, and balanced sample distribution are then applied.

[0138] Layered freezing of student models: Freeze the backbone network and only open the detection head for training; then perform global teacher KD knowledge distillation and use the factory teacher prior model for supervised training to avoid catastrophic forgetting under limited computing power.

[0139] After fitting and validating the defect data, the model with the best performance (target inspection model) is selected, and a new weight file is automatically issued.

[0140] 3) Terminal closed-loop application The terminal loads the new model weights issued by the server and performs periodic inspection tasks; at the same time, it continuously collects new samples that are missed or falsely detected and sends them back to the local server, constantly supplementing incremental samples to form a complete closed-loop iteration.

[0141] See Figure 9 This is a schematic diagram of the data entry-level encrypted cache and index structure provided in the embodiments of this application, as shown below. Figure 9 As shown, it includes: Physical storage layer: All binary encrypted cache file samples are encrypted and stored. Each entry consists of Nonce + AuthTag + ciphertext, and is encrypted using AES-GCM. The original plaintext image is not directly saved to the disk. New samples are incrementally appended to the append write area to achieve encrypted appending of missed / false detection samples.

[0142] The index file idx.rgpe records the metadata for each sample: byte length, entry offset, data source (in-plant base sample / on-site incremental sample), and model identifier.

[0143] Reading process: The training process initiates a batch request, queries the index file, and obtains the offset of the sample entry.

[0144] Read and decrypt layers on demand: By using the index offset, Seek is called to precisely read the corresponding ciphertext byte stream from the disk, without loading the entire dataset into memory at once.

[0145] The plaintext is sent to the instantaneous decryption area in memory and decrypted using AES-GCM. After decryption, it only exists in memory and will not be written to the hard drive, thus achieving no plaintext written to disk.

[0146] Memory pass-through layer: The decrypted samples are directly converted and sent to the GPU memory via CUDA, then handed over to the training and inference core, saving memory-CPU copy overhead and improving training read speed.

[0147] See Figure 10 This is a flowchart illustrating the on-site semi-automatic bounding box correction, model back-annotation, and matching filtering process for obtaining complete labels provided in this application embodiment. Figure 10 As shown, it includes: Start: On-site staff upload partial annotations. On-site staff only need to upload partial annotations, including two types of markings: missing detections are marked with additional frames, and false detections are marked. This eliminates the need for manual annotation of the entire image, reducing the workload of on-site annotation.

[0148] The server calls the original image of the current model and sends the original image into the current inspection model for inference, and obtains all the automatic detection boxes output by the model itself.

[0149] Diamond-shaped judgment: IoU matching filters conflicting boxes (same category and IoU greater than threshold). It performs intersection-union (IoU) comparison + category consistency comparison between manually labeled boxes and model output boxes, handling conflicts in three branches: Branch 1: Delete false positive boxes (manually marked for deletion): Boxes identified by the model but manually marked as false positives are directly removed from the model's output.

[0150] Branch 2: Retain correct back-labeled boxes (areas not manually marked): If the model output box category and IoU meet the conditions, the detection boxes automatically generated by the model are directly retained in the areas on the image that have not been manually marked. No further manual annotation is required.

[0151] Branch 3: Extracting Missed Defect Boxes (Manual Redrawing): Missed defect boxes are manually drawn. The model itself did not detect them, so the manually drawn boxes are directly adopted.

[0152] By merging manually added bounding boxes and back-labeled bounding boxes, the three sets of results above are combined: manually added missed bounding boxes, retained correct bounding boxes of the model, and incorrectly added bounding boxes without manual labels, thus integrating a complete set of annotations.

[0153] Generate full-image labeled samples and output the complete labeled file of the entire image to obtain samples that can be used for subsequent incremental training.

[0154] See Figure 11 This is a diagram of the multi-model logical isolation + independent snapshot storage structure provided in the embodiments of this application, such as... Figure 11 As shown, it includes: The entire system uses a single .dat binary cache file and idx.rgpe index for global unified storage, and only one physical copy of the sample data is stored. At the logical level, different models and different locations are read in isolation, and multiple models can reuse the same physical sample library.

[0155] The sample metadata directory qx_library contains a JSON file for each substation location, recording missed and false positive sample information for that location. The JSON collections corresponding to the model are associated with each location, and the MD5 hash values ​​of the model-specific sample library are calculated.

[0156] For the same physical sample library, different models use different subsets of samples for selection. Each model calculates the MD5 hash of its own subset separately, rather than using a unified hash across the entire library.

[0157] The training state snapshot file train_state saves historical MD5 snapshots of each model after the last round of training (modelA_MD5_A, modelB_MD5_B).

[0158] Diamond-shaped comparison: Compare the MD5 hash (target hash value) of a newly calculated subset of model samples with the historical MD5 hashes of the model stored in `train_state`. Consistent: If no new or modified sample subset is added to the model, skip this round of model training, release computing power, and the process ends.

[0159] Inconsistency: The sample set of the model has been updated. Jump to perform KD knowledge distillation fine-tuning.

[0160] After training is complete and the KD distillation training is finished, update the MD5 snapshot of the model in the train_state file and save it as the new historical verification benchmark, waiting for the next timed verification. Training read phase: Read the global train_cache encrypted cache and perform data augmentation and KD distillation fine-tuning.

[0161] See Figure 12 This is a flowchart of the substation directional enhancement + weighted DBSCAN clustering pruning process provided in the embodiments of this application, such as... Figure 12 As shown, it includes: Read the defect library sample (base + back-annotation fusion) input sample set, including in-plant base samples and on-site manual-model back-annotation fusion output labeled samples.

[0162] Extracting a 4D feature matrix (center point + width and height): Extracting the 4D geometric features of each defect box, namely the center point coordinates, width, and height of the target box, for clustering operations.

[0163] DBSCAN Weighted Clustering (Dense Small Target Grouping) uses the weighted DBSCAN algorithm to automatically group small defective targets that are spatially clustered together into a group, thus identifying dense small target regions within an image.

[0164] With white space cropping (local magnification to generate sub-images), for each cluster region, white space is reserved outward for local cropping and magnification to generate local sub-images (sub-detection samples), magnifying small defects and improving the model's learning effect on minor defects.

[0165] Two-way sample replication: Original image copy: Preserve the complete original image sample and ensure global context information.

[0166] Cluster subgraph copy: Save the enlarged subgraph cropped above.

[0167] The original image of the sample pool to be enhanced, plus all clustered sub-images, are combined and merged into the sample pool to be enhanced.

[0168] Pipeline A: Light Change Simulation (Brightness / Contrast) Level 1 Data Enhancement, simulates the light fluctuations at the substation site, randomly adjusts the image brightness and contrast to adapt to different lighting environments of the on-site camera.

[0169] Pipeline B: Lens Shake Simulation (Translation / Scaling / Rotation) Level 2 Data Augmentation, simulates camera gimbal shake and shooting angle shift, performs translation, scaling, and rotation transformations to improve model robustness.

[0170] The data is encrypted and appended to the global cache and all samples after index enhancement are updated. The data is then encrypted and appended to the .dat binary global cache file, and the idx.rgpe index file is updated synchronously for use in subsequent training processes.

[0171] See Figure 13 This is a diagram of the hierarchical frozen network structure of the CNN backbone and encoder based on the Transformer architecture detection model provided in this application embodiment, as shown below. Figure 13 As shown, it includes: Input: Images and annotations are fed into the image samples to be trained and defect annotations; the text in the lower left corner is the design goal of this scheme: retain the general visual prior of the base in the factory, suppress feature oscillations caused by small samples, and only fine-tune the output branch.

[0172] Dual-branch frozen feature extraction CNN backbone network: requires_grad=False, parameters are frozen, weights are not updated, responsible for extracting low-level visual features of the image.

[0173] Transformer encoder: requires_grad=False, parameters are frozen, weights are not updated, and global context features are captured.

[0174] The backbone and encoder use the factory-pre-trained weights, which are not changed when training with a small number of samples on site.

[0175] The decoderhead is the only trainable module: `requires_grad=True` means only this part participates in backpropagation and weight updates. Features from the CNN backbone output and the Transformer encoder output are fused for mapping to the detection task.

[0176] Output two branches: The box regression output box_pred: predicts the location coordinates of the defective target.

[0177] The classification output cls_pred predicts the category of the defect.

[0178] See Figure 14 This is a flowchart of the global teacher + adaptive equilibrium KD distillation loss calculation provided in the embodiments of this application, such as... Figure 14 As shown, it includes: The mixed sample input (base + field sample, i.e. incremental sample training data) is simultaneously input with the general sample of the factory base and the incremental sample collected and labeled at the substation site, and sent to two parallel branches, namely the global teacher model branch (i.e. prior model) and the student model branch (i.e. target inspection model).

[0179] Left-side - Global Teacher Model Branch The global teacher model is in eval inference mode, with parameters permanently frozen and not participating in training updates.

[0180] The input sample is processed by the teacher model to generate a high-temperature soft label.

[0181] The soft probability distribution is obtained by using Softmax(T) with a temperature coefficient T.

[0182] Calculate the KL divergence loss to transfer the general knowledge distillation from the teacher model to the student model.

[0183] The right-side student model branch maintains the same network structure as the previous block diagram: CNN backbone frozen, Transformer encoder frozen; only DecoderHead decoder head updated.

[0184] Forward inference outputs the coordinates of the predicted bounding box and the defect category.

[0185] Box location: Calculate the L1 box regression loss to constrain the accuracy of defect box coordinate prediction.

[0186] Defect classification: Introduce intra-class adaptive weights α_c to balance the gradients of rare defect samples, calculate weighted classification cross-entropy loss, and alleviate sample class imbalance.

[0187] Total loss calculation: Total loss = KL distillation loss + L1 box regression loss + weighted classification cross-entropy loss The combined loss is obtained by adding the three parts of the loss together.

[0188] Backpropagation (updating only the detector head) gradient backpropagation only updates the weights of the decoder detector head; the weights of the backbone network, Transformer encoder, and teacher model remain unchanged throughout the process.

[0189] See Figure 15 This is a flowchart of the nighttime mutex lock time-sharing serial distillation scheduling execution provided in the embodiments of this application, as follows: Figure 15 As shown, it includes: Reaching the nighttime training window: Entering the preset nighttime idle scheduling time, triggering a batch model local fine-tuning task.

[0190] Determine if the mutex is occupied: Yes (Lock already occupied): This indicates that a training task is already running. Abandon this scheduling and wait for the next night window to retry.

[0191] No (Idle Lock): Acquire a mutex lock to lock training computing resources and prevent concurrent conflicts.

[0192] Loop through the list of models to be trained, `pretrain_order`, and process each `modelId` one by one: Read the MD5 snapshot of the model and determine whether there are any new samples in the sample subset corresponding to the model (compare the MD5 snapshot): No new samples: Skip this model directly. Note: If a single model fails to train at the same time, it will not block subsequent models; if there is no change in MD5, skip training directly.

[0193] New samples are present: Perform KD distillation training (the entire knowledge distillation fine-tuning process mentioned above).

[0194] Training complete or abnormally interrupted: Regardless of whether the training is completed normally or interrupted by an error, the mutex lock is released.

[0195] Waiting for the next night window: This round of scheduling is complete, and the system is in hibernation, waiting for the next night window to arrive.

[0196] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not be construed as corresponding to the implementation process of this application's embodiments in the training method for substation inspection models based on hierarchical freezing and knowledge distillation in the above embodiments. Figure 16 This is a structural block diagram of the substation inspection model training device based on hierarchical freezing and knowledge distillation provided in the embodiments of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0197] Reference Figure 16 The device includes: The data acquisition module 161 is used to acquire the detection data output by the substation inspection model when inspecting substation equipment; the detection data includes missed detection data and false detection data. The training sample construction module 162 is used to construct incremental training sample data based on the detection data and the preset first power sample data. The network parameter fixing module 163 is used to lock the weight parameters of the feature extraction network and spatial coding network of the current substation inspection model to obtain a target inspection model with fixed backbone parameters. The timed training module 164 is used to perform timed supervised training on the target inspection model based on the prior model and incremental training sample data to obtain the updated target inspection model; wherein, the prior model is the substation inspection model trained based on the full power sample data; the first power sample data is the sample data selected from the full power sample data.

[0198] Optionally, the training sample building module 162 is also used for: Obtain the first correction data and the second correction data corresponding to the detection data; wherein, the first correction data is the data for correcting false detection data; and the second correction data is the data for correcting false negative detection data. Calculate the intersection-union ratio (IUGR) between the first detection box corresponding to the first corrected data and the second detection box corresponding to the detection data; If the crossover ratio is greater than the preset threshold, the first corrected data, the second corrected data, and the detection data are fused to obtain the detection sample data. Incremental training sample data is constructed based on the detection sample data and the first power sample data.

[0199] Optionally, the training sample building module 162 is also used for: Clustering of the test sample data yields various different sample clustering types; The test sample data is cropped according to the sample clustering type to obtain the sub-test sample dataset corresponding to each clustering type; Multiple subsample detection datasets and the first power sample data are combined to obtain incremental training sample data.

[0200] Optionally, the training sample building module 162 is also used for: Extract the center coordinates, length, and width of the detection frame corresponding to each detection sample data; Construct a feature matrix based on the center coordinates, length, and width of each detection box; Calculate the weighted distance between different detection sample data based on the feature matrix; Clustering is performed based on multiple weighted distances to obtain various sample clustering types.

[0201] Optionally, the timed training module 164 is also used for: At a set time interval, the target hash value of the preset database is calculated; the preset database stores incremental training sample data. Compare the target hash value with the historical hash value of the preset database at the previous moment; If the target hash value is different from the historical hash value, the target inspection model will be trained under timed supervision based on the incremental training sample data in the preset data.

[0202] Optionally, the timed training module 164 is also used for: The ratio between each sub-detection sample dataset and the incremental training sample dataset is calculated. The sub-detection sample dataset is weighted according to different ratios to obtain weighted sub-detection sample data. The sub-test data and the first power sample data are then recorded as the incremental training sample data. The target inspection model is subjected to timed supervised training based on the incremental training sample data.

[0203] Optionally, the timed training module 164 is also used for: For each training sample in the incremental training sample data, the training sample is input into the prior model to obtain the first detection result; The training samples are input into the target inspection model to obtain the second detection result; The first loss is calculated based on the first and second test results; The second loss is calculated based on the positions of the predicted detection box corresponding to the second detection result and the actual detection box corresponding to the training sample. The third loss is calculated based on the predicted sample category corresponding to the second detection result, the actual sample category corresponding to the training sample, and the weight assignment corresponding to the training sample. Calculate the total loss corresponding to the first loss, the second loss, and the third loss; If the total loss does not converge, the target inspection model will continue to be trained based on the incremental training sample data until the total loss converges, and the updated target inspection model will be obtained.

[0204] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0205] in addition, Figure 16 The substation inspection model training device based on hierarchical freezing and knowledge distillation shown can be a software unit, hardware unit, or a combination of software and hardware built into existing terminal equipment. It can also be integrated into the terminal equipment as an independent component or exist as an independent terminal equipment.

[0206] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0207] Figure 17 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. For example... Figure 17 As shown, the terminal device 17 of this embodiment includes: at least one processor 170 ( Figure 17(Only one is shown in the image) a processor, a memory 171, and a computer program 172 stored in the memory 171 and capable of running on at least one processor 170. When the processor 170 executes the computer program 172, it implements the steps in any of the above embodiments of the substation inspection model training method based on hierarchical freezing and knowledge distillation.

[0208] The terminal device can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. This terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 17 This is merely an example of terminal device 17 and does not constitute a limitation on terminal device 17. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0209] The processor 170 may be a Central Processing Unit (CPU), or it may be 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 may be a microprocessor or any conventional processor.

[0210] In some embodiments, memory 171 may be an internal storage unit of terminal device 17, such as a hard disk or memory of terminal device 17. In other embodiments, memory 171 may be an external storage device of terminal device 17, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on terminal device 17. Furthermore, memory 171 may include both internal and external storage units of terminal device 17. Memory 171 is used to store operating system, applications, boot loader, data, and other programs, such as program code of computer programs. Memory 171 may also be used to temporarily store data that has been output or will be output.

[0211] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps in the above-described method embodiments.

[0212] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.

[0213] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / terminal equipment, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0214] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0215] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0216] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0217] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0218] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A training method for a substation inspection model based on hierarchical freezing and knowledge distillation, characterized in that, The method includes: The detection data output by the substation inspection model for inspecting substation equipment is obtained; wherein, the detection data includes missed detection data and false detection data; Incremental training sample data is constructed based on the detection data and the preset first power sample data; By locking the weight parameters of the feature extraction network and spatial coding network of the current substation inspection model, a target inspection model with fixed backbone parameters is obtained. The target inspection model is subjected to timed supervised training based on the prior model and the incremental training sample data to obtain the updated target inspection model; wherein, the prior model is a substation inspection model trained based on the full power sample data; the first power sample data is sample data selected from the full power sample data.

2. The substation inspection model training method based on hierarchical freezing and knowledge distillation as described in claim 1, characterized in that, The step of constructing incremental training sample data based on the detection data and preset power sample data includes: Obtain first corrected data and second corrected data corresponding to the detection data; wherein, the first corrected data is data for correcting the false detection data; and the second corrected data is data for correcting the missed detection data. Calculate the intersection-union ratio (IUGR) between the first detection box corresponding to the first corrected data and the second detection box corresponding to the detection data; If the crossover ratio is greater than a preset threshold, the first corrected data, the second corrected data, and the detection data are fused to obtain the detection sample data. The incremental training sample data is constructed based on the detection sample data and the first power sample data.

3. The substation inspection model training method based on hierarchical freezing and knowledge distillation as described in claim 2, characterized in that, The step of constructing the incremental training sample data based on the detected sample data and the first power sample data includes: Clustering the detected sample data yields several different sample clustering types; The detection sample data is cropped according to the sample clustering type to obtain a sub-detection sample dataset corresponding to each clustering type; The incremental training sample data is obtained by combining multiple subsample detection datasets and the first power sample data.

4. The substation inspection model training method based on hierarchical freezing and knowledge distillation as described in claim 3, characterized in that, The clustering of the detected sample data yields several different sample clustering types, including: Extract the center coordinates, length, and width of the detection box corresponding to each of the detection sample data; A feature matrix is ​​constructed based on the center coordinates, length, and width of each detection box; Calculate the weighted distance between different detection sample data based on the feature matrix; Clustering is performed based on multiple weighted distances to obtain various sample clustering types.

5. The substation inspection model training method based on hierarchical freezing and knowledge distillation as described in any one of claims 1 to 4, characterized in that, The step of performing timed supervised training on the target inspection model based on the prior model and the incremental training sample data to obtain the updated target inspection model includes: At a predetermined time interval, the target hash value of a preset database is calculated; wherein, the preset database stores the incremental training sample data; The target hash value is compared with the historical hash value of the preset database at the previous moment; If the target hash value is different from the historical hash value, then the target inspection model is subjected to timed supervised training based on the incremental training sample data in the preset data.

6. The substation inspection model training method based on hierarchical freezing and knowledge distillation as described in claim 5, characterized in that, The step of performing timed supervised training on the target inspection model based on the incremental training sample data includes: The ratio between each sub-detection sample dataset and the incremental training sample data is calculated. The sub-detection sample dataset is weighted according to different ratios to obtain weighted sub-detection sample data. The assignment sub-detection sample data and the first power sample data are recorded as the assignment increment training sample data; The target inspection model is subjected to timed supervised training based on the incremental training sample data.

7. The substation inspection model training method based on hierarchical freezing and knowledge distillation as described in claim 6, characterized in that, The step of performing timed supervised training of the target inspection model based on the incremental training sample data includes: For each training sample in the incremental training sample data, the training sample is input into the prior model to obtain the first detection result; The training samples are input into the target inspection model to obtain the second detection result; Calculate the first loss based on the first detection result and the second detection result; The second loss is calculated based on the positions of the predicted detection box corresponding to the second detection result and the actual detection box corresponding to the training sample. The third loss is calculated based on the predicted sample category corresponding to the second detection result, the actual sample category corresponding to the training sample, and the weight assignment corresponding to the training sample. Calculate the first loss, the second loss, and the total loss corresponding to the second loss; If the total loss does not converge, the target inspection model is trained again based on the assigned incremental training sample data until the total loss converges, and the updated target inspection model is obtained.

8. A training device for a substation inspection model based on hierarchical freezing and knowledge distillation, characterized in that, include: The data acquisition module is used to acquire the detection data output by the substation inspection model when inspecting substation equipment; wherein, the detection data includes missed detection data and false detection data; The training sample construction module is used to construct incremental training sample data based on the detection data and the preset first power sample data. The network parameter fixing module is used to lock the weight parameters of the feature extraction network and spatial coding network of the current substation inspection model to obtain a target inspection model with fixed backbone parameters. The timed training module is used to perform timed supervised training on the target inspection model based on the prior model and the incremental training sample data to obtain the updated target inspection model; wherein, the prior model is a substation inspection model trained based on the full power sample data; the first power sample data is sample data selected from the full power sample data.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.