Electric power scene defect detection method and device and storage medium
By improving the YOLOX network model and building customized data sets, the problem of small target defect detection in complex power environments is solved, and high-precision and high-efficiency power scene defect detection is achieved, meeting the real-time operation and maintenance needs of the power grid.
Patent Information
- Application Number
- CN202410948699.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-11-08
AI Technical Summary
The existing technology is difficult to accurately detect small target defects in complex power environments, traditional detection methods cannot meet the operation and maintenance needs of modern power grids, and deep learning technology lacks customized data sets and is difficult to adapt to complex environments.
Adopting an improved model based on YOLOX network, by replacing the CSEA module to the improved CSEA module, the SPP module to the NSPPF module and the CBS module to the GMP module, and introducing the IOU-Based Focal Loss function, build preprocessing and enhanced data sets, using mixup and mosaic Technology enhances data to improve the generalization ability and detection accuracy of the model.
It significantly improves the accuracy of small target defect detection and model training efficiency in complex power scenarios, solves the problem of mismatch between category scores and position positioning scores, and meets the real-time detection needs.
Smart Images

Figure CN118918434A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method, a device and a storage medium for detecting defects in an electric power scene, and belongs to the technical field of detecting defects in an electric power scene. Background Art
[0002] With the booming economy and the continuous improvement of residents' living standards, the dependence on electricity resources is also increasing. This has led to the rapid expansion of the power grid structure, and at the same time has put forward higher requirements for the intelligent monitoring technology of the power system. In the power scenario, defect detection technology is particularly important, which is the key to ensure the stability and safe operation of the power grid. Faced with the rising power demand and the expansion of the power grid, traditional monitoring methods can no longer meet the operation and maintenance needs of modern power grids. Especially in complex power environments, defect detection requires more accurate and flexible technologies. Therefore, advanced power scenario defect detection technology can not only improve the operating efficiency of the power grid, but also provide strong technical support for the safe management of the power grid.
[0003] Although the application of deep learning technology in power system defect detection has made breakthroughs, it still faces many challenges. At present, there is no customized data set suitable for this field in China, which limits the further research and practical application of deep learning technology. In addition, the importance of power grid monitoring is not only reflected in ensuring the safety of electricity use, but also involves national security. Therefore, the deployment of monitoring equipment and data processing must follow strict standards. The complexity of the power environment, such as variable equipment types, lighting conditions and climate change, also puts high standards on the accuracy and adaptability of defect detection models.
[0004] The monitoring points of power systems are extensive, including equipment status, environmental assessment, safety inspection, data reading, defect measurement, and monitoring of display screens and indicator signs. Traditional detection technologies such as frame difference method and optical flow technology, HOG (Histogram of Oriented Gradients) algorithm and Haar algorithm are effective in simple backgrounds, but are limited in the complex environment of the power industry, especially for small target defects in complex environments that are difficult to detect. Summary of the invention
[0005] The purpose of the present invention is to provide a method, device and storage medium for detecting defects in power scenarios, so as to realize the detection of small target defects in power scenarios under complex environments.
[0006] To achieve the above objectives, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides a method for detecting defects in an electric power scene, comprising: Acquire preprocessed power scene images; Inputting the power scene image into a trained power scene defect detection model to obtain the power scene defects contained in the power scene image, and completing the power scene defect detection; The power scenario defect detection model is obtained based on the improvement of the YOLOX network, and the improvement includes: replacing the CSEA module with an improved CSEA module, replacing the SPP module with an NSPPF module, and replacing the CBS module with a GMP module; During the training process, an IOU-Based Focal Loss function is used as a loss function, and the IOU-Based Focal Loss function is obtained by introducing an IOU value into a Focal Loss function.
[0007] Furthermore, the preprocessing includes: acquiring the original image of the power scene and converting it into a format that can be processed by the power scene defect detection model to obtain a preprocessed power scene image.
[0008] Furthermore, the data sets used in the training process are a pre-constructed power scenario defect data set and a pre-constructed enhanced power scenario defect data set. The data set used at the beginning of training is the enhanced power scenario defect data set, until the data set used is changed to the power scenario defect data set when a preset number of training rounds is reached; The power scenario defect dataset is constructed by the following method: Obtain power scene related data in the open source database and the power scene original image collected from the power scene, put all the acquired data into a data set to obtain a power scene defect data set, and the power scene defect data set includes instrument status, operating environment, personnel working environment, instrument reading, defect area calculation results, indoor LCD instrument panel indicator light and identification status; The enhanced power scenario defect dataset is constructed by the following method: Label all data in the power scenario defect dataset, including: drawing bounding boxes and marking target categories of the data using the LabelImg labeling tool; The annotated data in the power scenario defect dataset is enhanced through mixup technology and mosaic technology to obtain an enhanced power scenario defect dataset.
[0009] Furthermore, the input feature map is processed as follows in the improved CSEA module: Perform average pooling on the input feature map in the X direction and the Y direction respectively, and concatenate the two feature maps obtained by the average pooling to obtain a concatenated feature map; The concatenated feature maps are uniformly processed through a cross-stage partial network structure to obtain a unified feature map; The unified feature map is divided into multiple small blocks in the height and width directions, and features are extracted for each small block to obtain each feature small block, and global maximum pooling is performed on each feature small block, and then the attention weight of each feature small block is calculated according to the Sigmoid activation function; All attention weights are expanded in height and width to match the size of the input feature map, and all the expanded attention weights are multiplied by the input feature map and then output.
[0010] Furthermore, the NSPPF module is improved based on the SPP module, and the improvements include: The parallel maximum pooling in the SPP module is changed to serial maximum pooling, and the pooling kernel size is unified to obtain the SPPF module; Add the ECA module to the SPPF module to obtain the NSPPF module; Among them, after the ECA module is added to the SPPF module, the ECA module performs global average pooling and 1D convolution on the input feature map to calculate the channel weight, and weights it through the Sigmoid function to obtain the ECA output feature map. In the NSPPF module, the ECA output feature map and the feature map output by the SPPF module are fused and output.
[0011] Furthermore, the input feature map is processed as follows in the GMP module: The input feature map is first processed by maximum pooling, and then processed by ghost convolution to adjust the number of channels to generate the first stage feature map; The first-stage feature map is processed by ghost convolution to adjust the number of channels, and then the first-stage feature map is processed by ghost convolution with a step size of 2 to reduce the size to generate the second-stage feature map; The first stage feature map and the second stage feature map are concatenated and output; The ghost convolution processes the feature map by ordinary convolution and grouped convolution.
[0012] Furthermore, the expression of the IOU-Based Focal Loss function is: ; Among them, IFL is the value of the IOU-Based Focal Loss function, q is the IOU value of the generated target prediction boundary and the true boundary, p is the IOU value of the predicted boundary and the true boundary, α is the first adjustment factor in the Focal Loss loss function, and γ is the second adjustment factor in the Focal Loss loss function. is the total adjustment factor, and -[qlogp+(1-q)log(1-p)] is the cross entropy loss.
[0013] Furthermore, after training, the power scene defect detection model also undergoes a verification of detection accuracy. The verification uses AP and FPS as evaluation indicators. AP is used to evaluate the detection accuracy of the power scene defect detection model, and FPS is used to evaluate the processing speed of the power scene defect detection model. When both the AP and FPS of the power scenario defect detection model meet the preset requirements, the training is terminated; otherwise, the training is continued until both the AP and FPS meet the preset requirements.
[0014] In a second aspect, the present invention provides a power scene defect detection device, comprising: The power scene image acquisition module is configured to: acquire the pre-processed power scene image; The power scene defect detection module is configured to: input the power scene image into a trained power scene defect detection model, obtain the power scene defects contained in the power scene image, and complete the power scene defect detection; The power scenario defect detection model is obtained based on the improvement of the YOLOX network, and the improvement includes: replacing the CSEA module with an improved CSEA module, replacing the SPP module with an NSPPF module, and replacing the CBS module with a GMP module; During the training process, an IOU-Based Focal Loss function is used as a loss function, and the IOU-Based Focal Loss function is obtained by introducing an IOU value into a Focal Loss function.
[0015] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which, when executed by a processor, implements the steps of the power scene defect detection method described in any one of the first aspects.
[0016] Compared with the prior art, the beneficial effects achieved by the present invention are: The present invention provides a method, device and storage medium for defect detection in power scenarios. By introducing an improved CSEA module and improving the YOLOX network, the present invention effectively reduces the interference of complex background on target detection, and at the same time enhances the ability to capture small target features through the GMP module and the NSPPF module, thereby significantly improving the accuracy of small target defect detection in complex power scenarios. The constructed enhanced power scene defect dataset provides rich samples for power scene defect detection, covering a variety of defect types, scales and colors, so that the YOLOSM model (the power scene defect detection model constructed by the present invention) can learn more comprehensive feature representations during the training process, thereby enhancing the generalization ability of the model in practical applications and realizing accurate detection of diverse defects in complex environments; The lightweight optimization of the YOLOX framework and the proposed IOU-Based Focal Loss loss function not only improve the training efficiency of the model, but also solve the problem of mismatch between category scores and location scores, so that the YOLOSM model maintains high accuracy while also having a faster reasoning speed, meeting the needs of real-time detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flow chart of a power scene defect detection method provided by an embodiment of the present invention; Figure 2 is a schematic diagram of a power scenario defect detection model provided by an embodiment of the present invention; Figure 3 is a schematic diagram of an improved CSEA module provided by an embodiment of the present invention; Figure 4 It is a schematic diagram of the NSPPF module provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the protection scope of the present invention.
[0019] Example 1.
[0020] The experimental environment of this embodiment is as follows: The GPU (graphics processing unit) is NVIDIA GeForce RTX 3080 Ti, the CPU (central processing unit) is Intel(R)Core(TM) i7-10750H, CUDA (Compute Unified Device Architecture, a computing platform) / CUDNN (CUDA Deep Neural Network library, a deep learning GPU acceleration library) is CUDA 11.3 / CUDNN 8.0.5, and the operating system is Windows 10 Professional.
[0021] like Figure 1 As shown, the present invention provides a method for detecting defects in an electric power scene, comprising the following steps: S1. Obtain a preprocessed power scene image.
[0022] After obtaining the original image of the power scene, it is converted into a format that can be processed by the power scene defect detection model to obtain a preprocessed power scene image.
[0023] S2. Input the power scene image into a trained power scene defect detection model to obtain the power scene defects contained in the power scene image, and complete the power scene defect detection.
[0024] In this embodiment, the data set used by the power scenario defect detection model during the training process includes a pre-constructed power scenario defect data set and a pre-constructed enhanced power scenario defect data set. The data set used at the beginning of training is the enhanced power scenario defect data set until the preset number of training rounds is reached, when the data set used is changed to the power scenario defect data set.
[0025] The power scenario defect dataset is constructed by the following method: The power scene related data in the open source database and the power scene original images collected from the power scene are obtained, and all the obtained data are put into a data set to obtain a power scene defect data set, and a power scene defect data set including multi-dimensional information such as instrument status, operating environment, personnel working environment, instrument readings, defect area calculation results, indoor LCD instrument panel indicator lights and identification status is obtained.
[0026] The enhanced power scenario defect dataset is constructed by the following method: Label all data in the power scenario defect dataset, including: drawing bounding boxes and marking the target categories of the data using the LabelImg labeling tool to ensure the consistency of category definitions and the accuracy of bounding box labeling; then, perform data cleaning to remove incorrect labels; The annotated data in the power scenario defect dataset is enhanced through mixup technology and mosaic technology to obtain an enhanced power scenario defect dataset.
[0027] The use of mixup technology and mosaic technology can improve the accuracy and generalization ability of target detection models in complex environments. Mixup technology provides the model with diverse background information by randomly mixing two images and adjusting their labels, thereby enhancing the model's adaptability to images under different angles and time conditions. However, since it may cause image distortion, the present invention recommends turning off mixup enhancement in the final stage of network training. Mosaic technology combines four images and their labels, which not only enriches the image background, but also increases the batch size in the batch normalization process, which helps the model learn the global features of the image more effectively. The application of these two technologies significantly improves the performance of the model in complex monitoring environments such as substations, while avoiding unreal feature learning caused by data enhancement.
[0028] In this embodiment, the first 270 rounds of training use an enhanced power scenario defect dataset, in which enhancement by mixup technology and enhancement by mosaic technology each account for 50%. Data enhancement helps the model learn richer feature representations and improve generalization capabilities. In the last 30 rounds of training, data enhancement is turned off and the power scenario defect dataset is used for training to enable the model to recover from the impact of data enhancement and better fit real samples.
[0029] In this embodiment, the training process uses a newly constructed loss function IOU-Based Focal Loss function for training.
[0030] Traditional target detection loss functions usually consist of three parts: classification loss (Cls), regression loss (Reg), and confidence loss (Obj). However, in complex environments such as power scenarios, these loss functions may not be able to effectively handle the problem of extreme imbalance between positive and negative samples, as well as the mismatch between classification scores and positioning scores. To address the imbalance between positive and negative samples, the Focal Loss function is introduced. Through the first adjustment factor α and the second adjustment factor γ, it automatically focuses on difficult-to-classify samples, thereby improving the model's sensitivity to a small number of positive samples.
[0031] The expression of the Focal Loss function is: ; in, L is the value of the Focal Loss function, p represents the predicted probability, and y represents whether the sample is a positive sample, which is 1 if it is and 0 if it is not.
[0032] In order to solve the problem of mismatch between classification scores and positioning scores, the present invention proposes an IOU-Based FocalLoss function; combining the idea of Focal Loss and the IOU value, by introducing the IOU values p and q of the target prediction boundary and the true boundary, the loss function is optimized, so that the model pays more attention to the prediction box with high IOU; the expression of the IOU-Based Focal Loss function is: ; Among them, IFL is the value of the IOU-Based Focal Loss function, q is the IOU value of the generated target prediction boundary and the true boundary, p is the IOU value of the predicted boundary and the true boundary, α is the first adjustment factor in the Focal Loss loss function, and γ is the second adjustment factor in the Focal Loss loss function. is the total adjustment factor, and -[qlogp+(1-q)log(1-p)] is the cross entropy loss.
[0033] The design of the new loss function enables the model to consider the accuracy of classification and positioning at the same time during training, and strengthens the optimization of high IOU prediction boxes through the confidence loss in the form of a product.
[0034] After the preset number of training rounds, the power scene defect detection model needs to be verified before it can be used for power scene defect detection. AP (average precision) and FPS (the number of images that the object detector can process per second) are used as evaluation indicators to measure the detection accuracy and processing speed of the model respectively. The average precision is determined by calculating the average value of the precision and recall rate obtained by the model at different confidence thresholds.
[0035] AP (Average Precision) is a measure of the area under the precision-recall curve. When there are multiple categories, mAP (mean Average Precision) is the mean of the AP values of all categories, providing a single indicator of the overall performance of the model. The frame rate represents the number of frames that the model can process per second. AP50 measures the average accuracy when the model confidence is at least 50%, while AP70 is evaluated at a higher confidence threshold of 70%. The higher the FPS value, the better the model's performance in real-time processing, and can meet the detection needs of high-speed video streams or dynamic scenes.
[0036] When both the AP and FPS of the power scenario defect detection model meet the preset requirements, the training is terminated; otherwise, the training is continued until both the AP and FPS meet the preset requirements.
[0037] In this embodiment, the power scene defect detection model (structure as shown in FIG. Figure 2The improvement is based on the YOLOX network, and the improvements include: replacing the CSEA module with an improved CSEA module, replacing the SPP module with an NSPPF module, and replacing the CBS module with a GMP module.
[0038] Figure 2 In the figure, Focus represents the Focus module in the YOLOX network, which performs a slice operation on the image (Slice in the figure); CBS represents the CBS module, C represents Conv (convolution), B represents BatchNorm2d function, S represents SiLu activation function, and the CBS module encapsulates the combined operation of convolution, batch normalization, and activation function; CSEA represents the CSEA module; GMP represents the GMP module; Concat represents concatenation; Reshape represents the Reshape function; NSPPF represents the NSPPF module; UpSample represents upsampling.
[0039] Improve the structure of CSEA module such as Figure 3 As shown in Figure 1, the improvement of the CSEA module lies in designing an EFEM module in CSEA to enhance the feature extraction capability and suppress the gradient transfer of useless information. The EFEM module first performs average pooling on the input feature map in the X and Y directions. This step enables the feature map to capture a wider range of contextual information and enhances the model's perception of long-distance semantic features. The two parts of the feature map after average pooling are then spliced together. Then, the Cross Stage Partial The CBS structure is further processed to obtain a unified feature representation (a unified feature map); the unified feature map is divided into multiple small blocks in the height (H) and width (W) directions, and these small blocks are further subjected to feature extraction to achieve decoupling of features in the spatial dimension; a global maximum pooling operation is performed on each divided feature block, and the attention weight of each feature block is calculated in conjunction with the Sigmoid activation function. This step enables the model to identify which features are important and which are not important; the calculated attention weights are expanded in the H and W directions to match the size of the feature map of the original input; then, these attention weights are multiplied with the feature map of the original input, which enhances useful features while suppressing the influence of useless features; finally, the feature maps processed by the above steps are integrated to form the output result of the improved CSEA module, which will be used in subsequent network layers.
[0040] Figure 3 In the figure, Res Unit represents residual unit; ADD represents ADD function; EFEM represents EFEM module.
[0041] Using the NSPPF module instead of the SPP module enhances the model's ability to detect multi-scale targets; the structure of the NSPPF module is as follows: Figure 4 As shown in the figure. The YOLOX model uses the SPP module as the end of the backbone network, extracts multi-scale features through maximum pooling of different sizes, and adjusts the number of feature map channels through 1×1 convolution kernels to achieve feature fusion. However, the SPP module may retain repeated or useless feature information when processing complex scenes. Based on SPP, the SPPF structure is introduced, the parallel maximum pooling is changed to serial, and the pooling kernel size is unified to 5, which significantly improves the inference speed of the model without affecting the number of parameters. On the basis of SPPF, the Efficient Channel Attention Module (ECA) is introduced, and the NSPPF module is proposed. The ECA module calculates channel weights through global average pooling and 1D convolution, and weights them through the Sigmoid function, which effectively suppresses repeated and useless feature information. The feature map after the ECA module is fused with the original feature map to reduce the feature loss caused by the maximum pooling operation, thereby improving the accuracy of the model.
[0042] The GMP module is designed to replace the CBS module to achieve lightweight network and feature fusion; the design of the GMP module fully considers the balance between computational efficiency and feature extraction capabilities, and significantly improves the performance of the model by combining the maximum pooling operation and the Ghost Conv (ghost convolution) technology. The core of the GMP module lies in its unique two-stage processing flow. In the first stage, the feature map first undergoes the maximum pooling operation to quickly reduce the size, and then Ghost Conv is applied to adjust the number of channels to generate the feature map F_1 (first stage feature map). In the second stage, after the feature map adjusts the number of channels through Ghost Conv, the size is further reduced by Ghost Conv with a step size of 2 to obtain the feature map F_2 (second stage feature map). Through this design, the GMP module not only inherits the advantages of maximum pooling in extracting texture features and fast calculation, but also reduces the number of model parameters through GhostConv, effectively improving the inference speed. Ghost Conv technology is another key innovation of the GMP module. It generates redundant feature maps through grouped convolution while reducing the number of parameters. The two-part design of Ghost Conv - ordinary convolution calculation and grouped convolution - work together on the feature map to achieve linear calculation effect while keeping the model lightweight. Finally, the GMP module splices the two feature maps F_1 and F_2 to achieve feature fusion and complementarity, enhancing the model's ability to capture multi-scale and multi-angle features. This feature fusion strategy not only enriches feature representation, but also helps improve the model's generalization ability and detection accuracy in complex scenarios.
[0043] The preprocessed power scene image obtained in step S1 is input into the power scene defect detection model trained in step S2 to obtain the power scene defects contained in the power scene image, thereby completing the power scene defect detection.
[0044] Example 2.
[0045] The present invention provides a power scene defect detection device, comprising: The power scene image acquisition module is configured to: acquire the pre-processed power scene image; The power scene defect detection module is configured to: input the power scene image into a trained power scene defect detection model, obtain the power scene defects contained in the power scene image, and complete the power scene defect detection; Among them, the power scene defect detection model is obtained based on the improvement of YOLOX network. The improvements include: replacing the CSEA module with the improved CSEA module, replacing the SPP module with the NSPPF module, and replacing the CBS module with the GMP module; During the training process, the IOU-Based Focal Loss function is used as the loss function. The IOU-Based Focal Loss function is obtained by introducing the IOU value into the Focal Loss function.
[0046] Example 3.
[0047] The present invention provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the power scene defect detection method provided in Example 1 are implemented: Acquire preprocessed power scene images; Inputting the power scene image into a trained power scene defect detection model to obtain the power scene defects contained in the power scene image, and completing the power scene defect detection; Among them, the power scene defect detection model is obtained based on the improvement of YOLOX network. The improvements include: replacing the CSEA module with the improved CSEA module, replacing the SPP module with the NSPPF module, and replacing the CBS module with the GMP module; During the training process, the IOU-Based Focal Loss function is used as the loss function. The IOU-Based Focal Loss function is obtained by introducing the IOU value into the Focal Loss function.
[0048] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0049] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0050] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0051] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0052] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for detecting defects in power scenarios, It is characterized in that include: Acquire preprocessed power scene images; Inputting the power scene image into a trained power scene defect detection model to obtain the power scene defects contained in the power scene image, and completing the power scene defect detection; The power scenario defect detection model is obtained based on the improvement of the YOLOX network, and the improvement includes: replacing the CSEA module with an improved CSEA module, replacing the SPP module with an NSPPF module, and replacing the CBS module with a GMP module; During the training process, an IOU-Based Focal Loss function is used as a loss function, and the IOU-Based Focal Loss function is obtained by introducing an IOU value into a Focal Loss function.
2. The power scene defect detection method according to claim 1, It is characterized in that The preprocessing includes: acquiring the original image of the power scene and converting it into a format that can be processed by the power scene defect detection model to obtain a preprocessed power scene image.
3. The power scene defect detection method according to claim 1, It is characterized in that The data sets used in the training process are a pre-constructed power scenario defect data set and a pre-constructed enhanced power scenario defect data set. The data set used at the beginning of training is the enhanced power scenario defect data set, and the data set used is changed to the power scenario defect data set when a preset number of training rounds is reached; The power scenario defect dataset is constructed by the following method: Obtain power scene related data in the open source database and the power scene original image collected from the power scene, put all the acquired data into a data set to obtain a power scene defect data set, and the power scene defect data set includes instrument status, operating environment, personnel working environment, instrument reading, defect area calculation results, indoor LCD instrument panel indicator light and identification status; The enhanced power scenario defect dataset is constructed by the following method: Label all data in the power scenario defect dataset, including: drawing bounding boxes and marking target categories of the data using the LabelImg labeling tool; The annotated data in the power scenario defect dataset is enhanced through mixup technology and mosaic technology to obtain an enhanced power scenario defect dataset.
4. The power scene defect detection method according to claim 1, It is characterized in that In the improved CSEA module, the input feature map is processed as follows: Perform average pooling on the input feature map in the X direction and the Y direction respectively, and concatenate the two feature maps obtained by the average pooling to obtain a concatenated feature map; The concatenated feature maps are uniformly processed through a cross-stage partial network structure to obtain a unified feature map; The unified feature map is divided into multiple small blocks in the height and width directions, and features are extracted for each small block to obtain each feature small block, and global maximum pooling is performed on each feature small block, and then the attention weight of each feature small block is calculated according to the Sigmoid activation function; All attention weights are expanded in height and width to match the size of the input feature map, and all the expanded attention weights are multiplied by the input feature map and then output.
5. The power scene defect detection method according to claim 1, It is characterized in that The NSPPF module is improved based on the SPP module, and the improvements include: The parallel maximum pooling in the SPP module is changed to serial maximum pooling, and the pooling kernel size is unified to obtain the SPPF module; Add the ECA module to the SPPF module to obtain the NSPPF module; Among them, after the ECA module is added to the SPPF module, the ECA module performs global average pooling and 1D convolution on the input feature map to calculate the channel weight, and weights it through the Sigmoid function to obtain the ECA output feature map. In the NSPPF module, the ECA output feature map and the feature map output by the SPPF module are fused and output.
6. The power scene defect detection method according to claim 1, It is characterized in that In the GMP module, the input feature map is processed as follows: The input feature map is first processed by maximum pooling, and then processed by ghost convolution to adjust the number of channels to generate the first stage feature map; The first-stage feature map is processed by ghost convolution to adjust the number of channels, and then the first-stage feature map is processed by ghost convolution with a step size of 2 to reduce the size to generate the second-stage feature map; The first stage feature map and the second stage feature map are concatenated and output; The ghost convolution processes the feature map by ordinary convolution and grouped convolution.
7. The power scene defect detection method according to claim 1, It is characterized in that The expression of the IOU-Based FocalLoss function is: ; Among them, IFL is the value of the IOU-Based Focal Loss function, q is the IOU value of the generated target prediction boundary and the true boundary, p is the IOU value of the target prediction boundary and the true boundary, α is the first adjustment factor in the Focal Loss loss function, and γ is the second adjustment factor in the Focal Loss loss function. is the total adjustment factor, and -[qlogp+(1-q)log(1-p)] is the cross entropy loss.
8. The power scene defect detection method according to claim 1, It is characterized in that After training, the power scene defect detection model also performs a verification of detection accuracy. The verification uses AP and FPS as evaluation indicators. AP is used to evaluate the detection accuracy of the power scene defect detection model, and FPS is used to evaluate the processing speed of the power scene defect detection model. When both the AP and FPS of the power scenario defect detection model meet the preset requirements, the training is terminated; otherwise, the training is continued until both the AP and FPS meet the preset requirements.
9. A power scene defect detection device, It is characterized in that include: The power scene image acquisition module is configured to: acquire the pre-processed power scene image; The power scene defect detection module is configured to: input the power scene image into a trained power scene defect detection model, obtain the power scene defects contained in the power scene image, and complete the power scene defect detection; The power scenario defect detection model is obtained based on the improvement of the YOLOX network, and the improvement includes: replacing the CSEA module with an improved CSEA module, replacing the SPP module with an NSPPF module, and replacing the CBS module with a GMP module; During the training process, an IOU-Based Focal Loss function is used as a loss function, and the IOU-Based Focal Loss function is obtained by introducing an IOU value into a Focal Loss function.
10. A computer-readable storage medium having a computer program / instructions stored thereon, It is characterized in that When the computer program / instruction is executed by a processor, the steps of the power scene defect detection method described in any one of claims 1-8 are implemented.
