A fast iteration method for intelligent detection model of contact network defects

Generating dynamic convolution kernels through multi-scale feature extraction and multi-head attention mechanism, combined with multi-level support vector machine models and adaptive gradient clipping, solves the problem of slow feature extraction and iteration speed in catenary defect detection, achieving efficient and accurate Defect identification and real-time detection.

CN118521837BActive Publication Date: 2024-09-20CHENGDU NUOBIKAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410988020.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-09-20
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

Existing catenary defect detection methods have limitations in feature extraction and recognition, are difficult to handle complex backgrounds and diverse defect types, and have slow model iteration speeds, which cannot meet the needs of real-time detection.

Method used

Multi-scale feature extraction and a multi-head attention mechanism are used to generate dynamic convolution kernels, combined with a multi-level support vector machine model, to optimize the feature extraction and training efficiency of the model through adaptive gradient clipping and dynamic learning rate adjustment.

Benefits of technology

It significantly improves the accuracy and real-time performance of catenary defect detection, enhances the model's ability to identify complex backgrounds and diverse defects, reduces training time and parameter adjustment requirements, and improves detection efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118521837B
    Figure CN118521837B
Patent Text Reader

Abstract

The present invention belongs to the technical field of computer models, and specifically relates to a fast iteration method of a contact network defect intelligent detection model. The method comprises: step 1: inputting multiple contact network images for training, and generating a dynamic convolution kernel based on the connection attention head; step 2: grouping all contact network images for training by defect type, as the dynamic convolution kernel of the defect type; step 3: establishing a contact network defect intelligent detection model, and using the adaptive gradient clipping method to adjust the weight of the dynamic convolution kernel of the defect type; step 4: after the fast iteration is completed, using the updated dynamic convolution kernel to extract its dynamic convolution features. The present invention significantly improves the feature extraction capability, training efficiency and detection accuracy of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer models, and in particular relates to a fast iteration method of an intelligent detection model for contact network defects. Background Art

[0002] The contact network is an important part of the electrified railway. Its main function is to provide continuous and stable power supply for electric locomotives to ensure the normal operation of trains. With the continuous development of railway transportation and the improvement of electrification, the operating environment and conditions of the contact network are becoming increasingly complex, and its maintenance and detection have become particularly important. In the long-term operation of the contact network, various defects such as wire wear, loose contact suspension, and insulator damage will occur due to environmental influences, mechanical wear, corrosion, etc. If these defects are not discovered and handled in time, they will pose a serious threat to the safety of train operation. Therefore, how to efficiently and accurately detect contact network defects has become a hot spot and difficulty in current research.

[0003] At present, the detection of contact network defects mainly relies on manual inspection and regular maintenance, which has low detection efficiency, high cost, and subjective judgment errors. The traditional manual inspection method requires maintenance personnel to regularly climb up to check, which is not only labor-intensive but also dangerous, and cannot achieve real-time monitoring of contact network defects. In addition, the frequency and coverage of manual inspection are limited, and it is difficult to detect and deal with sudden defects in time, resulting in frequent contact network failures, affecting the safety and efficiency of railway transportation. In order to improve the automation and intelligence level of contact network defect detection, domestic and foreign scholars have proposed contact network defect detection methods based on image processing and machine learning in recent years. The image data of the contact network is collected by high-resolution cameras and other sensor devices, and the image is preprocessed by image processing technology. Then, the preprocessed image is analyzed by machine learning algorithms to identify and locate contact network defects. Compared with traditional manual inspection, these methods have the advantages of fast detection speed, high accuracy, and low cost. However, the existing contact network defect detection methods still have some problems and are difficult to meet the needs of actual applications.

[0004] First, the existing methods for detecting defects in contact networks have limitations in feature extraction and recognition. Traditional image processing methods rely on manually designed features, which are difficult to effectively extract and identify complex backgrounds and diverse defect types. Although deep learning technology has made significant progress in the field of image processing in recent years, its application in contact network defect detection still faces challenges. Deep learning models require a large amount of labeled data for training, and the acquisition and labeling of contact network defect data is costly and time-consuming, resulting in insufficient model training data, which affects detection accuracy and generalization ability. Secondly, the existing methods for detecting defects in contact networks have deficiencies in model iteration and optimization. The training process of the contact network defect detection model requires a lot of computing resources and time, and the iteration speed of the model is slow, which makes it difficult to adapt to the real-time detection needs in practical applications. In addition, most of the existing model optimization methods rely on fixed hyperparameter settings and lack an adaptive adjustment mechanism. They cannot dynamically adjust the learning rate, regularization parameters, etc. according to data changes and model training status, which affects the training efficiency and convergence speed of the model. Summary of the invention

[0005] In view of this, the main purpose of the present invention is to provide a fast iteration method for an intelligent detection model for contact network defects, which significantly improves the feature extraction capability, training efficiency and detection accuracy of the model.

[0006] The technical solution adopted by the present invention is as follows:

[0007] A fast iteration method for an intelligent detection model of contact network defects, the method comprising:

[0008] Step 1: Input multiple contact network images for training, perform multi-scale feature extraction on each contact network image for training, perform nonlinear fusion on the results of multi-scale feature extraction to obtain fused features; perform multi-head attention calculation on the fused features, connect the outputs of all attention heads to obtain connected attention heads; generate dynamic convolution kernels based on the connected attention heads;

[0009] Step 2: All the contact network images for training are grouped according to the defect type, and the contact network images for training with the same defect type are divided into the same group. The dynamic convolution kernels of all the contact network images for training in the same group are calculated by arithmetic mean, and the result is the dynamic convolution kernel of the defect type.

[0010] Step 3: Establish a contact network defect intelligent detection model, which is a multi-level support vector machine model, with dynamic convolution features as input and a discrimination value represented by a three-dimensional vector as output; quickly iterate the contact network defect intelligent detection model, specifically including: for each contact network image for training input subsequently, select a corresponding dynamic convolution kernel according to the defect type annotated therein, perform convolution operation with each contact network image for training input subsequently, and extract the dynamic convolution features of the contact network image for training; the defect type annotated by each contact network defect intelligent detection model is also a type value represented by a three-dimensional vector; use the dynamic convolution feature to input into the contact network defect intelligent detection model to obtain a defect detection output, and continuously update the learning rate of the contact network defect intelligent detection model according to the distance between the defect detection output and the defect type annotated by the contact network image for training; at the same time, according to the distance between the defect detection output and the defect type annotated by the contact network image for training and the change ratio of the updated learning rate to the learning rate before the update, use the adaptive gradient clipping method to adjust the weight of the dynamic convolution kernel of the defect type;

[0011] Step 4: After the rapid iteration is completed, the dynamic convolution kernel of each defect type is multiplied by its corresponding weight to obtain the iterative dynamic convolution kernel. After adding all the iterative dynamic convolution kernels, they are divided by the total number of iterative dynamic convolution kernels to obtain the updated dynamic convolution kernel. For the subsequent input contact network image for detection, the updated dynamic convolution kernel is used to extract its dynamic convolution features.

[0012] Furthermore, the method further comprises: when inputting a contact network image for training or a contact network image for detection, performing a denoising process based on Gaussian filtering.

[0013] Furthermore, in step 1, multiple contact network images for training are input, multi-scale feature extraction is performed on each contact network image for training, and the results of multi-scale feature extraction are nonlinearly fused to obtain the formula for fusion features as follows:

[0014] ;

[0015] in, For fusion features; is the scale quantity; is the scale index; For the The weight of each scale; For the Feature maps of different scales; It is the index of the height direction of the result of multi-scale feature extraction; The width index of the result of multi-scale feature extraction; and Respectively The height and width of the result of multi-scale feature extraction; For the The results of multi-scale feature extraction are Row, No. The eigenvalues ​​of the columns; is the preset first regularization coefficient; For Hadamard; is the fast Fourier transform; is the conjugate complex transform of the fast Fourier transform; is the preset second regularization coefficient; is the matrix determinant operation; The number of features of the result of multi-scale feature extraction; is the index number; For the The results of multi-scale feature extraction are Row, No. Column No. feature values.

[0016] Furthermore, in step 1, the formula for calculating the multi-head attention of the fused features is as follows:

[0017] ;

[0018] in, For the The output of an attention head; , and Respectively The weight matrices of queries, keys, and values ​​for each attention head; , and Respectively The query, key, and value biases for each attention head; For the The dimension of the attention heads; For the The distance scaling factor of the attention heads; To query the location index, is the key position index; Indicates the calculation query position and key position The distance between them, according to this distance, gives the attention weights between different positions a decay factor. When , the query position and key position are the same, , the attenuation factor is the largest, equal to 1; represents the normalized exponential function.

[0019] Furthermore, in step 1, the formula for generating a dynamic convolution kernel based on the connected attention head is as follows:

[0020] ;

[0021] ;

[0022] in, is the initial dynamic convolution kernel; is the final generated dynamic convolution kernel; is the dynamic convolution kernel size; and are the number of input channels and the number of output channels respectively; is the Frobenius norm; is the L2 norm; Function to reshape the tensor; Multilayer Perceptron; Indicates flattening the input into a one-dimensional vector; is the inverse fast Fourier transform.

[0023] Further, in step 3, the method for continuously updating the learning rate of the contact network defect intelligent detection model according to the distance between the defect detection output and the defect type annotated by the contact network image for training includes: performing a distance operation on the discrimination value represented by the three-dimensional vector corresponding to each defect detection output and the type value represented by the three-dimensional vector corresponding to the defect type annotated by the contact network image for training, to obtain the distance between the defect detection output and the defect type annotated by the contact network image for training; and continuously updating the learning rate of the contact network defect intelligent detection model according to the distance by the following formula:

[0024] ;

[0025] in, For the The learning rate obtained by the iteration; hour, is the initial learning rate; For the The learning rate obtained by the iteration; For the The bias term for the iteration; The sensitivity of the preset bias term change; For the The support vector spacing factor for the iteration; For the The regularization parameter for the iteration; For the The bias term for the iteration; for distance; It is an absolute value operation.

[0026] Further, The support vector spacing factor for the iteration Use the following formula to calculate:

[0027] ;

[0028] in; No. The weight vector of the support vector machine for the iteration; For the The average value of the slack variables of the SVM at iterations; The sensitivity of the preset slack variable changes; is the number of layers of the multi-level support vector machine model; For the The average of the slack variables of the support vector machine for iterations.

[0029] Furthermore, the regularization parameter is calculated using the following formula:

[0030] ;

[0031] in, For the The regularization parameter adjustment factor for the iteration; For the The regularization parameter adjustment factor for the iteration; For the The degree of satisfaction of the KKT conditions of the iteration; For the The degree of satisfaction of the KKT conditions of the iteration; The sensitivity of the preset KKT condition changes; Adjust the intensity for the preset periodicity; is the total number of iterations; is the kernel function; For the Dynamic convolution feature input of the input of the iteration; For the Dynamic convolution feature input of the input of the iteration; It is the preset decision factor, ranging from 1 to 5.

[0032] Furthermore, in step 3, the weight of the dynamic convolution kernel of the defect type is adjusted using the adaptive gradient clipping method through the following formula:

[0033] ;

[0034] in, is the weight of the adjusted dynamic convolution kernel for this defect type; is the gradient clipping threshold; is the soft threshold parameter; is the preset adaptive weight decay parameter; is the weight of the dynamic convolution kernel of the defect type before adjustment; Modulo operation on vectors.

[0035] By adopting the above technical scheme, the present invention produces the following beneficial effects: The present invention has significant advantages in feature extraction. By introducing multi-scale feature extraction technology and using convolutional neural network (CNN) to extract image features at different scales, the details and global information in the contact network image can be captured. The multi-scale feature extraction technology enables the model to identify defects of various sizes and shapes by analyzing images at different resolutions, thereby improving the accuracy of detection. Compared with the traditional single-scale feature extraction method, the method of the present invention can more comprehensively characterize the complex information in the contact network image, providing a solid foundation for subsequent defect identification. Secondly, the present invention adopts a multi-head attention mechanism, which can capture important information and relationships in the image from different angles and levels by calculating attention in multiple subspaces. The multi-head attention mechanism enables the model to better understand the association between image features, thereby improving the expression ability of features and the accuracy of detection. This mechanism can effectively handle complex backgrounds and diverse defect types in images, and enhance the model's ability to identify contact network defects. In addition, the present invention introduces a dynamic convolution kernel generation technology, which generates a dynamic convolution kernel by connecting the attention heads, so that the convolution kernel parameters can be dynamically adjusted according to the input features. The generation process of the dynamic convolution kernel utilizes technologies such as multi-layer perceptron (MLP) and Fourier transform to ensure that the convolution kernel can adapt to different input features and defect types, thereby improving the quality of feature extraction. Compared with the traditional fixed convolution kernel, the dynamic convolution kernel of the present invention has higher flexibility and adaptability, and can better capture the changes and details in the image. In terms of model training and optimization, the present invention adopts the method of adaptive gradient clipping and dynamic adjustment of learning rate, and dynamically adjusts the learning rate and gradient clipping threshold of the model by comprehensively considering factors such as gradient size, learning rate change and model parameters. The adaptive gradient clipping technology prevents the problems of gradient explosion and gradient disappearance by controlling the size of the gradient, thereby ensuring the stability and efficiency of model training. The method of dynamically adjusting the learning rate enables the model to adaptively adjust the learning rate according to the actual situation during the training process, thereby improving the convergence speed and efficiency of the training. The combination of these optimization methods enables the model to always maintain the best learning state under different training stages and data distributions, thereby accelerating the iteration speed of the model. The present invention also further improves the generalization ability and robustness of the model through dynamic optimization of regularization parameters. By comprehensively considering the changes in regularization parameters, changes in KKT conditions, periodic adjustments, and kernel function similarity, the regularization parameters are dynamically adjusted to ensure that the model maintains the best learning state under different training data and defect types. The dynamic optimization of regularization parameters not only prevents the model from overfitting, but also improves the model's adaptability in different environments and conditions, making contact network defect detection more accurate and reliable. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1A schematic diagram of a method flow of a rapid iteration method for an intelligent detection model for contact network defects provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0037] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any manner.

[0038] Any feature disclosed in this specification (including any additional claims and abstract), unless otherwise stated, may be replaced by other alternative features that are equivalent or have similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.

[0039] Example 1: Reference Figure 1 , a fast iteration method of an intelligent detection model for contact network defects, the method comprising:

[0040] Step 1: Input multiple contact network images for training, perform multi-scale feature extraction on each contact network image for training, perform nonlinear fusion on the results of multi-scale feature extraction to obtain fused features; perform multi-head attention calculation on the fused features, connect the outputs of all attention heads to obtain connected attention heads; generate dynamic convolution kernels based on the connected attention heads;

[0041] By inputting multiple contact network images for training, multi-scale feature extraction is performed. This process aims to capture feature information at different scales in the contact network image. Specifically, multi-scale feature extraction uses convolutional neural networks (CNNs) to extract image features at different levels. Shallow convolution layers can capture low-level features of the image, such as edges and textures, while deep convolution layers can capture high-level features, such as shapes and objects. Such multi-scale feature extraction can make full use of information at all levels of the image, so that the detection model can understand the image content more comprehensively, thereby improving the accuracy of defect detection. Then, the results of multi-scale feature extraction are nonlinearly fused. Nonlinear fusion uses nonlinear activation functions, such as ReLU (rectified linear unit), to nonlinearly transform and combine the extracted multi-scale features. This fusion method can not only enhance the ability of feature expression, but also improve the model's ability to understand and represent complex image content. The features after nonlinear fusion are further calculated through a multi-head attention mechanism. The multi-head attention mechanism is a mechanism that can capture feature relationships in multiple subspaces. The features are weighted and summarized through multiple attention heads to obtain the output of the connected attention heads. The multi-head attention mechanism can simultaneously focus on multiple different parts of the image, improving the meticulousness of feature extraction and the overall characterization ability of the model. When generating a dynamic convolution kernel, a set of dynamically adjusted convolution kernel parameters is generated based on the output of the connected attention head. These dynamic convolution kernels are different from traditional fixed convolution kernels, and their parameters can be dynamically adjusted according to the input features, making the convolution operation more flexible and efficient. Specifically, the dynamic convolution kernel can adaptively adjust its parameters to adapt to different image features, so that the model can show better feature extraction ability and detection performance under different defect types and feature modes. The generation process of the dynamic convolution kernel is trained through a deep learning network, and the learning ability of large-scale data is used to optimize the parameters of the dynamic convolution kernel to reach the optimal state, thereby further improving the accuracy and reliability of contact network defect detection. Through the above steps, the contact network defect intelligent detection model in the present invention can effectively improve the efficiency of rapid iteration. This is because the combination of multi-scale feature extraction, multi-head attention mechanism and dynamic convolution kernel enables the model to more efficiently capture and utilize key information in the image in the initial training and subsequent iterations, thereby reducing the training time and improving the convergence speed of the model. In addition, the use of dynamic convolution kernels enables the model to adaptively adjust when dealing with different types of defects, thereby reducing the need for parameter adjustment during the iteration process and improving overall training efficiency. In the application scenario of intelligent detection of contact network defects, this fast iteration method can significantly improve the real-time and accuracy of detection, meeting the dual requirements of efficiency and accuracy in practical applications.

[0042] Step 2: All the contact network images for training are grouped according to the defect type, and the contact network images for training with the same defect type are divided into the same group. The dynamic convolution kernels of all the contact network images for training in the same group are calculated by arithmetic mean, and the result is the dynamic convolution kernel of the defect type.

[0043] By grouping all the training contact network images by defect type, the training images with the same defect type are divided into the same group. The purpose of this step is to bring together images with the same defect type, so that the subsequent dynamic convolution kernel generation process can be more targeted and optimized, and the detection effect and generalization ability of the model can be improved. In practical applications, the contact network may have many different types of defects, such as wear, fracture, corrosion, etc. Therefore, classifying and grouping these defects can help the model to more accurately identify and detect each defect. Then, for all the training contact network images in each group, the standard dynamic convolution kernel of the defect type is generated by arithmetic averaging of the dynamic convolution kernel. This process averages the dynamic convolution kernels of images of the same defect type, so that the generated convolution kernel can more accurately characterize the characteristics of the defect type, avoiding the noise and deviation that may be caused by a single image. This method of generating dynamic convolution kernels can not only improve the detection accuracy of the model, but also accelerate convergence during model training, reduce training time, and improve iteration efficiency. In actual operation, the arithmetic mean operation can smooth out abnormal features in individual images, making the generated standard dynamic convolution kernel more representative and robust, thereby enhancing the performance of the model in actual detection.

[0044] Through the above steps, the generated standard dynamic convolution kernel can play an important role in the subsequent training and iteration process of the model. When the newly input contact network image is used for training, the model can select the corresponding standard dynamic convolution kernel for convolution operation according to the labeled defect type of the image. This can not only improve the efficiency of feature extraction, but also ensure that the extracted features are more consistent with the feature pattern of the actual defect type, thereby improving the detection accuracy of the model. In addition, by using the standard dynamic convolution kernel generated by arithmetic averaging, the model can adaptively adjust when processing different defect types, thereby improving the recognition ability of multiple defects and enhancing the generalization performance of the model. In the application of intelligent detection of contact network defects, this method of defect type grouping and dynamic convolution kernel average generation has significant advantages. First, it can significantly improve the training efficiency and iteration speed of the model. Since each defect type has a corresponding standard dynamic convolution kernel, the model can quickly select and apply the appropriate convolution kernel for feature extraction and classification during the training process, thereby reducing the training time and improving the convergence speed. Secondly, by averaging the convolution kernels of the same defect images, the model can more accurately capture and characterize the features of different defect types, improving the accuracy and reliability of detection. Finally, this method is also highly adaptable and scalable, and can be dynamically adjusted according to different defect types and characteristic patterns, thus meeting the needs of diversified and complex defect detection in practical applications.

[0045] Step 3: Establish a contact network defect intelligent detection model, which is a multi-level support vector machine model, with dynamic convolution features as input and a discrimination value represented by a three-dimensional vector as output; quickly iterate the contact network defect intelligent detection model, specifically including: for each contact network image for training input subsequently, select a corresponding dynamic convolution kernel according to the defect type annotated therein, perform convolution operation with each contact network image for training input subsequently, and extract the dynamic convolution features of the contact network image for training; the defect type annotated by each contact network defect intelligent detection model is also a type value represented by a three-dimensional vector; use the dynamic convolution feature to input into the contact network defect intelligent detection model to obtain a defect detection output, and continuously update the learning rate of the contact network defect intelligent detection model according to the distance between the defect detection output and the defect type annotated by the contact network image for training; at the same time, according to the distance between the defect detection output and the defect type annotated by the contact network image for training and the change ratio of the updated learning rate to the learning rate before the update, use the adaptive gradient clipping method to adjust the weight of the dynamic convolution kernel of the defect type;

[0046] In this step, a multi-level support vector machine model is first established, in which the input is the dynamic convolution feature and the output is a discriminant value represented by a three-dimensional vector. The construction of the multi-level support vector machine model aims to classify different types of contact network defects in a hierarchical manner, so that the model can capture and distinguish different defect features more finely, thereby improving the accuracy and robustness of detection. On this basis, the intelligent detection model of contact network defects is quickly iterated and trained. This process includes several key steps, which aims to improve the learning efficiency and convergence speed of the model by dynamically adjusting the model parameters and convolution kernel weights. Specifically, for each subsequent input contact network image for training, the corresponding standard dynamic convolution kernel is first selected according to the defect type marked on it. The purpose of this step is to use the previously generated standard dynamic convolution kernel for different defect types to perform convolution operations with the current input image to extract the dynamic convolution features of the image. By using the pre-optimized standard dynamic convolution kernel, the efficiency and accuracy of the feature extraction process can be ensured, so that the extracted features can better represent the actual defect information of the image. Then, the extracted dynamic convolution features are input into the multi-level support vector machine model to obtain the output results of defect detection. The multi-level support vector machine model classifies and discriminates the input features layer by layer in a hierarchical manner, and finally outputs a three-dimensional vector to characterize the discriminant value of the defect type. This hierarchical classification method can not only improve the model's ability to classify complex features, but also enhance the generalization performance of the model, so that it can show higher accuracy and stability when dealing with different defect types. Next, the learning rate of the contact network defect intelligent detection model is dynamically updated according to the distance between the defect detection output and the defect type annotated by the training contact network image. The purpose of this step is to adjust the learning rate of the model by calculating the error between the detection output and the actual defect type, so that the model is gradually optimized during the training process and the convergence speed is improved. Specifically, if the error is large, the learning rate is increased to speed up the adjustment of the model parameters; if the error is small, the learning rate is reduced so that the model can be fine-tuned more stably when it is close to the optimal state. This method of dynamically adjusting the learning rate can effectively avoid overfitting or underfitting problems in the training process and improve the learning efficiency and accuracy of the model.

[0047] While adjusting the learning rate, the weight of the dynamic convolution kernel of the defect type is adjusted using the adaptive gradient clipping method according to the distance between the defect detection output and the actual defect type, and the change ratio of the updated learning rate to the learning rate before the update. Adaptive gradient clipping is an optimization method based on gradient adjustment, which can adaptively adjust the parameter update step size according to the size and direction of the gradient, thereby avoiding the problem of gradient explosion or disappearance. Through this method, the parameter optimization process can be accelerated while maintaining the stability of the model, further improving the training efficiency and detection accuracy. In general, step 3 constructs a multi-level support vector machine model, uses dynamic convolution features for defect detection, and continuously optimizes the model parameters and convolution kernel weights through a fast iterative training method, thereby realizing efficient and intelligent detection of contact network defects. In this process, dynamically adjusting the learning rate and using the adaptive gradient clipping method can effectively improve the learning efficiency and convergence speed of the model, so that the model can quickly and accurately classify and distinguish when facing complex defect types. This fast iteration method not only improves the training efficiency of the model, but also enhances its adaptability and generalization ability to different defect types, so that it can show higher detection accuracy and reliability in practical applications. Through the above steps, the contact network defect intelligent detection model of the present invention can quickly adapt to different types of defects during training and iteration, and improve the detection accuracy and efficiency of the model by dynamically adjusting parameters and convolution kernel weights. This method has significant advantages in practical applications. It can not only speed up the training speed of the model and reduce the training time, but also improve the detection accuracy and stability of the model, thereby meeting the requirements for efficiency and reliability in actual operation and maintenance. In short, the principle of step 3 realizes efficient and intelligent detection of contact network defects through the combination of multi-level support vector machine model, dynamic convolution feature extraction and fast iterative training method, provides strong technical support for contact network defect detection, and significantly improves the fast iteration efficiency and detection performance of the model.

[0048] Step 4: After the rapid iteration is completed, the dynamic convolution kernel of each defect type is multiplied by its corresponding weight to obtain the iterative dynamic convolution kernel. After adding all the iterative dynamic convolution kernels, they are divided by the total number of iterative dynamic convolution kernels to obtain the updated dynamic convolution kernel. For the subsequent input contact network image for detection, the updated dynamic convolution kernel is used to extract its dynamic convolution features.

[0049] After the rapid iteration is completed, the dynamic convolution kernel of each defect type is multiplied by its corresponding weight to obtain the iterated dynamic convolution kernel. Through this process, the characteristics of different defect types can be better characterized, so that the model can more accurately identify and classify different types of defects during the detection process. Specifically, during the rapid iteration of model training, the dynamic convolution kernel of each defect type will be continuously optimized according to the feedback and adjustment of the model. When the rapid iteration is completed, all dynamic convolution kernels will be weighted averaged according to their performance and weights during the training process to obtain a more accurate and robust dynamic convolution kernel. This weighted average method comprehensively considers the performance of each convolution kernel in different iterations and smoothes out the influence of individual anomalies or noise, so that the final dynamic convolution kernel generated can better represent the characteristics of the defect type and improve the performance of the model in actual detection.

[0050] Next, all iterative dynamic convolution kernels are added together and divided by the total number of iterative dynamic convolution kernels to obtain the updated dynamic convolution kernel. This process further improves the accuracy and generalization ability of the convolution kernel by comprehensively processing the dynamic convolution kernels generated in multiple iterations. The updated dynamic convolution kernel can better adapt to the various defect types in actual detection, so that the model can still maintain high detection accuracy and stability when facing different feature patterns. This update method ensures the optimization of the convolution kernel parameters through multiple iterations and weighted averaging, so that the model can converge faster, reduce training time, and improve iteration efficiency. For the subsequent input contact network image for detection, the updated dynamic convolution kernel is used to extract its dynamic convolution features. This step ensures the efficiency and accuracy of the feature extraction process by using the optimized convolution kernel for feature extraction. After multiple iterations and weighted averaging, the updated dynamic convolution kernel can better characterize the actual defect features of the contact network image, making the extracted feature information more comprehensive and accurate. In this way, the model can quickly and accurately extract features, classify and identify defects when detecting new images, significantly improving the detection efficiency and accuracy. In the application of intelligent detection of contact network defects, this method of weighted averaging and updating dynamic convolution kernels has significant advantages. First, through multiple iterations and weighted averaging, it can smooth out the anomalies and noise that may occur during the training process, and improve the robustness and generalization ability of the model. Secondly, by continuously optimizing and updating the dynamic convolution kernel, the efficiency and accuracy of the feature extraction process are ensured, so that the model can still maintain a high detection accuracy when facing different defect types. Finally, this method significantly improves the iteration efficiency of the model by reducing the training time and accelerating the convergence speed of the model, so that the intelligent detection system of contact network defects can adapt to the needs of practical applications more quickly.

[0051] Embodiment 2: The method further comprises: when inputting a contact network image for training or a contact network image for detection, performing a denoising process based on Gaussian filtering.

[0052] Specifically, Gaussian filtering is a classic image denoising technology. By performing convolution operations on the image, the image is smoothed using the weight coefficient of the Gaussian function to reduce the influence of noise. In the processing of contact network images, Gaussian filtering can effectively remove random noise introduced by environmental factors, equipment noise, etc., thereby improving the clarity of the image and the recognizability of features. Specifically, the weight coefficient of the Gaussian filter presents a two-dimensional Gaussian distribution, with the highest weight in the center and gradually decreasing outward, so that when performing convolution, the edge features of the image can be retained while smoothing out the noise. Performing Gaussian filtering when inputting contact network images for training can ensure the quality of training data and improve the accuracy of feature extraction during training. Since the quality of training data directly affects the performance of the model, Gaussian filtering denoising can reduce the interference of noise on feature extraction, so that the model can learn clearer and more accurate features, thereby improving the training effect and the generalization ability of the model. It is also important to perform Gaussian filtering on contact network images for input detection. Image denoising during the detection process can improve the detection accuracy in practical applications. Images in actual inspections are usually affected by various external factors, such as weather changes, lighting conditions, equipment vibrations, etc., which may introduce various noises. If these noises are not processed, they will interfere with feature extraction and defect detection, resulting in inaccurate inspection results. By performing Gaussian filtering and denoising before inspection, image quality can be significantly improved, making the feature extraction process more reliable, thereby improving the accuracy and stability of defect detection.

[0053] Embodiment 3: In step 1, multiple contact network images for training are input, multi-scale feature extraction is performed on each contact network image for training, and the results of multi-scale feature extraction are nonlinearly fused to obtain the formula for fusion features as follows:

[0054] ;

[0055] in, For fusion features; is the scale quantity; is the scale index; For the The weight of each scale; For the Feature maps of different scales; It is the index of the height direction of the result of multi-scale feature extraction; The width index of the result of multi-scale feature extraction; and Respectively The height and width of the result of multi-scale feature extraction; For the The results of multi-scale feature extraction are Row, No. The eigenvalues ​​of the columns; is the preset first regularization coefficient; For Hadamard; is the fast Fourier transform; is the conjugate complex transform of the fast Fourier transform; is the preset second regularization coefficient; is the matrix determinant operation; The number of features of the result of multi-scale feature extraction; is the index number; For the The results of multi-scale feature extraction are Row, No. Column No. feature values.

[0056] Specifically, the contact network images used for training are input, and these images are subjected to multi-scale feature extraction to generate a series of feature maps with different resolutions and features. The purpose of multi-scale feature extraction is to capture different levels of information in the image, such as edges, textures, and shapes. The feature maps at each scale Indicates In order to ensure that these feature maps can play a role in the fusion process, they need to be normalized and standardized. The first part of the formula involves normalizing these multi-scale feature maps. The normalization process is to normalize each eigenvalue. Perform exponential operation and then normalize to form standardized eigenvalues. The mathematical expression of this processing method includes the normalization step. Through the exponential function and the normalized denominator, each eigenvalue is limited to a uniform range. Normalization processing can not only eliminate the differences between features of different scales, but also enhance the contrast of feature maps, making feature extraction clearer and more accurate. Normalized eigenvalues In the formula, it is weighted and summed, where the weight This weighted summation method ensures the balanced fusion of multi-scale feature maps, so that the features of each scale can have an impact on the final fusion feature. It has an impact, thereby improving the comprehensiveness and accuracy of feature extraction.

[0057] The second part of the formula introduces a regularization term based on the determinant. The determinant operation reflects the overall characteristics and stability of the feature matrix. By performing determinant operations on feature matrices of all scales and taking their average values, the noise and redundant information in the feature extraction process can be effectively suppressed, and the expression ability of the fusion feature can be improved. Specifically, the determinant operation provides a compressed representation of the global information of the feature matrix, which can capture the core characteristics of the feature matrix. The regularization term uses a preset regularization coefficient To adjust its influence, ensure that the accuracy of feature extraction and the stability of the model can be balanced when fusing features. Through this regularization processing, the model can more robustly cope with different types of input images, reduce the interference of noise on feature extraction, and thus improve the quality of feature fusion. The third part of the formula uses the fast Fourier transform (FFT) and its conjugate complex transform, combined with the hyperbolic tangent function (tanh), to further enhance the frequency domain expression ability of the feature. The fast Fourier transform can convert the feature map from the time domain to the frequency domain, making the periodicity and local change patterns in the feature map more obvious. By performing a fast Fourier transform on the feature map, its frequency domain features are obtained, and then the frequency domain features are conjugate complex transformed and combined with the hyperbolic tangent function, the important frequency domain information in the feature map can be highlighted and unnecessary noise and interference can be suppressed. The introduction of FFT processing is to enhance the frequency domain representation ability of the feature, so that the model can better capture and understand the periodicity and local features in the contact network image. This part is achieved through a preset regularization coefficient To adjust its influence and ensure the balance and optimization of the feature fusion process.

[0058] Through the combination of the above three parts, this complex fusion formula realizes the nonlinear fusion of multi-scale features and obtains high-quality fusion features. . This method can not only enhance the feature extraction capability of the model, enabling it to more accurately capture defect information in the contact network image, but also improve the robustness and stability of the model through complex nonlinear processing and regularization methods, thereby significantly improving the rapid iteration efficiency of the model. In the application of intelligent detection of contact network defects, this fusion method can effectively improve the quality of feature extraction, enable the model to converge faster during training and detection, reduce training time, and improve iteration efficiency. Through the balanced fusion and regularization of features of different scales, the model can still maintain a high detection accuracy when facing various complex contact network defects. This not only meets the high requirements for detection accuracy and speed in practical applications, but also provides a solid foundation for subsequent model training and iteration through high-quality fusion features.

[0059] Example 4: In step 1, the formula for calculating multi-head attention on the fusion feature is as follows:

[0060] ;

[0061] in, For the The output of an attention head; , and Respectively The weight matrices of queries, keys, and values ​​for each attention head; , and Respectively The query, key, and value biases for each attention head; For the The dimension of the attention heads; For the The distance scaling factor of the attention heads; To query the location index, is the key position index; Indicates the calculation query position and key position The distance between them, according to this distance, gives the attention weights between different positions a decay factor. When , the query position and key position are the same, , the attenuation factor is the largest, equal to 1; represents the normalized exponential function.

[0062] Specifically, the calculation process of the multi-head attention mechanism first involves merging the features A weight matrix for queries, keys, and values , and Perform a linear transformation and add the corresponding bias term , and , get the query vector , key vector Sum value vector These vectors reflect the transformation and mapping of the fusion features in different subspaces through matrix operations. Then, the dot product result of the query vector and the key vector is scaled to is the scaling factor, and the attention weight is calculated by the softmax function. The softmax function converts the dot product result into a probability distribution, so that the attention weight is normalized between all positions, thereby ensuring the stability and rationality of the calculation. In order to further enhance the model's ability to capture the position relationship in the feature map, a distance-based attenuation factor is introduced into the formula The role of this factor is to and key position The distance between them is used to adjust the attention weight. and When the distance is close, the attenuation factor is close to 1, indicating that the attention weight between the two positions has a greater impact; when the distance is far, the attenuation factor is close to 0, indicating that the attention weight between the two positions has a smaller impact. This distance-based weighting process can effectively consider the relationship between different positions in the feature map, allowing the model to more accurately capture position-related information during feature extraction, thereby improving the quality of feature representation. After calculating the attention weight, apply it to the value vector , get the The output of an attention head . Output results of multiple attention heads The final multi-head attention feature is formed by concatenating operations. This step introduces multiple attention heads, allowing the model to capture feature relationships from multiple subspaces at the same time, enhancing the diversity and comprehensiveness of feature expression. Through parallel calculation of multiple attention heads, the model can process more feature information in a shorter time, thereby accelerating the training and iteration process of the model and improving the efficiency of rapid iteration.

[0063] In the application of contact network defect detection, the multi-head attention mechanism has significant advantages. First, by introducing the multi-head attention mechanism, the model can establish more detailed and complex feature relationships between different scales and different positions, thereby improving the detection accuracy of contact network defects. The types of defects in the contact network are diverse and complex, and different defects may be distributed at different positions and scales in the image. The multi-head attention mechanism can capture these complex feature relationships from multiple angles, so that the model can more accurately identify and classify various defects during the detection process, meeting the high-precision requirements in practical applications. Secondly, the parallel computing capability of the multi-head attention mechanism can also significantly accelerate the training and iteration process of the model. In practical applications, contact network defect detection requires processing a large amount of image data, and fast iteration is the key to improving detection efficiency. The multi-head attention mechanism can process more feature information in a shorter time by parallel computing the outputs of multiple attention heads, thereby accelerating the training and convergence of the model and improving the iteration efficiency. This is of great significance for the actual deployment and application of the contact network defect intelligent detection model. Finally, the introduction of the multi-head attention mechanism also enhances the robustness and generalization ability of the model. By calculating attention in parallel in different subspaces, the model can better capture the global and local information in the feature map, thereby improving its adaptability to various complex and diverse defects. This robustness and generalization ability enables the model to maintain high detection accuracy and stability when facing contact network images in different environments and conditions, meeting the needs of actual operation and maintenance.

[0064] Example 5: In step 1, the formula for generating a dynamic convolution kernel based on the connected attention head is as follows:

[0065] ;

[0066] ;

[0067] in, is the initial dynamic convolution kernel; is the final generated dynamic convolution kernel; is the dynamic convolution kernel size; and are the number of input channels and the number of output channels respectively; is the Frobenius norm; is the L2 norm; Function to reshape the tensor; Multilayer Perceptron; Indicates flattening the input into a one-dimensional vector; is the inverse fast Fourier transform.

[0068] Specifically, the first part of the formula is achieved by connecting the attention heads The flatten operation is used to convert it into a one-dimensional vector. This flattening operation is designed to convert the high-dimensional attention feature map into a form suitable for input into the multi-layer perceptron. Through this conversion, the multi-layer perceptron can receive and process the comprehensive information from different attention heads. The flattened vector is input into the multi-layer perceptron, and after a series of nonlinear transformations and weight adjustments, the initial dynamic convolution kernel is generated. The multilayer perceptron plays the role of feature mapping in this process. It generates a dynamic convolution kernel that adapts to the current input features by learning the relationship between the input features and the convolution kernel parameters. The generated dynamic convolution kernel is reshaped and adjusted to a shape suitable for the convolution operation, that is, ,in is the convolution kernel size, and are the number of input channels and the number of output channels, respectively. Next, the second part of the formula introduces a regularization term based on the Frobenius norm. By calculating the norm of the dynamic convolution kernel and adding an exponential decay factor, the stability and robustness of the convolution kernel parameters are ensured. The Frobenius norm is used to measure the overall size of the matrix. By calculating the Frobenius norm of the dynamic convolution kernel and combining it with the preset regularization coefficient , generates an attenuation factor. This attenuation factor is applied to the initial dynamic convolution kernel , element-by-element multiplication is performed through the Hadamard product operation, so that the convolution kernel parameters can maintain high flexibility while avoiding excessive changes, thereby enhancing the stability of the convolution kernel. This regularization process can effectively suppress the overfitting phenomenon of the convolution kernel parameters and ensure that the model has a high generalization ability when facing different input images. Finally, the third part of the formula further optimizes the dynamic convolution kernel through the fast Fourier transform (FFT) and its inverse transform (IFFT). Specifically, the attention head is connected Convert to frequency domain by fast Fourier transform and combine the modulus length of Fourier transform After normalization, the inverse Fourier transform is applied to convert the frequency domain features back to the time domain. This process aims to enhance the dynamic convolution kernel's ability to capture high-frequency and low-frequency features through the extraction and inverse transformation of frequency domain features, so that the final generated convolution kernel It has stronger feature expression ability and adaptability. Through Fourier transform and inverse transform processing, the convolution kernel can more comprehensively capture various frequency components in the image, thereby improving the quality of feature extraction and detection accuracy.

[0069] The types of defects in the contact network are diverse and complex, and different defects may be distributed at different positions and scales in the image. Through the generation of dynamic convolution kernels, the model can dynamically adjust the convolution kernel parameters according to different input features, so as to extract features more accurately and improve the accuracy of detection. At the same time, the use of dynamic convolution kernels can accelerate the training and iteration process of the model, reduce training time, and improve iteration efficiency. In practical applications, contact network defect detection requires processing a large amount of image data, and fast iteration is the key to improving detection efficiency. The generation and optimization process of dynamic convolution kernels ensures the flexibility and stability of convolution kernel parameters by introducing technologies such as multilayer perceptron, regularization processing, and Fourier transform, so that the model can quickly adapt to different input features and defect types, thereby accelerating the training and convergence process. This is of great significance for the actual deployment and application of the contact network defect intelligent detection model. In addition, the generation process of dynamic convolution kernels also enhances the robustness and generalization ability of the model. By regularizing and optimizing the convolution kernel parameters in the frequency domain, the model can better adapt to various complex and diverse defect types and reduce the overfitting phenomenon that may occur during training. In this way, when faced with contact network images in different environments and conditions, the model can still maintain high detection accuracy and stability, meeting the needs of actual operation and maintenance.

[0070] Embodiment 6: In step 3, the method for continuously updating the learning rate of the contact network defect intelligent detection model according to the distance between the defect detection output and the defect type annotated by the contact network image for training includes: performing a distance operation on the discrimination value represented by the three-dimensional vector corresponding to each defect detection output and the type value represented by the three-dimensional vector corresponding to the defect type annotated by the contact network image for training, to obtain the distance between the defect detection output and the defect type annotated by the contact network image for training; and continuously updating the learning rate of the contact network defect intelligent detection model according to the distance by the following formula:

[0071] ;

[0072] in, For the The learning rate obtained by the iteration; hour, is the initial learning rate; For the The learning rate obtained by the iteration; For the The bias term for the iteration; The sensitivity of the preset bias term change; For the The support vector spacing factor for the iteration; For the The regularization parameter for the iteration; For the The bias term for the iteration; for distance; It is an absolute value operation.

[0073] Specifically, in this process, the distance between the discriminant value of the three-dimensional vector representation corresponding to the defect detection output and the type value of the three-dimensional vector representation corresponding to the defect type annotated in the training contact network image is the key indicator. This distance reflects the difference between the model output and the actual annotation. The smaller the distance, the more accurate the model's prediction; the larger the distance, the larger the model's prediction error. By continuously calculating this distance, the model can dynamically adjust the learning rate, making the learning process more adaptive and efficient. In the formula, the learning rate of the current iteration is is the learning rate from the previous iteration Multiply by several factors to update. These factors include the support vector spacing factor , regularization parameter And an exponential decay factor based on the change in the bias term. Support vector spacing factor It reflects the size of the interval between the current support vectors and is an indicator of the stability of the classification boundary. It is used to control the complexity of the model and prevent overfitting. In each iteration, the model optimizes the learning rate by adjusting these factors. The exponential decay factor based on the change of the bias term plays a crucial role in the formula. part, by measuring the current iteration bias The bias term of the previous iteration To adjust the attenuation of the learning rate, Is a constant used to adjust the effect of changes in the bias term on the learning rate; is the preset sensitivity of the bias term change. The main purpose of this item is to adapt to the dynamic adjustment of model parameters by considering the degree of change of the bias term. When the bias term changes greatly, the attenuation factor decreases, indicating that the model needs a smaller learning rate for fine-tuning; when the bias term changes less, the attenuation factor is close to 1, indicating that a larger learning rate can be maintained for fast updates.

[0074] This method of dynamically adjusting the learning rate enables the model to adapt to the feature changes in the training data more quickly, thereby accelerating the convergence speed of the model. In particular, in the application of contact network defect detection, the diversity and complexity of the data are high, and different defect types may correspond to different feature patterns. By dynamically adjusting the learning rate, the model can adaptively adjust the learning process according to different feature patterns, thereby improving training efficiency and detection accuracy. In addition, this learning rate adjustment method can also effectively deal with the overfitting problem in the training process. By introducing the support vector spacing factor and the regularization parameter, the model can balance complexity and fitting accuracy during the training process, avoid overfitting the training data, and thus improve the generalization ability of the model. In practical applications, this method can significantly improve the robustness of the model under different environments and conditions, so that the contact network defect intelligent detection model can work stably and efficiently. Specifically for the application scenario of contact network defect intelligent detection, the rapid iteration capability of the model is crucial. The contact network is a key infrastructure in railway transportation, and its health status is directly related to the safe operation of the train. By introducing the above-mentioned dynamic learning rate adjustment method, the present invention can achieve efficient detection and rapid iteration of contact network defects, significantly improving the response speed and detection accuracy of the model. This has important practical significance for real-time monitoring and maintaining the health status of the contact network and preventing safety accidents.

[0075] Embodiment 7: The support vector spacing factor for the iteration Use the following formula to calculate:

[0076] ;

[0077] in; No. The weight vector of the support vector machine for the iteration; For the The average value of the slack variables of the SVM at iterations; The sensitivity of the preset slack variable changes; is the number of layers of the multi-level support vector machine model; For the The average of the slack variables of the support vector machine for iterations.

[0078] Specifically, the formula Partially through the weight vector of the support vector machine of norm to calculate the basic ratio of the support vector interval. The weight vector Norm It reflects the current complexity of the model and the size of the feature weights. By taking its reciprocal, the support vector interval can be adjusted so that the interval factor is inversely proportional to the model complexity. This adjustment ensures that when the model's weight vector is large, the interval factor is small, thereby slowing down the learning speed and avoiding over-adjustment of model parameters; when the weight vector is small, the interval factor is large, speeding up the learning speed and allowing the model to adapt to new feature patterns more quickly. Next, the exponential decay factor in the formula By measuring the slack variable between the current iteration and the previous iteration The slack variable reflects the flexibility of the model in dealing with misclassified points. A larger slack variable means that the model allows more misclassified points, while a smaller slack variable means that the model is more strictly classified. By calculating the changes in the slack variable, the support vector interval factor can be dynamically adjusted, so that the model can flexibly adjust the learning rate when facing different degrees of classification difficulty. Preset sensitivity parameters It is used to control the magnitude of this adjustment, ensuring that the model can converge stably when dealing with large changes and adapt quickly when dealing with small changes.

[0079] In addition, the formula also includes a hyperbolic tangent function , which is used to consider the impact of the hierarchical structure of the model on the support vector spacing factor. The multi-level support vector machine model processes and classifies the input features step by step in a hierarchical manner, and the output of each layer is used as the input of the next layer, thereby improving the classification ability and robustness of the overall model. By introducing the hyperbolic tangent function, the support vector spacing factor can be smoothly adjusted to be proportional to the number of layers of the model. When the number of model layers is large, the output of the hyperbolic tangent function is close to 1, indicating that the support vector spacing factor should maintain a high value to ensure sufficient learning of each layer of the model; when the number of model layers is small, the function output is small, indicating that the support vector spacing factor should be appropriately reduced to speed up the learning speed of the overall model. Through comprehensive consideration of the above multiple factors, the support vector spacing factor It can be flexibly adjusted in each iteration to ensure that the model always maintains the best learning rate and convergence speed under different feature patterns and classification difficulties. This dynamic adjustment mechanism not only improves the training efficiency of the model, but also enhances its adaptability and generalization ability to different defect types.

[0080] Example 8: The regularization parameter is calculated using the following formula:

[0081] ;

[0082] in, For the The regularization parameter adjustment factor for the iteration; For the The regularization parameter adjustment factor for the iteration; For the The degree of satisfaction of the KKT conditions of the iteration; For the The degree of satisfaction of the KKT conditions of the iteration; The sensitivity of the preset KKT condition changes; Adjust the intensity for the preset periodicity; is the total number of iterations; is the kernel function; For the Dynamic convolution feature input of the input of the iteration; For the Dynamic convolution feature input of the input of the iteration; It is the preset decision factor, ranging from 1 to 5.

[0083] Specifically, the first part of the formula Used to measure the ratio of the regularization parameter adjustment factor between the current iteration and the previous iteration. Regularization parameter adjustment factor and Respectively represent Second and The regularization parameter in the iteration. This part reflects the change trend of the regularization parameter in two consecutive iterations in the form of a ratio. When the ratio is greater than 1, it means that the regularization strength of the current iteration has increased, and the model pays more attention to preventing overfitting; when the ratio is less than 1, it means that the regularization strength has weakened, and the model is more flexible to adapt to new data features. The second part of the formula The regularization parameters are adjusted dynamically by measuring the change in the satisfaction of the Karush-Kuhn-Tucker (KKT) condition between the current iteration and the previous iteration. The KKT condition is a necessary condition for the optimization problem and reflects the optimization state of the current model. The difference between the KKT conditions between two iterations is calculated and combined with the preset sensitivity parameters. This part can flexibly adjust the regularization parameters so that when the model is close to the optimal solution, the regularization strength can be appropriately reduced to improve the model's fitting ability; when it is far away from the optimal solution, the regularization strength can be increased to prevent overfitting. Part III A periodic adjustment term based on a sine function is introduced. This term is adjusted by a preset periodic intensity parameter and the total number of iterations , and periodically adjust the regularization parameters in each iteration. The purpose of this periodic adjustment is to prevent the model from falling into a local optimal solution during training. Through periodic fluctuations, the model can conduct a wider search in the parameter space, thereby improving the overall optimization effect. The last part The kernel function is used to measure the current input features. With the input features of the previous iteration The kernel function can map the input features to a high-dimensional space, thereby better capturing the nonlinear relationship of the data. By comparing the similarity between the current feature and the previous feature, this part can dynamically adjust the regularization parameters so that the model can maintain a consistent regularization strength when processing similar data; and adjust the regularization parameters to better adapt to the new feature pattern when processing data with large differences. Preset decision factors It is used to avoid the situation where the denominator is zero and ensure the stability of the formula calculation. The dynamic optimization of the regularization parameter significantly improves the training efficiency and detection accuracy of the model. In the detection of contact network defects, the diversity and complexity of the data require the model to be able to quickly adapt to different defect types and feature patterns. By dynamically adjusting the regularization parameter, the model can flexibly respond to different feature distributions during the training process and maintain the best learning state. First of all, this formula ensures the stability and adaptability of the model during the training process. By measuring the changes in the regularization parameters of two consecutive iterations, the model can adjust the regularization strength in time according to the actual training situation to avoid overfitting and underfitting problems. At the same time, the dynamic adjustment of the KKT condition enables the model to reduce the regularization strength and improve the fitting ability when it is close to the optimal solution; when it is far away from the optimal solution, the regularization strength is increased to prevent the model from overfitting the training data. Secondly, the introduction of the periodic adjustment term enables the model to conduct a wider search in the parameter space through the periodic fluctuation of the sine function. This adjustment method can not only prevent the model from falling into the local optimal solution, but also improve the overall optimization effect through periodic fluctuations, so that the model can learn various features in the contact network defect data more comprehensively. Finally, the kernel function similarity calculation measures the similarity between the current input feature and the previous input feature, ensuring that the model maintains consistent regularization strength when processing similar data, and dynamically adjusts the regularization parameters when processing data with large differences. This processing method enables the model to better adapt to different feature patterns, improving the quality of feature extraction and the accuracy of detection.

[0084] Example 9: In step 3, the weight of the dynamic convolution kernel of the defect type is adjusted using the adaptive gradient clipping method through the following formula:

[0085] ;

[0086] in, is the weight of the adjusted dynamic convolution kernel for this defect type; is the gradient clipping threshold; is the soft threshold parameter; is the preset adaptive weight decay parameter; is the weight of the dynamic convolution kernel of the defect type before adjustment; Modulo operation on vectors.

[0087] Specifically, the core of the formula is to clip the gradient by Controls the size of the gradient. is the preset gradient clipping threshold, which is used to prevent the problem of training instability caused by excessive gradients. Model Greater than threshold , then scale it so that its modulus is equal to ; If the gradient The modulus is less than or equal to , the original value remains unchanged. This part ensures that the gradient changes within a reasonable range and avoids the problem of gradient explosion. Adaptive adjustment factor It is used to dynamically adjust the influence of the gradient according to the difference in learning rate between the current and previous iterations. and are the learning rates of the current and previous iterations, respectively. When the learning rate changes greatly, it means that the model parameters are adjusted to a large extent, and the gradient needs to be adjusted more strongly; when the learning rate changes slightly, it means that the model parameters are adjusted to a small extent, and the adjustment of the gradient should be weakened accordingly. This part improves the adaptability of the model by dynamically adjusting the influence of the gradient, so that the gradient clipping can be optimized according to the actual situation during the training process. The formula also includes a weight-based adjustment term .in, is the weight vector of the current iteration, is an adaptive weight decay parameter used to control the decay speed of the weight. It is calculated by calculating the modulus of the current weight vector and combining it with the soft threshold parameter , the weights can be clipped and adjusted. Specifically, when the modulus of the weight vector Exceeding the soft threshold , it is attenuated so that it gradually approaches the threshold, thereby preventing the model from overfitting due to excessive weights; when the modulus of the weight vector is less than or equal to the soft threshold , the original value remains unchanged.

[0088] This adjustment method ensures the stability and efficiency of the model during the training process by combining gradient clipping and weight attenuation. Through the dual control of gradient and weight, the model can better adapt to different training data and defect types, and improve the accuracy of feature extraction and defect detection. At the same time, the method of adaptive gradient clipping can dynamically adjust parameters so that the model maintains the best learning state at different training stages, thereby accelerating the convergence speed and improving the iteration efficiency. In combination with the subject of the present invention, the method of adaptive gradient clipping significantly improves the rapid iteration capability of the contact network defect intelligent detection model. In contact network defect detection, the diversity and complexity of data require the model to be able to quickly adapt to different defect types and feature patterns. Through adaptive gradient clipping, the model can flexibly respond to different feature distributions during the training process and maintain the best learning state. First of all, this formula ensures the stability and adaptability of the model during the training process. By clipping the gradient, the problem of gradient explosion is prevented, and the model parameters are ensured to change within a reasonable range, thereby improving the stability of training. At the same time, through the adaptive adjustment factor, the model can dynamically adjust the influence of the gradient according to the change of the learning rate, ensuring that the effect of gradient clipping is adapted to the actual situation during the training process. Secondly, the adaptive adjustment of weights prevents the problem of excessive weights by combining soft thresholds and weight decay, ensuring the rationality and robustness of model parameters. This adjustment method can not only avoid the problem of overfitting, but also improve the generalization ability of the model, so that it can still maintain high detection accuracy and stability when facing different defect types. Finally, the adaptive gradient clipping method dynamically adjusts parameters to keep the model in the best learning state at different training stages, thereby accelerating the convergence speed and improving the iteration efficiency. This is of great significance for the actual deployment and application of the intelligent detection model of contact network defects. In the actual application of intelligent detection of contact network defects, the diversity and complexity of data require the model to quickly adapt to different defect types and feature patterns. Through adaptive gradient clipping, the model can flexibly respond to different feature distributions during the training process and maintain the best learning state. For example, when facing different types of defects such as wear, fracture, and corrosion, the model needs to be dynamically adjusted according to the characteristics of each defect to ensure the accuracy of feature extraction and the accuracy of detection. The adaptive gradient clipping method enables the model to better cope with these different defect types and improve the overall detection effect through dual control of gradients and weights.

[0089] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that these specific embodiments are only illustrative, and those skilled in the art may omit, replace, and change the details of the above methods and systems in various ways without departing from the principles and essence of the present invention. For example, merging the above method steps so as to perform substantially the same functions in substantially the same manner to achieve substantially the same results is within the scope of the present invention. Therefore, the scope of the present invention is limited only by the appended claims.

Claims

1. A fast iteration method for an intelligent detection model of contact network defects, characterized in that: The method comprises: Step 1: Input multiple contact network images for training, perform multi-scale feature extraction on each contact network image for training, perform nonlinear fusion on the results of multi-scale feature extraction to obtain fused features; perform multi-head attention calculation on the fused features, connect the outputs of all attention heads to obtain connected attention heads; generate dynamic convolution kernels based on the connected attention heads; Step 2: All the contact network images for training are grouped according to the defect type, and the contact network images for training with the same defect type are divided into the same group. The dynamic convolution kernels of all the contact network images for training in the same group are calculated by arithmetic mean, and the result is the dynamic convolution kernel of the defect type. Step 3: Establish a contact network defect intelligent detection model, which is a multi-level support vector machine model, with dynamic convolution features as input and a discrimination value represented by a three-dimensional vector as output; quickly iterate the contact network defect intelligent detection model, specifically including: for each contact network image for training input subsequently, select a corresponding dynamic convolution kernel according to the defect type annotated therein, perform convolution operation with each contact network image for training input subsequently, and extract the dynamic convolution features of the contact network image for training; the defect type annotated by each contact network defect intelligent detection model is also a type value represented by a three-dimensional vector; use the dynamic convolution feature to input into the contact network defect intelligent detection model to obtain a defect detection output, and continuously update the learning rate of the contact network defect intelligent detection model according to the distance between the defect detection output and the defect type annotated by the contact network image for training; at the same time, according to the distance between the defect detection output and the defect type annotated by the contact network image for training and the change ratio of the updated learning rate to the learning rate before the update, use the adaptive gradient clipping method to adjust the weight of the dynamic convolution kernel of the defect type; Step 4: After the rapid iteration is completed, the dynamic convolution kernel of each defect type is multiplied by its corresponding weight to obtain the iterative dynamic convolution kernel. After adding all the iterative dynamic convolution kernels, they are divided by the total number of iterative dynamic convolution kernels to obtain the updated dynamic convolution kernel. For the subsequent input contact network image for detection, the updated dynamic convolution kernel is used to extract its dynamic convolution features.

2. The rapid iteration method of the contact network defect intelligent detection model according to claim 1 is characterized in that: The method further comprises: when a contact network image for training or a contact network image for detection is input, performing a denoising process based on Gaussian filtering.

3. The rapid iteration method of the contact network defect intelligent detection model according to claim 2 is characterized in that: In step 1, multiple contact network images for training are input, multi-scale feature extraction is performed on each contact network image for training, and the results of multi-scale feature extraction are nonlinearly fused to obtain the formula for fusion features as follows: ; in, For fusion features; is the scale quantity; is the scale index; For the The weight of each scale; For the Feature maps of different scales; It is the index of the height direction of the result of multi-scale feature extraction; The width index of the result of multi-scale feature extraction; and Respectively The height and width of the result of multi-scale feature extraction; For the The results of multi-scale feature extraction are Row, No. The eigenvalues ​​of the columns; is the preset first regularization coefficient; For Hadamard; is the fast Fourier transform; is the conjugate complex transform of the fast Fourier transform; is the preset second regularization coefficient; is the matrix determinant operation; The number of features of the result of multi-scale feature extraction; is the index number; For the The results of multi-scale feature extraction are Row, No. Column No. feature values.

4. The rapid iteration method of the contact network defect intelligent detection model according to claim 3 is characterized in that: In step 1, the formula for calculating multi-head attention for fusion features is as follows: ; in, For the The output of an attention head; , and Respectively The weight matrices of queries, keys, and values ​​for each attention head; , and Respectively The query, key, and value biases for each attention head; For the The dimension of the attention heads; For the The distance scaling factor of the attention heads; To query the location index, is the key position index; Indicates the calculation query position and key position The distance between them, according to this distance, gives the attention weights between different positions a decay factor. , the query position and key position are the same, , the attenuation factor is the largest, equal to 1; represents the normalized exponential function.

5. The rapid iteration method of the contact network defect intelligent detection model according to claim 4 is characterized in that: In step 1, the formula for generating a dynamic convolution kernel based on the connected attention head is as follows: ; ; in, is the initial dynamic convolution kernel; is the final generated dynamic convolution kernel; is the dynamic convolution kernel size; and are the number of input channels and the number of output channels respectively; is the Frobenius norm; is the L2 norm; Function to reshape the tensor; Multilayer Perceptron; Indicates flattening the input into a one-dimensional vector; is the inverse fast Fourier transform; To connect the attention heads.

6. The fast iteration method of the contact network defect intelligent detection model according to claim 5, characterized in that: In step 3, the method for continuously updating the learning rate of the contact network defect intelligent detection model according to the distance between the defect detection output and the defect type annotated by the contact network image for training includes: performing a distance operation on the discrimination value represented by the three-dimensional vector corresponding to each defect detection output and the type value represented by the three-dimensional vector corresponding to the defect type annotated by the contact network image for training, so as to obtain the distance between the defect detection output and the defect type annotated by the contact network image for training; and continuously updating the learning rate of the contact network defect intelligent detection model according to the distance by the following formula: ; in, For the The learning rate obtained by the iteration; hour, is the initial learning rate; For the The learning rate obtained by the iteration; For the The bias term for the iteration; The sensitivity of the preset bias term change; For the The support vector spacing factor for the iteration; For the The regularization parameter for the iteration; For the The bias term for the iteration; for distance; It is an absolute value operation.

7. The fast iteration method of the contact network defect intelligent detection model according to claim 6, characterized in that: No. The support vector spacing factor for the iteration Use the following formula to calculate: ; in; No. The weight vector of the support vector machine for the iteration; For the The average value of the slack variables of the SVM at iterations; The sensitivity of the preset slack variable changes; is the number of layers of the multi-level support vector machine model; For the The average of the slack variables of the support vector machine for iterations.

8. The fast iteration method of the contact network defect intelligent detection model according to claim 7, characterized in that: The regularization parameter is calculated using the following formula: ; in, For the The regularization parameter adjustment factor for the iteration; For the The regularization parameter adjustment factor for the iteration; For the The degree of satisfaction of the KKT conditions of the iteration; For the The degree of satisfaction of the KKT conditions of the iteration; The sensitivity of the preset KKT condition changes; Adjust the intensity for the preset periodicity; is the total number of iterations; is the kernel function; For the Dynamic convolution feature input of the input of the iteration; For the Dynamic convolution feature input of the input of the iteration; It is the preset decision factor, ranging from 1 to 5.

9. The fast iteration method of the contact network defect intelligent detection model according to claim 8, characterized in that: In step 3, the weight of the dynamic convolution kernel of the defect type is adjusted using the adaptive gradient clipping method through the following formula: ; in, is the weight of the adjusted dynamic convolution kernel for this defect type; is the gradient clipping threshold; is the soft threshold parameter; is the preset adaptive weight decay parameter; is the weight of the dynamic convolution kernel of the defect type before adjustment; Modulo operation on vectors.