Method for generating support vector machine model, and method and device for detecting foreign matter
Through the support vector machine model and the sparrow algorithm, the foreign object detection method for photovoltaic modules is solved, resulting in reduced power generation efficiency due to foreign objects on the surface of photovoltaic modules, and efficient and accurate foreign object detection is achieved.
Patent Information
- Application Number
- CN202411347708.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Foreign matter attached to the surface of photovoltaic modules leads to a reduction in power generation efficiency, and the prior art is difficult to effectively detect and solve this problem.
The support vector machine model is used to combine the sparrow algorithm to optimize the penalty coefficient C. The photovoltaic component pictures are processed by filtering and denoising and grayscale, and the model is trained to improve the accuracy of foreign object detection and converted into a convex quadratic planning optimization problem.
It realizes efficient detection of foreign objects on photovoltaic modules, improves detection accuracy, reduces noise impact, and enhances the robustness and computing efficiency of the model.
Smart Images

Figure CN119206348A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of photovoltaic technology, and in particular to a method for generating a support vector machine model between plane regions, a method for detecting foreign matter and a device thereof. Background Art
[0002] Solar energy, as a clean energy with direct source, largest resource, widest distribution and huge development potential, is gradually becoming the world's most important energy source in the future. Photovoltaic modules, as the main equipment for receiving solar energy, have attracted more and more attention. However, in the actual working environment, foreign matter (such as particles, branches, etc.) is usually attached to the surface of photovoltaic modules. It is understandable that this makes them work in a partial shadow state, which greatly reduces the power generation efficiency.
[0003] Therefore, how to detect foreign matter on photovoltaic modules has become a problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, the main purpose of the present invention is to provide a method for generating a support vector machine model between planar regions, a method for detecting foreign matter and a device thereof.
[0005] To achieve the above-mentioned purpose, the technical solution of the present invention is implemented as follows: a method for generating a support vector machine model for foreign object detection on a photovoltaic module, comprising the following steps: obtaining a plurality of first images to be processed and a foreign object detection result corresponding to each first image to be processed, a plurality of second images to be processed and a foreign object detection result corresponding to each second image to be processed, each of the first and second images to be processed contains a photovoltaic module, and the foreign object detection result includes: there is no foreign object occlusion and there is foreign object occlusion on the photovoltaic module, and each of the first and second images to be processed are preprocessed; creating a support vector machine model, using all the first images to be processed and the foreign object detection results corresponding to each first image to be processed as training data, and using all the second images to be processed and the foreign object detection results corresponding to each second image to be processed as test data, training the support vector machine model, and in the process of training, using the sparrow algorithm to optimize the penalty coefficient C in the support vector machine model, and the fitness function is the accuracy of the support vector machine model for foreign object detection of all the second images to be processed.
[0006] As an improvement of the embodiment of the present invention, the “pre-processing each of the first and second images to be processed” specifically includes: performing filtering, denoising and gray-scaling processing on each of the first and second images to be processed.
[0007] As an improvement of the embodiment of the present invention, the "filtering and denoising processing" specifically includes: Gaussian filtering.
[0008] As an improvement of the embodiment of the present invention, in the support vector machine model, the objective function is Wherein, q represents the total number of the first to-be-processed images, ξ represents the slack variable, and ‖·‖ represents the norm calculation; the support vector machine model converts the foreign body detection problem into a convex quadratic programming optimization problem:
[0009] Among them, N h Represents the total number of parameters, a1, a2, ..., is the Lagrange multiplier.
[0010] The embodiment of the present invention also provides a device for generating a support vector machine model for foreign object detection on a photovoltaic module, comprising the following modules: an information acquisition module, used to obtain multiple first pictures to be processed and foreign object detection results corresponding to each first picture to be processed, multiple second pictures to be processed and foreign object detection results corresponding to each second picture to be processed, each of the first and second pictures to be processed contains a photovoltaic module, and the foreign object detection results include: there is no foreign object occlusion and there is foreign object occlusion on the photovoltaic module, and each first and second pictures to be processed are preprocessed; a model creation module, used to create a support vector machine model, using all first pictures to be processed and the foreign object detection results corresponding to each first picture to be processed as training data, all second pictures to be processed and the foreign object detection results corresponding to each second picture to be processed as test data, training the support vector machine model, and in the training process, using the sparrow algorithm to optimize the penalty coefficient C in the support vector machine model, and the fitness function is the accuracy of the support vector machine model for foreign object detection of all second pictures to be processed.
[0011] As an improvement of the embodiment of the present invention, the information acquisition module is further used to: perform filtering, denoising and grayscale processing on each of the first and second images to be processed.
[0012] As an improvement of the embodiment of the present invention, the "filtering and denoising processing" specifically includes: Gaussian filtering.
[0013] As an improvement of the embodiment of the present invention, in the support vector machine model, the objective function is Wherein, q represents the total number of the first to-be-processed images, ξ represents the slack variable, and ‖·‖ represents the norm calculation; the support vector machine model converts the foreign body detection problem into a convex quadratic programming optimization problem:
[0014] Among them, N h Represents the total number of parameters, a1, a2, ..., is the Lagrange multiplier.
[0015] An embodiment of the present invention also provides a method for detecting foreign objects on a photovoltaic module, comprising the following steps: executing the above-mentioned generation method and obtaining a support vector machine model; obtaining a picture to be detected containing a photovoltaic module, preprocessing the picture to be detected, processing the picture to be detected based on the support vector machine model, and obtaining a foreign object detection result.
[0016] The embodiment of the present invention also provides a detection device for foreign objects on photovoltaic modules, comprising the following modules: a processing module, which is used to execute the above-mentioned generation method and obtain a support vector machine model; obtain a picture to be detected containing a photovoltaic module, pre-process the picture to be detected, process the picture to be detected based on the support vector machine model, and obtain a foreign object detection result
[0017] The generation method of the support vector machine model between plane regions, the detection method of foreign objects and the device thereof provided by the embodiment of the present invention have the following advantages: the embodiment of the present invention discloses a generation method of a support vector machine model, the detection method of foreign objects and the device thereof, and the generation method comprises the following steps: obtaining a plurality of images to be processed and the foreign object detection result corresponding to each image to be processed; creating a support vector machine model, using some of the images to be processed and the corresponding foreign object detection results as training data, using the remaining images to be processed and the corresponding foreign object detection results as test data, training the support vector machine model, and in the training process, using the sparrow algorithm to optimize the penalty coefficient C in the support vector machine model, and the fitness function is the accuracy of the foreign object detection of the support vector machine model for all test data. The support vector machine model can detect foreign objects on photovoltaic modules. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Schematic diagram of the flow of the method for generating a support vector machine model in an embodiment. DETAILED DESCRIPTION
[0019] The present invention will be described in detail below in conjunction with the embodiments shown in the accompanying drawings. However, the embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on the embodiments are all within the protection scope of the present invention.
[0020] The following description and accompanying drawings fully illustrate the specific embodiments of this article so that those skilled in the art can practice them. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of this article includes the entire scope of the claims, as well as all available equivalents of the claims. Herein, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the structure, device or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such structure, device or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the structure, device or equipment including the elements. Each embodiment is described in a progressive manner herein, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other.
[0021] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0022] Embodiment 1 of the present invention provides a method for generating a support vector machine model for foreign body detection on a photovoltaic module, such as Figure 1 As shown, the following steps are included:
[0023] Step 101: Obtain multiple first images to be processed and the foreign object detection results corresponding to each first image to be processed, multiple second images to be processed and the foreign object detection results corresponding to each second image to be processed, each of the first and second images to be processed contains a photovoltaic component, and the foreign object detection results include: there is no foreign object blocking the photovoltaic component and there is foreign object blocking the photovoltaic component, and each first and second image to be processed is pre-processed; optionally, the number of first and second images to be processed is the same.
[0024] Here, the first and second images to be processed are generally captured by a camera. In some of the first and second images to be processed, the photovoltaic modules are blocked by foreign objects, while in other of the first and second images to be processed, the photovoltaic modules are not blocked by foreign objects.
[0025] Step 102: Create a support vector machine model, use all first images to be processed and the foreign object detection results corresponding to each first image to be processed as training data, use all second images to be processed and the foreign object detection results corresponding to each second image to be processed as test data, train the support vector machine model, and during the training process, use the sparrow algorithm to optimize the penalty coefficient C in the support vector machine model, and the fitness function is the accuracy of the support vector machine model in foreign object detection of all second images to be processed.
[0026] The penalty coefficient C in the support vector machine model (SVM) plays the role of penalizing errors. The larger the value of C, the greater the penalty for misclassification, which means that the algorithm will be more inclined to correctly classify all samples, but may overfit. The smaller the value of C, the smaller the penalty, and the algorithm will be more inclined to simply classify all samples as support vector machines, which may lead to overfitting. In the support vector machine model, the C parameter is the penalty parameter of the penalty term, which determines the degree of penalty for the classification interval. The larger the C, the more severe the penalty for the classification interval, which means that the algorithm will be more inclined to choose a wider decision boundary, which is more robust to noise.
[0027] The images of photovoltaic modules without foreign objects and with foreign objects are used as input samples to train the support vector machine model. The support vector machine is a model for solving binary classification problems. The foreign object occlusion detection model and objective function are constructed based on the support vector machine, which can transform the complex photovoltaic module foreign object occlusion detection problem into a binary classification problem and improve the calculation efficiency. When solving the binary classification problem, the support vector machine needs to find the optimal value of the penalty coefficient C, and the general search algorithm is prone to fall into the local extreme value. The generation method in the embodiment of the present invention uses the sparrow algorithm to determine the penalty coefficient C, which can effectively solve the above problem. In addition, the sparrow algorithm speeds up the calculation efficiency.
[0028] Fitness function finteness = max(accuracy[predict(all second images to be processed)].
[0029] In the sparrow search algorithm, sparrows are divided into "discoverers" and "followers". The formula for updating the discoverer's position is as follows:
[0030]
[0031] Among them, t m is the number of iterations, j represents the individual sparrow, Indicates the tth m The position of the lth sparrow in the generation in the k dimension, t max is the maximum number of falls, R2 is the warning value, S T is a safe value, Q is a random parameter, and L is a 1*d matrix;
[0032] Update the follower position as shown below:
[0033]
[0034] Among them, C p is the optimal position for the finder, C worst is the worst position of the finder, and n is the total number of sparrows.
[0035] In this embodiment, the “pre-processing each of the first and second to-be-processed pictures” specifically includes: performing filtering, denoising and gray-scaling processing on each of the first and second to-be-processed pictures.
[0036] Here, when the camera collects pictures, due to various reasons, the collected pictures generally contain multiple noise points, which will affect the subsequent processing of the pictures. Therefore, filtering and denoising can be used to remove the noise points.
[0037] Grayscale processing, the images obtained by scanning with a camera are generally in color. According to the principle of three primary colors, they are generally made up of three single colors, R, G, and B, in a certain ratio. Since color images contain more information, it is not convenient to process them. Although there are some processing methods based on color images, the actual effect is not obvious. Generally speaking, when the light is too strong or too weak, the image collected by the camera will be different from the expected image effect.
[0038] As for color images, there are many types of colors and they contain a lot of information, so the capacity is also large, which is not conducive to the processing of single-chip microcomputers. However, once the image is binarized, it will become a grayscale image. In such a picture, there are only black and white. For the convenience of representation and observation, according to the different shades of black and white, the black to white are divided into 256 levels. This is the 256-level grayscale commonly referred to in the binarization process. This representation method is relatively simple, and the processed image capacity is small, which can further reduce the amount of calculation. The specific conversion method is shown in the following formula: Gray value
[0039] =0.299R+0.587G+0.114B.
[0040] The purpose of grayscale processing is to reduce the amount of calculation. During the collection, the photovoltaic components will be collected when they are not blocked, and the photovoltaic components will be collected when they are blocked. After training with the support vector machine, appropriate parameters are obtained to generate a foreign body blockage detection model, and then the model is used to detect whether there is foreign body blockage. For photovoltaic components, the grayscale of the image collected by the same camera is different when there is blockage and when there is no blockage, so the support vector machine uses this difference for detection.
[0041] In this embodiment, the “filtering and denoising process” specifically includes: Gaussian filtering.
[0042] Gaussian filtering is a linear smoothing filter that is suitable for eliminating Gaussian noise. Gaussian filtering can perform weighted averaging on the entire image. The value of each pixel is obtained by weighted averaging the value of itself and other pixels in the neighborhood.
[0043] In this embodiment, in the support vector machine model, the objective function is Where q represents the total number of the first to-be-processed images, ξ represents the slack variable, and ‖·‖ represents the norm calculation;
[0044] The support vector machine model transforms the foreign body detection problem into a convex quadratic programming optimization problem:
[0045] Among them, N h Represents the total number of parameters, a1, a2, ..., is the Lagrange multiplier.
[0046] Here, the slack variable reflects the model's tolerance to outliers, and the norm calculation can be understood as calculating the length of the vector, a1, a2, ..., These are the parameters needed to find the optimal solution.
[0047] In the support vector machine model, the plane equation of the classification line is assumed to be: ω*x+b=0, where ω is the weight coefficient, b is the bias value, and x is the input image, that is, the gray value of the pixel.
[0048] Further introduce the slack variable ξ i and penalty coefficient C, satisfying the following formula: i (ω*x i +b)≥1-ξ i , where y is the sample category function and i is an integer. Since the results are only foreign object occlusion and no foreign object occlusion, there are only two cases. Due to the binary classification problem, there are only two results.
[0049] Embodiment 2 of the present invention provides a device for generating a support vector machine model for detecting foreign matter on a photovoltaic module, comprising the following modules:
[0050] An information acquisition module is used to acquire a plurality of first images to be processed and a foreign object detection result corresponding to each first image to be processed, a plurality of second images to be processed and a foreign object detection result corresponding to each second image to be processed, each of the first and second images to be processed contains a photovoltaic module, and the foreign object detection result includes: there is no foreign object blocking the photovoltaic module and there is a foreign object blocking the photovoltaic module, and each of the first and second images to be processed is preprocessed;
[0051] A model creation module is used to create a support vector machine model, using all first images to be processed and the foreign body detection results corresponding to each first image to be processed as training data, and all second images to be processed and the foreign body detection results corresponding to each second image to be processed as test data, to train the support vector machine model, and during the training process, using the sparrow algorithm to optimize the penalty coefficient C in the support vector machine model, and the fitness function is the accuracy of the support vector machine model in foreign body detection of all second images to be processed.
[0052] In this embodiment, the information acquisition module is further used to perform filtering, denoising and grayscale processing on each of the first and second to-be-processed pictures.
[0053] In this embodiment, the “filtering and denoising process” specifically includes: Gaussian filtering.
[0054] In this embodiment, in the support vector machine model, the objective function is Where q represents the total number of the first to-be-processed images, ξ represents the slack variable, and ‖·‖ represents the norm calculation;
[0055] The support vector machine model transforms the foreign body detection problem into a convex quadratic programming optimization problem:
[0056] Among them, Nh Represents the total number of parameters, a1, a2, ..., is the Lagrange multiplier.
[0057] Embodiment 3 of the present invention provides a method for detecting foreign objects on photovoltaic modules, comprising the following steps: executing the generation method in embodiment 1 and obtaining a support vector machine model; obtaining a picture to be detected containing a photovoltaic module, preprocessing the picture to be detected, processing the picture to be detected based on the support vector machine model, and obtaining a foreign object detection result.
[0058] Here, once it is found that the photovoltaic components are blocked by foreign objects, an alarm will sound to promptly notify the on-duty personnel to conduct a patrol inspection of the photovoltaic components, check the surrounding environment, analyze the cause of the blockage, and eliminate the hidden dangers in a timely manner.
[0059] Embodiment 4 of the present invention provides a method for detecting foreign objects on photovoltaic modules, comprising the following modules: a processing module, used to execute the generation method in embodiment 1 and obtain a support vector machine model; obtain a picture to be detected containing photovoltaic modules, pre-process the picture to be detected, process the picture to be detected based on the support vector machine model, and obtain a foreign object detection result.
[0060] The “preprocessing the image to be detected” specifically includes: performing filtering and denoising processing and grayscale processing on the image to be detected. The filtering and denoising processing may be Gaussian filtering.
[0061] It should be noted that although the above describes the various steps in a specific order, it does not mean that the various steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order as long as the required functions can be achieved.
[0062] The present invention may be a system, a method and / or a computer program product. The computer program product may include a readable storage medium carrying computer readable program instructions for causing a processor to implement various aspects of the present invention.
[0063] The readable storage medium can be a tangible device that holds and stores the instructions used by the instruction execution device. The readable storage medium can include, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a protruding structure in a groove on which instructions are stored, and any suitable combination thereof.
[0064] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for generating a support vector machine model for foreign body detection on a photovoltaic module, characterized in that: The following steps are involved: Obtain a plurality of first images to be processed and a foreign object detection result corresponding to each first image to be processed, a plurality of second images to be processed and a foreign object detection result corresponding to each second image to be processed, each of the first and second images to be processed contains a photovoltaic module, and the foreign object detection result includes: there is no foreign object blocking the photovoltaic module and there is a foreign object blocking the photovoltaic module, and each of the first and second images to be processed are preprocessed; A support vector machine model is created, all first images to be processed and the foreign object detection results corresponding to each first image to be processed are used as training data, all second images to be processed and the foreign object detection results corresponding to each second image to be processed are used as test data, the support vector machine model is trained, and during the training process, the penalty coefficient C in the support vector machine model is optimized using the sparrow algorithm, and the fitness function is the accuracy of the support vector machine model in foreign object detection of all second images to be processed.
2. The generation method according to claim 1, characterized in that: The “preprocessing each of the first and second to-be-processed pictures” specifically includes: Each of the first and second to-be-processed pictures is subjected to filtering, denoising and gray-scaling processing.
3. The generation method according to claim 2, characterized in that: The "filtering and denoising processing" specifically includes: Gaussian filtering.
4. The generation method according to claim 1, characterized in that: In the support vector machine model, the objective function is Where q represents the total number of the first to-be-processed images, ξ represents the slack variable, and ‖·‖ represents the norm calculation; The support vector machine model transforms the foreign body detection problem into a convex quadratic programming optimization problem: Among them, N h Represents the total number of parameters, is the Lagrange multiplier.
5. A device for generating a support vector machine model for foreign body detection on a photovoltaic module, characterized in that: Includes the following modules: An information acquisition module is used to acquire a plurality of first images to be processed and a foreign object detection result corresponding to each first image to be processed, a plurality of second images to be processed and a foreign object detection result corresponding to each second image to be processed, each of the first and second images to be processed contains a photovoltaic module, and the foreign object detection result includes: there is no foreign object blocking the photovoltaic module and there is a foreign object blocking the photovoltaic module, and each of the first and second images to be processed is preprocessed; A model creation module is used to create a support vector machine model, using all first images to be processed and the foreign body detection results corresponding to each first image to be processed as training data, and all second images to be processed and the foreign body detection results corresponding to each second image to be processed as test data, to train the support vector machine model, and during the training process, using the sparrow algorithm to optimize the penalty coefficient C in the support vector machine model, and the fitness function is the accuracy of the support vector machine model in foreign body detection of all second images to be processed.
6. The generating device according to claim 5, characterized in that The information acquisition module is also used for: Each of the first and second to-be-processed pictures is subjected to filtering, denoising and gray-scaling processing.
7. The generating device according to claim 6, characterized in that: The "filtering and denoising processing" specifically includes: Gaussian filtering.
8. The generating device according to claim 5, characterized in that In the support vector machine model, the objective function is Where q represents the total number of the first to-be-processed images, ξ represents the slack variable, and ‖·‖ represents the norm calculation; The support vector machine model transforms the foreign body detection problem into a convex quadratic programming optimization problem: Among them, N h Represents the total number of parameters, is the Lagrange multiplier.
9. A method for detecting foreign matter on a photovoltaic module, characterized in that: The following steps are involved: Execute the generation method described in any one of claims 1 to 4, and obtain a support vector machine model; Acquire a picture to be detected containing a photovoltaic module, pre-process the picture to be detected, process the picture to be detected based on the support vector machine model, and obtain a foreign body detection result.
10. A device for detecting foreign matter on a photovoltaic module, characterized in that: Includes the following modules: A processing module, used to execute the generation method described in any one of claims 1-4 and obtain a support vector machine model; obtain a picture to be detected containing a photovoltaic component, pre-process the picture to be detected, process the picture to be detected based on the support vector machine model, and obtain a foreign body detection result.
Citation Information
Patent Citations
Ultrasonic flowmeter fault diagnosis method based on improved sparrow search algorithm
CN117851903A
All-vanadium battery safety state estimation method based on sparrow optimization support vector machine algorithm
CN118569411A