An al-yolo-based insulator defect detection method and system
By optimizing the model structure using the AL-YOLO network and introducing the OCG spatial channel attention mechanism, the problems of low accuracy and poor environmental adaptability of traditional detection algorithms in insulator detection are solved, achieving efficient and accurate insulator defect detection.
Patent Information
- Application Number
- CN202511222021.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-08-29
AI Technical Summary
Traditional target detection algorithms suffer from low detection accuracy and susceptibility to changes in complex environments when detecting insulators.
The AL-YOLO network is adopted, and the OCG spatial channel attention mechanism module is introduced. Combined with deformable convolution and residual connection, the model structure is optimized to enhance the feature expression capability and adapt to insulator defect detection in complex environments.
It achieves high-precision insulator defect detection with low computational load, is suitable for efficient inspection in complex environments, and significantly improves detection results and equipment usability.
Smart Images

Figure CN120726048B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of insulator defect detection technology, and particularly relates to an insulator defect detection method and system based on AL-YOLO. Background Technology
[0002] Insulators are a critical component for the normal operation of transmission lines, and their health directly affects the safety and stability of these lines. Any defects in insulators, such as cracks, damage, aging, and discharge, can lead to line faults and even power accidents. Therefore, timely detection and repair of insulator defects are crucial for ensuring the safety of the power system. However, traditional transmission line inspection methods, such as manual inspection and basic sensor monitoring, suffer from low efficiency, long processing times, and high missed detection rates. In complex environments, manual inspection often fails to achieve accurate detection results. With the rapid development of drone technology, drone inspections capture a large number of insulator images, enabling multi-dimensional data collection and accurate identification of insulator defects, while significantly reducing the safety risks of manual inspection. However, although target detection algorithms play a major role in transmission line insulator inspection, they also face many challenges. For example, traditional target detection algorithms suffer from low detection accuracy and susceptibility to complex environmental changes, all of which complicate the detection process. Summary of the Invention
[0003] This invention provides an insulator defect detection method and system based on AL-YOLO, which solves the technical problems of low detection accuracy and susceptibility to complex environmental changes in traditional target detection algorithms.
[0004] In a first aspect, the present invention provides an insulator defect detection method based on AL-YOLO, comprising:
[0005] At least one insulator defect image is acquired, and the at least one insulator defect image is preprocessed to obtain at least one target insulator defect image;
[0006] An AL-YOLO network is constructed, and the image of at least one target insulator defect is input into the AL-YOLO network for iterative training to obtain an insulator defect detection model. The AL-YOLO network includes a backbone network, a neck network, and a head network. The backbone network includes a C3K2 module, an ALConv module, an SPPF module, and a C2PSA module.
[0007] A real-time insulator defect image is acquired and input into the insulator defect detection model. The insulator defect detection model outputs a defect detection result corresponding to the real-time insulator defect image.
[0008] Secondly, the present invention provides an insulator defect detection system based on AL-YOLO, comprising:
[0009] The acquisition module is configured to acquire at least one insulator defect image and preprocess the at least one insulator defect image to obtain at least one target insulator defect image;
[0010] The module is configured to build an AL-YOLO network and input the at least one target insulator defect image into the AL-YOLO network for iterative training to obtain an insulator defect detection model. The AL-YOLO network includes a backbone network, a neck network, and a head network. The backbone network includes a C3K2 module, an ALConv module, an SPPF module, and a C2PSA module.
[0011] The output module is configured to acquire real-time insulator defect images, input the real-time insulator defect images into the insulator defect detection model, and output defect detection results corresponding to the real-time insulator defect images.
[0012] Thirdly, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the steps of the AL-YOLO-based insulator defect detection method according to any embodiment of the present invention.
[0013] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the steps of the AL-YOLO-based insulator defect detection method according to any embodiment of the present invention.
[0014] This application presents an AL-YOLO-based insulator defect detection method and system. By automatically learning the weights of different branches, the network can dynamically select the more important scale based on input features. Residual connections are used to fuse dynamic and residual features, enhancing feature representation capabilities. Existing methods independently compute channel and spatial attention. Channel attention may amplify noise in irrelevant spatial regions, and spatial attention may ignore semantic information of key channels. Therefore, this invention introduces an OCG spatial channel attention mechanism module, enabling the model to simultaneously focus on spatial and channel information. Through the dynamic deformation capability of deformable convolution, it accurately adapts to the arc-shaped arrangement of insulator strings, effectively overcoming the feature shift problem caused by tilted shooting angles in traditional convolution. Overall, the AL-YOLO algorithm proposed in this invention achieves high-precision insulator defect detection with low computational cost by optimizing the model structure and introducing innovative modules. It is suitable for efficient inspection needs in complex environments, significantly improving detection performance and equipment usability. Attached Figure Description
[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 A flowchart illustrating an AL-YOLO-based insulator defect detection method according to an embodiment of the present invention;
[0017] Figure 2 This is a diagram of the ALNet structure of a specific embodiment of the present invention.
[0018] Figure 3 A structural diagram of the ALConv module of a specific embodiment of the present invention is provided;
[0019] Figure 4 A structural diagram of the OCG-Attention module of a specific embodiment of the present invention is provided;
[0020] Figure 5 This is a structural block diagram of an insulator defect detection system based on AL-YOLO, provided in an embodiment of the present invention.
[0021] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] Please see Figure 1 The diagram shows a flowchart of an insulator defect detection method based on AL-YOLO according to this application.
[0024] like Figure 1 As shown, the insulator defect detection method based on AL-YOLO specifically includes the following steps:
[0025] Step S101: Obtain at least one insulator defect image and preprocess the at least one insulator defect image to obtain at least one target insulator defect image.
[0026] Step S102: Construct an AL-YOLO network and input the at least one target insulator defect image into the AL-YOLO network for iterative training to obtain an insulator defect detection model.
[0027] In this step, the AL-YOLO network includes a backbone network, a neck network, and a head network. The backbone network includes a C3K2 module, an ALConv module, an SPPF module, and a C2PSA module. A feature map with a size of 640×640 and 3 channels is subjected to two consecutive convolution operations to obtain a first feature map, wherein the size of the first feature map is reduced to 160×160 and the number of channels is 32. The first feature map is then processed stepwise through the C3K2 module, the ALConv module, the SPPF module, and the C2PSA module to obtain a second feature map, wherein the size of the second feature map is reduced to 20×20 and the number of channels is 256.
[0028] It should be noted that the ALConv module specifically performs the following operations: The first input feature is simultaneously fed into the first convolutional branch, the second convolutional branch, and the third convolutional branch. The first convolutional branch uses 3×3 deformable convolution to obtain the first feature F1, the second convolutional branch uses 3×3 dilated convolution to obtain the second feature F2, and the third convolutional branch uses 5×5 deformable convolution to obtain the third feature F3. The first feature F1, the second feature F2, and the third feature F3 are fused to obtain the fourth feature F4. The first input feature is used to generate the fifth feature F5 through intelligent residual connection, and the fourth feature F4 and the fifth feature F5 are concatenated along the channel dimension and input into the localization head and the classification head, respectively. The localization head uses CoordConv combined with the CBAM module to output a defect location heatmap, and the classification head outputs the defect category probability distribution through a non-local network and ECA attention. After processing by 1×1 convolution and BN layer, the final first result is output.
[0029] The neck network includes the Concat module, UpSample module, C3K2 module, ALConv module, and OCG-Attention module. The Upsample module converts low-resolution feature maps into high-resolution feature maps through upsampling operations to restore the spatial dimension of the feature maps. The Concat module is used to stitch feature maps of different scales together to form a new feature map. The OCG-Attention module uses a bidirectional attention guidance mechanism to enhance spatial attention and channel attention.
[0030] In the OCG-Attention module, the following process is specifically executed: the second input feature is processed by deformable convolution to generate the aligned sixth feature F6; the sixth feature F6 is subjected to spatial dimension average pooling and channel dimension average pooling to obtain the seventh feature F7 and the eighth feature F8, respectively; the seventh feature F7 is processed by two layers of 3x3 convolution and sigmoid activation to generate channel attention weight F9; the eighth feature F8 is processed by two layers of 1x1 convolution and sigmoid activation to generate spatial attention weight F10; the sixth feature F6 is connected through residuals to obtain the eleventh feature F11, which is then multiplied element-wise with the channel attention weight F9 and the spatial attention weight F10, and the second final result is output after passing through the ReLU activation function.
[0031] Step S103: Obtain a real-time insulator defect image, input the real-time insulator defect image into the insulator defect detection model, and the insulator defect detection model outputs a defect detection result corresponding to the real-time insulator defect image.
[0032] In summary, the method in this application automatically learns the weights of different branches, enabling the network to dynamically select more important scales based on input features. It also enhances feature representation by fusing dynamic and residual features through residual connections. Existing methods independently compute channel and spatial attention. Channel attention may amplify noise in irrelevant spatial regions, and spatial attention may ignore semantic information of key channels. Therefore, this invention introduces an OCG spatial channel attention mechanism module, enabling the model to simultaneously focus on spatial and channel information. Through the dynamic deformation capability of deformable convolution, it accurately adapts to the arc-shaped arrangement features of insulator strings, effectively overcoming the feature shift problem caused by tilted shooting angles in traditional convolution. Overall, the AL-YOLO algorithm proposed in this invention achieves high-precision insulator defect detection with low computational cost by optimizing the model structure and introducing innovative modules. It is suitable for efficient inspection needs in complex environments, significantly improving detection performance and equipment usability.
[0033] In one specific embodiment, the AL-YOLO-based insulator defect detection method includes the following steps:
[0034] Step 1: Data preprocessing before model training
[0035] When constructing an insulator defect detection model, the first step is to prepare an insulator defect image dataset, including five types of defects: pollution, cracks, damage, flashover, and aging. The LabelImg tool is used to label the defect regions with rectangular bounding boxes, labeled as "Polluted_insulator," "Cracked_insulator," "Broken_insulator," "Flashover_insulator," and "Aged_insulator," respectively, generating a label file containing the category and bounding box coordinates. To improve model robustness, data augmentation techniques such as image quality enhancement, contrast adjustment, and noise reduction are employed to increase data diversity and enhance the model's adaptability to complex scenes. Finally, the dataset is divided into training and validation sets in a 9:1 ratio. The training set is used for model parameter optimization, and the validation set is used for performance evaluation, ensuring the model has good generalization ability and avoiding overfitting.
[0036] Step 2: Construction of the AL-YOLO network model
[0037] The AL-YOLO network model mainly consists of three parts (such as...) Figure 2As shown, the network consists of a Backbone, a Neck, and a Head. The Backbone comprises the ALConv (convolutional) module, the C3K2 module, the SPPF module, and the C2PSA module. The ALConv convolutional module is an innovative version that significantly improves robustness to multi-scale defects in complex backgrounds. The C3K2 module is an efficient feature extraction module that significantly improves the performance of the object detection network by deeply optimizing the computational structure and introducing dynamic mechanisms. The SPPF module effectively reduces computation by employing a fast spatial pyramid pooling strategy. The C2PSA module is an innovative attention mechanism module that significantly improves the model's feature extraction capability for multi-scale targets by combining partial convolution and spatial attention cross-enhancement techniques. The Neck network consists of the Concat module, the Upsample module, the C3K2 module, the ALConv module, and the OCG-Attention module. The Upsample module converts low-resolution feature maps into high-resolution feature maps through upsampling operations to restore the spatial dimension of the feature maps. The Concat module concatenates feature maps of different scales to form a new feature map, thereby enhancing the representational power of the features. The OCG-Attention module is an innovative spatial channel attention mechanism module, designed with a unique bidirectional attention guidance mechanism that allows spatial attention (focusing on important regions) and channel attention (strengthening key features) to mutually reinforce each other, significantly improving the adaptability of the object detection network to complex scenes. The head network consists of the Detect module, which comprises convolutional layers and fully connected layers, used to predict the category of each candidate box. The detection head also includes a Non-Maximum Suppression (NMS) algorithm and a loss function. The NMS algorithm ensures that each object has only one detection box, thus improving the clarity and accuracy of the detection results. The loss function includes classification loss, localization loss, and confidence loss, used to measure the difference between the model's predicted values and the true values, guiding the model to continuously optimize parameters during training, thereby improving the model's detection accuracy and robustness. The AL-YOLO network model is as follows: Figure 1 As shown.
[0038] Detailed network construction process:
[0039] Backbone: The input to the Backbone part is a 640×640 image with 3 channels, whose features are extracted stepwise from top to bottom. First, the image undergoes two consecutive convolutional operations, reducing the feature map size to 160×160 with 32 channels. Next, the network sequentially connects multiple modules, including the C3K2 module, ALConv module, SPPF module, and C2PSA module. After these modules' stepwise processing, the feature map size is reduced to 20×20 with 256 channels. In the Backbone part, all convolutional layers have a kernel size of 3×3 and a stride of 2.
[0040] The neck network primarily consists of an enhanced Feature Pyramid Network (FPN) and a Path Aggregation Network (PAN). The enhanced PAN-FPN structure comprises a top-down path and a bottom-up path. The top-down path refers to the progressive upsampling and propagation of high-level semantic features, while the bottom-up path refers to the progressive downsampling and propagation of low-level detailed features. Three OGC-Attention mechanisms are connected between the FPN and PAN networks. This attention mechanism automatically focuses on the most discriminative feature regions, significantly suppressing background interference and noise, and exhibiting excellent generalization performance while maintaining high accuracy.
[0041] Head: The head network employs a three-head specialized design, with three independent detection branches optimized for detecting insulator defects of different sizes. The small defect detection head, based on high-resolution feature maps, uses 5×5 depthwise separable convolutions to accurately locate microcracks of 3-15 pixels; the medium defect detection head expands the receptive field through dynamic dilated convolutions, effectively capturing medium-sized defects of 15-50 pixels; and the large defect detection head utilizes deep semantic features and cross-layer attention mechanisms to accurately identify large-area damage exceeding 50 pixels. Each detection head includes a feature enhancement module, a dynamic prediction layer, and adaptive NMS processing. End-to-end optimization is achieved through a multi-task loss function, ensuring accurate identification of defects of different scales in complex scenarios while maintaining efficient inference speed.
[0042] AL-YOLO Module Descriptions:
[0043] ALConv module (such as) Figure 3As shown): First, the input features are simultaneously fed into three parallel convolutional branches: Branch 1 uses a 3×3 deformable convolution (dilation=1, containing 9 learnable offsets) to obtain feature F1; Branch 2 uses a 3×3 dilated convolution (dilation=2, padding=2) to obtain feature F2; and Branch 3 uses a 5×5 deformable convolution (dilation=3, padding=3) to obtain feature F3. Simultaneously, the input features undergo a cross-guided attention mechanism, first aligning features through deformable convolution, then calculating the spatially guided channel attention weights Wc and the channel-guided spatial attention weights Ws, dynamically fusing features F1-F3 with the attention weights to obtain feature F4. In another path, the input features generate feature F5 through intelligent residual connections (using identity mapping for channel matching, otherwise using 1×1 convolution). Finally, the dynamic fusion feature F4 and the residual feature F5 are concatenated along the channel dimension and input into the dual-task output head: the localization head uses CoordConv combined with the CBAM module to output a defect location heatmap, and the classification head outputs the defect category probability distribution through a non-local network and ECA attention. After processing by 1×1 convolution and BN layer, the final detection result is output.
[0044] OCG-Attention module (such as) Figure 4 As shown): First, the input features are processed by deformable convolution (DeformConv) to generate aligned features F1. Next, F1 undergoes two different pooling operations: spatial average pooling to obtain features F2 (shape [B,1,H,W]), and channel average pooling to obtain features F3 (shape [B,C,1,1]). Then, F2 is processed through two 3x3 convolutions (containing BN and ReLU) and sigmoid activation to generate channel attention weights F4; F3 is processed through two 1x1 convolutions (containing BN and ReLU) and sigmoid activation to generate spatial attention weights F5. Subsequently, the original features F1 are processed through residual connections (1x1 convolution + BN) to obtain F6, which is then multiplied element-wise with F4 and F5 to achieve attention modulation. Finally, the final result, Output, is output after passing through the ReLU activation function.
[0045] AL-YOLO module function description:
[0046] The ALConv module, as the core convolutional module for insulator defect detection, achieves three major functional enhancements through innovative designs including multi-scale deformable convolution, dynamic feature fusion, and dual-task collaborative optimization: First, it adopts a three-branch deformable convolutional architecture (including standard 3×3 convolution, dilation=2 dilated convolution, and 5×5 large-kernel deformable convolution) to achieve cross-scale adaptive feature capture, enabling the model to simultaneously and accurately extract local details of tiny cracks (<5 pixels) on the insulator surface and global contextual features of large defects; Second, through spatial-channel bidirectional dynamic weighting using a cross-guided attention mechanism, it effectively enhances the feature response of defect areas while suppressing interference from complex backgrounds; Finally, combined with conditional residual connections and a collaborative optimization design of dual-task output heads, compared to traditional convolutional modules, it significantly reduces the false detection rate while maintaining real-time performance, providing a high-precision and high-efficiency defect detection solution for mobile devices such as power inspection drones.
[0047] As the core feature enhancement module for insulator defect detection, the OCG spatial channel attention module achieves three major performance breakthroughs through an innovative dual-path attention mechanism and deformable convolution technology: First, by adopting a deformable convolution and bidirectional attention collaborative architecture, it improves the model's detection rate for micro-cracks (<3 pixels) and significantly enhances the detection accuracy for large defects by dynamically learning the sampling position offset and combining it with a spatial-channel cross-guidance mechanism; Second, through bidirectional dynamic weighting of spatial-guided channel attention and channel-guided spatial attention, it significantly reduces the false positive and false negative rates under complex background interference, while improving the detection accuracy for key features; Finally, by combining lightweight residual design and hardware optimization strategies, it improves detection stability while maintaining the model's real-time processing speed.
[0048] Please see Figure 5 The diagram shows a structural block diagram of an insulator defect detection system based on AL-YOLO according to this application.
[0049] like Figure 5 As shown, the insulator defect detection system 200 includes an acquisition module 210, a construction module 220, and an output module 230.
[0050] The acquisition module 210 is configured to acquire at least one insulator defect image and preprocess the at least one insulator defect image to obtain at least one target insulator defect image. The construction module 220 is configured to construct an AL-YOLO network and input the at least one target insulator defect image into the AL-YOLO network for iterative training to obtain an insulator defect detection model. The AL-YOLO network includes a backbone network, a neck network, and a head network. The backbone network includes a C3K2 module, an ALConv module, an SPPF module, and a C2PSA module. The output module 230 is configured to acquire a real-time insulator defect image, input the real-time insulator defect image into the insulator defect detection model, and output a defect detection result corresponding to the real-time insulator defect image.
[0051] It should be understood that Figure 5 The modules and references described in the document Figure 1 The steps described in the text correspond to those in the method described above. Therefore, the operations, features, and corresponding technical effects described above also apply to the method described in the text. Figure 5 The various modules in the document will not be described in detail here.
[0052] In other embodiments, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the AL-YOLO-based insulator defect detection method in any of the above method embodiments.
[0053] In one embodiment, the computer-readable storage medium of the present invention stores computer-executable instructions, which are configured as follows:
[0054] At least one insulator defect image is acquired, and the at least one insulator defect image is preprocessed to obtain at least one target insulator defect image;
[0055] An AL-YOLO network is constructed, and the image of at least one target insulator defect is input into the AL-YOLO network for iterative training to obtain an insulator defect detection model. The AL-YOLO network includes a backbone network, a neck network, and a head network. The backbone network includes a C3K2 module, an ALConv module, an SPPF module, and a C2PSA module.
[0056] A real-time insulator defect image is acquired and input into the insulator defect detection model. The insulator defect detection model outputs a defect detection result corresponding to the real-time insulator defect image.
[0057] Computer-readable storage media may include a stored program area and a stored data area, wherein the stored program area may store an operating system and an application program required for at least one function; the stored data area may store data created based on the use of the AL-YOLO-based insulator defect detection system, etc. Furthermore, the computer-readable storage medium may include high-speed random access memory, and may also include memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the computer-readable storage medium may optionally include memory remotely configured relative to a processor, which can be connected to the AL-YOLO-based insulator defect detection system via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0058] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present invention, such as... Figure 6 As shown, the device includes a processor 310 and a memory 320. The electronic device may also include an input device 330 and an output device 340. The processor 310, memory 320, input device 330, and output device 340 can be connected via a bus or other means. Figure 6 Taking a bus connection as an example, the memory 320 is the computer-readable storage medium described above. The processor 310 executes various server functions and data processing by running non-volatile software programs, instructions, and modules stored in the memory 320, thereby implementing the AL-YOLO-based insulator defect detection method described in the above embodiment. The input device 330 can receive input digital or character information and generate key signal inputs related to user settings and function control of the AL-YOLO-based insulator defect detection system. The output device 340 may include a display screen or other display device.
[0059] The aforementioned electronic device can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0060] In one implementation, the above-described electronic device is used in an AL-YOLO-based insulator defect detection system as a client, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0061] At least one insulator defect image is acquired, and the at least one insulator defect image is preprocessed to obtain at least one target insulator defect image;
[0062] An AL-YOLO network is constructed, and the image of at least one target insulator defect is input into the AL-YOLO network for iterative training to obtain an insulator defect detection model. The AL-YOLO network includes a backbone network, a neck network, and a head network. The backbone network includes a C3K2 module, an ALConv module, an SPPF module, and a C2PSA module.
[0063] A real-time insulator defect image is acquired and input into the insulator defect detection model. The insulator defect detection model outputs a defect detection result corresponding to the real-time insulator defect image.
[0064] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An AL-YOLO-based insulator defect detection method, characterized in that, The application relates to an insulator defect detection method and device. At least one insulator defect image is acquired, and the at least one insulator defect image is preprocessed to obtain at least one target insulator defect image; An AL-YOLO network is constructed, and the at least one target insulator defect image is input into the AL-YOLO network for iterative training to obtain an insulator defect detection model, wherein the AL-YOLO network comprises a backbone network, a neck network and a head network, the backbone network comprises a C3K2 module, an ALConv module, an SPPF module and a C2PSA module, and the neck network comprises a Concat module, an UpSample module, a C3K2 module, an ALConv module and an OCG-Attention module; The Upsample module converts a low-resolution feature map into a high-resolution feature map through an up-sampling operation to restore the spatial dimension of the feature map; The Concat module is used for splicing feature maps of different scales together to form a new feature map; The OCG-Attention module enhances spatial attention and channel attention through a bidirectional attention guiding mechanism, and the following processes are performed in the OCG-Attention module: The second input feature is processed through deformable convolution to generate an aligned sixth feature F6; The sixth feature F6 is subjected to spatial dimension average pooling and channel dimension average pooling respectively to obtain a seventh feature F7 and an eighth feature F8; The seventh feature F7 is subjected to two layers of 3x3 convolution and Sigmoid activation to generate channel attention weight F9; The eighth feature F8 is subjected to two layers of 1x1 convolution and Sigmoid activation to generate spatial attention weight F10; The sixth feature F6 is connected through a residual connection to obtain an eleventh feature F11, and is multiplied by the channel attention weight F9 and the spatial attention weight F10 element by element, and is output through a ReLU activation function to obtain a second final result; A real-time insulator defect image is acquired, and the real-time insulator defect image is input into the insulator defect detection model, and the insulator defect detection model outputs a defect detection result corresponding to the real-time insulator defect image.
2. The AL-YOLO-based insulator defect detection method according to claim 1, characterized in that, In the backbone network, the following operations are performed: A feature map with a size of 640*640 and a channel number of 3 is subjected to two consecutive convolution operations to obtain a first feature map, wherein the size of the first feature map is reduced to 160*160, and the channel number is 32; The first feature map is sequentially subjected to step-by-step processing of a C3K2 module, an ALConv module, an SPPF module and a C2PSA module to obtain a second feature map, wherein the size of the second feature map is reduced to 20*20, and the channel number is 256.
3. The AL-YOLO-based insulator defect detection method according to claim 2, characterized in that, In the ALConv module, the following operations are performed: The first input feature is simultaneously input into a first convolution branch, a second convolution branch and a third convolution branch, the first convolution branch adopts 3*3 deformable convolution processing to obtain a first feature F1, the second convolution branch adopts 3*3 hollow convolution processing to obtain a second feature F2, and the third convolution branch adopts 5*5 deformable convolution processing to obtain a third feature F3; The first feature F1, the second feature F2 and the third feature F3 are fused to obtain a fourth feature F4; The first input feature generates a fifth feature F5 through intelligent residual connection, and the fourth feature F4 and the fifth feature F5 are spliced along the channel dimension, and are respectively input into a positioning head and a classification head, the positioning head adopts CoordConv combined with a CBAM module to output a defect position heat map, the classification head outputs a defect category probability distribution through a Non-local network and an ECA attention, and outputs a final first final result after 1*1 convolution and BN layer processing.
4. An AL-YOLO-based insulator defect detection system, characterized in that, Comprise: The acquisition module is configured to acquire at least one insulator defect image, and pre-process the at least one insulator defect image to obtain at least one target insulator defect image; The construction module is configured to construct an AL-YOLO network, and input the at least one target insulator defect image into the AL-YOLO network for iterative training to obtain an insulator defect detection model, wherein the AL-YOLO network comprises a backbone network, a neck network and a head network, the backbone network comprises a C3K2 module, an ALConv module, an SPPF module and a C2PSA module, and the neck network comprises a Concat module, an UpSample module, a C3K2 module, an ALConv module and an OCG-Attention module; The Upsample module converts a low-resolution feature map into a high-resolution feature map through an up-sampling operation to restore the spatial dimension of the feature map; The Concat module is used for splicing feature maps of different scales together to form a new feature map; The OCG-Attention module enhances spatial attention and channel attention through a bidirectional attention guidance mechanism, and in the OCG-Attention module, the following processes are specifically performed: The second input feature is processed by deformable convolution to generate an aligned sixth feature F6; The sixth feature F6 is subjected to spatial dimension average pooling and channel dimension average pooling respectively to obtain a seventh feature F7 and an eighth feature F8; The seventh feature F7 is subjected to two layers of 3x3 convolution and Sigmoid activation to generate channel attention weight F9; The eighth feature F8 is subjected to two layers of 1x1 convolution and Sigmoid activation to generate spatial attention weight F10; The sixth feature F6 is obtained through residual connection to obtain an eleventh feature F11, and is multiplied by the channel attention weight F9 and the spatial attention weight F10 element by element, and outputs a second final result through a ReLU activation function; The output module is configured to acquire a real-time insulator defect image, input the real-time insulator defect image into the insulator defect detection model, and output a defect detection result corresponding to the real-time insulator defect image.
5. An electronic device, comprising: Comprise: At least one processor and a memory connected with the at least one processor in communication, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 3.
6. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1 to 3.
Citation Information
Patent Citations
Insulator defect detection method based on lightweight CGC-YOLO
CN119444752A