Solar panel defect detection method and system, storage medium and terminal
Through the dual-channel generative self-supervised learning method, the problem of defect location and high data annotation cost in solar panel defect detection is solved, and defect detection with high accuracy and low computational complexity is achieved, which is suitable for industrial surface inspection.
Patent Information
- Application Number
- CN202210550523.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-18
AI Technical Summary
Existing solar panel defect detection methods based on supervised learning need to accurately locate defect locations and rely on a large number of manually annotated data sets. Data annotation leads to information loss and poor feature extraction and generalization capabilities.
A dual-channel generative self-supervised learning method is used to train the image feature recognition model and defect detection model through self-supervised learning. The self-attention mechanism is used to randomly cover image blocks, generate feature vectors, and adjust model parameters to reduce errors and achieve defect detection. .
There is no need to manually label large sample data sets, it can accurately identify solar panel defects, capture local details and global semantic features, reduce the amount of calculations, and is suitable for industrial production. The classification accuracy reaches 81.79%, and has broad application prospects.
Smart Images

Figure CN114862814B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of solar panels, and in particular to a solar panel defect detection method and system, a storage medium and a terminal. Background Art
[0002] With the increasing maturity of photovoltaic power generation technology, photovoltaic power generation has become an important field of new energy development in my country. The core component of photovoltaic power generation applications is solar panels, which have complex production processes and are prone to defects. During production and use, detecting and replacing defective solar panels can significantly improve power generation efficiency and extend the life of solar power stations. In the prior art, solar panel defect detection methods mainly include the following three methods:
[0003] (1) Manual visual inspection of solar panels
[0004] Manual visual inspection is performed by specialized personnel through visible light camera or infrared camera to judge whether there are defects in the solar panel image, which requires a lot of human resources and has low detection efficiency. At the same time, different defects are seriously affected by subjective judgment, which affects the accuracy.
[0005] (2) Physical inspection of solar panels
[0006] Physical testing refers to the use of sound waves, infrared, laser scanning, resonant ultrasonic vibration and other methods to detect defects in solar panels. Wang Yali et al. designed a method for detecting and classifying defects in solar panels based on infrared thermal imaging technology. According to common defects such as black pieces, broken grids, hidden cracks and fragments, the average gray value difference, aspect ratio and edge curvature of infrared images can be extracted for defect detection. Experiments show that this method can detect and locate defects and accurately classify them. Bai Kai et al. proposed a defective photovoltaic module detection scheme suitable for field applications based on the defect formation mechanism of crystalline silicon photovoltaic modules, including infrared thermal imaging troubleshooting, insulation resistance testing, EL testing and photovoltaic module characteristic testing, which can identify the causes of photovoltaic module defects and their impact on power generation performance. Shi Guanghui proposed to use EL (Electroluminescent) testing technology to find defects such as black core, black spots, hidden cracks and broken grids of battery modules, and to determine the existence of defects in combination with the VI characteristic curve of photovoltaic modules. Yang Ruizhen proposed an infrared thermal imaging defect detection method for crystalline silicon photovoltaic cells under active electromagnetic induction excitation, which has the advantages of high detection sensitivity, ability to detect internal defects, and multiple types of defects. The thermal imaging sequence of silicon cells was obtained under the pulsed and phase-locked excitation modes, and the thermal image sequence was processed to achieve visual detection of defects such as hot spots, cracks, broken grids, and heavy doping in crystalline silicon photovoltaic cells. Based on the electroluminescence principle of solar cells, Shi Lei designed an EL defect detection unit, which collected data through a machine vision system, generated EL images of photovoltaic modules, assisted manual defect detection of photovoltaic modules, and reduced the impact of human factors such as manual fatigue on the detection results.
[0007] (3) Machine vision inspection of solar panels
[0008] Compared with physical detection methods, machine vision measurement, as a new measurement technology, has the characteristics of high efficiency, accuracy, real-time, flexibility, non-contact, and long-distance measurement. With the continuous development of information processing software and hardware technology, the advantages of machine vision detection technology are becoming increasingly significant. The detection speed is fast, only a few hundred milliseconds; the application deployment is flexible and can be configured according to different environments to meet user requirements and realize remote detection operations; the detection accuracy is high, and the detection standardization and consistency are constantly improving.
[0009] Sun Hairong et al. proposed a deep convolutional autoencoder network model for small sample photovoltaic hot spot identification and positioning, automatically learning and extracting effective features from small sample images. Experimental results show that for small sample photovoltaic hot spot image datasets, this method improves the recognition accuracy by 7.98% compared with traditional convolutional neural networks, and has stronger generalization ability and robustness. Du Huping et al. proposed a method for detecting cell damage during the production process, using the Sobel operator to detect image edges, calculating the cell deflection angle, and detecting whether the cell is damaged based on the corner detection method. Experimental results show that this method has high accuracy and can detect problems such as position deflection and damage during cell string welding. Chen Fengmei designed a solar panel defect detection model SSNBDL based on deep learning. Based on the SegNet network framework, it uses dilated convolution to replace the pooling layer, increases the receptive field, and retains the image edge information. The model significantly improves the detection accuracy. Deng Baoyuan proposed a thermal image sequence analysis method based on the optical flow method to process the thermal flow field of photovoltaic cells. It can accurately find the abnormal heat source and merge it with the abnormal light source found by short-wave infrared imaging. Through deep convolutional neural networks, it can effectively identify the internal defects of photovoltaic cells and artificial defects such as scratches, coverage, cracks, and defects. The experimental results show that it can converge faster in the training of convolutional networks. Zhou Deyong used the YOLOv3 target detection model to detect defects in electroluminescent images of solar panels, and the average accuracy on the test set reached 81.81%. The experimental results show that the YOLOv3 target detection model can achieve relatively accurate detection of solar panels with broken grids and hidden cracks. Liu Huaiguang established a feature-enhanced lightweight convolutional neural network model, designed a feature enhancement extraction module, improved the extraction ability of weak boundaries, and added a small target prediction layer based on the multi-scale recognition principle to achieve multi-scale feature prediction. In the experimental test, the average accuracy of the model reached 87.55%, which is 6.78 percentage points higher than the traditional model, and meets the requirements of accuracy and real-time detection.
[0010] However, existing machine vision inspection methods based on supervised learning have the following three disadvantages:
[0011] 1) Defects need to be accurately located in order to identify them. However, defect location is difficult because defects are open, and local defects and global defects are the same type of defects. For example, if a crack is long and has a break in the middle, should it be located as a long crack or two short cracks? This is the dilemma of defect detection and location.
[0012] 2) Supervised learning-based methods require large amounts of manually annotated data sets, and a large amount of training is required on the data sets to obtain a model that converges with the training. Data sets require manual annotation, which is both time-consuming and expensive. Sample annotation in special fields such as the medical field is extremely expensive, and is increasingly becoming a bottleneck in the development of artificial intelligence.
[0013] 3) Data labeling will lead to information loss. An image contains a lot of information. In addition to the labeled object, there is also background information, secondary target information, etc. A single training task only extracts the labeled information in the image and ignores other useful information. It is precisely because of information loss that the feature extraction ability of the supervised learning model is distorted and the generalization ability is poor.
[0014] Self-supervised learning methods can overcome the shortcomings of supervised learning methods. Self-supervised learning can be divided into two types: discriminative self-supervised learning and generative self-supervised learning. The typical discriminative self-supervised learning method is contrastive learning. The main idea is to automatically construct similar instances and dissimilar instances, and require the acquisition of a feature representation learning model so that similar instances are clustered in the projection space and dissimilar instances are separated in the projection space. The generative self-supervised learning method mainly trains a deep learning model to reconstruct the obscured part of the image. The reconstructed model that has converged in training is similar to an image encoder and has the ability to extract image features. The image reconstruction task is relatively difficult and generally requires pixel-level reconstruction. Summary of the invention
[0015] In view of the shortcomings of the prior art described above, the object of the present invention is to provide a solar panel defect detection method and system, a storage medium and a terminal, which can accurately identify defects of solar panels based on a dual-channel generative self-supervised learning method.
[0016] To achieve the above-mentioned object and other related objects, the present invention provides a method for detecting defects in a solar panel, comprising the following steps: training an image feature recognition model based on a self-supervised learning method; extracting image features of a solar panel image containing surface defects based on the image feature recognition model; training a solar panel defect detection model according to the image features based on a supervised learning method; inputting the solar panel image into the image feature recognition model and the solar panel defect detection model in sequence to obtain a solar panel defect detection result.
[0017] In one embodiment of the present invention, training an image feature recognition model based on a self-supervised learning method includes the following steps:
[0018] Divide the input image into multiple image blocks;
[0019] Encoding each of the image blocks to generate a coding value corresponding to the image block;
[0020] Randomly masking the multiple image blocks according to a preset ratio, inputting a sequence of image blocks obtained after masking into a ViT model, and obtaining a feature vector of the masked image blocks;
[0021] Inputting the feature vector into the MIM model to obtain the encoding value of the feature vector;
[0022] Obtain the error between the coding value of the masked image block and the coding value of the feature vector; if the error is not within a preset range, adjust the parameter values of the ViT model and the MIM model until the error is within the preset range, and use the ViT model as the image feature recognition model.
[0023] In one embodiment of the present invention, a discrete variation encoder is used to encode each of the image blocks, and the discrete variation encoder is used to convert the image block into a discrete encoding value.
[0024] In one embodiment of the present invention, the parameter values of the ViT model include a batch size of 32, an optimizer selected as Adm, a learning rate of a cosine optimization scheme, a warm-up cycle of 5, a layer attenuation of 0.75, a descent path of 0.2, a weight decay of 0.05, and a training cycle of 200 times.
[0025] In an embodiment of the present invention, the preset ratio is 40%.
[0026] In one embodiment of the present invention, based on a supervised learning method, training a solar panel defect detection model according to the image features includes the following steps:
[0027] Acquire image features of the solar panel image extracted by the image feature recognition model;
[0028] Inputting the image features into the solar panel defect detection model;
[0029] Obtaining a solar panel defect detection result output by the solar panel defect detection model;
[0030] If the accuracy of the solar panel defect detection result does not reach a preset threshold, the parameters of the solar panel defect detection model are adjusted until the accuracy of the solar panel defect detection result reaches a preset threshold.
[0031] In one embodiment of the present invention, the solar panel defect detection model adopts a fully connected MLP network.
[0032] The present invention provides a solar panel defect detection system, comprising an image feature training module, an extraction module, a defect detection training module and a detection module;
[0033] The image feature training module is used to train the image feature recognition model based on a self-supervised learning method;
[0034] The extraction module is used to extract image features of the solar panel image containing surface defects based on the image feature recognition model;
[0035] The defect detection training module is used to train a solar panel defect detection model according to the image features based on a supervised learning method;
[0036] The detection module is used to input the solar panel image into the image feature recognition model and the solar panel defect detection model in sequence to obtain a solar panel defect detection result.
[0037] The present invention provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned solar cell panel defect detection method is implemented.
[0038] The present invention provides a solar panel defect detection terminal, comprising: a processor and a memory;
[0039] The memory is used to store computer programs;
[0040] The processor is used to execute the computer program stored in the memory, so that the solar panel defect detection terminal performs the above-mentioned solar panel defect detection method.
[0041] As described above, the solar panel defect detection method and system, storage medium and terminal of the present invention have the following beneficial effects:
[0042] (1) Generative self-supervised learning methods can construct self-supervised tasks for training on unlabeled datasets and generate feature extraction models without the need for manually labeled large sample datasets, thereby greatly reducing the workload of manual labeling and reducing costs and increasing efficiency;
[0043] (2) It can locate the defect through self-attention fuzzy positioning, avoiding the difficulty of accurate defect positioning. It can detect defects without explicitly identifying the defect location, which is suitable for detecting open errors.
[0044] (3) After the feature extraction model is trained using the self-supervised learning method, it can capture the local detail features and global semantic features of the data set compared to the supervised model. Only a small number of labeled typical defect samples are needed to train the classifier to achieve good classification results.
[0045] (4) By adopting a dual-channel mode to train the model, it avoids restoring the original image from the pixel level, significantly reducing the amount of calculation and meeting the actual needs of industrial production; by adopting a universal semantic generative self-supervised learning method, it can be applied to a wide range of industrial surface detection and has a very broad application prospect;
[0046] (5) When trained and tested on the solar panel defect dataset, only 120 training cycles are required to achieve a classification accuracy of 81.79%, with good robustness and strong generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 Shown is a flow chart of a solar panel defect detection method in one embodiment of the present invention;
[0048] Figure 2 Shown is a flow chart of a dual-channel based generative self-supervised learning algorithm in one embodiment of the present invention;
[0049] Figure 3 A schematic diagram showing a defect image of a solar panel according to an embodiment of the present invention;
[0050] FIG. 4( a ) is a schematic diagram showing a training error and a validation error in an embodiment of the present invention;
[0051] FIG. 4( b ) is a schematic diagram showing the training accuracy and the verification accuracy of the present invention in one embodiment.
[0052] Figure 5 Shown is a schematic structural diagram of a solar panel defect detection system according to an embodiment of the present invention;
[0053] Figure 6 It is a schematic structural diagram of a solar panel defect detection terminal in one embodiment of the present invention.
[0054] Component number description
[0055] 51 Image feature training module
[0056] 52 Extraction module
[0057] 53 Defect Detection Training Module
[0058] 54 Detection module
[0059] 61 Processor
[0060] 62 Memory DETAILED DESCRIPTION
[0061] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0062] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0063] The solar panel defect detection method and system, storage medium and terminal of the present invention first discretely encode the input image based on a discrete variational encoder to form a coded representation of the input image features; then use a self-attention channel to randomly cover a preset proportion of image blocks and input a self-attention-based covering model, use a fully connected classification network to map the self-attention representation to an image discrete coding representation, and finally train the model to enable it to learn the ability to reconstruct the covered image blocks, so that the defects of the solar panel can be accurately identified according to the image features. It has the characteristics of high accuracy and small amount of calculation, and has a wide range of application scenarios.
[0064] like Figure 1 As shown, in one embodiment, the solar panel defect detection method of the present invention includes the following steps:
[0065] Step S1: training an image feature recognition model based on a self-supervised learning method.
[0066] Specifically, the present invention uses a generative self-supervised learning algorithm based on a double pass to train an image feature recognition model based on a self-supervised learning method. Figure 1 As shown, training the image feature recognition model based on the self-supervised learning method includes the following steps:
[0067] 11) Divide the input image into multiple image blocks.
[0068] Specifically, the input image X is evenly divided into multiple image blocks, that is, The image is divided into deformations as N = HW / P 2 image blocks, image blocks Where (H, W) is the resolution of the input image, C is the number of image channels, and (P, P) is the resolution of each image block. When the input image resolution is 224×224, the resolution of each image block is 16×16, so the input image can be divided into 14×14=196 image blocks. All image blocks are stacked to form an image block vector with a length of 196.
[0069] 12) Encode each of the image blocks to generate a coding value corresponding to the image block.
[0070] Specifically, in the first channel, a discrete variational autoencoder (dVAE encoder) and a decoder are used to encode and decode the image. The dVAE encoder and decoder are both composed of deep learning residual networks and need to be obtained through training. The present invention uses a pre-trained dVAE encoder to establish a vocabulary for the image. The vocabulary dictionary includes 8192 words and is uniformly discretely distributed. That is to say, by using dVAE to encode each image block of the image, each image block of the image can be mapped to a codeword in a dictionary with a scale of 8192. Therefore, the dVAE encoder can greatly compress the image and extract image features; the decoder uses 196 codewords to reconstruct the original image. The quality of the reconstructed image indicates the strength of the dVAE encoder's feature extraction ability and the decoder's generation ability. Among them, the 196 16×16 image blocks obtained by dividing the input image X are input into the encoder to obtain 196 discrete codes, each of which takes a value of 0 to 8191. The input image is converted into an array with a length of 196 and a value of 0 to 8191.
[0071] 13) Randomly masking the multiple image blocks according to a preset ratio, inputting the image block sequence obtained after masking into a ViT (Vision Transformer) model, and obtaining feature vectors of the masked image blocks.
[0072] Specifically, in the second channel, the image blocks of the input image X are randomly masked, for example, 40% of the image blocks are masked, that is, 5 image blocks are masked. The masked image blocks and their corresponding position information are constructed into an image block sequence and input into the ViT model.
[0073] The ViT model consists of Attention, feedforward layer, skip connection, dropout layer, etc. Figure 1 As shown in the figure, the black squares represent the covered image blocks. After inputting the ViT model, the feature vectors of all image blocks are obtained. Among them, the feature vectors of the uncovered image blocks are discarded, and the feature vectors of the covered image blocks h2, h4, h7, h 10 ,h 14 .
[0074] 14) Inputting the feature vector into the MIM (Masked Image Model) model to obtain the encoding value of the feature vector.
[0075] Specifically, the feature vector of the masked image block obtained by the ViT model is input into the MIM (Masked Image Modeling Head) model to obtain the encoding value corresponding to the feature vector.
[0076] 15) Obtaining the error between the coding value of the masked image block and the coding value of the feature vector; if the error is not within a preset range, adjusting the parameter values of the ViT model and the MIM model until the error is within the preset range, and using the ViT model as the image feature recognition model.
[0077] Specifically, the purpose of the image feature recognition model of the present invention is to reduce the error between the encoding value of the covered image block and the encoding value of the feature vector as much as possible. Therefore, a threshold range judgment is performed on the error currently obtained. When the error is within the preset range, it indicates that the training target of the image feature recognition model has been completed and the training can be terminated. When the error is not within the preset range, it is necessary to adjust the parameter values of the ViT model and the MIM model, and continue the model training until the error obtained is within the preset range. After the training is completed, only the ViT model needs to be retained and the subsequent MIM model is discarded to obtain the image feature recognition model. In one embodiment of the present invention, the parameter values of the ViT model include a batch size of 32, an optimizer selects Adm, a learning rate of cosine optimization scheme, a warm-up cycle of 5, a layer decay of 0.75, a drop path of 0.2, a weight decay of 0.05, and a training cycle of 200 times.
[0078] Step S2: extracting image features of the solar panel image containing surface defects based on the image feature recognition model.
[0079] Specifically, the solar panel image containing surface defects is input into a trained image feature recognition model, so that the image features of the solar panel image can be extracted, that is, the surface defect features of the solar panel image can be extracted.
[0080] Step S3: Based on a supervised learning method, a solar panel defect detection model is trained according to the image features.
[0081] Specifically, the solar panel defect detection model is essentially a classification module, which provides a solar panel defect detection result of whether there is a defect based on the input image features.
[0082] In one embodiment of the present invention, based on a supervised learning method, training a solar panel defect detection model according to the image features includes the following steps:
[0083] 31) Obtaining image features of the solar panel image extracted by the image feature recognition model.
[0084] 32) Inputting the image features into the solar panel defect detection model.
[0085] Preferably, the solar panel defect detection model adopts a fully connected MLP network.
[0086] 33) Obtaining a solar panel defect detection result output by the solar panel defect detection model.
[0087] 34) If the accuracy of the solar panel defect detection result does not reach a preset threshold, adjust the parameters of the solar panel defect detection model until the accuracy of the solar panel defect detection result reaches a preset threshold.
[0088] Step S4: inputting the solar panel image into the image feature recognition model and the solar panel defect detection model in sequence to obtain a solar panel defect detection result.
[0089] Specifically, for the solar panel image to be detected, it is sequentially input into the image feature recognition model and the solar panel defect detection model to obtain the solar panel defect detection result output by the solar panel defect detection model.
[0090] In order to test the actual effect of the solar panel defect detection method of the present invention, experimental verification was carried out. The experimental environment was completed on the Linux system, the operating system version was Ubuntu 20.04, the server was installed with 128G memory, and equipped with 4 RTX2080Ti GPU graphics cards. The experimental development platform selected the mainstream deep learning platform PyTorch 1.7.1, implemented in Python programming language, and the development environment used Minconda3 to create an independent experimental environment.
[0091] The solar panel defect dataset ELPV contains 2624 8-bit grayscale images with a resolution of 300x300 pixels, and the specific distribution is shown in Table 1. The defective solar cell samples have different degrees of degradation of solar cells, extracted from 44 different solar panel modules. The defects in the annotated images are of intrinsic or extrinsic type and reduce the power efficiency of the solar module. All images are normalized according to size and perspective. In addition, any distortion caused by the camera lens used to capture the EL image is eliminated before extracting the solar cell. Each image is annotated with a defect probability (a floating point value between 0 and 1) and the type of solar module (monocrystalline or multicrystalline) from which the solar cell image was originally extracted.
[0092] Table 1. Sample distribution of solar panel defect dataset
[0093]
[0094]
[0095] Among them, the category mono represents a monocrystalline silicon solar cell, the category poly represents a polycrystalline silicon solar cell, a defect probability of 0 represents no defect, a defect probability of 0.33 represents a 33% probability of a defect, a defect probability of 0.66 represents a 66% probability of a defect, and a defect probability of 1 represents a defect.
[0096] Specifically, the 2,624 images are divided into training set, validation set and data set according to the ratio of 7:2:1, that is, the training set contains 1,834 images, the training set contains 526 images, and the test set contains 264 images. As can be seen from Table 1, the number of samples between different categories of the data set is very unbalanced. There are many images with defect probabilities of 0 and 1 in the mono and poly categories, while there are few images with defect probabilities of 0.33 and 0.66. In particular, the number of samples with a probability of 0.66 in the mono category is only 50, and the number of samples with a probability of 0.66 in the poly category is only 50, which brings certain difficulties to model training and generalization.
[0097] from Figure 3 It can be seen from the defect images that there are large differences in samples within a class. For example, the Poly category with a defect probability of 1 shows extremely rich diversity, and the Mono category with a defect probability of 1 also shows extremely rich diversity; from the surface image, there is a situation where the image with a poly defect probability of 1 is cleaner than the image with a poly defect probability of 0.33; there is a situation where the image with a Mono defect probability of 0 has a more complex texture than the image with a Mono defect probability of 0.66. There are samples with huge differences within the class of the data set, and at the same time, there are samples with little difference between classes, which brings great difficulties to defect classification, especially the difficulty of generalizing the trained model.
[0098] The existing pre-trained models have the ability to extract broad-spectrum two-dimensional image features, especially the ability to extract natural image features. However, solar panels are industrial products, and the visual features of defects are significantly different, so pre-trained models cannot be used directly. The present invention imports the pre-trained model and optimizes it on the solar panel data set, so that the optimized model can extract defect features in a targeted manner.
[0099] When using the training set for tuning, the training cycle is set to 200, and the curves of training error and validation error are shown in Figure 4(a). As the number of training cycles increases, the training error decreases, and the validation error decreases. When the training cycle reaches about 80, the validation error reaches the minimum, and the training error continues to decrease. When the training cycle reaches 150, the training error converges to about 0.75, and the training error has basically converged and no longer decreases. From experience, the intersection of the training error and the validation error is the optimal training point for model training. In the subsequent training, although the training error continues to decrease, the validation error increases, and the model is in danger of overfitting. The curves of training and validation accuracy are shown in Figure 4(b). As the number of training cycles increases, the accuracy of the training set and validation set increases accordingly. When the training cycle reaches 114, the validation set accuracy reaches 81.74%, and then the validation accuracy is basically stable and almost no longer increases.
[0100] The present invention was compared with the CNN benchmark model ResNet using supervised learning and the best model SwinTransformer in 2021. The test results show that if the defect area detection and other tasks are not performed, and the supervised learning ResNet50 and SwinTransformer networks are directly used for classification, the network training classification accuracy is less than 75%. The reason is that the defects of solar panels are open and have no fixed pattern. In this case, it is difficult to locate the defective area. When the defective area cannot be located, it is difficult for traditional supervised learning methods to accurately extract the features of magnetic tiles, and it is also difficult to achieve accurate classification and recognition.
[0101] As shown in the comparison results in Table 2, Dino uses self-supervised learning based on contrastive learning, and the backbone network is the ViT method, which has a better effect. The self-supervised learning attention model can rely on its attention mechanism to implicitly improve the self-attention of the defect area, thereby achieving a good feature extraction effect. Among them, the recognition accuracy of the Dino KNN method reached 76.67%, and the recognition accuracy of the Dino Linear method reached 78.90%. Since Dino's contrastive learning is discriminative self-supervised learning, its feature extraction ability is not as good as generative self-supervised learning, and its classification accuracy is lower than 81.75% of BEiT.
[0102] Table 2. Comparison results of different models
[0103]
[0104] like Figure 5 As shown, in one embodiment, the solar panel defect detection system of the present invention includes an image feature training module 51 , an extraction module 52 , a defect detection training module 53 and a detection module 54 .
[0105] The image feature training module 51 is used to train the image feature recognition model based on a self-supervised learning method.
[0106] The extraction module 52 is connected to the image feature training module 51 and is used to extract image features of the solar panel image containing surface defects based on the image feature recognition model.
[0107] The defect detection training module 53 is connected to the extraction module 52 and is used to train a solar panel defect detection model according to the image features based on a supervised learning method.
[0108] The detection module 54 is connected to the image feature training module 51 and the defect detection training module 53, and is used to input the solar panel image into the image feature recognition model and the solar panel defect detection model in sequence to obtain the solar panel defect detection result.
[0109] The structures and principles of the image feature training module 51, the extraction module 52, the defect detection training module 53 and the detection module 54 correspond to the steps in the above-mentioned solar panel defect detection method, so they are not described here in detail.
[0110] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements, or they can all be implemented in the form of hardware, or some modules can be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example: the x module can be a separately established processing element, or it can be integrated in a certain chip of the above device. In addition, the x module can also be stored in the memory of the above device in the form of program code, and called and executed by a certain processing element of the above device. The implementation of other modules is similar. These modules can be integrated together in whole or in part, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software. The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), one or more microprocessors (DSP), one or more field programmable gate arrays (FPGA), etc. When a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. These modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0111] The storage medium of the present invention stores a computer program, which implements the above-mentioned solar panel defect detection method when executed by a processor. Preferably, the storage medium includes: ROM, RAM, disk, USB flash drive, memory card or optical disk and other media that can store program codes.
[0112] like Figure 6 As shown, in one embodiment, the solar panel defect detection terminal of the present invention includes: a processor 61 and a memory 62 .
[0113] The memory 62 is used to store computer programs.
[0114] The memory 62 includes: ROM, RAM, disk, USB flash drive, memory card or optical disk, etc., which can store program codes.
[0115] The processor 61 is connected to the memory 62 and is used to execute the computer program stored in the memory so that the solar panel defect detection terminal executes the above-mentioned solar panel defect detection method.
[0116] Preferably, the processor 61 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0117] In summary, the solar panel defect detection method and system, storage medium and terminal generative self-supervised learning method of the present invention can construct self-supervised tasks for unlabeled data sets for training, generate feature extraction models, and do not need to use manually labeled large sample data sets, thereby greatly reducing the workload of manual labeling and reducing costs and increasing efficiency; the location of the defect can be located by self-attention fuzzy positioning, avoiding the difficulty of accurate defect positioning, and the defect can be detected without explicitly distinguishing the defect location, which is suitable for detecting open errors; after the feature extraction model training is completed using the self-supervised learning method, compared with the supervised model, the local detail features and global semantic features of the data set can be captured, and only a small amount of labeled typical defect samples are needed to train the classifier to achieve a good classification effect; by adopting a dual-channel mode training model, the original image is avoided from being restored from the pixel level, the amount of calculation is significantly reduced, and the actual needs of industrial production are met; by adopting a universal semantic generative self-supervised learning method, it can be applied to a wide range of industrial surface detection, and has a very broad application prospect; training and testing on the solar panel defect data set only requires 120 training cycles, that is, a classification accuracy of 81.79% can be achieved, and the robustness is good and the generalization ability is strong. Therefore, the present invention effectively overcomes various shortcomings in the prior art and has high industrial utilization value.
[0118] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A method for detecting defects in a solar panel, characterized in that: The following steps are involved: Train the image feature recognition model based on self-supervised learning method; Extracting image features of a solar panel image containing surface defects based on the image feature recognition model; Based on a supervised learning method, a solar panel defect detection model is trained according to the image features; Inputting the solar panel image into the image feature recognition model and the solar panel defect detection model in sequence to obtain a solar panel defect detection result; Training the image feature recognition model based on the self-supervised learning method includes the following steps: Divide the input image into multiple image blocks; Encoding each of the image blocks to generate a coding value corresponding to the image block; Randomly masking the multiple image blocks according to a preset ratio, inputting a sequence of image blocks obtained after masking into a ViT model, and obtaining a feature vector of the masked image blocks; Inputting the feature vector into the MIM model to obtain the encoding value of the feature vector; Obtaining an error between a coding value of the masked image block and a coding value of a feature vector; if the error is not within a preset range, adjusting parameter values of the ViT model and the MIM model until the error is within the preset range, and using the ViT model as the image feature recognition model; Based on the supervised learning method, training the solar panel defect detection model according to the image features includes the following steps: Acquire image features of the solar panel image extracted by the image feature recognition model; Inputting the image features into the solar panel defect detection model; Obtaining a solar panel defect detection result output by the solar panel defect detection model; If the accuracy of the solar panel defect detection result does not reach a preset threshold, the parameters of the solar panel defect detection model are adjusted until the accuracy of the solar panel defect detection result reaches a preset threshold.
2. The solar panel defect detection method according to claim 1, characterized in that: A discrete variation encoder is used to encode each of the image blocks, and the discrete variation encoder is used to convert the image block into a discrete encoding value.
3. The solar panel defect detection method according to claim 1, characterized in that: The parameter values of the ViT model include a batch size of 32, an optimizer of Adm, a learning rate of cosine optimization scheme, a warm-up period of 5, a layer decay of 0.75, a descent path of 0.2, a weight decay of 0.05, and a training period of 200 times.
4. The solar panel defect detection method according to claim 1, characterized in that: The preset ratio is 40%.
5. The solar panel defect detection method according to claim 1, characterized in that: The solar panel defect detection model adopts a fully connected MLP network.
6. A solar panel defect detection system, characterized in that: It includes image feature training module, extraction module, defect detection training module and detection module; The image feature training module is used to train the image feature recognition model based on a self-supervised learning method; The extraction module is used to extract image features of the solar panel image containing surface defects based on the image feature recognition model; The defect detection training module is used to train a solar panel defect detection model according to the image features based on a supervised learning method; The detection module is used to input the solar panel image into the image feature recognition model and the solar panel defect detection model in sequence to obtain a solar panel defect detection result; Training the image feature recognition model based on the self-supervised learning method includes the following steps: Divide the input image into multiple image blocks; Encoding each of the image blocks to generate a coding value corresponding to the image block; Randomly masking the multiple image blocks according to a preset ratio, inputting a sequence of image blocks obtained after masking into a ViT model, and obtaining a feature vector of the masked image blocks; Inputting the feature vector into the MIM model to obtain the encoding value of the feature vector; Obtaining an error between a coding value of the masked image block and a coding value of a feature vector; if the error is not within a preset range, adjusting parameter values of the ViT model and the MIM model until the error is within the preset range, and using the ViT model as the image feature recognition model; Based on the supervised learning method, training the solar panel defect detection model according to the image features includes the following steps: Acquire image features of the solar panel image extracted by the image feature recognition model; Inputting the image features into the solar panel defect detection model; Obtaining a solar panel defect detection result output by the solar panel defect detection model; If the accuracy of the solar panel defect detection result does not reach a preset threshold, the parameters of the solar panel defect detection model are adjusted until the accuracy of the solar panel defect detection result reaches a preset threshold.
7. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the solar panel defect detection method according to any one of claims 1 to 5 is implemented.
8. A solar panel defect detection terminal, characterized in that: include: Processor and memory; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory, so that the solar panel defect detection terminal performs the solar panel defect detection method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Solar cell panel defect detection method based on multi-scale joint convolutional neural network
CN110689011A
Image anomaly detection and anomaly positioning method and system based on self-supervised mask
CN114022475A
Food image classification method and system, storage medium and terminal
CN114842266A
Method and System for Identifying Defects in NDT Image Data
US20090279772A1
