Lightweight power transformation defect identification detection method and system of improved YOLOv5s model
By constructing the C3-Bneck module in the YOLOv5s model and using DWConv deep convolution blocks, and clustering the prior boxes with the K-means++ algorithm, the problems of large amount of calculation and insufficient ability to analyze complex business are solved, and the model is lightweight and efficient detection is achieved.
Patent Information
- Application Number
- CN202411700908.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-25
AI Technical Summary
In the detection of defects of substation equipment, the YOLOv5s model has problems such as huge computing volume, high operating environment requirements and lack of comprehensive analysis capabilities for complex businesses.
By constructing the C3-Bneck module, replacing the YOLOv5s backbone extracting the original C3 module in the network, and replacing the CBS convolution block with the DWConv deep convolution block, and using the K-means++ algorithm to cluster the prior boxes.
The reduction of the number of model parameters is achieved, the detection accuracy and speed are improved, the detection speed and accuracy are balanced, and the error of clustering results is reduced.
Smart Images

Figure CN119693308A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a lightweight substation defect recognition and detection method and system based on an improved YOLOv5s model. Background Art
[0002] With the development of artificial intelligence, digitalization and other technologies, the power industry has developed a series of models such as appearance defect detection, early insulation state identification of converter transformers, and voiceprint anomaly identification according to the needs of various professions. Due to various factors such as complex on-site environment, weak model operation infrastructure, and insufficient training data, the application effect of the model in the field of capacitive equipment, bushings, and transformer partial discharge monitoring is not good, with low accuracy, weak generalization, and lack of comprehensive analysis capabilities in complex businesses. At present, with the application of cloud-edge collaborative technology, through the cooperation of cloud and edge, the rich infrastructure of the cloud can be fully utilized. Through model lightweighting, model compression, knowledge distillation, and knowledge migration, knowledge can be transferred between the cloud and the edge to train personalized edge models. At the same time, by continuously collecting data samples on the edge, various monitoring data of substation equipment can be effectively integrated to extract richer feature representations, so as to train general large models on the cloud and personalized models on the edge.
[0003] Target detection is currently widely used in various power businesses to determine the detection object or screen key parts to improve detection accuracy. The basic structure of the YOLOv5s model consists of input (Input Module), backbone network (BackboneModule), neck network (Neck Module) and detection output (Head Module). The input end mainly includes Mosaic data enhancement, adaptive anchor frame calculation and adaptive image scaling; the backbone network includes CBS module processing, C3 structure and fast spatial pyramid pooling (SPPF); Neck uses the path aggregation network of YOLOv4, a bottom-up path enhancement, which contains information components that can be aggregated through pipelines, upsamples and pools the features extracted by Backbone at different stages, uses lateral connections between low and top layers, shortens the information propagation path, and uses enhanced paths to enrich feature information at different levels. The prediction part uses GIOU_Loss as the loss function by default and has three different scales of output, corresponding to three different target predictions: large, medium and small. Although YOLOv5s is a fast and high-precision algorithm, in the task of defect detection of substation equipment, background images account for a large proportion, and semantic segmentation is required to retain key point small target information, such as power transmission hardware, insulators, and partially obscured detection targets. Therefore, the detection model must maintain high resolution as much as possible, consider the amount of calculation, and try to connect global information, which is what YOLOv5s currently lacks. At the same time, in order to improve the feature extraction capability and ensure the accuracy of the model, YOLOv5s adds a large number of complex CBS and C3 structures, resulting in a huge amount of calculation for the model, and thus high requirements for the operating environment.
[0004] In the prior art CN118379234A, a photovoltaic module electroluminescent image defect recognition method based on improved Yolov5s is disclosed. First, the photovoltaic module electroluminescent image is acquired through the photovoltaic module electroluminescent image acquisition device. Then, the acquired image is preprocessed, including image denoising, enhancement and size adjustment. Next, the improved YOLOv5s-DBB model is used for training to improve the accuracy and robustness of image feature extraction and defect recognition. In the defect recognition stage, the preprocessed image is analyzed and detected by the improved model to identify the defective area in the photovoltaic module electroluminescent image. Finally, the result is displayed.
[0005] In the prior art, YOLOv5s is improved through a multi-branch structure to increase the model depth and width, and improve feature extraction and detection efficiency; the present invention adopts a C3-Bneck module, a DWConv deep convolution module and a K-means++ algorithm to improve the YOLOv5s model, so that the YOLOv5s model has higher efficiency and accuracy. Summary of the invention
[0006] In order to solve the above problems existing in the prior art, the present invention proposes a lightweight substation defect recognition and detection method and system based on an improved YOLOv5s model.
[0007] The technical solution of the present invention is as follows:
[0008] On the one hand, the present invention proposes a lightweight substation defect recognition and detection method based on an improved YOLOv5s model, and the specific steps include:
[0009] Obtain the substation equipment defect data set, input it into the improved YOLOv5s model for training, and obtain a trained substation defect recognition model;
[0010] Obtain images of the substation equipment to be inspected and input them into the trained substation defect recognition model for defect recognition;
[0011] Among them, the improved YOLOv5s model is specifically:
[0012] Construct a Bneck structure that includes a deep separable convolution and an inverse residual structure, combined with the CBAM attention mechanism;
[0013] Use the Bneck structure to replace the CBS convolution block in the Bottleneck structure in the C3 structure to form a C3-Bneck structure;
[0014] In the backbone extraction network of the YOLOv5s model, all C3 structures are replaced with C3-Bneck structures, and all separate CBS convolution blocks are replaced with DWConv deep convolution blocks;
[0015] The K-means++ algorithm is used to replace the K-means algorithm in the original YOLOv5s model to cluster the prior boxes.
[0016] As a preferred implementation, the Bneck structure includes a 1X1 dimensionality-increasing convolution layer, a 3X3 depth-separable convolution layer, a channel weight adjustment layer using a CBAM attention mechanism, and a 1X1 dimensionality-reducing convolution layer.
[0017] As a preferred implementation, the channel weight adjustment layer using the CBAM attention mechanism includes a channel attention module and a spatial attention module; the features extracted by the depth-separable convolutional layer are input into the channel attention module to weight different features, and then the weighted features are input into the spatial attention module for calculation to obtain the final adjustment result for output.
[0018] As a preferred implementation, the step of using the K-means++ algorithm to replace the K-means algorithm in the original YOLOv5s model to cluster the priori boxes is specifically as follows:
[0019] In the first step, a sample in the data set is randomly selected as the first cluster center;
[0020] The second step is to calculate the closest distance D(X) between each sample X in the data set and the currently selected cluster center.
[0021] The third step is to select the next cluster center with probability P according to the probability distribution function P. The function expression of probability P is as follows:
[0022]
[0023] In the fourth step, repeat the second and third steps to select a preset number K of cluster centers. Based on the obtained K cluster centers, use the K-means++ algorithm to iterate to obtain the final result. The average value of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard for evaluating the final clustering effect. The specific calculation formula is as follows:
[0024]
[0025] In the formula, box is the predicted box, center is the real box, and Accuracy is the average value of the maximum intersection ratio of each sample point and the cluster center.
[0026] On the other hand, the present invention proposes a lightweight substation defect recognition and detection system based on an improved YOLOv5s model, comprising:
[0027] Improve the YOLOv5s model training module, obtain the substation equipment defect data set, input it into the improved YOLOv5s model for training, and obtain a trained substation defect recognition model;
[0028] The defect recognition module obtains the image of the substation equipment to be inspected and inputs it into the trained substation defect recognition model for defect recognition;
[0029] Among them, the improved YOLOv5s model is specifically:
[0030] Construct a Bneck structure that includes a deep separable convolution and an inverse residual structure, combined with the CBAM attention mechanism;
[0031] Use the Bneck structure to replace the CBS convolution block in the Bottleneck structure in the C3 structure to form a C3-Bneck structure;
[0032] In the backbone extraction network of the YOLOv5s model, all C3 structures are replaced with C3-Bneck structures, and all separate CBS convolution blocks are replaced with DWConv deep convolution blocks;
[0033] The K-means++ algorithm is used to replace the K-means algorithm in the original YOLOv5s model to cluster the prior boxes.
[0034] As a preferred implementation, the Bneck structure includes a 1X1 dimensionality-increasing convolution layer, a 3X3 depth-separable convolution layer, a channel weight adjustment layer using a CBAM attention mechanism, and a 1X1 dimensionality-reducing convolution layer.
[0035] As a preferred implementation, the channel weight adjustment layer using the CBAM attention mechanism includes a channel attention module and a spatial attention module; the features extracted by the depth-separable convolutional layer are input into the channel attention module to weight different features, and then the weighted features are input into the spatial attention module for calculation to obtain the final adjustment result for output.
[0036] As a preferred implementation, the step of using the K-means++ algorithm to replace the K-means algorithm in the original YOLOv5s model to cluster the priori boxes is specifically as follows:
[0037] In the first step, a sample in the data set is randomly selected as the first cluster center;
[0038] The second step is to calculate the closest distance D(X) between each sample X in the data set and the currently selected cluster center.
[0039] The third step is to select the next cluster center with probability P according to the probability distribution function P. The function expression of probability P is as follows:
[0040]
[0041] In the fourth step, repeat the second and third steps to select a preset number K of cluster centers. Based on the obtained K cluster centers, use the K-means++ algorithm to iterate to obtain the final result. The average value of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard for evaluating the final clustering effect. The specific calculation formula is as follows:
[0042]
[0043] In the formula, box is the predicted box, center is the real box, and Accuracy is the average value of the maximum intersection ratio of each sample point and the cluster center.
[0044] On the other hand, the present invention proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements a lightweight substation defect identification and detection method based on an improved YOLOv5s model as described in any embodiment of the present invention.
[0045] On the other hand, the present invention proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a lightweight substation defect identification and detection method and system based on an improved YOLOv5s model as described in any embodiment of the present invention.
[0046] The present invention has the following beneficial effects:
[0047] 1. The present invention constructs a C3-Bneck module through the Bneck structure to replace the original C3 module in the YOLOv5s backbone extraction network, greatly reducing the number of model parameters and achieving model lightweight.
[0048] 2. The present invention introduces the CBAM attention mechanism into the Bneck structure to improve the detection accuracy of the model and thus balance the detection speed and accuracy.
[0049] 3. The present invention uses the K-means++ algorithm to cluster the priori frame at the detection output end, which speeds up the convergence speed and reduces the error of the clustering result. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a schematic diagram of the steps of the present invention;
[0051] Figure 2 This is the basic structure diagram of the YOLOv5s model;
[0052] Figure 3 This is a schematic diagram of the standard convolution process;
[0053] Figure 4 Schematic diagram of the process of depth-wise separable convolution;
[0054] Figure 5 This is the structural diagram of Bneck;
[0055] Figure 6 This is the structural diagram of the Bottleneck network;
[0056] Figure 7This is the structural diagram of the C3-Bneck module;
[0057] Figure 8 This is the Backbone module structure diagram in the improved YOLOv5s model;
[0058] Fig. 9 The flowchart of the CBAM attention mechanism. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] It should be understood that the step numbers used in this document are only for convenience of description and are not intended to limit the order in which the steps are executed.
[0061] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0062] The terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0063] The term "and / or" means and includes any and all possible combinations of one or more of the associated listed items.
[0064] Embodiment 1:
[0065] See also Figure 1 , a lightweight substation defect recognition and detection method based on an improved YOLOv5s model, the specific steps include:
[0066] Obtain the substation equipment defect data set, input it into the improved YOLOv5s model for training, and obtain a trained substation defect recognition model;
[0067] Obtain images of the substation equipment to be inspected and input them into the trained substation defect recognition model for defect recognition;
[0068] Among them, the improved YOLOv5s model is specifically:
[0069] Construct a Bneck structure that includes a deep separable convolution and an inverse residual structure, combined with the CBAM attention mechanism;
[0070] Use the Bneck structure to replace the CBS convolution block in the Bottleneck structure in the C3 structure to form a C3-Bneck structure;
[0071] In the backbone extraction network of the YOLOv5s model, all C3 structures are replaced with C3-Bneck structures, and all separate CBS convolution blocks are replaced with DWConv deep convolution blocks;
[0072] The K-means++ algorithm is used to replace the K-means algorithm in the original YOLOv5s model to cluster the prior boxes.
[0073] In this embodiment, the basic structure of the YOLOv5s model is as follows Figure 2 As shown in the figure, since the YOLOv5s model adds a large number of complex CBS and C3 structures, the computational complexity of the model is huge, which requires high computing power for the operating environment. For the backbone extraction network of YOLOv5s, on the one hand, the number of CBS and C3 structures is reduced, and on the other hand, a structure with simple structure and small computational complexity is used instead. Therefore, the deep separable convolution and inverse residual structure of the MobileNet model are borrowed, and the CBAM attention mechanism is combined to form a Bneck structure.
[0074] The MobileNet model is a lightweight model. It uses deep separable convolution and inverse residual structure. It has powerful feature extraction capabilities and significantly reduces the amount of deep separable convolution calculations. Deep separable convolution consists of channel-by-channel convolution (DW) and point-by-point convolution (PW). Channel-by-channel convolution convolves the pixels on each channel to obtain their respective features. The convolution kernel size is 3×3, and the number of convolution kernels is equal to the number of input channels. Point-by-point convolution uses a 1×1 convolution kernel to convolve the features of different channels at each pixel. Standard convolution and deep separable convolution are as follows: Figure 3 and Figure 4 As shown. Figure 3 As we can see, assuming that the input feature map is H long, W wide, has M input channels, N output channels, and a convolution kernel size of D K ×D K , then the computational cost of standard convolution is:
[0075] S=H×W×M×N×D K ×D K
[0076] Depend on Figure 4 It can be obtained that the computational cost of depth-separable convolution is:
[0077] P=H×W×M×D K ×D K +H×W×M×N
[0078] The computational ratio of depth-separable convolution to standard convolution can be obtained as follows:
[0079]
[0080] It can be seen from the above formula that the depthwise separable convolution greatly reduces the overall computational complexity and parameter amount of the network, thereby achieving a lightweight model and improving the detection speed of the model.
[0081] As a preferred implementation of this embodiment, the Bneck structure includes a 1X1 dimensionality increase convolution layer, a 3X3 depth-separable convolution layer, a channel weight adjustment layer using the CBAM attention mechanism, and a 1X1 dimensionality reduction convolution layer.
[0082] In this embodiment, the structure of Bneck is as follows Figure 5 As shown in the figure, in the Bneck structure, the dimension is first increased by a 1×1 convolution, and then a 3×3 depth-separable convolution is used to extract feature information; then the weight of each channel is adjusted through the CBAM attention mechanism; finally, a 1×1 convolution is used to achieve dimensionality reduction, and the output after dimensionality reduction is summed with the residual edge part.
[0083] A lighter Bneck structure is used instead of CBS convolution to build a Bottleneck network. The structure is as follows Figure 6 As shown; replace the Bottleneck structure in the C3 structure to form a C3-Bneck module, the structure is as follows Figure 7 As shown in the figure, all C3 modules in the backbone network are replaced by C3-Bneck modules, and DWConv deep convolution is used to replace CBS convolution module. The structure of the Backbone module in the improved YOLOv5s model is as follows: Figure 8 As shown, the purpose of reducing the amount of model calculation and the amount of parameters is achieved.
[0084] As a preferred implementation scheme of this embodiment, the channel weight adjustment layer using the CBAM attention mechanism includes a channel attention module and a spatial attention module; the features extracted by the depth-separable convolutional layer are input into the channel attention module to weight different features, and then the weighted features are input into the spatial attention module for calculation to obtain the final adjustment result for output.
[0085] In this embodiment, during the feature extraction process, the YOLOv5s model uses the same weighting method for features of different importance, which is not conducive to the extraction of small-scale target information. To solve this problem, the CBAM attention mechanism is introduced. The CBAM attention mechanism combines the spatial attention module and the channel attention module, and its main purpose is to improve the feature expression ability and generalization ability of the neural network. Fig. 9 As shown in the figure, the CBAM attention mechanism first weights different features through the channel attention module, and then sends the weighted features to the spatial attention module to obtain the final result.
[0086] As a preferred implementation of this embodiment, the step of clustering the priori boxes by using the K-means++ algorithm to replace the K-means algorithm in the original YOLOv5s model is specifically as follows:
[0087] In the first step, a sample in the data set is randomly selected as the first cluster center;
[0088] The second step is to calculate the closest distance D(X) between each sample X in the data set and the currently selected cluster center.
[0089] The third step is to select the next cluster center with probability P according to the probability distribution function P. The function expression of probability P is as follows:
[0090]
[0091] In the fourth step, repeat the second and third steps to select a preset number K of cluster centers. Based on the obtained K cluster centers, use the K-means++ algorithm to iterate to obtain the final result. The average value of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard for evaluating the final clustering effect. The specific calculation formula is as follows:
[0092]
[0093] In the formula, box is the predicted box, center is the real box, and Accuracy is the average value of the maximum intersection ratio of each sample point and the cluster center.
[0094] In this embodiment, YOLOv5s uses the K-means algorithm to cluster the prior boxes. The K-means algorithm randomly specifies the cluster centers, and it is difficult to avoid the similarity problem of the cluster centers. Therefore, this paper selects the K-means++ algorithm to cluster the prior boxes. The K-means++ algorithm can better select the initial cluster center and obtain a better prior box size.
[0095] Among them, the K-means++ algorithm is used to iterate based on the obtained K cluster centers to obtain the final result. The average of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard step to evaluate the final clustering effect. The value of the cluster center K of the data set is determined by the average intersection-over-union ratio of the cluster centers.
[0096] Embodiment 2:
[0097] A lightweight substation defect recognition and detection system based on an improved YOLOv5s model, comprising:
[0098] Improve the YOLOv5s model training module, obtain the substation equipment defect data set, input it into the improved YOLOv5s model for training, and obtain a trained substation defect recognition model;
[0099] The defect recognition module obtains the image of the substation equipment to be inspected and inputs it into the trained substation defect recognition model for defect recognition;
[0100] Among them, the improved YOLOv5s model is specifically:
[0101] Construct a Bneck structure that includes a deep separable convolution and an inverse residual structure, combined with the CBAM attention mechanism;
[0102] Use the Bneck structure to replace the CBS convolution block in the Bottleneck structure in the C3 structure to form a C3-Bneck structure;
[0103] In the backbone extraction network of the YOLOv5s model, all C3 structures are replaced with C3-Bneck structures, and all separate CBS convolution blocks are replaced with DWConv deep convolution blocks;
[0104] The K-means++ algorithm is used to replace the K-means algorithm in the original YOLOv5s model to cluster the prior boxes.
[0105] As a preferred implementation of this embodiment, the Bneck structure includes a 1X1 dimensionality increase convolution layer, a 3X3 depth-separable convolution layer, a channel weight adjustment layer using the CBAM attention mechanism, and a 1X1 dimensionality reduction convolution layer.
[0106] As a preferred implementation scheme of this embodiment, the channel weight adjustment layer using the CBAM attention mechanism includes a channel attention module and a spatial attention module; the features extracted by the depth-separable convolutional layer are input into the channel attention module to weight different features, and then the weighted features are input into the spatial attention module for calculation to obtain the final adjustment result for output.
[0107] As a preferred implementation of this embodiment, the step of clustering the priori boxes by using the K-means++ algorithm to replace the K-means algorithm in the original YOLOv5s model is specifically as follows:
[0108] In the first step, a sample in the data set is randomly selected as the first cluster center;
[0109] The second step is to calculate the closest distance D(X) between each sample X in the data set and the currently selected cluster center.
[0110] The third step is to select the next cluster center with probability P according to the probability distribution function P. The function expression of probability P is as follows:
[0111]
[0112] In the fourth step, repeat the second and third steps to select a preset number K of cluster centers. Based on the obtained K cluster centers, use the K-means++ algorithm to iterate to obtain the final result. The average value of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard for evaluating the final clustering effect. The specific calculation formula is as follows:
[0113]
[0114] In the formula, box is the predicted box, center is the real box, and Accuracy is the average value of the maximum intersection ratio of each sample point and the cluster center.
[0115] Embodiment three:
[0116] The present embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a lightweight substation defect identification and detection method based on an improved YOLOv5s model as described in any embodiment of the present invention is implemented.
[0117] Embodiment 4:
[0118] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements a lightweight substation defect recognition and detection method based on an improved YOLOv5s model as described in any embodiment of the present invention.
[0119] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A lightweight substation defect recognition and detection method based on an improved YOLOv5s model, characterized in that: The specific steps include: Obtain the substation equipment defect data set, input it into the improved YOLOv5s model for training, and obtain a trained substation defect recognition model; Obtain images of the substation equipment to be inspected and input them into the trained substation defect recognition model for defect recognition; Among them, the improved YOLOv5s model is specifically: Construct a Bneck structure that includes a deep separable convolution and an inverse residual structure, combined with the CBAM attention mechanism; Use the Bneck structure to replace the CBS convolution block in the Bottleneck structure in the C3 structure to form a C3-Bneck structure; In the backbone extraction network of the YOLOv5s model, all C3 structures are replaced with C3-Bneck structures, and all separate CBS convolution blocks are replaced with DWConv deep convolution blocks; The K-means++ algorithm is used to replace the K-means algorithm in the original YOLOv5s model to cluster the prior boxes.
2. According to the improved YOLOv5s model of claim 1, the lightweight substation defect recognition and detection method is characterized in that: The Bneck structure includes a 1X1 dimensionality-increasing convolution layer, a 3X3 depth-separable convolution layer, a channel weight adjustment layer using a CBAM attention mechanism, and a 1X1 dimensionality-reducing convolution layer.
3. According to the improved YOLOv5s model of claim 2, the lightweight substation defect recognition and detection method is characterized in that: The channel weight adjustment layer using the CBAM attention mechanism includes a channel attention module and a spatial attention module; The features extracted by the depthwise separable convolutional layer are input into the channel attention module to weight different features, and then the weighted features are input into the spatial attention module for calculation to obtain the final adjustment result for output.
4. According to the method for detecting lightweight substation defects based on an improved YOLOv5s model according to claim 1, it is characterized in that: The steps of clustering the priori boxes by using the K-means++ algorithm to replace the K-means algorithm in the original YOLOv5s model are as follows: In the first step, a sample in the data set is randomly selected as the first cluster center; The second step is to calculate the closest distance D(X) between each sample X in the data set and the currently selected cluster center. The third step is to select the next cluster center with probability P according to the probability distribution function P. The function expression of probability P is as follows: In the fourth step, repeat the second and third steps to select a preset number K of cluster centers. Based on the obtained K cluster centers, use the K-means++ algorithm to iterate to obtain the final result. The average value of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard for evaluating the final clustering effect. The specific calculation formula is as follows: In the formula, box is the predicted box, center is the real box, and Accuracy is the average value of the maximum intersection ratio of each sample point and the cluster center.
5. A lightweight substation defect recognition and detection system based on an improved YOLOv5s model, characterized in that: include: Improve the YOLOv5s model training module, obtain the substation equipment defect data set, input it into the improved YOLOv5s model for training, and obtain a trained substation defect recognition model; The defect recognition module obtains the image of the substation equipment to be inspected and inputs it into the trained substation defect recognition model for defect recognition; Among them, the improved YOLOv5s model is specifically: Construct a Bneck structure that includes a deep separable convolution and an inverse residual structure, combined with the CBAM attention mechanism; Use the Bneck structure to replace the CBS convolution block in the Bottleneck structure in the C3 structure to form a C3-Bneck structure; In the backbone extraction network of the YOLOv5s model, all C3 structures are replaced with C3-Bneck structures, and all separate CBS convolution blocks are replaced with DWConv deep convolution blocks; The K-means++ algorithm is used to replace the K-means algorithm in the original YOLOv5s model to cluster the prior boxes.
6. According to the improved YOLOv5s model of claim 5, the lightweight substation defect recognition and detection system is characterized in that: The Bneck structure includes a 1X1 dimensionality-increasing convolution layer, a 3X3 depth-separable convolution layer, a channel weight adjustment layer using a CBAM attention mechanism, and a 1X1 dimensionality-reducing convolution layer.
7. According to the improved YOLOv5s model of claim 6, the lightweight substation defect recognition and detection system is characterized in that: The channel weight adjustment layer using the CBAM attention mechanism includes a channel attention module and a spatial attention module; The features extracted by the depthwise separable convolutional layer are input into the channel attention module to weight different features, and then the weighted features are input into the spatial attention module for calculation to obtain the final adjustment result for output.
8. According to the improved YOLOv5s model of claim 5, the lightweight substation defect recognition and detection system is characterized in that: The steps of clustering the priori boxes by using the K-means++ algorithm to replace the K-means algorithm in the original YOLOv5s model are as follows: In the first step, a sample in the data set is randomly selected as the first cluster center; The second step is to calculate the closest distance D(X) between each sample X in the data set and the currently selected cluster center. The third step is to select the next cluster center with probability P according to the probability distribution function P. The function expression of probability P is as follows: In the fourth step, repeat the second and third steps to select a preset number K of cluster centers. Based on the obtained K cluster centers, use the K-means++ algorithm to iterate to obtain the final result. The average value of the maximum intersection-over-union ratio of each sample point and the cluster center is used as the standard for evaluating the final clustering effect. The specific calculation formula is as follows: In the formula, box is the predicted box, center is the real box, and Accuracy is the average value of the maximum intersection ratio of each sample point and the cluster center.
9. 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, it implements a lightweight substation defect identification and detection method based on an improved YOLOv5s model as described in any one of claims 1 to 4.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a lightweight substation defect recognition and detection method based on an improved YOLOv5s model as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Photovoltaic module electroluminescent image defect identification method based on improved Yolov5s
CN118379234A
Livestock image target detection method and device based on lightweight YOLOv4
CN113537244A
Light-weight crack identification method based on MDCN
CN115330740A
PCB surface defect detection method based on improved YOLOv5 algorithm
CN116309427A
Edge end steel surface defect detection method based on YOLOv5s-CM
CN117934363A