Knowledge distillation based power operation visual model light-weight method and system
By employing a knowledge distillation-based approach and utilizing a CNN-Transformer hybrid teaching assistant model for cross-architecture feature perception and safety perception adaptive distillation, the deployment challenge of high-precision lightweight models at power operation sites was solved, enabling efficient identification and safety assurance of edge devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NARI INFORMATION & COMM TECH
- Filing Date
- 2026-03-09
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies struggle to deploy high-precision and high-speed lightweight models at power operation sites, facing contradictions between high model accuracy and limited computing power hardware adaptation of edge devices, semantic gaps in knowledge transfer features of heterogeneous models, and the conflict between lightweight models and high power safety requirements.
We employ a knowledge distillation-based approach, introducing a special CNN-Transformer hybrid teaching assistant model and combining it with safety prior knowledge and robustness enhancement strategies specific to the power scenario. This approach enables cross-architecture feature-aware distillation and safety-aware adaptive distillation, generating a lightweight model suitable for edge devices.
It achieves deeper knowledge transfer, conveys the attention and representation capabilities of the intermediate feature layer, combines extremely lightweight parameters with high recognition accuracy, meets the real-time inference requirements of power edge devices, prioritizes the recognition performance of core devices, and eliminates the omission of high-risk hidden dangers.
Smart Images

Figure CN122390992A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a lightweight method and system for power operation visual models based on knowledge distillation, belonging to the field of computer vision technology. Background Technology
[0002] Computer vision technology plays an increasingly important role in intelligent operation and maintenance in the power industry, and is widely used in scenarios such as substation equipment status identification (e.g., transformer oil leakage, circuit breaker open / closed status identification), transmission line fault detection (e.g., insulator damage, hardware corrosion), and worker safety behavior analysis (e.g., not wearing a safety helmet, not wearing insulated clothing). However, the power operation site environment is complex (with strong electromagnetic interference, drastic changes in lighting, and extreme weather effects), and the edge devices deployed on-site (e.g., drones, quadruped inspection robots, portable surveillance cameras) have limited computing power, unstable network connections, and extremely low power consumption budgets. Currently, the solution of deploying large-scale deep learning models on cloud servers and transmitting video data back has problems such as high latency, high bandwidth pressure, and data security risks.
[0003] Therefore, while researching high-precision models, how to generate lightweight models that are suitable for edge devices and combine high precision and high speed has become a key technical challenge for the practical application of artificial intelligence in the power industry.
[0004] Currently, lightweight technology faces three major technical challenges when applied to power applications:
[0005] 1. The contradiction between high model accuracy and limited computing power of edge devices: In recent years, high-precision vision models based on self-attention mechanisms (such as Transformer-based architectures, like Swin Transformer and ViT) have made breakthrough progress on major vision benchmarks. However, these models have a huge number of parameters (usually in the tens of millions to hundreds of millions), and their computational complexity increases quadratically. Moreover, their core self-attention operators lack underlying hardware optimization on current edge NPUs (Neural Processing Units). To pursue the ultimate energy efficiency, the underlying instruction sets of edge devices are usually specially customized for highly parallel standard convolutions and depthwise separable convolutions. Therefore, directly deploying Transformer models at the edge cannot meet the real-time requirements of power services.
[0006] 2. The Feature-Semantic Gap in Knowledge Transfer from Heterogeneous Models (The Core Pain Point of This Invention): To achieve optimal recognition accuracy, cloud-based teacher models typically employ a Transformer architecture; however, to adapt to edge chips, the deployed student model must use a pure CNN architecture. Traditional knowledge distillation methods, if they directly align the features of these two models with drastically different inductive biases and feature distribution spaces, will lead to severe knowledge decay. Transformers process one-dimensional global token sequences, focusing on modeling global long-distance dependencies; while CNNs process three-dimensional local pixel tensors, focusing on extracting local translation invariance. Directly aligning the feature maps of the two is like asking people speaking two different languages to communicate directly, causing the student model to diverge and converge.
[0007] 3. The contradiction between lightweight model design and high power safety requirements: Traditional model compression methods (such as pruning and quantization) often result in uniform accuracy loss while achieving model lightweighting. This might be acceptable in general target detection tasks, but the consequences of identification errors on different devices vary drastically in power safety operations. For example, the potential risk of missing a damaged high-voltage insulator is far greater than the risk of misdetecting a common sign. Traditional lightweighting processes cannot guarantee consistently high-reliability identification of safety-critical equipment such as transformers and high-voltage lines, directly violating the power industry's "safety first" production principle. Summary of the Invention
[0008] Objective: To overcome the shortcomings of existing technologies, this invention provides a lightweight method and system for power operation visual models based on knowledge distillation. This invention completely breaks down the cross-architecture feature semantic gap between Transformer and pure CNN by introducing a special CNN-Transformer hybrid teaching assistant model. Furthermore, it injects safety prior knowledge and robustness enhancement strategies specific to the power scenario into the entire knowledge distillation process.
[0009] Technical solution: To solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0010] Firstly, a lightweight method for power operation visual models based on knowledge distillation is provided, specifically including:
[0011] Step S1: Preprocess the power image data to obtain the transformed enhanced image and the composite label dictionary.
[0012] Step S2: Train the teacher model using the transformed enhanced image and the composite label dictionary to obtain the trained teacher model.
[0013] Step S3: Construct a hybrid teaching assistant model and student model.
[0014] Step S4: Use the teacher model to perform the first stage of cross-architecture feature perception distillation on the hybrid teaching assistant model to obtain the updated parameters of the hybrid teaching assistant model.
[0015] Step S5: Use the hybrid teaching assistant model to update the parameters and perform a second-stage safety-aware adaptive distillation on the student model to obtain the updated parameters of the student model.
[0016] Optionally, it also includes: Step S6: Lightweighting the student model based on the updated parameters of the student model to obtain the student model executed by the edge computing device.
[0017] Optionally, step S1 specifically includes:
[0018] Step 1.1: Obtain the original three-channel image of the power equipment, defined as the input tensor I_orig, and obtain the bounding box label set Y_bbox and the category label set Y_cls corresponding to the original three-channel image.
[0019] Step 1.2: Apply the atmospheric scattering physics vector to the input tensor I_orig to obtain the enhanced weather parameter tensor I_weather.
[0020] Step 1.3: Randomly generate a two-dimensional mask matrix, use the two-dimensional mask matrix to occlude the enhanced weather parameter tensor I_weather, set the background area to zero, and inject Gaussian distributed noise with a mean of 0 and a random variance into the label area to obtain the transformed enhanced image tensor I_aug.
[0021] Step 1.4: Construct a mapping dictionary according to the power safety regulations. Iterate through each category label in the category label set Y_cls based on the mapping dictionary, and attach a static weight scalar omega to each category label. Construct a composite label dictionary Y_final containing safety level weights based on the bounding box label set Y_bbox, the category label set Y_cls, and the static weight scalar omega. Y_final = {Y_bbox, Y_cls, omega}.
[0022] Optionally, step S2 specifically includes:
[0023] Step 2.1: Use the transformed enhanced image and composite label dictionary to perform fully supervised fine-tuning training on the teacher model.
[0024] Step 2.2: During training, the standard cross-entropy loss is minimized and backpropagation is performed using the optimizer to update the data. After training converges, the weights of all network layers of the teacher model are obtained, and the pre-trained weight file Theta_Teacher is generated.
[0025] Optionally, the hybrid teaching assistant model includes: a shallow convolutional local perceptron and a deep attention global aggregator connected in sequence.
[0026] The shallow convolutional local perceptron, used for backward compatibility with student models, includes a series of 3×3 standard convolutional layers, a first depth-separable convolutional block, and a second depth-separable convolutional block.
[0027] A deep attention global aggregator is used to align the teacher model upwards, comprising a flattening module, a multi-head self-attention module, and a feedforward neural network connected in sequence.
[0028] The student model adopts a pure CNN architecture based on a deep customization of the MobileNetV3 series.
[0029] Optionally, the teacher model employs a Swing Transformer network.
[0030] Optionally, step S4 specifically includes:
[0031] Step 4.1: Input the image tensor X_batch of the same batch into the teacher model and the hybrid teaching assistant model at the same time. Output the deep output sequence T_seq corresponding to the teacher model with dimensions (Batch, Length, C_T) and the deep output feature map A_map corresponding to the hybrid teaching assistant model with dimensions (Batch, C_A, H_prime, W_prime).
[0032] Step 4.2: Use the reverse folding algorithm to perform spatial recovery on the deep output sequence T_seq corresponding to the teacher model to obtain the reconstructed two-dimensional spatial feature map T_map, with dimensions (Batch, C_A, H_prime, W_prime).
[0033] Step 4.3: Input the output feature map A_map of the corresponding depth of the hybrid teaching assistant model into the differentiable adapter module, and output the projected aligned feature map A_tilde_map, with the dimensions becoming (Batch, C_T, H_prime, W_prime).
[0034] Step 4.4: Mean the reconstructed 2D spatial feature map T_map over the channel dimension C_T to obtain the teacher model spatial attention distribution map M_s_T, with dimensions (Batch, 1, H_prime, W_prime). Mean the projected aligned feature map A_tilde_map over the channel dimension C_T to obtain the hybrid teaching assistant model spatial attention distribution map M_s_A. Calculate the spatial mean squared error loss L_S_MSE using the teacher model spatial attention distribution map M_s_T and the hybrid teaching assistant model spatial attention distribution map M_s_A.
[0035] L_S_MSE = Sum(|| M_s_T - M_s_A ||^2)
[0036] Sum() is the summation function.
[0037] Step 4.5: Perform global average pooling along the spatial dimension on the reconstructed 2D spatial feature map T_map to obtain the pure teacher model semantic strength vector v_c_T, with dimensions (Batch, C_T). Perform global average pooling along the spatial dimension on the projected aligned feature map A_tilde_map to obtain the pure hybrid teaching assistant model semantic strength vector v_c_A. Calculate the channel mean squared error loss L_C_MSE using the teacher model semantic strength vector v_c_T and the hybrid teaching assistant model semantic strength vector v_c_A.
[0038] L_C_MSE = Sum(|| v_c_T - v_c_A ||^2)
[0039] Step 4.6: Input the image tensors X_batch from the same batch into both the teacher model and the hybrid teaching assistant model simultaneously to obtain the output probability distribution Logits_Teacher of the teacher model and the output probability distribution Logits_Assistant of the hybrid teaching assistant model. Based on the output probability distributions Logits_Teacher and Logits_Assistant, calculate the KL divergence loss L_KL1, as shown in the following expression:
[0040] L_KL1 = KL(Softmax(Logits_Teacher / T_temp), Softmax(Logits_Assistant / T_temp))
[0041] Where KL() represents the KL divergence function and T_temp represents the first temperature coefficient.
[0042] Step 4.7: Construct the first-stage optimization objective Loss_Stage1 based on the spatial mean square error loss L_S_MSE, the channel mean square error loss L_C_MSE, and the KL divergence loss L_KL1. Distill the hybrid teaching assistant model through the first-stage optimization objective Loss_Stage1 to obtain the updated parameter Theta_Assistant_star of the hybrid teaching assistant model.
[0043] The expression for the first-stage optimization objective Loss_Stage1 is as follows:
[0044] Loss_Stage1 = alpha * L_S_MSE + beta * L_C_MSE + gamma * L_KL1 + L_CE
[0045] Where alpha, beta, and gamma are hyperparameters, and L_CE is the cross-entropy loss of the hybrid teaching assistant model for the real labels.
[0046] Optionally, step S5 specifically includes:
[0047] Step 5.1: Input the image tensor X_batch from the same batch into the student model, and output the student model prediction logic Logits_Student. Input the image tensor X_batch from the same batch into the hybrid teaching assistant model, and output the hybrid teaching assistant model prediction logic Logits_Assistant2.
[0048] Step 5.2: For the i-th detected target in the batch, obtain the static weight scalar omega_i based on the composite label dictionary Y_final corresponding to the i-th detected target. Calculate the KL divergence KL_i between the prediction logic distributions of the hybrid teaching assistant model and the prediction logic distribution of the student model for the i-th detected target. Construct the weighted loss operator L_SA based on the static weight scalar omega_i and the KL divergence KL_i.
[0049] in:
[0050] KL_ i = KL(Softmax(Logits_Assistant2 / T_temp2), Softmax(Logits_Student / T_temp2))
[0051] Wherein, Logits_Assistant2 is the prediction logic of the hybrid teaching assistant model, Logits_Student is the prediction logic of the student model, KL() represents the KL divergence function, and T_temp2 represents the second temperature coefficient.
[0052] L_SA = Sum (omega_i * KL_i)
[0053] Sum() is the summation function.
[0054] Step 5.3: Construct the second-stage optimization objective Loss_Stage2 based on the weighted loss operator L_SA, and distill the student model using the second-stage optimization objective Loss_Stage2 to obtain the student model update parameter Theta_Student_Base.
[0055] The second-stage optimization target, Loss_Stage2, is:
[0056] Loss_Stage2 = α* L_CE2 +β* L_SA
[0057] Where α and β are dynamic balancing weight coefficients, and L_CE2 is the cross-entropy loss of the student model for the true label.
[0058] Optionally, step 5.3 further includes: during training iterations, monitoring the student model validation set, and if the performance of a certain high-security-level device is lower than a threshold, dynamically increasing the omega_i parameter and β weight corresponding to that high-security-level device.
[0059] Optionally, step S6 specifically includes:
[0060] Step 6.1: Based on the updated parameters of the student model, perform amplitude-based weight pruning on the student model, evaluate the amplitude of all channels, set the pruning threshold, remove redundant convolutional kernels and connection topologies, and generate the pruned student model.
[0061] Step 6.2: Retrain the pruned student model with a learning rate less than the threshold to obtain the trained student model.
[0062] Step 6.3: Use the inference framework tool to perform asymmetric quantization transformation on all weight matrices and activation tensors in the trained student model to obtain the transformed student model. Then, use a calibration dataset of real power scenarios to calibrate the transformed student model to obtain the calibrated student model.
[0063] In a second aspect, a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a lightweight method for a knowledge distillation-based visual model of power operations as described in any of the first aspects.
[0064] Thirdly, a computer device comprising:
[0065] Memory is used to store instructions.
[0066] A processor is configured to execute the instructions, causing the computer device to perform operations as described in any of the first aspects of a lightweight method for a knowledge distillation-based visual model of power operations.
[0067] Beneficial Effects: The lightweight method and system for power operation visual models based on knowledge distillation provided by this invention achieves deeper and more comprehensive knowledge transfer, not only transferring output knowledge but also the attention and representation capabilities of intermediate feature layers. By introducing a safety-critical perception mechanism, different levels of power equipment are treated differently during the lightweighting process, prioritizing the recognition performance of core equipment. Compared with existing technologies, the lightweight method and system for power operation visual models based on knowledge distillation provided by this invention have the following significant advantages:
[0068] 1. Overcoming the technical bottleneck of cross-architecture distillation: By introducing a carefully designed hybrid teaching assistant model, the originally large-scale distillation from Transformer to CNN is decomposed into a smooth transition from Transformer to hybrid model and then from hybrid model to CNN. Experimental data shows that the lossless transfer rate of intermediate features is improved by more than 40%, significantly reducing the difficulty for student models to fit the global receptive field.
[0069] 2. Combining extremely lightweight parameters with superior recognition accuracy: The final pure CNN architecture student model has its parameter count and floating-point operation count (FLOPs) compressed to less than one-tenth of the teacher model, fully meeting the real-time inference requirements of power edge devices (greater than 30 FPS); at the same time, due to the complete inheritance of the dual attention features of the teacher model, its recognition accuracy significantly surpasses that of the same level CNN model that has not undergone cross-architecture distillation.
[0070] 3. Meeting the absolute safety baseline of power operations: The unique safety-critical perception mechanism ensures that the accuracy loss during model compression is non-uniformly distributed. The system automatically prioritizes the allocation of limited network weight parameters to high-safety-level equipment (such as transformers and insulators), effectively preventing the omission of high-risk hazards and directly meeting the core safety requirements of the power industry. Attached Figure Description
[0071] Figure 1 This is a flowchart illustrating the complete framework of the multi-level distillation, attention mechanism, and security perception of the present invention.
[0072] Figure 2 This is a schematic diagram of the hybrid teaching assistant model in this invention. Detailed Implementation
[0073] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0074] The present invention will be further described below with reference to specific embodiments.
[0075] Example 1:
[0076] This embodiment introduces a lightweight method for power operation visual models based on knowledge distillation, guiding data flow through forward propagation, feature reconstruction, and backward gradient update in different network topologies. It demonstrates the global data flow from original data augmentation and three-level model cascade training to final lightweight deployment, specifically including:
[0077] Step S1: Perform robust data augmentation and preprocessing of the power scene and safety level labeling on the power image data to obtain the transformed enhanced image and composite label dictionary.
[0078] Furthermore, step S1 specifically includes:
[0079] Step 1.1: Obtain the original three-channel color image from the fixed camera or inspection drone in the substation, defined as the input tensor I_orig, and at the same time obtain the bounding box label set Y_bbox and the category label set Y_cls corresponding to the original three-channel color image.
[0080] The input tensor I_orig has dimensions (Batch, 3, H_in, W_in), where Batch is the batch size, and H_in and W_in are the height and width of the image, respectively.
[0081] Step 1.2: Apply the atmospheric scattering physics vector to the input tensor I_orig to obtain the enhanced weather parameter tensor I_weather.
[0082] Among them, I_weather(x) = I_orig(x) * t(x) + A * (1 - t(x))
[0083] I_weather(x) represents the enhanced pixel value at input tensor x, I_orig(x) represents the pixel value at input tensor x, t(x) represents the transmittance matrix, and A represents the global atmospheric illumination constant. t(x) and A are adjusted for different weather conditions, including: haze, rain, dust storms, etc.
[0084] Step 1.3: Randomly generate a two-dimensional mask matrix, use the two-dimensional mask matrix to occlude the enhanced weather parameter tensor I_weather, set the background area to zero, and inject Gaussian distributed noise with a mean of 0 and a random variance into the label area to obtain the transformed enhanced image tensor I_aug.
[0085] Step 1.4: Construct a mapping dictionary for the "Safety Critical Level Map of Power Equipment" based on the power safety regulations. Iterate through each category label in the category label set Y_cls according to the mapping dictionary, and attach a static weight scalar omega to each category label. Construct a composite label dictionary Y_final containing safety level weights based on the bounding box label set Y_bbox, the category label set Y_cls, and the static weight scalar omega, where Y_final = {Y_bbox, Y_cls, omega}.
[0086] The mapping dictionary is as follows:
[0087] (1) When the safety level of power equipment is Level 1 (extremely high risk), such as insulator damage or circuit breaker malfunction, assign a high weight omega = 3.0.
[0088] (2) When the safety level of the power equipment is Level 2 (high risk), such as when the safety helmet is not worn, assign a medium weight of omega = 2.0.
[0089] (3) When the safety level of power equipment is Level 3 (general), such as signage obstruction and fence, assign a basic weight omega = 1.0.
[0090] Before entering the computational flow graph, the power image data needs to undergo complex mathematical transformation matrix processing to simulate real-world challenges and improve the robust generalization ability of the neural network model at the edge.
[0091] Step S2: Train a high-precision teacher model based on Transformer using the transformed enhanced image and the composite label dictionary to obtain the trained high-precision teacher model.
[0092] Furthermore, step S2 specifically includes:
[0093] Step 2.1: Use the enhanced image from the transformation and the composite label dictionary to perform fully supervised fine-tuning training on the high-precision teacher model based on Transformer.
[0094] Step 2.2: During training, the standard cross-entropy loss is minimized and backpropagation is performed using the optimizer to update the data. After training converges, the weights of all network layers of the high-precision teacher model based on Transformer are obtained, and the pre-trained weight file Theta_Teacher is generated.
[0095] Traditional Transformers use global self-attention, and their computational complexity is quadratic with image resolution, making them unsuitable for high-resolution power images. The high-precision teacher model based on Transformers in this invention employs the SwinTransformer network.
[0096] The Swin Transformer network includes local window and shift window mechanisms. These are used to segment the transformed enhanced image tensor I_aug into a non-overlapping sequence of patches.
[0097] In the last stage of the Swing Transformer network, the output is no longer a traditional feature map, but a high-dimensional feature sequence tensor T_seq with dimensions (Batch, Length, C_T), where: Length is the sequence length (number of tokens), and C_T is the feature channel dimension of the teacher model (e.g., 1024).
[0098] In subsequent distillation, given the input image, the high-precision teacher model will output a deterministic deep feature sequence T_seq and the final logistic prediction probability distribution P_T.
[0099] This step aims to obtain a knowledge source with the ability to represent limits.
[0100] Step S3: Build a hybrid teaching assistant model and CNN student model for cross-architecture bridging.
[0101] Furthermore, the hybrid teaching assistant model, such as Figure 2 As shown, this is not a simple stacking of modules, but rather follows the biological feedforward mechanism of visual perception, namely "from local to global, from concrete to abstract". Specifically, it includes two main parts: a shallow convolutional local perceptron and a deep attention global aggregator connected in sequence.
[0102] The shallow convolutional local perceptron, used for backward compatibility with student models, includes a series of 3×3 standard convolutional layers, a first depth-separable convolutional block, and a second depth-separable convolutional block.
[0103] A deep attention global aggregator is used to align the teacher model upwards, comprising a flattening module, a multi-head self-attention module, and a feedforward neural network connected in sequence.
[0104] The hybrid teaching assistant model is used to input the image tensor I_aug (Batch, 3, H_in, W_in) into a shallow convolutional local perceptron. Based on the three-dimensional spatial tensor, after downsampling through several stages, it extracts high-frequency local features of power equipment (such as the edge of the insulator skirt and the rust texture of the metal bolt). The feature dimension evolves to (Batch, C_A_mid, H_mid, W_mid).
[0105] The shallow convolutional local perceptron is topologically highly isomorphic to the final edge-end student model. This ensures that the hybrid teaching assistant model fully understands and is backward compatible with the local translation invariance of the pure CNN model in its low-level feature extraction logic (inductive bias). In subsequent stages (distillation from the hybrid teaching assistant model to the student model), this isomorphic performance enables near-zero-loss knowledge dumping.
[0106] The three-dimensional spatial feature map of the high-frequency local features of the power equipment is flattened into a one-dimensional sequence and an absolute position code is added to generate a sequence tensor (Batch, L_A, C_A_mid).
[0107] The sequence tensor enters a Transformer Block that alternates between multiple multi-head self-attention modules (MHSA) and feedforward neural networks (FFN). After deep interaction, it outputs a tensor A_hybrid_out that captures global context information.
[0108] The deep attention global aggregator, in the last two stages of the network architecture, abandons traditional convolutional layers and introduces a tensor transformation interface. This self-attention mechanism can ignore physical distance and directly calculate the correlation between any two pixels in an image (for example, even if an insulator and a transmission tower base are at opposite ends of the image, the attention matrix can still establish a strong correlation). This gives the hybrid teaching assistant model a global representation space in the deep layers that is remarkably similar to the high-precision Swin Transformer teacher model.
[0109] The CNN student model is designed for deployment in low-power (typically below 1 TOPS) and power-critical edge devices requiring stringent power consumption (milliwatts). Therefore, the student model must discard all complex self-attention operators. The CNN student model of this invention employs a pure CNN architecture based on a deep custom design of the MobileNetV3 series. It extensively uses depthwise separable convolutions to significantly reduce the number of parameters, and finally adds a lightweight Squeeze-and-Excitation attention module to compensate for performance issues.
[0110] The most innovative aspect of the hybrid teaching assistant model in this invention lies in its radical change to the loss function for terrain optimization in cross-framework distillation, specifically including:
[0111] (1) Alleviating the non-convexity dilemma of the optimization process: Directly mapping a one-dimensional global sequence (Teacher) to a three-dimensional local tensor (Student) is a highly non-convex and extremely difficult optimization problem. The hybrid teaching assistant model is like an "intermediate solution" that has both sequence and tensor properties. It first absorbs the global knowledge of the Teacher, internalizes and integrates it into its own CNN shallow features, and then uses the language of CNN to teach this integrated high-dimensional knowledge to the Student.
[0112] (2) Buffering and reshaping of gradient flow: When backpropagating directly across frames, the huge feature difference gradients generated by the Transformer can easily destroy the fragile early weight distribution of a pure CNN. The existence of the hybrid teaching assistant model makes the strong supervised gradients from the Teacher smoothed and structured after passing through the deep self-attention module, and transformed into a more stable backpropagation signal that is easier for the CNN to digest.
[0113] This step is the core structural innovation of this invention. It details how the features of the Swin Transformer, after spatial dimension reconstruction, extract channel attention vectors through global average pooling and spatial attention maps through channel-dimensional mean, and calculate the mean squared error loss using the tensor corresponding to the hybrid assistant model. This bridges the dimensionality gap between Transformer and CNN. Traditional knowledge distillation often directly calculates the loss between the teacher (Transformer) and student (CNN) architectures, which are vastly different. This "hard landing" approach ignores the essential topological differences between the two in the feature manifold space, easily leading to gradient vanishing or feature collapse. Therefore, this invention innovatively designs a Hybrid Assistant Model, whose core lies in constructing a "semantic translator" and a "gradient buffer pool," achieving a disruptive innovation in cross-framework distillation.
[0114] Step S4: Use the teacher model to perform the first stage of cross-architecture feature perception distillation on the hybrid teaching assistant model to obtain the updated parameters of the hybrid teaching assistant model.
[0115] Furthermore, step S4 specifically includes:
[0116] Step 4.1: Input the image tensors X_batch from the same batch into both the frozen teacher model (SwinTransformer) and the hybrid teaching assistant model to be trained. Output the deep output sequence T_seq corresponding to the teacher model, with dimensions (Batch, Length, C_T), and the deep output feature map A_map corresponding to the hybrid teaching assistant model, with dimensions (Batch, C_A, H_prime, W_prime). Used for forward inference to obtain multidimensional representations of features.
[0117] Step 4.2: Since the high-dimensional knowledge of the teacher model exists in the one-dimensional sequence tokens and follows the strict mathematical relationship Length = H_prime * W_prime during feature map segmentation, it cannot be directly aligned with the multi-dimensional space of the hybrid teaching assistant model.
[0118] The deep output sequence T_seq corresponding to the teacher model is spatially restored using an inverse folding algorithm to obtain a reconstructed two-dimensional spatial feature map T_map, with dimensions (Batch, C_A, H_prime, W_prime), where the expression is as follows:
[0119] T_map = Reshape(T_seq)
[0120] The innovation of this step lies in restoring the discrete tokens of pure mathematics into structured features with physical spatial semantics (such as the sky in the upper left corner and a transformer in the lower right corner), breaking down dimensional barriers to reconstruct spatial dimensions.
[0121] Step 4.3: After channel-dimensional projection reconstruction, although the spatial dimensions are consistent, the number of channels C_T in the teacher model is usually much larger than the number of channels C_A in the hybrid teaching assistant model in terms of semantic depth. Forcibly pruning teacher features will lead to catastrophic knowledge loss.
[0122] Input the output feature map A_map of the corresponding depth of the hybrid teaching assistant model into the differentiable adapter module, and output the projected aligned feature map A_tilde_map with dimensions (Batch, C_T, H_prime, W_prime).
[0123] The differentiable adapter module, containing nonlinear operators (1x1 convolution operator, batch normalization, and activation function), does not change the width and height of the feature map. Instead, it increases the channel dimension of the output feature map A_map at the corresponding depth of the hybrid teaching assistant model in a multidimensional space, performing a high-dimensional projection mapping.
[0124] A_tilde_map = Adaptor(A_map)
[0125] This means that the hybrid teaching assistant model is forced to expand its own expressive bandwidth to adapt to and accommodate the massive features of the teacher model in order to cross channel gaps.
[0126] Step 4.4: After solving the dimension alignment, the core is to guide the hybrid teaching assistant model "where to find key features".
[0127] The reconstructed two-dimensional spatial feature map T_map is averaged over the channel dimension C_T to compress the heavy features into a two-dimensional heatmap, resulting in the teacher model spatial attention distribution map M_s_T with dimensions (Batch, 1, H_prime, W_prime).
[0128] The mean value (and compression operation) of the projected aligned feature map A_tilde_map is calculated on the channel dimension C_T to obtain the spatial attention distribution map M_s_A of the hybrid teaching assistant model.
[0129] The spatial mean squared error loss L_S_MSE is calculated using the spatial attention distribution map M_s_T of the teacher model and the spatial attention distribution map M_s_A of the hybrid teaching assistant model.
[0130] L_S_MSE = Sum(|| M_s_T - M_s_A ||^2)
[0131] This step is used to force the hybrid teaching assistant model to spatially focus on the core power equipment area that the teacher model is interested in, locate key knowledge, and align spatial attention mechanisms.
[0132] Step 4.5: Forcing teaching assistants to learn which device features are most important information is key to improving recognition robustness.
[0133] The reconstructed two-dimensional spatial feature map T_map is subjected to global average pooling along the spatial dimension to dismantle the spatial structure and obtain the pure teacher model semantic strength vector v_c_T with dimensions (Batch, C_T).
[0134] Global average pooling is performed along the spatial dimension on the projected aligned feature map A_tilde_map to obtain the pure hybrid teaching assistant model semantic strength vector v_c_A.
[0135] The channel mean squared error loss L_C_MSE is calculated using the semantic strength vector v_c_T from the teacher model and the semantic strength vector v_c_A from the hybrid teaching assistant model.
[0136] L_C_MSE = Sum(|| v_c_T - v_c_A ||^2)
[0137] This step is used to force the hybrid teaching assistant model to maintain a high degree of synchronization with the teacher model in understanding high-dimensional semantics such as the material and defect type of power equipment, to identify the essence of semantics, and to align with the channel attention mechanism.
[0138] Step 4.6: Input the image tensors X_batch from the same batch simultaneously into the frozen teacher model (SwinTransformer) and the hybrid teaching assistant model to be trained, to obtain the output probability distribution Logits_Teacher of the teacher model and the output probability distribution Logits_Assistant of the hybrid teaching assistant model. Based on the output probability distributions Logits_Teacher and Logits_Assistant, calculate the KL divergence loss L_KL1, as shown in the following expression:
[0139] L_KL1 = KL(Softmax(Logits_Teacher / T_temp), Softmax(Logits_Assistant / T_temp))
[0140] Where KL() represents the KL (Kullback-Leibler Divergence) divergence function, and T_temp represents the temperature coefficient.
[0141] This step utilizes the softened prediction distribution, which contains extremely rich "dark knowledge." By calculating the KL divergence loss, the teaching assistant fully mimics the teacher's decision-making process, establishing soft inter-class associations and performing logical-level soft label alignment.
[0142] Step 4.7: In this cross-architecture distillation network, the losses in each dimension do not exist in isolation, but rather constitute an interconnected potential field.
[0143] The first-stage optimization objective Loss_Stage1 is constructed based on the spatial mean square error loss L_S_MSE, the channel mean square error loss L_C_MSE, and the KL divergence loss L_KL1. The hybrid teaching assistant model is then distilled using the first-stage optimization objective Loss_Stage1 to obtain the updated parameter Theta_Assistant_star of the hybrid teaching assistant model.
[0144] The expression for the first-stage optimization objective Loss_Stage1 is as follows:
[0145] Loss_Stage1 = alpha * L_S_MSE + beta * L_C_MSE + gamma * L_KL1 + L_CE
[0146] Where alpha, beta, and gamma are hyperparameters, and L_CE is the cross-entropy loss of the hybrid teaching assistant model for the real labels.
[0147] This step innovatively translates and imprints the elusive self-attention global cognition of Transformer into a hybrid teaching assistant model with the underlying genes of CNN.
[0148] The core task of this stage is to losslessly map, reorganize, and compress the one-dimensional sequence features of the teacher model into the hybrid feature space of the hybrid teaching assistant model. This is not a simple imitation of the output layer results, but a tensor-level dissection and reconstruction that delves into the network's structure, fully demonstrating the depth and precision of the cross-frame feature transfer of this invention.
[0149] Step S5: Use the hybrid teaching assistant model to update the parameters and perform a second-stage safety-aware adaptive distillation on the student model to obtain the updated parameters of the student model.
[0150] At this point, since both the teaching assistant (Hybrid) and the student (CNN) use convolutional topologies at the underlying layer, the largest dimensionality gap has been bridged. The core of this stage is to transfer the teaching assistant's knowledge to the student and forcibly inject the power safety priority judgment matrix.
[0151] Furthermore, step S5 specifically includes:
[0152] Step 5.1: Input the image tensors X_batch from the same batch into the student model, perform forward propagation, and output the student model prediction logic Logits_Student. Input the image tensors X_batch from the same batch into the hybrid teaching assistant model, perform forward propagation, and output the hybrid teaching assistant model prediction logic Logits_Assistant2. This is used for isomorphic feature distillation.
[0153] Step 5.2: Traditional KL divergence averages all samples in a batch equally. In this invention, because the omega_i of high-risk devices is greater than that of low-risk devices, the gradient values of Level 1 samples (high-risk devices, such as transformers) will be amplified by a factor of omega_i when calculating the gradient matrix through backpropagation and partial derivatives. This means that when the lightweight model's parameter capacity is limited, the optimizer will force the model to prioritize updating and converging to fit the features of high-risk devices, thus sacrificing some feature memory capacity of low-risk signs and achieving non-uniform accuracy preservation.
[0154] For the i-th detection target in the batch, obtain the static weight scalar omega_i based on the composite label dictionary Y_final corresponding to the i-th detection target.
[0155] Calculate the KL divergence KL_i between the distributions of the hybrid teaching assistant model prediction logic Logits_Assistant2 and the student model prediction logic Logits_Student for the i-th detected target.
[0156] KL_ i = KL(Softmax(Logits_Assistant2 / T_temp2), Softmax(Logits_Student / T_temp2))
[0157] Where KL() represents the KL (Kullback-Leibler Divergence) divergence function, and T_temp2 represents the temperature coefficient.
[0158] Based on the static weight scalar omega_i and the KL divergence KL_i, construct the weighted loss operator L_SA:
[0159] L_SA = Sum (omega_i * KL_i)
[0160] This step is a key safety feature of the present invention, employing a safety adaptive loss function (L_SA) calculation mechanism to reconstruct the computation flow graph.
[0161] Step 5.3: Construct the second-stage optimization objective Loss_Stage2 based on the weighted loss operator L_SA, and distill the student model using the second-stage optimization objective Loss_Stage2 to obtain the student model update parameter Theta_Student_Base.
[0162] The second-stage optimization target Loss_Stage2 is:
[0163] Loss_Stage2 = α* L_CE2 +β* L_SA
[0164] Where α and β are dynamic balancing weight coefficients, and L_CE2 is the cross-entropy loss of the student model for the true label.
[0165] This step involves the optimizer performing a final update iteration on the student model parameters Theta_Student_Base based on the gradient information guided by Loss_Stage2. This is used to obtain the initial weights of a lightweight student model that achieves multi-level knowledge inheritance and possesses safety-aware capabilities.
[0166] Furthermore, step 5.3 also includes monitoring the student model validation set during training iterations. If the performance of a certain high-security-level device is lower than the threshold, the omega_i parameter and β weight corresponding to the high-security-level device are dynamically increased to trigger a negative feedback loop in reinforcement learning.
[0167] Step S6: Update the parameters based on the student model, lightweight the structure of the student model, and compile for hardware deployment. This is used to completely convert the student model into a binary executable file that can be deployed on a real device.
[0168] Furthermore, step S6 specifically includes:
[0169] Step 6.1: Based on the updated parameters of the student model, perform amplitude-based weight pruning on the student model, evaluate the amplitude of all channels, set a pruning threshold (e.g., 30%), forcibly remove redundant convolutional kernels and connection topologies, and generate the pruned student model. This is used for network pruning.
[0170] Step 6.2: Retrain the pruned student model with a learning rate less than the threshold to obtain a trained student model. This is used to compensate for the slight accuracy loss caused by pruning and to perform fine-tuning to restore accuracy.
[0171] Step 6.3: Use inference framework tools (such as TensorRT, TFLite) to perform asymmetric quantization transformation on all weight matrices and activation tensors in the trained student model to obtain the transformed student model, which is an efficient inference engine file in 8-bit integer (INT8) format. Use a calibration dataset of real power scenarios to calibrate the transformed student model to obtain the calibrated student model.
[0172] The high-efficiency inference engine file generated in this step, which is highly bound to the underlying hardware instruction set, is directly integrated into the drone flight control board or fixed camera edge computing box of the power inspection system to perform real-time and reliable visual analysis tasks.
[0173] Example 2:
[0174] This embodiment describes a computer-readable storage medium storing a computer program that, when executed by a processor, implements a lightweight method for a power operation visual model based on knowledge distillation as described in any of Embodiment 1.
[0175] Example 3:
[0176] This embodiment describes a computer device, including:
[0177] Memory is used to store instructions.
[0178] A processor is configured to execute the instructions, causing the computer device to perform operations as described in any of Embodiment 1 of a lightweight method for a knowledge distillation-based visual model of power operations.
[0179] Example 4:
[0180] This embodiment introduces the irreplaceable nature of the "cross-architecture distillation based on hybrid teaching assistants" scheme proposed in this invention in solving the feature transfer from Transformer to CNN. This embodiment selects three of the most mainstream knowledge distillation (KD) baseline methods in academia and industry as comparative examples, and conducts horizontal performance evaluation under the same power vision dataset and edge computing hardware environment.
[0181] 1. Definition of prior art (comparative example):
[0182] Comparative Example 1: Classical Soft Label Distillation (Standard KD). KL divergence is calculated only in the last layer of the network (logic output layer).
[0183] Comparative Example 2: Direct Alignment Distillation of Intermediate Features (FitNets). This forcibly requires the student network's CNN 3D feature map to fit the teacher network's Transformer 1D sequence feature map.
[0184] Comparative Example 3: Spatial Attention Transfer (AT). The spatial attention distribution map of the teacher is extracted and directly guides the student model, but no transition network is set.
[0185] 2. Comparison Table of Core Indicators:
[0186] Table 1 is a comparison table of core indicators.
[0187]
[0188] This test focuses on monitoring the model's "feature alignment convergence" during training, as well as its "global average precision (mAP@0.5)" and "level 1 recall (e.g., insulator damage)" on the final test set.
[0189] Comparative analysis of experimental results:
[0190] Overcoming the "feature collapse" deadlock across architectures: As can be seen from the table, Comparative Example 2 (FitNets) suffers from severe underlying inductive bias conflicts due to its forced crossing of architectural gaps, resulting in accuracy even lower than Comparative Example 1. This invention, however, achieves a smooth transition through a "hybrid teaching assistant model," successfully boosting global accuracy (mAP) to 83.6%, and achieving a 6.8% leap in absolute accuracy compared to the traditional best method (Comparative Example 3).
[0191] Breaking the uniform decay of knowledge and reshaping the safety baseline: Existing methods (comparative examples 1 to 3) exhibit a "uniform decay" of accuracy across all categories when compressing models, causing the detection accuracy of extremely high-risk equipment to drop below 75%. This invention, by injecting a "safety-critical adaptive distillation" mechanism, forces computing resources to be tilted towards high-risk targets, successfully safeguarding the detection accuracy of extremely high-risk equipment to 90.4%, 17.5% higher than the existing best baseline, perfectly meeting the safety red line of the power industry.
[0192] To further clarify the independent effectiveness of each innovative module (hybrid teaching assistant transition, dual attention alignment, and safety adaptive weight) in this invention patent and the performance gain under their combined effect, this embodiment designs an ablation experiment of progressively stacked components.
[0193] Experimental setup:
[0194] This test uses a lightweight MobileNetV3 trained from scratch with data without any distillation as the initial baseline, and gradually adds the core innovations of this invention to observe the growth trajectory of global average accuracy (mAP@0.5) and detection accuracy of extremely high-risk devices (Level 1 mAP).
[0195] Table 2 shows the growth trajectory.
[0196]
[0197] Analysis of ablation experiment results:
[0198] The data clearly demonstrates the step-by-step leaps brought about by the various technical features of this invention:
[0199] Transitional effectiveness: By simply introducing a hybrid teaching assistant model as a dimensionality reduction buffer (Phase 1), the barrier of direct cross-architecture distillation can be broken, resulting in an initial global accuracy improvement of 5.1%.
[0200] Feature assimilation effectiveness: After introducing a dual attention mechanism of space and channel (stage 2), the model truly learned the teacher's "tacit knowledge" on the mathematical manifold, achieving a significant leap in accuracy of 6.7%.
[0201] Business-oriented effectiveness: When the safety adaptive weight was finally introduced (Phase 3), although the global accuracy only improved by 3.4%, the system successfully focused the limited parameter capacity on high-risk targets, resulting in an explosive increase of 11.9% in the detection accuracy of extremely high-risk equipment. This data-driven approach fully confirmed the core value of this invention in the application of the power industry.
[0202] By introducing a teaching assistant model in a transitional architecture and a deep-aligned attention feature distillation mechanism, this invention achieves deeper and more lossless cross-architecture knowledge transfer than traditional lightweight methods in both mathematical principles and engineering practice. Simultaneously, the system's security adaptive strategy prioritizes the protection of the core equipment monitoring accuracy of the power grid under physical constraints. This complete system-level methodology effectively removes the core obstacles for intelligent vision technology to move from the cloud to the harsh edge environments of power operation sites. The above description is merely a preferred embodiment of this invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. The focus is on elaborating the data reconstruction and flow mechanism between different architectural models:
[0203] 1. Multi-layered teacher-teacher-student cross-architecture pipeline: including a progressive knowledge distillation process from teacher (Transformer) to teacher (hybrid architecture) and then to student (CNN).
[0204] 2. Constructing a cross-architecture bridge (teacher assistant model): Introducing a CNN-Transformer hybrid model with a structure between the teacher and student as a teacher assistant. The front end of this model uses convolution operators to extract local features (backward compatible with the spatial features of the student model), while the back end uses a self-attention mechanism to extract global features (upward aligned with the sequence features of the teacher model), acting as a semantic translator between different feature spaces.
[0205] 3. Tensor-level feature alignment based on dual attention mechanism: In the first stage (teacher to teaching assistant) distillation, not only is the logical probability of the output layer passed, but it also goes deeper into the intermediate feature layer. By using the channel and spatial dual attention mechanism, the mathematical dimensions of one-dimensional sequences and multi-dimensional tensors are reconstructed and aligned, so as to realize the efficient transfer of deep feature knowledge.
[0206] 4. Safety-critical adaptive distillation: In the second stage (from teaching assistant to student) of distillation, the loss function is designed to assign differentiated weights (adaptive weight penalty mechanism) to power equipment targets with different safety levels in order to achieve guaranteed, non-uniform accuracy maintenance.
[0207] 5. Power Scenarios-Specific Data Stream Enhancement: At the data input source, implement robust data enhancement methods for real power operating conditions, including specific enhancement techniques such as lighting and weather simulation and shading simulation, to ensure that the input feature stream has extremely strong generalization ability.
[0208] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0209] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0210] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0211] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0212] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A lightweight method for power operation visual models based on knowledge distillation, characterized in that: Specifically, it includes: Step S1: Preprocess the power image data to obtain the transformed enhanced image and the composite label dictionary; Step S2: Train the teacher model using the transformed enhanced image and the composite label dictionary to obtain the trained teacher model; Step S3: Construct a hybrid teaching assistant model and student model; Step S4: Use the teacher model to perform the first stage of cross-architecture feature perception distillation on the hybrid teaching assistant model to obtain the updated parameters of the hybrid teaching assistant model; Step S5: Use the hybrid teaching assistant model to update the parameters and perform a second-stage safety-aware adaptive distillation on the student model to obtain the updated parameters of the student model.
2. The lightweight method for power operation visual models based on knowledge distillation according to claim 1, characterized in that: Also includes: Step S6: Update the parameters of the student model to lighten the student model and obtain the student model executed by the edge computing device.
3. The lightweight method for power operation visual models based on knowledge distillation according to claim 1 or 2, characterized in that: Step S1 specifically includes: Step 1.1: Obtain the original three-channel image of the power equipment, defined as the input tensor I_orig, and obtain the bounding box label set Y_bbox and the category label set Y_cls corresponding to the original three-channel image; Step 1.2: Apply the atmospheric scattering physics vector to the input tensor I_orig to obtain the enhanced weather parameter tensor I_weather; Step 1.3: Randomly generate a two-dimensional mask matrix, use the two-dimensional mask matrix to occlude the enhanced weather parameter tensor I_weather, set the background area to zero, inject Gaussian distributed noise with a mean of 0 and a random variance into the label area, and obtain the transformed enhanced image tensor I_aug; Step 1.4: Construct a mapping dictionary according to the power safety regulations; traverse each category label in the category label set Y_cls according to the mapping dictionary, and attach a static weight scalar omega to the category label. Construct a composite label dictionary Y_final containing safety level weights based on the bounding box label set Y_bbox, the category label set Y_cls, and the static weight scalar omega, Y_final = { Y_bbox, Y_cls, omega}.
4. The lightweight method for power operation visual models based on knowledge distillation according to claim 1 or 2, characterized in that: Step S2 specifically includes: Step 2.1: Use the transformed enhanced image and composite label dictionary to perform fully supervised fine-tuning training on the teacher model; Step 2.2: During training, the standard cross-entropy loss is minimized and backpropagation is performed using the optimizer to update the data. After training converges, the weights of all network layers of the teacher model are obtained, and the pre-trained weight file Theta_Teacher is generated.
5. The lightweight method for power operation visual models based on knowledge distillation according to claim 1 or 2, characterized in that: The hybrid teaching assistant model includes: a shallow convolutional local perceptron and a deep attention global aggregator connected in sequence; Among them, the shallow convolutional local perceptron is used for backward compatibility with the student model, including a 3×3 standard convolutional layer connected in sequence, a first depth separable convolutional block, and a second depth separable convolutional block; A deep attention global aggregator is used to align the teacher model upwards, comprising a flattening module, a multi-head self-attention module, and a feedforward neural network connected in sequence. The student model adopts a pure CNN architecture based on a deep customization of the MobileNetV3 series.
6. The lightweight method for power operation visual models based on knowledge distillation according to claim 1 or 2, characterized in that: Step S4 specifically includes: Step 4.1: Input the image tensor X_batch of the same batch into the teacher model and the hybrid teaching assistant model at the same time. Output the deep output sequence T_seq corresponding to the teacher model with dimensions (Batch, Length, C_T) and the deep output feature map A_map corresponding to the hybrid teaching assistant model with dimensions (Batch, C_A, H_prime, W_prime). Step 4.2: Use the reverse folding algorithm to perform spatial recovery on the deep output sequence T_seq corresponding to the teacher model to obtain the reconstructed two-dimensional spatial feature map T_map, with dimensions (Batch, C_A, H_prime, W_prime); Step 4.3: Input the output feature map A_map of the corresponding depth of the hybrid teaching assistant model into the differentiable adapter module, and output the projected aligned feature map A_tilde_map, with the dimensions becoming (Batch, C_T, H_prime, W_prime); Step 4.4: Calculate the mean of the reconstructed 2D spatial feature map T_map over the channel dimension C_T to obtain the teacher model spatial attention distribution map M_s_T, with dimensions (Batch, 1, H_prime, W_prime); calculate the mean of the projected aligned feature map A_tilde_map over the channel dimension C_T to obtain the hybrid teaching assistant model spatial attention distribution map M_s_A; calculate the spatial mean squared error loss L_S_MSE using the teacher model spatial attention distribution map M_s_T and the hybrid teaching assistant model spatial attention distribution map M_s_A. L_S_MSE = Sum(|| M_s_T - M_s_A ||^2) Sum() is the summation function; Step 4.5: Perform global average pooling along the spatial dimension on the reconstructed 2D spatial feature map T_map to obtain the pure teacher model semantic strength vector v_c_T, with dimensions (Batch, C_T); perform global average pooling along the spatial dimension on the projected aligned feature map A_tilde_map to obtain the pure hybrid teaching assistant model semantic strength vector v_c_A; calculate the channel mean squared error loss L_C_MSE using the teacher model semantic strength vector v_c_T and the hybrid teaching assistant model semantic strength vector v_c_A. L_C_MSE = Sum(|| v_c_T - v_c_A ||^2) Step 4.6: Input the image tensors X_batch from the same batch into both the teacher model and the hybrid teaching assistant model simultaneously to obtain the output probability distribution Logits_Teacher of the teacher model and the output probability distribution Logits_Assistant of the hybrid teaching assistant model. Based on the output probability distributions Logits_Teacher and Logits_Assistant, calculate the KL divergence loss L_KL1, as shown in the following expression: L_KL1 = KL(Softmax(Logits_Teacher / T_temp), Softmax(Logits_Assistant / T_temp)) Where KL() represents the KL divergence function, and T_temp represents the first temperature coefficient; Step 4.7: Construct the first-stage optimization objective Loss_Stage1 based on the spatial mean square error loss L_S_MSE, the channel mean square error loss L_C_MSE, and the KL divergence loss L_KL1. Distill the hybrid teaching assistant model through the first-stage optimization objective Loss_Stage1 to obtain the updated parameter Theta_Assistant_star of the hybrid teaching assistant model. The expression for the first-stage optimization objective Loss_Stage1 is as follows: Loss_Stage1 = alpha * L_S_MSE + beta * L_C_MSE + gamma * L_KL1 + L_CE Where alpha, beta, and gamma are hyperparameters, and L_CE is the cross-entropy loss of the hybrid teaching assistant model for the real labels.
7. The lightweight method for power operation visual models based on knowledge distillation according to claim 1 or 2, characterized in that: Step S5 specifically includes: Step 5.1: Input the image tensor X_batch from the same batch into the student model and output the student model prediction logic Logits_Student; input the image tensor X_batch from the same batch into the hybrid teaching assistant model and output the hybrid teaching assistant model prediction logic Logits_Assistant2; Step 5.2: For the i-th detection target in the batch, obtain the static weight scalar omega_i based on the composite label dictionary Y_final corresponding to the i-th detection target; calculate the KL divergence KL_i between the prediction logic of the hybrid teaching assistant model and the prediction logic of the student model for the i-th detection target; construct the weighted loss operator L_SA based on the static weight scalar omega_i and the KL divergence KL_i. in: KL_ i = KL(Softmax(Logits_Assistant2 / T_temp2), Softmax(Logits_Student / T_temp2)) Wherein, Logits_Assistant2 is the prediction logic of the hybrid teaching assistant model, Logits_Student is the prediction logic of the student model, KL() represents the KL divergence function, and T_temp2 represents the second temperature coefficient; L_SA = Sum (omega_i * KL_i) Sum() is the summation function; Step 5.3: Construct the second-stage optimization objective Loss_Stage2 based on the weighted loss operator L_SA, and distill the student model through the second-stage optimization objective Loss_Stage2 to obtain the student model update parameter Theta_Student_Base; The second-stage optimization target, Loss_Stage2, is: Loss_Stage2 = α* L_CE2 +β* L_SA Where α and β are dynamic balancing weight coefficients, and L_CE2 is the cross-entropy loss of the student model for the true label.
8. The lightweight method for power operation visual models based on knowledge distillation according to claim 2, characterized in that: Step S6 specifically includes: Step 6.1: Based on the updated parameters of the student model, perform amplitude-based weight pruning on the student model, evaluate the amplitude of all channels, set the pruning threshold, remove redundant convolutional kernels and connection topologies, and generate the pruned student model. Step 6.2: Retrain the pruned student model with a learning rate less than the threshold to obtain the trained student model; Step 6.3: Use the inference framework tool to perform asymmetric quantization transformation on all weight matrices and activation tensors in the trained student model to obtain the transformed student model. Then, use a calibration dataset of real power scenarios to calibrate the transformed student model to obtain the calibrated student model.
9. A computer-readable storage medium, characterized in that: It stores a computer program that, when executed by a processor, implements a lightweight method for a power operation visual model based on knowledge distillation as described in any one of claims 1 to 8.
10. A computer device, characterized in that: include: Memory, used to store instructions; A processor is configured to execute the instructions, causing the computer device to perform the operation of a lightweight method for a knowledge distillation-based visual model of power operations as described in any one of claims 1 to 8.