Photovoltaic pose recognition method based on improved YOLOv8n algorithm model
By improving the YOLOv8n algorithm model and introducing the MPDIoU boundary box regression loss function, the photovoltaic panel position data set was constructed, which solved the cleaning difficulties caused by inconsistent photovoltaic panel arrays, and achieved efficient identification and adaptive cleaning of photovoltaic panel position.
Patent Information
- Application Number
- CN202411599988.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively identify and adapt to the position changes of photovoltaic panels, especially in photovoltaic power stations in the northwest region. Due to the flat terrain and changes in the sunlight irradiation angle, the photovoltaic panel array is not uniform, resulting in manual cleaning or mechanical cleaning being unsuitable.
The photovoltaic position recognition method based on the improved YOLOv8n algorithm model is adopted, and the photovoltaic plate position data set is constructed, the YOLOv8n-PP model is built, and the MPDIoU boundary box regression loss function is introduced to realize the adaptive recognition of the photovoltaic plate position.
The accuracy, recall and average accuracy average value of photovoltaic panel pose recognition is improved, the number of floating-point operations is reduced, the detection frame rate is improved, and the application and flexibility are achieved without manual interference to adjust the cleaning equipment.
Smart Images

Figure CN119540352A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a photovoltaic posture recognition method based on an improved YOLOv8n algorithm model. Background Art
[0002] Photovoltaic power generation is a key component of my country's efforts to build a clean, low-carbon, safe, and efficient energy system. China has become the world's largest photovoltaic power generation market and the country with the largest photovoltaic power generation capacity. During operation, photovoltaic panels are coated with a layer of dust. Under normal illumination conditions, uncleaned panels can reduce power generation efficiency by 15%, accelerate panel aging, and in severe cases, cause fires. Therefore, photovoltaic panel cleaning is essential.
[0003] Photovoltaic power stations in the northwest region are mostly located in flat, desert areas, with neatly arranged photovoltaic arrays. However, due to factors such as topography and sunlight angle, the photovoltaic arrays in most fields are not uniformly oriented or aligned. Similarly, some arrays have large gaps between adjacent photovoltaic panels. This makes manual cleaning or mechanical cleaning methods unsuitable for cleaning these types of photovoltaic arrays. Therefore, it is necessary to introduce visual deep learning object detection algorithms to adaptively identify the current position of the photovoltaic panels to be cleaned. This algorithm has higher adaptability and flexibility, eliminating the need for manual intervention to adjust the cleaning equipment, and realizing photovoltaic position detection functions, which provides the prerequisites for the implementation of other tasks and functions of the photovoltaic intelligent cleaning vehicle. Summary of the Invention
[0004] The purpose of the present invention is to provide a photovoltaic posture recognition method based on an improved YOLOv8n algorithm model to solve the problems existing in the above background technology.
[0005] To achieve the above objectives, the present invention provides a photovoltaic posture recognition method based on an improved YOLOv8n algorithm model, comprising the following steps:
[0006] S1. Construct a photovoltaic panel pose dataset, including
[0007] Data acquisition; obtaining multi-angle pose images of photovoltaic panels;
[0008] Data expansion and data enhancement: Use data enhancement technology to increase the diversity and quantity of deep learning training data, simulate various situations and changes that may be encountered in the real world, and enable the model to better adapt to different scenarios and conditions, thereby improving the generalization and robustness of the model. In the data preprocessing stage, the data is losslessly compressed and normalized; in the data enhancement stage, the data enhancement methods used include adding noise, horizontal flipping, blurring, brightness transformation, scaling, translation and rotation transformation, etc., and finally expanding the data set; in order to ensure the robustness and generalization ability of the model, all samples are randomly divided in a ratio of 8:1:1 to obtain the divided training set samples, validation set samples and test set samples;
[0009] Data labeling is the process of converting the location and category information of photovoltaic panels in an image into a digital form that can be recognized by a computer, in order to facilitate model training and prediction. The photovoltaic panel pose dataset is annotated using the labeling program Labelme. The "Create RectBox" rectangular target selection tool provided by Labelme is more suitable for annotating photovoltaic panels with variable poses at different angles. For labels of the same type, the system will automatically distinguish and set the label boxes of the same category to the same color the next time they are annotated. Due to the compact arrangement of photovoltaic panels in photovoltaic sites and the fact that multiple photovoltaic panels can be seen from the same viewing angle, when annotating photovoltaic panel poses, the same pose is repeatedly annotated to improve the robustness of the algorithm model.
[0010] S2. Build an improved YOLOv8n-PP model based on the YOLOv8n algorithm and introduce the MPDIoU bounding box regression loss function to realize photovoltaic panel pose recognition and detection;
[0011] S3. Evaluate the performance of the YOLOv8n-PP model, specifically using precision P, recall R, mean average precision (mAP), F1 score, number of floating-point operations, and detection frame rate as evaluation indicators.
[0012] Preferably, the YOLOv8n-PP model specifically includes:
[0013] Input, preprocess the data in S1; compared to YOLOv5, YOLOv8 introduces a multi-scale detection function, which enables the model to perform target detection on images of different sizes and can work in a wider range of scenarios; In addition, during the data preprocessing stage, the pixel values of each channel of the image (usually red, green, and blue channels) are normalized to ensure that they are within a specific range, usually between 0 and 1 or between -1 and 1, which helps improve the model's ability to better handle different image brightness and contrast; Finally, batch processing is introduced to process multiple images simultaneously to improve processing efficiency;
[0014] Backbone, specifically the Mobile-ViT backbone network, is used for feature extraction. As an efficient and lightweight visual ViT model, Mobile-ViT offers greater deployment flexibility and adaptability, making it easily applicable to outdoor mobile smart photovoltaic cleaning vehicles. Compared to traditional ViT models, Mobile-ViT has a simpler structure and fewer parameters, enabling efficient computation even with limited computing resources. This allows it to better meet the practical needs of smart photovoltaic cleaning vehicles in real-world environments.
[0015] Mobile-ViT is a lightweight visual Transformer model for image classification and detection. The ViT (Vision Transformer) divides the input image into a series of fixed-size patches (patches). These patches are then processed by the Transformer model. These patches are flattened into vectors and linearly transformed in an embedding layer, mapping each patch into a one-dimensional vector (considered as a token), which serves as the fixed-dimensional vector representation of the initial input. Positional bias information is added to convey positional information between patches to the model. The initial input is passed to a multi-layer Transformer encoder, which uses self-attention to learn the relationships between different positions of the patches. The output of each encoder layer is called an attention representation, which encodes the importance of the current patch and is independently calculated at each position. Furthermore, the input vector is grouped into multiple "heads" that simultaneously perform self-attention operations and merge their results. The results are then fed into a tensor feedforward network for additional nonlinear transformations. The output of the final Transformer encoder layer is aggregated through a global average pooling layer to produce the final feature representation of the image. These features are processed through a final linear layer using a softmax function, resulting in a probability distribution equal to the number of categories. These designs enable MobileViT to adaptively process input images of any size and capture global information, making it suitable for object detection tasks. While ViT and its variants have achieved impressive performance, current Transformer models still suffer from several issues, based on the principles of the Transformer. First, the large number of parameters and high computational requirements limit the deployment flexibility and adaptability of these models, making them difficult to widely use in real-world scenarios. Second, traditional Transformer models lack a spatial inductive bias, meaning that pure Transformers are insensitive to spatial position information, which is crucial in vision applications. To address this, ViT introduces positional encoding. However, the sequence length of these absolute positional encodings is consistent with the length of the input sequence, requiring the input image size to be pre-determined during model training. Subsequent resizing of the input image during training affects the length of the positional encoding sequence, rendering it untrainable. To address this, interpolation methods have been proposed to interpolate the absolute positional encodings to the same length as the input sequence. However, this results in decreased model performance, necessitating further fine-tuning of the model.Therefore, relative position encoding is used, such as the Swin Transformer. This encoding is only dependent on the window size, but when migrating to other tasks, the image scale may vary significantly, and fine-tuning is still required. This problem makes the Transformer model difficult to migrate to other tasks and limits its flexibility and versatility in practical applications. Finally, the model is difficult to train, requiring more training data, a larger L2 regularization, more data augmentation, and more epochs. It is also relatively sensitive to data augmentation. These issues make training an efficient and accurate Transformer model even more difficult.
[0016] Neck is used to fuse feature maps at different levels to build a feature pyramid, which helps the model process multi-scale information more effectively and perform learning and reasoning. The Neck part adopts the PANet structure, the core of which includes the feature pyramid network FPN and the path aggregation network PAN. FPN first constructs a feature pyramid by extracting feature maps, and then fuses features from the top to the bottom to achieve multi-scale information fusion. However, using only FPN will lead to the loss of target position information. PAN, as a supplement to FPN, adopts a bottom-up structure and fuses feature maps from different levels through convolutional layers, which can more accurately retain spatial information. The combination of FPN and PAN realizes the comprehensive fusion of upper and lower information flows of the feature pyramid network, thereby improving the target detection performance of the network;
[0017] The head employs strategies such as multi-stage prediction and cross-feature map connections. Multiple feature maps output by the neck are fused according to specific rules to generate a global feature vector. This feature vector is used to encode the features of anchor boxes, effectively improving object detection accuracy. The detection head generates multiple sets of anchor boxes of varying sizes based on the scale of the target being detected. Classification and regression predictions are then performed on each anchor box. When making predictions on higher-level feature maps, information from lower-level feature maps is used for corrections, improving object detection accuracy.
[0018] Preferably, Mobile-ViT consists of an MV2 module and a MobileViT module;
[0019] The MV2 module is the InvertedResidualblock in MobileNetv2. When the stride is 1, the MV2 module adopts the MV2 structure; when the stride is 2, the MV2 module needs to be downsampled and adopts the MV2 structure marked with a downward arrow. The MV2 module is an inverted residual structure, that is, the dimension of the feature map first increases and then decreases after passing through the activation function. This design strategy can reduce the premature compression of the feature map dimension, thereby retaining more useful information and improving model performance. In addition, the MV2 module also has very good scalability. It can be easily inserted into other model structures to improve computing and storage efficiency;
[0020] In the MobileViT module, each block is composed of multiple alternating layers of Multi-Head Self-Attention (MHSA) and Feed-Forward Neural Networks (FFNN). The feature map is modeled locally through an n×n convolutional module, followed by a 1×1 convolutional layer to adjust the number of channels. Global feature modeling is then performed sequentially through the Unfold, Transformer, and Fold structures. The channels are then resized to their original size through a 1×1 convolutional layer, and then concatenated with the original input feature map by channel through a shortcut branch. Finally, a convolutional layer with an n×n convolutional kernel is used to fuse the features to obtain the final output.
[0021] Preferably, in the MobileViT module, local features Flattened into image blocks
[0022] X T p=TransformeX U p,p∈1,p
[0023] Where N is the number of flattened image blocks; P is the size of the image block; W and H are the width and height of the flattened image block respectively.
[0024] In the Transformer module, Self-Attention is used to learn the correlation between different locations in the image in order to fully understand the intrinsic structure of the image features. When calculating each token, Self-Attention needs to consider the correlation with all other tokens. The original Self-Attention calculation formula is:
[0025] softmax(XX T )X
[0026] To improve the model's fitting ability, a linear transformation is performed on the input X. This is done by multiplying the input X by the weight matrices W corresponding to Q, K, and V, respectively. This yields three vectors: Query, Key, and Value. For each patch, a linear transformation yields three vectors: Query, Key, and Value. The self-attention calculation formula is as follows:
[0027]
[0028] Where: T represents the length of the sequence; d k represents the dimension of K (d q d v Similarly). Before calculating softmax, the weight matrix is multiplied by a d k (-1 / 2) After XXT calculations are completed, the variance of the matrix elements becomes very large, causing the softmax distribution to become extremely steep, thus affecting the stable calculation of the gradient. The softmax calculation normalizes the previously calculated similarity and reduces the variance to 1, decoupling the steepness of the softmax distribution from d. This maintains gradient stability during training, implements the self-attention mechanism, and completes self-attention feature extraction.
[0029] Preferably, the context dependency between the local block and the global block is established through channel fusion and restoration operations, as follows:
[0030] X G =ξ(X N , X U )
[0031] Among them, XN represents the input local feature block, X U Indicates the expansion of local feature blocks, X G Represents the fusion feature block, ξ represents the feature weighted fusion operation; the channel features are restored through multi-scale convolution, and finally the photovoltaic posture features are extracted through the feature fusion structure.
[0032] Preferably, the MPDIoU bounding box regression loss function is introduced in S2. MPDIoU defines the center point distance difference metric MD and the target box width and height difference metric PD. The center point distance difference metric MD is obtained by calculating the Euclidean distance between the center points of the two target boxes and normalizing it to the range of [0,1]. The formula is as follows:
[0033]
[0034] Among them, c1 and c2 represent the center coordinates of the two target boxes, w1 and h1 represent the width and height of the first target box, and w2 and h2 represent the width and height of the second target box.
[0035] By calculating the sum of the Euclidean distances between the upper left corner and lower right corner coordinates of the two target boxes and normalizing the distance to the range of [0,1], the formula is as follows:
[0036]
[0037] in, and Respectively represent the upper left corner coordinates of the two target boxes, and Respectively represent the coordinates of the lower right corners of the two target boxes;
[0038] The center point distance difference metric MD and the target box width and height difference metric PD are summarized through the maximum pooling operation to obtain the overlap metric MPD:
[0039] MPD=max(MD, PD).
[0040] Preferably, the overlap metric MPD is weightedly fused with IoU to obtain the final MPDIoU value:
[0041] MPDIoU=IoU+α·MPD
[0042] Among them, α is a hyperparameter used to control the weight between the two metrics;
[0043] According to the definition of MPDIoU, define the bounding box regression loss function L based on MPDIoU MPDIoU :
[0044] L MPDIoU =1-MPDIoU.
[0045] Preferably, a confusion matrix is used to evaluate the performance of a binary classification model. The model's predictions are compared with the actual results to obtain a statistical analysis of the four cases. The predictions are classified as positive and negative, respectively, while the actual results are also positive and negative. These predictions can be combined into a confusion matrix. The four elements in the confusion matrix are represented as follows:
[0046] (1) True Positives (TP): The number of samples that the model correctly predicts as positive examples;
[0047] (2) True Negatives (TN): The number of samples that the model correctly predicts as negative examples;
[0048] (3) False Positives (FP): The number of samples where the model mistakenly predicts negative examples as positive examples;
[0049] (4) False Negatives (FN): The number of samples where the model mistakenly predicts positive examples as negative examples;
[0050] In order to make a more comprehensive evaluation of the performance of the algorithm model, the following evaluation indicators are used to comprehensively evaluate the performance of the model:
[0051] The precision rate is the proportion of correct predictions in the positive samples, and the formula is
[0052]
[0053] The calculation formula for recall is
[0054]
[0055] The average precision is used to evaluate the performance by plotting the Precision-Recall curve and calculating the area under the curve. The calculation formula is:
[0056]
[0057] Among them, m represents the average; the number after @ represents the threshold for determining IoU as positive and negative samples; n represents the number of categories; it can more comprehensively and objectively reflect the performance of the model when processing multi-classification tasks, which helps to select the optimal model for practical applications;
[0058] The F1 score is the harmonic mean of precision and recall, so the F1 curve is usually used to compare the performance of different models. Its value range is 0, 1. The larger the value, the better the performance of the model. The formula is
[0059]
[0060] The number of floating-point operations is used to measure the complexity of the model; a higher value generally means that the model requires more computing resources for inference, which may result in longer inference time. Conversely, a lower value means that the model has less computational resources and can complete the inference process faster;
[0061] The detection frame rate refers to the number of frames per second that an image is processed. A higher FPS means the system can process images or videos faster, resulting in smoother display or faster detection. Its value is affected by the algorithm weight and the hardware configuration of the experimental equipment.
[0062] Therefore, the present invention adopts the above-mentioned photovoltaic posture recognition method based on the improved YOLOv8n algorithm model. By improving the YOLOv8n model, the improved model has significant improvements in precision, recall, average precision mean, F1 score and frame rate. At the same time, the number of floating-point operations is reduced, thereby improving its excellent performance in photovoltaic panel posture recognition, and providing a prerequisite for the realization of other tasks and functions of the photovoltaic intelligent cleaning vehicle.
[0063] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 This is a flow chart of the photovoltaic posture recognition method of the present invention;
[0065] Figure 2 Schematic diagram of the confusion matrix in the present invention;
[0066] Figure 3 This is a schematic diagram of MV2 of the present invention;
[0067] Figure 4 A schematic diagram of the MobileViT network structure of the present invention;
[0068] Figure 5 Schematic diagram of the Mobile-ViT network structure of the present invention;
[0069] Figure 6 A schematic diagram showing a visual comparison of accuracy rates according to an embodiment of the present invention;
[0070] Figure 7 This is a diagram illustrating a visualized comparison of recall rates according to an embodiment of the present invention;
[0071] Figure 8 Schematic diagram of visual comparison of average precision means according to an embodiment of the present invention. DETAILED DESCRIPTION
[0072] Example
[0073] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of 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. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0074] like Figure 1-5 As shown, a photovoltaic posture recognition method based on an improved YOLOv8n algorithm model includes the following steps:
[0075] S1. Constructing a photovoltaic panel pose dataset, including data collection, data expansion, data enhancement, and data labeling.
[0076] S2. Build an improved YOLOv8n-PP model based on the YOLOv8n algorithm and introduce the MPDIoU bounding box regression loss function to realize photovoltaic panel pose recognition and detection;
[0077] S3. Evaluate the performance of the YOLOv8n-PP model, specifically using precision P, recall R, mean average precision (mAP), F1 score, number of floating-point operations, and detection frame rate as evaluation indicators.
[0078] To verify the effectiveness of the improved algorithm model YOLOv8n-PP, we established several variants based on the original YOLOv8n model for ablation experiments, including YOLOv8n-M, YOLOv8n-MPD, and YOLOv8n-PP. YOLOv8n-M adds the lightweight and more mobile-friendly Mobile-ViT model, using Mobile-ViT as its backbone. YOLOv8n-MPD replaces the class BboxLoss and classv8DetectionLoss functions in the detection head module with the bounding box regression loss function class LMPDIoULoss.
[0079] Photovoltaic pose recognition is a crucial visual task, and the original YOLOv8n algorithm has demonstrated strong reliability in this field. As shown in Table 1, the original YOLOv8n algorithm demonstrates strong reliability in photovoltaic pose recognition. Initial deep learning using the unmodified YOLOv8n algorithm achieved precision, recall, mean average precision (mAP@0.5), F1 score, and frame rate of 91.43%, 83.33%, 88.95%, 87%, and 126%, respectively. These excellent performance metrics demonstrate the potential of the YOLOv8n algorithm for photovoltaic pose recognition. However, the algorithm still suffers from challenges in detecting these metrics, such as low F1 scores and mean average precision (mAP@0.5:0.95), and a high number of floating-point operations. Although the overall performance of the model is good, there is still room for improvement in the performance of the algorithm in the field of target detection. Therefore, it is necessary to continue exploring and optimizing the YOLOv8n algorithm to improve its performance in tasks such as photovoltaic pose recognition.
[0080] The improvement of the algorithm includes the use of a more efficient neural network structure to optimize the YOLOv8n model, which successfully reduces the amount of calculation while improving the accuracy of target detection, and improves the calculation speed of the network model, with the highest detection frame rate reaching 239FPS. Compared with the unimproved YOLOv8n algorithm model, after replacing Mobile-ViT as the backbone network of the algorithm, the precision, recall, mean average precision (mAP@0.5), F1 score, mean average precision (mAP@0.5:0.95) and frame rate increased by 1.52%, 8.9%, 3.97%, 5%, 4.14% and 113 respectively, the number of floating-point operations was reduced by 2.4, and the overall performance of the model was greatly improved; after replacing the MPDIoU bounding box regression loss function, the precision, recall, mean average precision (mAP@0.5) and F1 score increased by 1.52%, 8.9%, 3.97%, 5%, 4.14% and 113 respectively. 1 scores increased by 0.76%, 1.28%, 1.11% and 1 respectively, but the number of floating-point operations increased by 0.5, and the mean average precision (mAP@0.5:0.95) and frame rate decreased by 0.56% and 4 respectively; the YOLOv8n-PP algorithm model improved by the two models, the precision, recall, mean average precision (mAP@0.5), F1 score, mean average precision (mAP@0.5:0.95) and frame rate increased by 3.45%, 5.78%, 4.41%, 6%, 4.45% and 89 respectively, and the number of floating-point operations decreased by 2.1.
[0081] Table 1 Ablation experiment results
[0082]
[0083] Note: The bold data are the optimal values
[0084] Comparing the ablation experiment results clearly demonstrates that the YOLOv8n-PP algorithm model demonstrates superior performance across seven evaluation metrics for photovoltaic panel pose recognition. Four evaluation metrics—precision, mean average precision (mAP@0.5), F1 score, and mean average precision (mAP@0.5:0.95)—reached optimal values in this experiment. Recall, floating-point operations, and frame rate also performed at high levels. These ablation experiment results fully demonstrate the comprehensive performance advantages of the YOLOv8n-PP object detection algorithm model for photovoltaic panel pose recognition.
[0085] In order to more intuitively evaluate the performance of the improved algorithm, the Precision, Recall, and mAP@0.5 indicators of the YOLOv8n and YOLOv8n-PP models during training are visualized and analyzed.
[0086] Figure 6This visualization shows a comparison of the Precision values of the YOLOv8n and YOLOv8n-PP models during training. Experimental data analysis shows that the YOLOv8n algorithm initially has a low Precision value during the first 100 epochs of deep learning, and the Precision value fluctuates significantly as the number of epochs increases. After epoch 100, the Precision value stabilizes, remaining generally above 90%. However, the curve still exhibits significant fluctuations until the end of training, indicating that the Precision value is unstable. In contrast, the YOLOv8n-PP algorithm's Precision value is approximately 10% higher than YOLOv8n's during the first 100 epochs of deep learning, and the Precision value increases more steadily with each epoch. The Precision value stabilizes before epoch 100 and remains stable until the end of training, consistently exceeding that of YOLOv8n.
[0087] Figure 7 This visualization shows a comparison of the recall values of the YOLOv8n and YOLOv8n-PP models during training. Based on experimental data analysis, both curves reach a relatively stable state at approximately the same time. However, YOLOv8n-PP's recall rate is consistently higher than YOLOv8n's, and its recall curve is more stable.
[0088] Figure 8 This visualization shows a comparison of the mAP@0.5 values of the YOLOv8n and YOLOv8n-PP models during training. Based on experimental data analysis, YOLOv8n's mAP@0.5 value fluctuates significantly and does not reach a stable state at the end of training. However, YOLOv8n-PP achieves a higher mAP@0.5 value than YOLOv8n and exhibits a more stable curve, which essentially flattens out in the later stages of training.
[0089] The visualization results demonstrate that the YOLOv8n-PP model's superiority extends beyond numerical performance; the stability of its recognition capabilities is also crucial. This robustness demonstrates excellent performance during both training and testing, consistently delivering high-quality recognition results. This stability enables the model to maintain efficiency and accuracy even when handling complex tasks. Consequently, the YOLOv8n-PP model demonstrates exceptional applicability when performing photovoltaic pose recognition tasks on real-world devices. Its stable recognition capabilities and superior numerical performance enable the model to effectively handle a variety of complex environments and conditions, significantly facilitating practical applications.
[0090] This example uses the currently popular YOLOv5s and YOLOv7 object detection models and compares them with the three aforementioned object detection models, YOLOv8s, YOLOv8n, and YOLOv8n-PP. The overall performance of each algorithm model is evaluated using the same evaluation metrics. The results of the comparative experiments with different algorithm models, while maintaining the same photovoltaic pose dataset, model hyperparameters, and training parameters, are shown in Table 2.
[0091] Table 2 Comparative experimental results of different algorithm models
[0092] Model P / % R / % mAP@0.5 / % F1 / % GFLOPs mAP@0.5:0.95 / % FPS YOLOv5s 90.31 81.64 88.07 88 15.8 80.87 76 YOLOv7 89.13 82.24 85.93 87 11.6 82.65 87 YOLOv8s 90.37 82.31 88.22 86 28.3 87.63 157 YOLOv8n 91.43 83.33 88.95 87 8.2 86.63 126 YOLOv8n-PP 94.88 89.11 93.36 93 6.1 91.08 215
[0093] Note: The bold data are the optimal values
[0094] Table 2 shows that the YOLOv8n-PP algorithm model performs best across all performance metrics, significantly outperforming the other algorithms across all seven evaluation metrics. In contrast, the YOLOv5s algorithm model performs relatively poorly across all performance metrics, likely due to its shallower feature extraction network. Consequently, most performance evaluation metrics show relatively low performance. These experimental results demonstrate the YOLOv8n-PP algorithm model's superiority in detecting photovoltaic panel pose.
[0095] Therefore, the present invention adopts the above-mentioned photovoltaic posture recognition method based on the improved YOLOv8n algorithm model, which achieves comprehensive performance advantages in posture recognition and can accurately detect the posture of the photovoltaic panel that currently needs to be cleaned, so that the cleaning operation of the cleaning cart can be carried out smoothly. The improved YOLOv8n-PP has significant improvements in precision, recall rate, average precision mean, F1 score and frame rate compared with the original algorithm model, while reducing the number of floating-point operations.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solutions of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A photovoltaic posture recognition method based on an improved YOLOv8n algorithm model, characterized in that: The following steps are involved: S1. Construct a photovoltaic panel pose dataset, including data collection, data expansion, data enhancement and data label processing; S2. Build an improved model YOLOv8n-PP based on YOLOv8n algorithm, and introduce the MPDIoU bounding box regression loss function to realize photovoltaic panel posture recognition and detection; S3. Evaluate the performance of the YOLOv8n-PP model, using precision P, recall R, mean average precision (mAP), F1 score, number of floating-point operations, and detection frame rate as evaluation indicators.
2. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 1 is characterized in that: The YOLOv8n-PP model specifically includes: Input, preprocess the data in S1; Backbone, used for feature extraction, specifically the Mobile-ViT backbone network; Neck is used to fuse feature maps of different levels to build a feature pyramid. It adopts the PANet structure, which includes the feature pyramid network FPN and the path aggregation network PAN. Head, fuses several feature maps output by Neck to obtain a global feature vector, and uses the global feature vector for feature encoding.
3. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 2 is characterized in that: Mobile-ViT consists of MV2 module and MobileViT module; The MV2 module is the Inverted Residual block in MobileNetv2 and is an inverted residual structure; In the MobileViT module, each Block is composed of several Multi-Head Self-Attention layers and Feed-Forward Neural Networks layers stacked alternately. The feature map is modeled locally through a convolution module of size n×n, and then a convolution layer with a convolution kernel of 1×1 is used to adjust the number of channels. Then, the global feature modeling is performed through the Unfold, Transformer, and Fold structures in sequence. Then, the channel is adjusted to the original size through a convolution layer with a convolution kernel size of 1×1, and then it is concatenated with the original input feature map by channel through the shortcut branch. Finally, a convolution layer with a convolution kernel size of n×n is used to fuse the features to obtain the final output.
4. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 3 is characterized in that: In the MobileViT module, local features Flattened into image blocks XT(p)Transform(X U (p)),p∈[1,p] Wherein, N is the number of flattened image blocks; P is the size of the image block; W and H are the width and height of the flattened image block, respectively.
5. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 4 is characterized in that: The dependency relationship between the local block and the global block is established through channel fusion and restoration operations: X G =ξ(X N ,X U ) Among them, XN represents the input local feature block, X U represents the expansion of local feature blocks, X G Represents the fusion feature block, ξ represents the feature weighted fusion operation; the channel features are restored through multi-scale convolution, and finally the photovoltaic posture features are extracted through the feature fusion structure.
6. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 5 is characterized in that: The MPDIoU bounding box regression loss function is introduced in S2. MPDIoU defines the center point distance difference metric MD and the target box width and height difference metric PD. By calculating the Euclidean distance between the center points of the two target boxes and normalizing it to the range of [0, 1], the center point distance difference metric MD is obtained. The formula is as follows: Among them, c1 and c2 represent the center point coordinates of the two target frames, w1 and h1 represent the width and height of the first target frame, and w2 and h2 represent the width and height of the second target frame. By calculating the sum of the Euclidean distances between the upper left corner and lower right corner coordinates of the two target boxes and normalizing the distance to the range of [0, 1], the formula is as follows: in, and Respectively represent the upper left corner coordinates of the two target boxes, and Respectively represent the coordinates of the lower right corners of the two target boxes; The center point distance difference metric MD and the target box width and height difference metric PD are summarized through the maximum pooling operation to obtain the overlap metric MPD: MPD = max(MD, PD).
7. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 6 is characterized in that: The overlap metric MPD is weightedly fused with IoU to obtain the final MPDIoU value: MPDIoU=IoU+α·MPD Among them, α is a hyperparameter used to control the weight between the two metrics; According to the definition of MPDIoU, define the bounding box regression loss function L based on MPDIoU MPDIoU : L MPDIoU =1-MPDIoU.
8. The photovoltaic posture recognition method based on the improved YOLOv8n algorithm model according to claim 1 is characterized in that: The evaluation indicators in S3 are as follows: The precision rate is the proportion of correct predictions in the positive samples, and the formula is: Among them, TP is a true positive example; FP is a false positive example; The calculation formula for recall is: Among them, FN is a false negative example; The average precision is used to evaluate the performance by plotting the Precision-Recall curve and calculating the area under the curve. The calculation formula is: Among them, m represents the average; n represents the number of categories; The F1 score is the harmonic mean of precision and recall, and its value range is [0, 1]. The formula is: The number of floating-point operations is used to measure the complexity of the model; The detection frame rate refers to the number of frames processed per second.
Citation Information
Cited By
Bidirectional network abandoned land identification method and system based on truth value approximation principle
CN120375216A
Method for evaluating urban space boundary recognition accuracy, medium and program product
CN120409949A