Lightning arrester appearance defect detection method and device based on improved YOLOv10
By introducing an adaptive attention mechanism and a distance-aware adaptive non-maximum suppression algorithm in the YOLOv10 model, the accuracy and efficiency of external defect detection of lightning arresters are improved, and the problems of poor generalization ability and missed detection in the existing technology are solved, achieving high-precision and fast detection effects.
Patent Information
- Application Number
- CN202510230129.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art has poor generalization capabilities and potential misdetection and missed detection problems in the detection of external defects of lightning arresters, especially in complex scenarios.
An improved YOLOv10 model (Ar-YOLOv10) is proposed to enhance the model's perception ability and detection accuracy of key features by introducing adaptive attention mechanism (AAM) and distance-aware adaptive non-maximum suppression (DA-NMS) algorithm.
The Ar-YOLOv10 model significantly improves the detection accuracy in the detection of external defects of lightning arresters. The average detection accuracy mAP@0.5 reaches 82.12%, and effectively reduces the missed detection and false detection rates. It has the characteristics of fast detection speed and strong real-time performance.
Smart Images

Figure CN120071010A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of power market clearing methods, and particularly relates to a method and device for detecting external defects of lightning arresters based on improved YOLOv10. Background Art
[0002] The detection of electrical equipment can be divided into traditional inspection methods and modern inspection methods; traditional electrical equipment detection is carried out by operators through walking or ground vehicle patrols. Although manual inspection is excellent in identifying visible damages, it has significant limitations and safety problems in detecting hidden or minor defects, especially in harsh environments; with the continuous progress of intelligent technologies, intelligent detection methods have gradually taken the leading position. Modern intelligent detection systems are better at identifying small-scale faults than humans, such as external defects of lightning arresters (an electrical equipment). Common intelligent detection devices include tower cameras, inspection drones, robots, etc. These devices are equipped with high-resolution cameras and various sensors to capture images and data of line equipment, and use computational analysis for object recognition and defect detection. Therefore, the camera installed on the intelligent detection robot can effectively capture the external defects of lightning arresters in the distribution system and be inferred and recognized by the edge computing module.
[0003] YOLO (You Only Look Once) is one of the leading models in the field of object detection, with significant advantages in terms of speed and accuracy, and has been successfully applied to fields such as insulator detection and positioning, transmission line foreign object detection, and transmission line defect detection. As the latest version of YOLO, YOLOv10 performs well in target defect recognition. However, YOLOv10 still has problems of poor generalization ability and potential false detection and missed detection in complex scenarios.
[0004] Reviewing the literature, it is found that most of the online defect detection methods for arresters are based on electrical parameters. As described in Fan, Y., Fei, Z., Shang, Z.: 'Current Status Analysis of Online Performance Monitoring for Metal Oxide Surge Arresters', Power & Energy, 2020, 41, (4), pp 442-446+454, the online monitoring of metal oxide arresters (MOA) mainly focuses on detecting aging through methods such as total current measurement, resistive current analysis, temperature monitoring, and phase angle difference technology. The literature Li, Y., Zhang, L., Liu, Y., et al.: 'An Online Method for Detecting the Resistive Current of Lightning Arresters', Insulators and Surge Arresters, 2019, (5), pp 150-154 proposed a novel resistive current detection and evaluation method. However, visible light vision detection is the most direct method for identifying external defects of arresters. However, there is little literature on combining visible light vision detection with the identification of external defects of arresters. Therefore, this study first constructed a dataset consisting of 6591 external defects of arresters (including the arrester body, breakage, cracks, oil stains) (released at https: / / app.roboflow.com / godlizy / arrester-external-defect-dataset / 1). Subsequently, an improved adaptive attention mechanism was proposed to enhance the model's perception ability of key features. Then, a distance-aware adaptive NMS (DA-NMS) algorithm was proposed to reduce missed detections and false detections. Applying them to the YOLOv10 model for improvement to form the improved model Ar-YOLOv10, through comparative experiments with current advanced object detection algorithms (YOLOv10, SSD, Ar-YOLOv10, RT-DETR), we found that the Ar-YOLOv10 algorithm performed optimally on the dataset of external defects of arresters constructed by us. The average detection accuracies mAP@0.5 and mAP@0.95 reached 82.12% and nearly 60% respectively, which were better than other algorithms. In addition, in terms of recall rate and accuracy, Ar-YOLOv10 was almost on par with YOLOv10 and RT-DETR.
[0005] However, this study has several limitations: First, the current dataset mainly consists of arrester images from specific regions, and the generalization performance of the model across different regions and arrester types needs to be further verified; Second, the detection performance under complex weather conditions (such as rain, fog, and strong light) requires further research. The findings of this study have important practical significance for enhancing the intelligence and automation of power system equipment detection, while providing effective technical support for ensuring the safe and stable operation of the power system. Summary of the Invention
[0006] To solve the problems existing in the background technology, the present invention proposes an improved YOLOv10 model (Ar-YOLOv10) to solve the problem of detecting external defects of arresters; Comparative experimental analysis shows that in terms of detection accuracy, the Ar-YOLOv10 model reached 82.12% of mAP@0.5 on the test set, which is 2.13 percentage points higher than the original YOLOv10 (79.99%), and is more significant than RT-DETR (75.56%) and SSD (63.72%); This enhancement mainly comes from the effectiveness of the adaptive attention mechanism (AAM) and the improved distance-aware adaptive non-maximum suppression (DA-NMS) algorithm.
[0007] The present invention adopts the following technical solutions:
[0008] An arrester appearance defect detection method based on improved YOLOv10, the method comprising the following steps:
[0009] Improve the YOLOv10 model and train the improved YOLOv10 model using a dataset to obtain the trained YOLOv10 model;
[0010] Use the trained YOLOv10 model to detect the appearance defects of arresters;
[0011] Among them, improving the YOLOv10 model includes introducing an adaptive attention mechanism AAM to enhance the model's perception ability of key features, and introducing a distance-aware adaptive NMS algorithm to improve the detection accuracy of external defects of arresters.
[0012] Further, the adaptive attention mechanism AAM includes:
[0013] Channel grouping: The input data is divided into two groups, and the two groups of data are respectively subjected to spatial attention calculation and channel attention calculation; Among them, the spatial attention branch uses 3×3 convolution to extract spatial information;
[0014] Adaptive fusion: Introduce a learnable parameter α to dynamically balance the importance of the two attention mechanisms; Among them, the calculation method of the adaptive attention mechanism AAM is:
[0015] G = δ(Wg[Q; k])(2)
[0016] Attentionadaptive = G * Attention(Q, K, V)(3)
[0017] Wherein:
[0018]
[0019] In the formula: Q, K, and V respectively represent the query, key, and value matrices, and d k is the dimension of the key vector; G represents the generated adaptive gating value, δ represents the Sigmoid activation function, Wg represents the learnable weight matrix, [Q, k] represents the concatenation of Query and Key; Attentionadaptive represents the output of the adaptive attention, and Attention(Q, K, V) represents the calculation of the standard attention mechanism.
[0020] Furthermore, the distance-aware adaptive NMS algorithm includes:
[0021] Calculating the spatial relationship between detection boxes: First, for each detected target box, calculate its spatial relationship with all other target boxes;
[0022] Dynamically adjusting the suppression threshold: Based on the calculated spatial relationship above, dynamically adjust the suppression threshold for each pair of target boxes;
[0023] Selecting high-quality detection boxes: Before performing the suppression operation, sort all detection boxes and retain the box with the highest score and not yet suppressed as part of the final result;
[0024] Performing adaptive suppression: For each currently processed detection box, determine whether to suppress the latter based on the dynamically adjusted suppression threshold between it and the remaining unprocessed detection boxes. If the intersection over union IoU of an unprocessed box with the current box exceeds the specific suppression threshold between the two, then the unprocessed box will be suppressed;
[0025] Outputting the final detection result: After the above steps are processed, the remaining un-suppressed detection boxes are the final detection results.
[0026] Furthermore, the method for improving the YOLOv10 model and training the improved YOLOv10 model using a dataset is as follows:
[0027] Dataset construction and preprocessing: The dataset consists of several pictures of various external defects of lightning arresters. Process the pictures, perform data normalization processing, and finally perform a convolution operation to obtain the input feature map I norm;
[0028] Input the feature map I norm into the backbone network of YOLOv10 to extract multi-scale feature maps;
[0029] Introduce the improved adaptive attention mechanism AAM to enhance feature learning and adaptively fuse the two features;
[0030] Use the Head to perform bounding box prediction, class prediction, and confidence prediction;
[0031] Bounding box decoding;
[0032] Use the distance-aware adaptive NMS algorithm to more precisely handle the selection and filtering of bounding boxes and improve the overall performance of the model;
[0033] Result formatting.
[0034] Furthermore, the method of inputting the feature map I norm into the backbone network of YOLOv10 to extract multi-scale feature maps is as follows:
[0035] First, perform CSP feature extraction:
[0036] F 1 = CSP 1 (x)(4)
[0037] F 2 = CSP 2 (F 1 )(5)
[0038] F 3 = CSP 3 (F 2 )(6)
[0039] Then, perform multi-scale feature generation:
[0040] P 5 = Conv(F 3 )(7)
[0041] P 4 = Upsample(P 5 ) + Conv(F 2 )(8)
[0042] P 3 = Upsample(P 4 ) + Conv(F 4 )(9)
[0043] where x is the input image, Upsample is the upsampling operation, Conv is the convolution operation, F1 , F 2 , F 3 is the output feature map of the CSP module, and P 4 , P 5 is the multi-scale feature generation map of the corresponding calculation formula.
[0044] Furthermore, the method of introducing the improved adaptive attention mechanism AAM to enhance feature learning and adaptively fusing the two features is as follows:
[0045] First, calculate the channel attention:
[0046] W c = σ(NLP(AvgPool(F)) + NLP(MaxPool(F)))(10)
[0047]
[0048] Then, calculate the spatial attention:
[0049] M - s = σ(Conv 3×3 (AvgPool(F)) + Conv 3×3 (NaxPool(F)))(12)
[0050]
[0051] Subsequently, adaptively fuse the two features.
[0052] Fused f eatures = a * Channel a ttention + (1 - a) * Spatial a ttention(14)
[0053] Among them, α is a learnable parameter used to dynamically adjust the weights of the two attention mechanisms.
[0054] Furthermore, after the bounding box is decoded, it needs to be filtered by a confidence threshold: To remove low-confidence prediction results, a confidence threshold is usually set, and all bounding boxes with a confidence lower than this threshold in all prediction results will be discarded.
[0055] The arrester appearance defect detection device based on the improved YOLOv10 includes:
[0056] The trained YOLOv10 model acquisition module is used to improve the YOLOv10 model and train the improved YOLOv10 model using the dataset to obtain the trained YOLOv10 model;
[0057] An arrester appearance defect detection module is used to detect the appearance defects of arresters by using the trained YOLOv10 model;
[0058] Among them, the improvement of the YOLOv10 model includes introducing an adaptive attention mechanism AAM to enhance the model's perception ability of key features, and introducing a distance-aware adaptive NMS algorithm to improve the detection accuracy of external defects of arresters.
[0059] A non-transitory computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, it implements the above-mentioned arrester appearance defect detection method based on the improved YOLOv10.
[0060] An electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the above-mentioned arrester appearance defect detection method based on the improved YOLOv10.
[0061] The beneficial technical effects of the present invention are:
[0062] The present invention proposes an improved YOLOv10 model (Ar-YOLOv10) to solve the problem of detecting external defects of arresters, significantly improving the detection accuracy of external defects of arresters, being able to accurately identify the arrester body and subtle defects such as arrester breakage, arrester oil stain, and arrester cracks, effectively reducing the missed detection and false detection rates; at the same time, it has the characteristics of fast detection speed and strong real-time performance, realizing the intelligence and automation of the detection of external defects of arresters, and can provide reliable technical support for the condition assessment and preventive maintenance of power system equipment, having good practical value and technical feasibility. Description of the Drawings
[0063] Figure 1 It is the flowchart of the working process of the adaptive attention mechanism in Embodiment 1 of the present invention;
[0064] Figure 2 It is the display of the DA-NMS algorithm in Embodiment 1 of the present invention;
[0065] Figure 3 It is the comparison chart of mAP@0.5 of each model in Embodiment 1 of the present invention;
[0066] Figure 4 It is the flowchart of the arrester appearance defect detection method based on the improved YOLOv10 in Embodiment 1 of the present invention. Detailed Embodiments
[0067] The following further clearly and completely describes the arrester appearance defect detection method and device based on the improved YOLOv10 provided by the present invention in conjunction with the drawings:
[0068] Example 1
[0069] As Figure 4 shown, the method for detecting the appearance defects of lightning arresters based on the improved YOLOv10 includes the following steps:
[0070] Improve the YOLOv10 model and train the improved YOLOv10 model using the dataset to obtain the trained YOLOv10 model;
[0071] Use the trained YOLOv10 model to detect the appearance defects of lightning arresters;
[0072] Among them, improving the YOLOv10 model includes introducing an adaptive attention mechanism AAM to enhance the model's perception ability of key features, and introducing a distance-aware adaptive NMS algorithm to improve the detection accuracy of external defects of lightning arresters.
[0073] Specifically, the traditional YOLOv10 attention mechanism has limitations in feature extraction and generalization for the task of detecting external defects of lightning arresters. The adaptive attention mechanism (AAM) provided in this embodiment enhances the model's perception ability of key features by dynamically fusing spatial and channel attention; the core idea of AAM is to dynamically enhance features by adaptively fusing spatial and channel attention; specifically, the method includes three key steps:
[0074] 1. Channel grouping: The input feature map is divided into two groups, and different spatial and channel attention calculations are performed on each group;
[0075] 2. Attention calculation: The spatial attention branch uses a 3×3 convolution to extract spatial information;
[0076] 3. Adaptive fusion: Introduce a learnable weight α to dynamically balance the importance of the two attention mechanisms;
[0077] Calculation method of the basic attention mechanism:
[0078]
[0079] Calculation method of the adaptive attention mechanism (AAM):
[0080] G = δ(Wg[Q; k])(2)
[0081] Attentionadaptive = G * Attention(Q, K, V)(3)
[0082] In formula (1): Q, K, and V represent the query (Query), key (Key), and value (Value) matrices respectively, d kis the dimension of the key vector; in formula (2): G represents the generated adaptive gating value, δ represents the Sigmoid activation function, Wg represents the learnable weight matrix, and [Q, k] represents the concatenation of Query and Key; in formula (3): Attentionadaptive represents the output of the adaptive attention, and Attention(Q, K, V) represents the calculation of the standard attention mechanism.
[0083] AAM is essentially an enhancement and improvement of the basic attention mechanism. By introducing G, the model can more flexibly control the allocation of attention, better handle complex long-sequence dependencies, and improve the ability to capture important information. AAM has stronger expressive power because it can degrade to the basic attention when needed (when G is close to 1), and can also achieve more complex attention allocation strategies through the adjustment of G.
[0084] In addition, when dealing with dense arrester detection, the traditional NMS algorithm has problems such as fixed thresholds and single bounding box relationships, which are prone to false detections and missed detections; this embodiment proposes a distance-aware adaptive NMS (DA-NMS) algorithm, as Figure 2 shown. Compared with the traditional NMS, DA-NMS has the following advantages: considering the spatial relationship between detection boxes, dynamically adjusting the suppression threshold, and retaining high-quality dense targets, which is beneficial to improving the accuracy of external defects of arresters.
[0085] Specifically, the distance-aware adaptive NMS algorithm includes:
[0086] Calculating the spatial relationship between detection boxes: First, for each detected target box, calculate its spatial relationship with all other target boxes; this step considers the relative position and distance between target boxes to better understand their interaction;
[0087] Dynamically adjusting the suppression threshold: Based on the calculated spatial relationship above, dynamically adjust the suppression threshold for each pair of target boxes. Different from the traditional NMS that uses a fixed IoU (Intersection over Union) threshold, DA-NMS adjusts this threshold according to the actual distance and overlap between target boxes. This means that when dealing with target boxes that are very close or have a high overlap, a lower suppression threshold may be adopted to more precisely distinguish these targets; while in the case of target boxes that are far apart, a higher threshold may be adopted;
[0088] Selecting high-quality detection boxes: Before performing the suppression operation, sort all detection boxes according to certain criteria (such as score); then, process each detection box in order from high score to low score, and retain the box with the highest score and not yet suppressed as part of the final result;
[0089] Perform adaptive suppression: For each currently processed detection box, determine whether to suppress the remaining unprocessed detection boxes based on the dynamically adjusted suppression threshold between it and the remaining unprocessed detection boxes; if the intersection over union (IoU) of an unprocessed box with the current box exceeds the specific suppression threshold between the two, the unprocessed box will be suppressed (i.e., not selected as part of the final result).
[0090] Output the final detection results: After the above steps, the remaining un-suppressed detection boxes are the final detection results. These boxes are considered to be of high quality and can effectively reduce false detections and missed detections in dense target scenarios.
[0091] In this embodiment, the method for improving the YOLOv10 model and training the improved YOLOv10 model using a dataset is as follows:
[0092] Dataset construction and preprocessing: The dataset consists of several pictures of various external defects of lightning arresters. Process the pictures, perform data normalization, and finally perform a convolution operation to obtain the input feature map I norm ; Specifically, in this embodiment, a dataset consisting of 6591 pictures of various external defects of lightning arresters is collected. Among them, the pictures are RGB three-channel color images, the picture type is jpg, and it includes four types: lightning arrester body, damage, oil stain, and crack; use the Sprite Labeling Assistant to label each picture one by one, unify the image size to 640×640, perform operations such as randomly flipping, rotating, adjusting brightness and contrast on the images, perform data normalization, and finally perform a convolution operation to obtain the input feature map I norm ;
[0093] Input the feature map I norm into the backbone network of YOLOv10 to extract multi-scale feature maps.
[0094] First, perform CSP feature extraction:
[0095] F 1 = CSP 1 (x)(4)
[0096] F 2 = CSP 2 (F 1 )(5)
[0097] F 3 = CSP 3 (F 2 )(6)
[0098] Then, perform multi-scale feature generation:
[0099] P 5 = Conv(F 3 )(7)
[0100] P 4 = Upsample(P 5 ) + Conv(F 2 )(8)
[0101] P 3 = Upsample(P 4 ) + Conv(F 4 )(9)
[0102] Where x is the input image, Upsample is the upsampling operation, Conv is the convolution operation, the CSP module is an efficient neural network architecture design, mainly aiming to improve the computational efficiency and reduce the consumption of computational resources, while maintaining or enhancing the model performance, F i is the output feature map of F i-1 through the CSP module, and P i is the multi-scale feature generation map corresponding to the calculation formula.
[0103] After feature extraction and multi-scale feature generation, the improved adaptive attention mechanism AAM is applied to enhance feature learning, enabling the model to learn more and richer features:
[0104] First, calculate the channel attention:
[0105] W c = σ(NLP(AvgPool(F)) + NLP(MaxPool(F)))(10)
[0106]
[0107] Then, calculate the spatial attention:
[0108] M - s = σ(Conv 3×3 (AvgPool(F)) + Conv 3×3 (NaxPool(F)))(12)
[0109]
[0110] Subsequently, fuse the two features adaptively:
[0111] Fused f eatures = α * Channel a ttention + (1 - α) * Spatial αAttention(14)
[0112] Among them, α is a learnable parameter used to dynamically adjust the weights of the two attention mechanisms; in formula (10): W c represents the channel attention weight, F represents the input feature map, AvgPool(F) represents average pooling of F, MaxPool(F) represents max pooling of F, NLP represents the non-linear projection operation, and σ represents the activation function; in formula (11): F′ c represents the channel attention feature, F: the original feature, Mc: the channel attention weight, matrix multiplication operation; in formula (12): M_s represents the spatial attention weight, Conv 3×3 represents the 3×3 convolution operation; in formula (13): F'_s represents the spatial attention feature; in formula (14): Fusedfeatures represents the finally fused feature, α represents the learnable parameter used to balance the weights of the two attentions (0 ≤ α ≤ 1), Channelattention represents the channel attention feature, and Spatialattention represents the spatial attention feature;
[0113] Use the head to perform bounding box prediction, class prediction, and confidence prediction: Feed the fused features into the detection head network. When training with the head, there are two heads, namely One-to-many Head and One-to-one Head. When performing inference prediction with the head, only One-to-one Head is needed. Among them, One-to-many Head: Select multiple outputs with higher scores as positive samples, while One-to-one Head: Only select the output with the highest score as the positive sample;
[0114] Bounding box decoding: The model predicts the offsets and ratios relative to the anchor boxes, and these offsets need to be converted into actual bounding box coordinates; this step includes using sigmoid or other activation functions to determine the position of the bounding box center as well as the width and height;
[0115] Confidence threshold filtering: To remove low-confidence prediction results, a confidence threshold is usually set; all bounding boxes with confidence lower than this threshold in all prediction results will be discarded;
[0116] Use the distance-aware adaptive NMS algorithm to more precisely handle the selection and filtering of bounding boxes and improve the overall performance of the model;
[0117] Result Formatting: The final step is to organize the filtered bounding box coordinates, corresponding class labels, and confidence scores into an easily understandable format for subsequent use by applications.
[0118] Using the obtained improved YOLOv10 model, comparative experiments were conducted with YOLOv10, SSD, and RT-DETR models. The goal of this experiment was to verify the effectiveness of the Ar-YOLOv10 algorithm. The experiment was carried out on the Windows 11 operating system, and the deep learning model was implemented using PyTorch 2.4.1 based on Python 3.10.15. For model training, an NVIDIA GeForce RTX 3090 GPU was used as the training platform and accelerated through CUDA 12.1. The lightest pre-trained weights were selected for each model. To ensure a fair performance comparison between models, all models used the same parameters, and the specific parameter settings are shown in Table 1:
[0119] Table 1 Parameter Settings for Each Model
[0120] Parameter Setting Parameter Setting Number of types 4 Initial learning rate 0.01 Input width 640 Learning rate decay 0.01 Input height 640 Optimizer SGD Batch size 16 Regularization 0.0
[0121] The performance of the improved YOLOv10 (Ar-YOLOv10) model is the best, being 2.13 and 6.56 percentage points higher than YOLOv10 and RT-DETR respectively in terms of detection accuracy, and far higher than the SSD model. The comparison graph is as Figure 3 shown.
[0122] The adaptive attention mechanism AAM and distance-aware adaptive NMS (DA-NMS) of the present invention cooperate with each other to produce a synergistic effect, rather than a simple superposition: Firstly, it is the feature-detection closed-loop optimization in the synergistic mechanism. The high-quality features provided by AAM enable DA-NMS to make decisions based on more reliable confidence levels. The precise screening of DA-NMS in turn provides more accurate supervision signals for AAM, forming a benign feature extraction-object detection feedback loop. Secondly, it is multi-scale complementarity. AAM processes target information at different scales at the feature level, and DA-NMS processes the spatial relationships of targets at the detection box level. The two jointly improve the scale adaptability of the model at different levels. Then, it is the non-linear effect of performance improvement. The precise feature expression provided by AAM makes the confidence levels output by the model more reliable. DA-NMS can make more accurate retention / suppression decisions based on these high-quality confidence levels, and finally the improvement in detection performance exceeds the use of any single improvement alone. Finally, the combination of the two enhances the accuracy of small target detection. AAM enhances the model's attention to small target features, and the distance-aware mechanism of DA-NMS avoids over-suppression of small targets, and the combination of the two enhances the accuracy of small target detection.
[0123] Example 2
[0124] This embodiment provides an arrester appearance defect detection device based on improved YOLOv10, including:
[0125] A trained YOLOv10 model acquisition module, which is used to improve the YOLOv10 model and train the improved YOLOv10 model using a dataset to obtain a trained YOLOv10 model;
[0126] An arrester appearance defect detection module, which is used to detect arrester appearance defects using the trained YOLOv10 model;
[0127] Among them, improving the YOLOv10 model includes introducing an adaptive attention mechanism AAM to enhance the model's perception ability of key features, and introducing a distance-aware adaptive NMS algorithm to improve the detection accuracy of external defects of arresters.
[0128] A non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the above-mentioned arrester appearance defect detection method based on improved YOLOv10.
[0129] Furthermore, the present invention adopts the following technical solutions:
[0130] An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the above-mentioned arrester appearance defect detection method based on improved YOLOv10.
[0131] Through the description of the above embodiments, those skilled in the art can clearly understand that the facilities of the present invention can be implemented by means of software plus a necessary general hardware platform. The embodiments of the present invention can be implemented using existing processors, or by dedicated processors used for this purpose or other purposes in a suitable system, or by a hardwired system. The embodiments of the present invention also include non-transitory computer-readable storage media, which include machine-readable media for carrying or having machine-executable instructions or data structures stored thereon; such machine-readable media can be any available media accessible by a general or special-purpose computer or other machine with a processor. For example, such machine-readable media can include RAM, ROM, EPROM, EEPROM, CD-ROM or other optical disc storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store the required program code in the form of machine-executable instructions or data structures and can be accessed by a general or special-purpose computer or other machine with a processor. When information is transmitted or provided to a machine through a network or other communication connection (hardwired, wireless, or a combination of hardwired and wireless), this connection is also regarded as a machine-readable medium.
[0132] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present invention.
Claims
1. A lightning arrester appearance defect detection method based on improved YOLOv10, characterized in that: The method comprises the following steps: Improve the YOLOv10 model and use the data set to train the improved YOLOv10 model to obtain the trained YOLOv10 model; Use the trained YOLOv10 model to detect the appearance defects of the arrester; Among them, the improvements to the YOLOv10 model include the introduction of the adaptive attention mechanism AAM to enhance the model's perception of key features, and the introduction of the distance-aware adaptive NMS algorithm to improve the accuracy of external defect detection of lightning arresters.
2. The method for detecting appearance defects of lightning arresters based on improved YOLOv10 according to claim 1 is characterized in that: The adaptive attention mechanism AAM includes: Channel grouping: The input data is divided into two groups, and the two groups of data are respectively subjected to spatial attention calculation and channel attention calculation; among them, the spatial attention branch uses 3×3 convolution to extract spatial information; Adaptive fusion: Introduce a learnable parameter α to dynamically balance the importance of the two attention mechanisms; the adaptive attention mechanism AAM is calculated as: G = δ(Wg[Q; k]) (2) Attentionadaptive=G*Attention(Q,K,V) (3) in: In the formula: Q, K, V represent query, key, and value matrices respectively, d k is the dimension of the key vector; G represents the generated adaptive gating value, δ represents the Sigmoid activation function, Wg represents the learnable weight matrix, [Q, k] represents the concatenation of Query and Key; Attentionadaptive represents the output of adaptive attention, and Attention(Q, K, V) represents the calculation of the standard attention mechanism.
3. The method for detecting appearance defects of lightning arresters based on improved YOLOv10 according to claim 1 is characterized in that: The distance-aware adaptive NMS algorithm includes: Calculate the spatial relationship between detection boxes: First, for each detected target box, calculate its spatial relationship with all other target boxes; Dynamically adjust the suppression threshold: Based on the spatial relationship calculated above, dynamically adjust the suppression threshold for each pair of target boxes; Select high-quality detection boxes: Before performing the suppression operation, all detection boxes are sorted and the boxes with the highest scores and not suppressed are retained as part of the final result; Perform adaptive suppression: For each currently processed detection box, decide whether to suppress the latter based on the dynamically adjusted suppression threshold between it and the remaining unprocessed detection boxes. If the intersection over union (IoU) of an unprocessed box and the current box exceeds a specific suppression threshold between the two, the unprocessed box will be suppressed. Output the final detection result: After the above steps, the remaining unsuppressed detection box is the final detection result.
4. The method for detecting appearance defects of lightning arresters based on improved YOLOv10 according to claim 1 is characterized in that: The YOLOv10 model is improved and trained using the data set. The method for obtaining the trained YOLOv10 model is as follows: Dataset construction and preprocessing: The dataset consists of several pictures of various external defects of lightning arresters. The pictures are processed and normalized, and finally a convolution operation is performed to obtain the input feature map I. norm ; The feature map I norm Input the backbone network of YOLOv10 to extract multi-scale feature maps; An improved adaptive attention mechanism AAM is introduced to enhance feature learning and adaptively fuse the two features; Use the head to perform bounding box prediction, category prediction, and confidence prediction; Bounding box decoding; Use the distance-aware adaptive NMS algorithm to more accurately handle the selection and filtering of bounding boxes and improve the overall performance of the model; Format the result.
5. The method for detecting appearance defects of lightning arresters based on improved YOLOv10 according to claim 4 is characterized in that: The feature map I norm Input the backbone network of YOLOv10 and extract the multi-scale feature map as follows: First, perform CSP feature extraction: F1=CSP1(x) (4) F2=CSP2(F1) (5) F3=CSP3(F2) (6) Then multi-scale feature generation is performed: P5=Conv(F3) (7) P4=Upsample(P5)+Conv(F2) (8) P3=Upsample(P4)+Conv(F4) (9) In the formula, x is the input image, Upsample is the upsampling operation, Conv is the convolution operation, F1, F2, F3 are the output feature maps of the CSP module, and P4 and P5 are the multi-scale feature generation maps of the corresponding calculation formula.
6. The method for detecting appearance defects of lightning arresters based on improved YOLOv10 according to claim 4 is characterized in that: The improved adaptive attention mechanism AAM is introduced to enhance feature learning, and the method of adaptively fusing the two features is as follows: First calculate the channel attention: W c =σ(NLP(AvgPool(F))+NLP(MaxPool(F))) (10) Then calculate the spatial attention: M - s=σ(Conv 3×3 (AvgPool(F))+Conv 3×3 (NaxPool(F))) (12) The two features are then adaptively fused. Fused f eatures=a*Channel a ttention+(1-a)*Spatial a ttention (14) Among them, α is a learnable parameter used to dynamically adjust the weights of the two attention mechanisms.
7. The method for detecting appearance defects of lightning arresters based on improved YOLOv10 according to claim 4 is characterized in that: After decoding, the bounding box needs to be filtered by confidence threshold: In order to remove low-confidence prediction results, a confidence threshold is usually set, and all bounding boxes in the prediction results with confidence lower than this threshold will be discarded.
8. The arrester appearance defect detection device based on improved YOLOv10 is characterized in that: include: A trained YOLOv10 model acquisition module is used to improve the YOLOv10 model and train the improved YOLOv10 model using a data set to obtain a trained YOLOv10 model; Arrester appearance defect detection module, used to detect arrester appearance defects using the trained YOLOv10 model; Among them, the improvements to the YOLOv10 model include the introduction of the adaptive attention mechanism AAM to enhance the model's perception of key features, and the introduction of the distance-aware adaptive NMS algorithm to improve the accuracy of external defect detection of lightning arresters.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for detecting appearance defects of a lightning arrester based on improved YOLOv10 is implemented as described in any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the arrester appearance defect detection method based on improved YOLOv10 is implemented as described in any one of claims 1 to 7.