Search

CN-122024038-A - YOLOv8n model-based distributed photovoltaic panel anomaly detection method under high-altitude visual angle

CN122024038ACN 122024038 ACN122024038 ACN 122024038ACN-122024038-A

Abstract

The invention discloses a YOLOv n model-based distributed photovoltaic panel anomaly detection method under a high-altitude visual angle, and belongs to the technical field of target detection. The model comprises the steps of obtaining a distributed photovoltaic panel image dataset under a high-altitude visual angle and carrying out data enhancement and labeling, constructing an improved YOLOv n model, wherein the improvement comprises the steps of introducing a C2f_AT module in a backbone network to enhance small target feature extraction capability, replacing the SPPF module with the SPPF-LSKA module to inhibit complex background interference, introducing an EMA attention mechanism in the neck network to promote multi-scale adaptability, optimizing a training process by adopting a WIoU v loss function, training and optimizing the model by using a training set, and finally outputting a detection result through a testing set. The invention effectively solves the problem of false detection and missing detection of the distributed photovoltaic panel under the high-altitude visual angle, further improves the detection precision of the distributed photovoltaic panel, and helps inspection personnel to inspect the photovoltaic panel target in an abnormal state under the high-altitude visual angle.

Inventors

  • CHANG BOWEN
  • WANG KUISHENG

Assignees

  • 西安石油大学

Dates

Publication Date
20260512
Application Date
20251230

Claims (8)

  1. 1. A YOLOv n model-based distributed photovoltaic panel anomaly detection method under a high-altitude visual angle is characterized by comprising the following steps: s1, acquiring a distributed photovoltaic panel image dataset under a high-altitude visual angle, carrying out data enhancement and labeling on the dataset, wherein labeling categories comprise normal, shielding and damage, and dividing the dataset into a training set, a verification set and a test set; s2, constructing an improved YOLOv n target detection model; S3, training the improved YOLOv n model by using a training set, and performing model verification and super-parameter tuning by using the verification set; S4, inputting the images in the test set into a trained improved model, and outputting a detection result of the distributed photovoltaic panel, wherein the detection result comprises a target position and a category confidence coefficient.
  2. 2. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on the YOLOv n model according to claim 1, wherein in the step S2, the specific steps of constructing an improved YOLOv n detection model are as follows: S2.1, introducing a convolution and attention fusion module into the C2f module to form a new C2f_AT module, and completely replacing the C2f module in the original model backbone network with the C2f_AT module; s2.2, at the end of the model backbone network, replacing the SPPF module with an SPPF-LSKA module; s2.3, introducing an EMA attention mechanism into a model neck network part; S2.4, adopting WIoU v3 as an improved loss function.
  3. 3. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on the YOLOv n model according to claim 2, wherein in the step S2.1, a C2f_AT module is constructed by a convolution and attention fusion module CAFM, and a CAFM module comprises a local branch and a global branch; The local branches fuse information among different channels through channel shuffling operation, the global branches respectively generate a query tensor Q, a key tensor K and a numerical tensor V through 1X 1 convolution and three 3X 3 depth separable convolutions, an attention weight matrix is obtained through calculating the correlation of Q and K and normalizing by a Softmax function, and the global attention output is obtained through weighting and summing the V; And carrying out addition fusion on the output characteristics of the local branches and the output characteristics of the global branches to obtain the output of the C2f_AT module.
  4. 4. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on the YOLOv n model according to claim 2, wherein in the step S2.2, the SPPF-LSKA module can separate the large convolution kernel attention mechanism enhancement feature through LSKA, and the specific process comprises the following steps: Firstly, processing input features by using standard depth convolution to generate an initial attention diagram; Then, extracting and fusing the context information with different scales by using depth expansion convolution with different expansion rates; finally, the fused attention map is weighted multiplied with the original input features for enhancing the important features and suppressing background interference.
  5. 5. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on YOLOv n model according to claim 2, wherein in the step S2.3, the workflow of the EMA efficient multi-scale attention module comprises the following steps: Coding global information through parallel branches, wherein the global information is used for realizing recalibration of channel weights; Capturing spatial association information at a pixel level by adopting a cross-dimension interaction mode; the method is used for improving the processing capacity and efficiency of the model on the characteristics by reconstructing the channel dimension and the batch dimension.
  6. 6. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on the YOLOv n model according to claim 2 is characterized in that the WIoUv loss function in S2.4 is used for reducing the influence of a low-quality example on the model, and the specific working steps of the WIoUv loss function are as follows: WIoU adopts a non-monotonic focusing mechanism, and adopts outliers to replace the cross ratio to evaluate the quality of the anchor frame by constructing dynamic gradient gain coefficients, so as to provide an intelligent gradient gain distribution strategy; WIoU are added with non-monotonic focusing coefficient r on the basis of v1 version for WIoU v version 3, which is used for enabling gradient gain to be non-monotonically changed along with the increase of loss value; CIoU loss functions in the original model were replaced with WIoU v loss functions.
  7. 7. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on YOLOv n model according to claim 1, wherein the specific operation flow of the step S3 is as follows: S3.1, on a server equipped with a high-performance GPU, a PyTorch deep learning framework, a CUDA toolkit and a cuDNN acceleration library are configured, an official or custom code library of YOLOv is installed, the improved YOLOv n model structure constructed in S2 is loaded, a loss function of the model is set to WIoU v3, and AdamW or SGD is selected as an optimizer; S3.2, creating a data loader of a training set and a verification set, wherein in each training batch, an image is input into a model, and the model is transmitted forwards through a backbone network, a neck network and a detection head to obtain a predicted boundary box and a category confidence; S3.3, comparing the predicted result with the marked true value, calculating positioning loss through WIoU v loss functions, calculating classification loss through classification loss functions, carrying out weighted summation on the two to obtain total loss, recording and outputting training loss values and learning rate changes of each epoch in real time, and periodically running model reasoning on a verification set to calculate and record key performance indexes; s3.4, diagnosing the state of the model by comparing the verification set index with the training set index; and S3.5, when training reaches a preset maximum round or an early stop mechanism is triggered, finishing the training process, loading a stored optimal model check point, and exporting a trained PyTorch model into a format which can be used for deployment.
  8. 8. The method for detecting the abnormality of the distributed photovoltaic panel under the high-altitude visual angle based on YOLOv n model according to claim 7, wherein in the step S3.4, the specific evaluation criteria for diagnosing the state of the model are as follows: If the training loss and the verification loss synchronously drop, the index synchronously rises, so that the training health is indicated; If the training loss decreases but the validation loss increases or the index stagnates, overfitting may occur; if both fall slowly, there may be under-fitting or improperly set learning rates.

Description

YOLOv8n model-based distributed photovoltaic panel anomaly detection method under high-altitude visual angle Technical Field The invention relates to the technical field of computer vision and target detection, in particular to a method for detecting abnormity of a distributed photovoltaic panel under a high-altitude visual angle based on YOLOv n model. Background With the popularization of photovoltaic power generation, the distributed photovoltaic panel is widely applied to scattered scenes such as roofs, farmlands, parking lots and the like. Traditional manual inspection methods are inefficient, costly, and difficult to cover over a wide range of areas. Unmanned aerial vehicle inspection is an important means for monitoring the photovoltaic panel state gradually due to the high-efficiency and flexible characteristics. However, the photovoltaic panel image photographed under the high-altitude visual angle has the problems of large target scale difference, complex background, high small target duty ratio and the like, so that the general target detection model is poor in performance in the scene, and false detection and omission detection are easy to occur. Currently, YOLO series-based target detection algorithms have been tried for photovoltaic panel detection, but most research has focused on photovoltaic panel surface defect identification, not fully considering multi-scale variation and complex background interference at high-altitude viewing angles. Therefore, a detection model optimized for the high-altitude inspection scene is urgently needed, and the detection precision and the robustness are improved while the instantaneity is guaranteed. Disclosure of Invention The invention aims to provide a method for detecting the abnormality of a distributed photovoltaic panel under a high-altitude visual angle based on YOLOv n model, which solves the problems of poor scale adaptation, strong background interference, small target omission and the like in the prior art when the distributed photovoltaic panel is detected under the high-altitude visual angle. Therefore, the invention provides a method for detecting the abnormality of a distributed photovoltaic panel under a high-altitude visual angle based on YOLOv n model, which comprises the following steps: s1, acquiring a distributed photovoltaic panel image dataset under a high-altitude visual angle, carrying out data enhancement and labeling on the dataset, wherein labeling categories comprise normal, shielding and damage, and dividing the dataset into a training set, a verification set and a test set; s2, constructing an improved YOLOv n target detection model; S3, training the improved YOLOv n model by using a training set, and performing model verification and super-parameter tuning by using the verification set; S4, inputting the images in the test set into a trained improved model, and outputting a detection result of the distributed photovoltaic panel, wherein the detection result comprises a target position and a category confidence coefficient. Preferably, in the step S2, the specific steps for constructing the improved YOLOv n detection model are as follows: S2.1, introducing a convolution and attention fusion module into the C2f module to form a new C2f_AT module, and completely replacing the C2f module in the original model backbone network with the C2f_AT module; s2.2, at the end of the model backbone network, replacing the SPPF module with an SPPF-LSKA module; s2.3, introducing an EMA attention mechanism into a model neck network part; S2.4, adopting WIoU v3 as an improved loss function. Preferably, in step S2.1, the c2f_at module is constructed by a convolution and attention fusion module CAFM, and the CAFM module includes a local branch and a global branch; The local branches fuse information among different channels through channel shuffling operation, the global branches respectively generate a query tensor Q, a key tensor K and a numerical tensor V through 1X 1 convolution and three 3X 3 depth separable convolutions, an attention weight matrix is obtained through calculating the correlation of Q and K and normalizing by a Softmax function, and the global attention output is obtained through weighting and summing the V; And carrying out addition fusion on the output characteristics of the local branches and the output characteristics of the global branches to obtain the output of the C2f_AT module. Preferably, in the step S2.2, the SPPF-LSKA module may separate the large convolution kernel attention mechanism enhancement feature by LSKA, and the specific process includes: Firstly, processing input features by using standard depth convolution to generate an initial attention diagram; Then, extracting and fusing the context information with different scales by using depth expansion convolution with different expansion rates; finally, the fused attention map is weighted multiplied with the original input features for enhancing the important f