A method and device for positioning a battery in an image, an electronic device, and a storage medium
By accurately locating the cell strings, cells, and busbars in photovoltaic module images, the problem of insufficient accuracy in cell defect detection during the welding process is solved, achieving efficient and robust cell positioning that is adaptable to different types of cells and busbars.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-03
- Publication Date
- 2026-03-17
AI Technical Summary
In the production of photovoltaic modules, existing technologies suffer from insufficient accuracy in detecting cell defects during the welding process, especially for defects with high requirements for cell boundaries and main busbar positioning.
By locating the battery string in the image, the position information of the battery string is obtained, and the battery cells and main grid are further located. The straight line detection principle and deep learning algorithm are used for adjustment to ensure positioning accuracy.
It improves the accuracy of battery defect detection, reduces interference from other areas in the image on positioning, achieves adaptive positioning, is not affected by stringer model, cell type and main grid type, and enhances robustness.
Smart Images

Figure CN117152246B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine vision technology, and in particular to a method, apparatus, electronic device, and storage medium for locating a battery in an image. Background Technology
[0002] Photovoltaic modules are the core component of solar power systems, converting solar energy into electrical energy for storage or powering loads. Photovoltaic string welding machines, as crucial equipment in photovoltaic module production, use welding ribbons to weld multiple solar cells into strings. However, the welding process can introduce various cell defects, such as misaligned welds, short circuits, foreign objects, missing strips, edge chipping, and poor spacing.
[0003] To address these defects, machine vision inspection methods can significantly improve the quality and efficiency of battery string production. When detecting defects in batteries, the accuracy depends on the precise positioning of the battery cells within the image. For example, detecting defects such as edge chipping and poor spacing requires precise positioning of the battery cell boundaries, while detecting defects such as misaligned solder joints, missing strips, and short circuits requires precise positioning of the battery cell's main grid. Therefore, accurately detecting battery defects necessitates a method capable of accurately locating the batteries within an image. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for locating batteries in an image, so as to accurately locate batteries in an image. The specific technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide a method for locating a battery in an image, the method comprising:
[0006] Acquire an image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, and each battery cell includes multiple main grids;
[0007] The image to be processed is subjected to battery string localization processing to obtain the position information of the battery string, and the battery string image is determined from the image to be processed based on the position information of the battery string;
[0008] Perform battery cell localization processing on the battery string image to obtain the position information of each battery cell;
[0009] For each cell's location information in the cell region corresponding to the cell in the cell string image, main grid positioning processing is performed to obtain the main grid's location information in each cell region.
[0010] Optionally, the step of performing battery string localization processing on the image to be processed to obtain the location information of the battery string includes:
[0011] Based on the blank area between adjacent battery strings in the image to be processed, battery string localization processing is performed on the image to be processed to obtain a first localization box.
[0012] The position information of the first positioning frame is determined as the position information of the battery string; or...
[0013] The first positioning frame is expanded to obtain an expanded first positioning frame; the position information of the expanded first positioning frame is determined as the position information of the battery string.
[0014] Optionally, the step of performing cell localization processing on the battery string image to obtain the position information of each cell includes:
[0015] Obtain the first number of battery cells actually included in the battery string in the image to be processed;
[0016] The battery string image is subjected to initial positioning processing of the battery cells to obtain the second positioning frame of the battery cells;
[0017] Based on the first quantity and the position information of the second positioning frame, the second positioning frame is corrected to obtain the corrected second positioning frame;
[0018] Based on the principle of line detection, the modified second positioning frame is adjusted to obtain the position information of each battery cell.
[0019] Optionally, the position information of the second positioning frame includes the center point coordinates, width, height, and angle of the second positioning frame;
[0020] The step of correcting the second positioning frame based on the first quantity and the position information of the second positioning frame to obtain the corrected second positioning frame includes:
[0021] The second positioning frame is sorted according to the preset order of the horizontal axis coordinate values of the center point to obtain the sorting result, wherein the preset order is either from small to large or from large to small;
[0022] Calculate the distance between every two adjacent second positioning frames along the horizontal axis in the sorting result;
[0023] Calculate the average value of the other spacings besides the maximum and minimum spacings to obtain the first average spacing;
[0024] Based on the ordinate, width, height and angle of the center point of each second positioning frame, calculate the average ordinate, width, height and angle of the center point of the second positioning frame respectively.
[0025] Based on the first average spacing, the average value of the vertical axis coordinate of the center point of the second positioning frame, the average width, the average height, and the average angle, the second positioning frame is corrected to obtain the corrected second positioning frame.
[0026] Optionally, the step of correcting the second positioning frame based on the first average spacing, the average value of the vertical coordinate of the center point of the second positioning frame, the average width, the average height, and the average angle to obtain a corrected second positioning frame includes:
[0027] Based on the first average spacing and the horizontal axis coordinate value of the center point of the second positioning frame, the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame is determined according to the following formula.
[0028] or
[0029] Where, x i The x-axis coordinate of the center point of the i-th second positioning frame after being arranged in the preset order is given. The maximum value of i+1 is the number of battery cells, and the minimum value of i-1 is 1. This is the first average spacing;
[0030] For each corrected horizontal axis coordinate value, if there is a corresponding second positioning box for the corrected horizontal axis coordinate value, the corrected horizontal axis coordinate value corresponding to the second positioning box is used as the horizontal axis coordinate value of the center point of the corrected second positioning box, and the vertical axis coordinate value, width, height and angle of the center point of the second positioning box are used as the vertical axis coordinate value, width, height and angle of the center point of the corrected second positioning box, respectively, to obtain the corrected second positioning box corresponding to the corrected horizontal axis coordinate value.
[0031] If the corrected horizontal axis coordinate value does not correspond to a second positioning frame, the corrected horizontal axis coordinate value is used as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and the average value of the vertical axis coordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle are used as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value.
[0032] Optionally, the step of adjusting the corrected second positioning frame based on the line detection principle to obtain the position information of each battery cell includes:
[0033] For each corrected second positioning box, generate the line search area corresponding to the four sides of the corrected second positioning box;
[0034] The line detection area is subjected to line detection according to the line detection principle to obtain the line detection result;
[0035] The intersection of the straight lines included in the straight line detection results is determined as the position information of the battery cell corresponding to the corrected second positioning frame.
[0036] Optionally, the step of performing main grid location processing on the corresponding cell region in the battery string image for the location information of each cell to obtain the location information of the main grid in each cell region includes:
[0037] Obtain the second number of main grids actually included in each cell of the battery string included in the image to be processed;
[0038] For the cell location information of each cell in the cell area corresponding to the cell in the cell string image, main grid positioning processing is performed to obtain the third positioning box of each main grid.
[0039] For each battery cell area, the third positioning frame is corrected based on the second quantity and the position information of the third positioning frame to obtain the corrected third positioning frame;
[0040] Based on the distribution pattern of the main grid in the battery string image and the principle of line detection, the corrected third positioning frame is adjusted to obtain the position information of the main grid.
[0041] Optionally, the position information of the third positioning frame includes the center point coordinates, width, height, and angle of the third positioning frame;
[0042] The step of correcting the third positioning frame for each battery cell region based on the second quantity and the position information of the third positioning frame to obtain the corrected third positioning frame includes:
[0043] For each battery cell area, the third positioning frame is sorted according to the preset order of the vertical axis coordinate values of the center point to obtain the sorting result, wherein the preset order is either from small to large or from large to small;
[0044] Calculate the distance between every two adjacent third positioning frames along the vertical axis in the sorting result;
[0045] Calculate the average value of the other spacings besides the maximum and minimum spacings to obtain the second average spacing;
[0046] Based on the horizontal axis coordinates, width, height and angle of the center point of each third positioning frame, calculate the average horizontal axis coordinates, average width, average height and average angle of the center point of the third positioning frame respectively.
[0047] Based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle, the third positioning frame is corrected to obtain the corrected third positioning frame.
[0048] Optionally, the step of correcting the third positioning frame based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle to obtain a corrected third positioning frame includes:
[0049] Based on the second average spacing and the ordinate value of the center point of the third positioning frame, the corrected ordinate value of the center point of each third positioning frame is determined according to the following formula.
[0050] or
[0051] Among them, y i The value of i+1 is the ordinate of the center point of the i-th third positioning frame arranged in the preset order. The maximum value of i+1 is the number of main grids included in the battery cell, and the minimum value of i-1 is 1. This is the second average spacing;
[0052] For each corrected ordinate value, if there is a corresponding third positioning box for the corrected ordinate value, the corrected ordinate value corresponding to the third positioning box is used as the ordinate value of the center point of the corrected third positioning box, and the horizontal ordinate value, width, height and angle of the center point of the third positioning box are used as the horizontal ordinate value, width, height and angle of the center point of the corrected third positioning box, respectively, to obtain the corrected third positioning box corresponding to the corrected ordinate value.
[0053] If the corrected ordinate value does not correspond to a third positioning frame, the corrected ordinate value is used as the ordinate value of the center point of the corrected third positioning frame. The average value of the lateral ordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle are used as the lateral ordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected ordinate value.
[0054] Optionally, the position information of the corrected third positioning frame includes the coordinates of the center point of the third positioning frame;
[0055] The step of adjusting the corrected third positioning frame based on the distribution pattern of the main grid in the battery string image and the principle of line detection to obtain the position information of the main grid includes:
[0056] Based on the center point of each corrected third positioning frame, a vertical line is detected to obtain the vertical line;
[0057] Based on the center point of each corrected third positioning box, a horizontal line is detected to obtain a horizontal line;
[0058] The intersection of the vertical line and the horizontal line is determined as the position information of the main grid.
[0059] Optionally, after the step of performing main grid location processing on the corresponding cell region in the battery string image for the location information of each cell to obtain the position information of the main grid in each cell region, the method further includes:
[0060] Based on the position information of each battery cell and the position information of the main grid, defect detection is performed on the battery string image to obtain the defect detection result.
[0061] Secondly, embodiments of this application provide a battery positioning device in an image, the device comprising:
[0062] The image acquisition module is used to acquire the image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, and each battery cell includes multiple main grids;
[0063] A battery string image acquisition module is used to perform battery string positioning processing on the image to be processed, obtain the position information of the battery string, and determine the battery string image from the image to be processed based on the position information of the battery string.
[0064] The battery cell location information acquisition module is used to perform battery cell positioning processing on the battery string image to obtain the location information of each battery cell;
[0065] The main grid position information acquisition module is used to perform main grid positioning processing on the corresponding cell area in the battery string image for the position information of each cell, so as to obtain the position information of the main grid in each cell area.
[0066] Optionally, the battery string image acquisition module includes:
[0067] The first positioning box acquisition submodule is used to perform battery string positioning processing on the image to be processed based on the blank area between adjacent battery strings in the image to be processed, and obtain the first positioning box.
[0068] A battery string location information acquisition submodule is used to determine the location information of the first positioning frame as the location information of the battery string; or...
[0069] The first positioning frame is expanded to obtain an expanded first positioning frame; the position information of the expanded first positioning frame is determined as the position information of the battery string.
[0070] Optionally, the cell location information acquisition module includes:
[0071] The first quantity acquisition submodule is used to acquire the first quantity of battery cells actually included in the battery string included in the image to be processed;
[0072] The second positioning frame acquisition submodule is used to perform initial positioning processing on the battery string image to obtain the second positioning frame of the battery cell.
[0073] The second positioning frame acquisition submodule is used to correct the second positioning frame based on the first quantity and the position information of the second positioning frame to obtain the corrected second positioning frame.
[0074] The cell position information acquisition submodule is used to adjust the corrected second positioning frame based on the straight line detection principle to obtain the position information of each cell.
[0075] Optionally, the position information of the second positioning frame includes the center point coordinates, width, height, and angle of the second positioning frame;
[0076] The modified second positioning frame acquisition submodule includes:
[0077] The first acquisition unit is used to sort the second positioning frame according to a preset order of the horizontal axis coordinate values of the center point to obtain a sorting result, wherein the preset order is either from smallest to largest or from largest to smallest.
[0078] The first calculation unit is used to calculate the distance between every two adjacent second positioning frames along the horizontal axis in the sorting result;
[0079] The first average spacing acquisition unit is used to calculate the average value of the other spacings besides the maximum and minimum spacings, and obtain the first average spacing.
[0080] The second calculation unit is used to calculate the average value of the longitudinal coordinates, the average value of the width, the average value of the height, and the average value of the angle of the center point of each second positioning frame based on the longitudinal coordinates, width, height, and angle of the center point of each second positioning frame.
[0081] The second positioning frame acquisition unit is used to correct the second positioning frame based on the first average spacing, the average value of the vertical axis coordinate of the center point of the second positioning frame, the average width, the average height, and the average angle, so as to obtain the corrected second positioning frame.
[0082] Optionally, the modified second positioning box acquisition unit includes:
[0083] The horizontal axis coordinate value determination subunit is used to determine the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame based on the first average spacing and the horizontal axis coordinate value of the center point of the second positioning frame, according to the following formula.
[0084] or
[0085] Where, x i The x-axis coordinate of the center point of the i-th second positioning frame after being arranged in the preset order is given. The maximum value of i+1 is the number of battery cells, and the minimum value of i-1 is 1. This is the first average spacing;
[0086] The first correction subunit is used to, for each corrected horizontal axis coordinate value, if there is a corresponding second positioning box for the corrected horizontal axis coordinate value, take the corrected horizontal axis coordinate value corresponding to the second positioning box as the horizontal axis coordinate value of the center point of the corrected second positioning box, and take the vertical axis coordinate value, width, height and angle of the center point of the second positioning box as the vertical axis coordinate value, width, height and angle of the center point of the corrected second positioning box, respectively, to obtain the corrected second positioning box corresponding to the corrected horizontal axis coordinate value.
[0087] The first completion subunit is used to, if the corrected horizontal axis coordinate value does not have a corresponding second positioning frame, use the corrected horizontal axis coordinate value as the horizontal axis coordinate value of the center point of the corrected second positioning frame corresponding to the battery cell, and use the average value of the vertical axis coordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value.
[0088] Optionally, the cell location information acquisition submodule includes:
[0089] The line lookup region generation unit is used to generate the line lookup region corresponding to the four sides of each corrected second positioning box.
[0090] The line detection result acquisition unit is used to perform line detection on the line search area according to the line detection principle to obtain the line detection result;
[0091] The cell position information acquisition unit is used to determine the intersection of the straight lines included in the straight line detection result as the position information of the cell corresponding to the corrected second positioning frame.
[0092] Optionally, the main grid position information acquisition module includes:
[0093] The second quantity acquisition submodule is used to acquire the second quantity of main grids actually included in each battery cell in the battery string included in the image to be processed;
[0094] The third positioning frame acquisition submodule is used to perform main grid positioning processing on the battery cell area corresponding to the position information of each battery cell in the battery string image, and obtain the third positioning frame of each main grid.
[0095] The third positioning frame acquisition submodule is modified to modify the third positioning frame for each battery cell area based on the second quantity and the position information of the third positioning frame, so as to obtain the modified third positioning frame.
[0096] The main grid position information acquisition submodule is used to adjust the corrected third positioning frame based on the distribution pattern of the main grid in the battery string image and the principle of line detection to obtain the position information of the main grid.
[0097] Optionally, the position information of the third positioning frame includes the center point coordinates, width, height, and angle of the third positioning frame;
[0098] The modified third positioning frame acquisition submodule includes:
[0099] The second acquisition unit is used to sort the third positioning frame according to the preset order of the vertical axis coordinate values of the center point for each battery cell area to obtain the sorting result, wherein the preset order is either from small to large or from large to small.
[0100] The third calculation unit is used to calculate the distance between every two adjacent third positioning frames along the vertical axis in the sorting result;
[0101] The second average spacing acquisition unit is used to calculate the average value of the other spacings besides the maximum and minimum spacings, and obtain the second average spacing.
[0102] The fourth calculation unit is used to calculate the average horizontal coordinate value, average width, average height, and average angle of the center point of each third positioning frame based on the horizontal coordinate value, width, height, and angle of the center point of each third positioning frame.
[0103] The third positioning frame acquisition unit corrects the third positioning frame based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle, to obtain the corrected third positioning frame.
[0104] Optionally, the modified third positioning box acquisition unit includes:
[0105] The vertical axis coordinate value determination subunit is used to determine the corrected vertical axis coordinate value corresponding to the center point of each third positioning frame based on the second average spacing and the vertical axis coordinate value of the center point of the third positioning frame, according to the following formula.
[0106] or
[0107] Among them, y i The value of i+1 is the ordinate of the center point of the i-th third positioning frame arranged in the preset order. The maximum value of i+1 is the number of main grids included in the battery cell, and the minimum value of i-1 is 1. This is the second average spacing;
[0108] The second correction subunit is used to, for each corrected ordinate value, if there is a corresponding third positioning box for the corrected ordinate value, take the corrected ordinate value corresponding to the third positioning box as the ordinate value of the center point of the corrected third positioning box, and take the horizontal coordinate value, width, height and angle of the center point of the third positioning box as the horizontal coordinate value, width, height and angle of the center point of the corrected third positioning box, respectively, to obtain the corrected third positioning box corresponding to the corrected ordinate value.
[0109] The second completion subunit is used to, if the corrected vertical axis coordinate value does not have a corresponding third positioning frame, use the corrected vertical axis coordinate value as the vertical axis coordinate value of the center point of the corrected third positioning frame, and use the average value of the horizontal axis coordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle as the horizontal axis coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical axis coordinate value.
[0110] Optionally, the position information of the corrected third positioning frame includes the coordinates of the center point of the third positioning frame;
[0111] The main grid position information acquisition submodule includes:
[0112] The vertical line acquisition unit is used to detect vertical lines based on the center points of each corrected third positioning frame to obtain vertical lines;
[0113] The horizontal line acquisition unit is used to detect horizontal lines based on the center points of each corrected third positioning box to obtain horizontal lines.
[0114] The main grid position information acquisition unit is used to determine the intersection of the vertical line and the horizontal line as the position information of the main grid.
[0115] Optionally, the device further includes:
[0116] The defect detection result acquisition module is used to perform main grid location processing on the battery string image based on the location information of each battery cell in the corresponding battery cell area to obtain the location information of the main grid in each battery cell area, and then perform defect detection on the battery string image to obtain the defect detection result.
[0117] Thirdly, embodiments of this application provide an electronic device, including:
[0118] Memory, used to store computer programs;
[0119] When a processor executes a program stored in memory, it implements any of the methods described in the first aspect above.
[0120] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the methods described in the first aspect above.
[0121] Beneficial effects of the embodiments in this application:
[0122] The solution provided in this application embodiment allows an electronic device to acquire an image to be processed. The image includes a battery string, which comprises multiple battery cells, each battery cell including multiple main grids. Battery string positioning processing is performed on the image to obtain the battery string's position information. Based on this position information, a battery string image is determined from the image to be processed. Battery cell positioning processing is then performed on the battery string image to obtain the position information of each battery cell. For the battery cell region corresponding to the position information of each battery cell in the battery string image, main grid positioning processing is performed to obtain the position information of the main grids in each battery cell region. Since the image to be processed includes a battery string, battery string positioning processing can be performed to obtain the battery string image. Then, based on the battery string image, battery cell positioning and main grid positioning processing are performed to obtain the position information of the battery cells and the main grids. This reduces interference from other areas in the image for battery cell and main grid positioning, accurately locating the batteries in the image. It also enables adaptive positioning of the batteries in the image, unaffected by the stringer model, battery cell type, or main grid type, thus improving the robustness of battery positioning in the image. Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0123] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0124] Figure 1 A flowchart illustrating a method for locating a battery in an image, as provided in an embodiment of this application;
[0125] Figure 2(a) is a schematic diagram of a type of solar cell without chamfering on the front and without being stacked.
[0126] Figure 2(b) is a schematic diagram of a type of solar cell without chamfering on the back and without parallel stacking;
[0127] Figure 3(a) is a schematic diagram of a type of solar cell with chamfered front and not stacked.
[0128] Figure 3(b) is a schematic diagram of a type of solar cell with chamfered back and no cells stacked together;
[0129] Figure 4(a) is a schematic diagram of a type of solar cell with chamfered front end;
[0130] Figure 4(b) is a schematic diagram of a type of solar cell with chamfered back edges;
[0131] Figure 5(a) is a schematic diagram of different main grid shapes on the front of the solar cell;
[0132] Figure 5(b) is a schematic diagram of different main grid shapes on the back of the electrode sheet;
[0133] Figure 6(a) is a schematic diagram of an image to be processed provided in an embodiment of this application;
[0134] Figure 6(b) is another schematic diagram of the image to be processed provided in the embodiment of this application;
[0135] Figure 6(c) is a schematic diagram of a battery string image provided in an embodiment of this application;
[0136] Figure 7 for Figure 1 A specific flowchart of step S102 in the illustrated embodiment;
[0137] Figure 8 For based on Figure 7 A schematic diagram of the first positioning frame in the embodiment shown;
[0138] Figure 9 For based on Figure 7 A schematic diagram of a battery string image in the embodiment shown;
[0139] Figure 10 for Figure 1 A specific flowchart of step S103 in the illustrated embodiment;
[0140] Figure 11 For based on Figure 10 A schematic diagram of the second positioning frame in the embodiment shown;
[0141] Figure 12 for Figure 10 A specific flowchart of step S1003 in the illustrated embodiment;
[0142] Figure 13 for Figure 10 A specific flowchart of step S1004 in the illustrated embodiment;
[0143] Figure 14 for Figure 1 A specific flowchart of step S104 in the illustrated embodiment;
[0144] Figure 15 For based on Figure 14 A schematic diagram of the third positioning frame in the embodiment shown;
[0145] Figure 16 for Figure 14 A specific flowchart of step S1403 in the illustrated embodiment;
[0146] Figure 17 for Figure 14A specific flowchart of step S1404 in the illustrated embodiment;
[0147] Figure 18 This is a specific flowchart of a method for locating a battery in an image provided in an embodiment of this application;
[0148] Figure 19 This is a specific flowchart of obtaining an image of a battery string provided in an embodiment of this application;
[0149] Figure 20 This is a specific flowchart illustrating the acquisition of battery cell location information provided in an embodiment of this application.
[0150] Figure 21 This is a specific flowchart illustrating the acquisition of the main gate's position information provided in an embodiment of this application;
[0151] Figure 22 This is a schematic diagram of the structure of a battery positioning device in an image provided in an embodiment of this application;
[0152] Figure 23 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0153] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0154] To accurately locate batteries in images, embodiments of this application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for locating batteries in images. The method for locating batteries in images provided by embodiments of this application will be described first.
[0155] The method for locating a battery in an image provided in this application embodiment can be applied to any device that needs to locate a battery in an image, such as a battery detection device, a server, an image processor, etc., without specific limitations. For clarity, it will be referred to as an electronic device below.
[0156] like Figure 1 As shown, a method for locating a battery in an image, the method comprising:
[0157] S101, Obtain the image to be processed;
[0158] The image to be processed includes a battery string, which includes multiple battery cells, and each battery cell includes multiple main grids.
[0159] S102, perform battery string localization processing on the image to be processed to obtain the position information of the battery string, and determine the battery string image from the image to be processed based on the position information of the battery string.
[0160] S103, Perform battery cell positioning processing on the battery string image to obtain the position information of each battery cell;
[0161] S104, for the battery cell area corresponding to the position information of each battery cell in the battery string image, perform main grid positioning processing to obtain the position information of the main grid in each battery cell area.
[0162] As can be seen, in the solution provided in this application embodiment, the electronic device can acquire an image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, each battery cell includes multiple main grids, the battery string is localized in the image to be processed to obtain the position information of the battery string, and the battery string image is determined from the image to be processed based on the position information of the battery string, the battery cell localization is performed on the battery string image to obtain the position information of each battery cell, and the main grid localization is performed on the battery cell area corresponding to the position information of each battery cell in the battery string image to obtain the position information of the main grid in each battery cell area. Since the image to be processed includes a battery string, the battery string localization can be performed on the image to be processed to obtain the battery string image, and then the battery cell localization and main grid localization can be performed based on the battery string image to obtain the position information of the battery cells and the position information of the main grids. This can reduce the interference of other areas in the image on the battery cell localization and main grid localization, accurately locate the battery in the image, and achieve adaptive localization of the battery in the image. It is not affected by the stringer model, battery cell type and main grid type, which can improve the robustness of battery localization in the image.
[0163] Solar power generation is an emerging renewable energy technology, and photovoltaic (PV) power generation, as a method of solar power generation, is applied in numerous industries. PV string welding machines, as important equipment in PV module production, can use mechanical transmission mechanisms to transport solar cells and can weld multiple cells into strings using high-temperature gas from hot air ducts on a heated base plate.
[0164] The cell designs are quite varied, with the front and back sides including parallel, non-parallel, chamfered, and non-chamfered designs, respectively. For example, a non-parallel cell without chamfered front side is shown in Figure 2(a), and a non-parallel cell without chamfered back side is shown in Figure 2(b). A non-parallel cell with chamfered front side is shown in Figure 3(a), and a non-parallel cell with chamfered back side is shown in Figure 3(b). A parallel cell with chamfered front side is shown in Figure 4(a), and a parallel cell with chamfered back side is shown in Figure 4(b).
[0165] There are also various main grid shapes for solar cells, with multiple main grid shapes on both the front and back sides. For example, different main grid shapes on the front side of the solar cell are shown in Figure 5(a), and different main grid shapes on the back side of the solar cell are shown in Figure 5(b).
[0166] To inspect the battery, in step S101, the electronic device can acquire an image to be processed. This image includes a battery string, which comprises multiple battery cells, and each battery cell includes multiple main grids. The electronic device can acquire the corresponding image to be processed based on the layout of the battery cells and the shape of the main grids.
[0167] Because the positions of the battery strings produced by the stringer are not fixed at different times, the images to be processed acquired by the electronic device at different times are different. For example, the positions of the battery strings produced by the stringer at time T1 are different from those produced at time T2. Therefore, the images to be processed acquired by the electronic device at time T1 are different from those acquired at time T2. The image to be processed acquired by the electronic device at time T1 is shown in Figure 6(a), and the image to be processed acquired at time T2 is shown in Figure 6(b). Furthermore, the number of battery cells on both sides of the first battery string 601 in the image to be processed at time T1 is different from the number of battery cells on both sides of the second battery string 602 in the image to be processed at time T2.
[0168] After acquiring the image to be processed, in step S102, the electronic device can perform battery string localization processing on the image to obtain the position information of the battery string. Based on this position information, the electronic device can determine the region of the battery string within the image to be processed, and then identify that region as the battery string image. The electronic device can use a deep learning algorithm or a traditional localization algorithm for battery string localization processing; no specific limitation is made here.
[0169] For example, as shown in Figure 6(b), the electronic device acquires an image to be processed, which includes a second battery string 602 and some battery cells located on both sides of the second battery string 602. The electronic device can use a target detection algorithm to perform battery string localization processing on the image to be processed, obtain the position information of the second battery string 602, and determine the region of the second battery string 602 in the image to be processed based on the position information of the second battery string 602. Then, the image of the region is copied from the image to be processed to obtain the image of the second battery string 602, i.e., the battery string image, as shown in Figure 6(c).
[0170] Next, in step S103, the electronic device can perform battery cell positioning processing on the battery string image to obtain the position information of each battery cell, so as to determine the corresponding area of each battery cell in the battery string image.
[0171] In one implementation, the electronic device can use a traditional positioning algorithm or a deep learning algorithm to perform initial positioning of the battery cells included in the battery string image, obtain the initial positioning result of the battery cells, and then adjust the initial positioning result according to the actual number of battery cells and the size of each battery cell to accurately obtain the position information of each battery cell.
[0172] For example, as shown in Figure 6(c), the electronic device obtains an image of the battery string and can perform battery cell positioning processing on the image. The second battery string 602 includes 13 battery cells; therefore, by performing battery cell positioning processing on the battery string image, the electronic device can obtain the position information of the 13 battery cells.
[0173] Since each battery cell includes multiple main grids, in step S104, the electronic device can perform main grid positioning processing on the battery cell area corresponding to the position information of each battery cell in the battery string image to obtain the position information of the main grids in each battery cell area.
[0174] In one implementation, the electronic device can use a traditional positioning algorithm or a deep learning algorithm to perform initial positioning of the main grids included in each battery cell region, obtaining an initial positioning result for the main grids. Then, based on the actual number and size of each main grid, the initial positioning result is adjusted to accurately obtain the position information of each main grid.
[0175] For example, as shown in Figure 6(c), the electronic device obtains the position information of the battery cells and can determine the corresponding region of each battery cell in the battery string image, such as battery cell region 603. For battery cell region 603, the electronic device can perform main grid localization to obtain the position information of the main grids within battery cell region 603. If battery cell region 603 includes 12 main grids, the electronic device can obtain the position information of all 12 main grids.
[0176] As can be seen, in this embodiment, since the image to be processed includes battery strings, battery string positioning processing can be performed on the image to obtain a battery string image. Then, based on the battery string image, cell positioning processing and main grid positioning processing are performed to obtain the cell position information and the main grid position information. This can reduce the interference of other areas in the image on cell positioning and main grid positioning, accurately locate the battery in the image, and achieve adaptive positioning of the battery in the image. It is not affected by the stringer model, cell type, and main grid type, which can improve the robustness of battery positioning in the image.
[0177] As one implementation method of this application, such as Figure 7 As shown, the step of performing battery string localization processing on the image to be processed to obtain the location information of the battery string may include:
[0178] S701, Based on the blank area between adjacent battery strings in the image to be processed, perform battery string positioning processing on the image to be processed to obtain a first positioning box;
[0179] In the image to be processed acquired by the electronic device, in addition to a complete battery string, it may also include some battery cells from other battery string images. In order to reduce the interference of other areas besides the battery string area on the positioning of battery cells, the battery string in the image to be processed is subjected to positioning processing.
[0180] Because there is a certain gap between adjacent battery strings during the stringing process, the image to be processed acquired by the electronic device contains blank areas between the two battery strings. In one embodiment, the electronic device can perform battery string positioning processing on the image to be processed based on the blank areas between adjacent battery strings, and outline the portion containing the battery strings between two adjacent blank areas with a quadrilateral to obtain a first positioning frame. The first positioning frame is used to characterize the position of the battery strings in the image to be processed.
[0181] In one implementation, the electronic device can use a deep learning algorithm to locate the battery string in the image to be processed, and use a quadrilateral to outline the portion containing the battery string between two adjacent blank areas to obtain a first location box. The deep learning algorithm can be a semantic segmentation algorithm, an instance segmentation algorithm, an object detection algorithm, etc., and is not specifically limited here.
[0182] In another implementation, the electronic device can use a conventional positioning algorithm to locate the battery string in the image to be processed. The portion containing the battery string between two adjacent blank areas is enclosed by a quadrilateral to obtain the first positioning frame. The conventional algorithm can be a blob analysis algorithm, a spacing detection algorithm, etc., and is not specifically limited here.
[0183] For example, such as Figure 8 As shown, the image to be processed includes a battery string 801. There are blank areas between the battery string 801 and the previous battery string, and between the battery string 801 and the next battery string. Therefore, the electronic device can use a target detection algorithm to perform battery string localization processing on the image to be processed based on the blank areas between adjacent battery strings, and outline the part including the battery string 801 with a quadrilateral to obtain the first positioning box 802.
[0184] In one embodiment, the electronic device can preprocess the image to be processed to reduce the influence of noise in the battery string image, reduce interference at the left and right boundaries of the battery cells, and improve the efficiency of battery string positioning processing. Preprocessing may include morphological erosion processing, image scaling, etc., and is not specifically limited thereto.
[0185] S702, the position information of the first positioning frame is determined as the position information of the battery string; or, the first positioning frame is expanded to obtain an expanded first positioning frame; the position information of the expanded first positioning frame is determined as the position information of the battery string.
[0186] In one implementation, since the first positioning frame can characterize the position of the battery string in the image to be processed, the electronic device can determine the position information of the first positioning frame as the position information of the battery string.
[0187] In another implementation, to retain more edge information of the battery string in the image to be processed, the electronic device can expand the first positioning frame to obtain an expanded first positioning frame, and then determine the position information of the expanded first positioning frame as the position information of the battery string. The expansion direction can be upward, downward, left, or right, and is not specifically limited here.
[0188] For example, such as Figure 8 As shown, the electronic device uses a spacing detection algorithm to locate the battery string in the image to be processed, resulting in a first positioning frame 802. This first positioning frame 802 includes the battery string 801. Therefore, the electronic device can determine the position information of the first positioning frame 802 as the position information of the battery string 801.
[0189] After obtaining the first positioning frame 802, the electronic device can also expand the first positioning frame 802 based on the blank areas on both sides of the battery string 801 and the upper and lower boundaries of the image to be processed. The horizontal axis coordinate value of the center point of the blank area is used as the boundary of the first positioning frame, and the upper and lower boundaries of the image to be processed are used as the upper and lower boundaries of the first positioning frame to obtain the expanded first positioning frame 803. Then, the position information of the expanded first positioning frame 803 is determined as the position information of the battery string 801.
[0190] After the electronic device determines the position information of the first positioning frame, it can determine the area of the battery string in the image to be processed based on the position information of the first positioning frame. Then, the electronic device can copy the image of that area from the image to be processed to obtain the battery string image.
[0191] For example, continuing the above example, after the electronic device determines the position information of the expanded first positioning frame 803, it can determine the region in the image to be processed where the battery string 801 is located based on the position information of the expanded first positioning frame 803. Then, the electronic device copies the image of that region from the image to be processed to obtain the battery string image, such as... Figure 9 As shown.
[0192] As can be seen, in this embodiment, the electronic device can perform battery string localization processing on the image to be processed based on the blank areas between adjacent battery strings in the image to be processed, obtaining a first localization box, and determining the position information of the first localization box as the position information of the battery strings; or, the first localization box can be expanded to obtain an expanded first localization box, and the position information of the expanded first localization box can be determined as the position information of the battery strings. This allows for adaptive localization of battery strings in the image, improving the robustness of battery localization in the image.
[0193] As one implementation method of this application, such as Figure 10 As shown, the above-described step of performing battery cell localization processing on the battery string image to obtain the position information of each battery cell may include:
[0194] S1001, Obtain the first number of battery cells actually included in the battery string included in the image to be processed;
[0195] During the battery stringing process, a preset number of battery cells are welded together to form a battery string. Therefore, the number of battery cells in a battery string is fixed. The preset number can be set by the user according to actual needs.
[0196] After the electronic device determines the battery string image from the image to be processed, it can locate the battery cells within the battery string image. If the battery cell images included in the battery string image are unclear, or the blank areas between adjacent battery cells are blurred, the electronic device cannot accurately locate all the battery cells, and multiple battery cells may be identified as a single battery cell. Therefore, the electronic device can obtain a first number of battery cells actually included in the battery string in the image to be processed to ensure that the number of obtained battery cell location information is the same as the first number.
[0197] S1002, Perform initial positioning processing on the battery string image to obtain the second positioning frame of the battery cell;
[0198] In one implementation, the electronic device can use a deep learning algorithm to perform initial localization processing on the battery cell image, obtaining a second localization box for each battery cell. The second localization box represents the position of the battery cell within the battery string image. The deep learning algorithm can be a semantic segmentation algorithm, an instance segmentation algorithm, an object detection algorithm, etc., and is not specifically limited here.
[0199] In another implementation, the electronic device can use a conventional positioning algorithm to perform initial positioning processing on the battery string image to obtain a second positioning bounding box for the battery cells. The conventional positioning algorithm can be a template matching algorithm, etc., and is not specifically limited here.
[0200] For example, such as Figure 11 As shown, the electronic device can use a target detection algorithm to perform initial positioning processing of the battery cells in the battery string image, that is, to outline each battery cell in the battery string image with a quadrilateral to obtain the second positioning frame of each battery cell, as shown in the second positioning frame 1101 of the second battery cell.
[0201] S1003, Based on the first quantity and the position information of the second positioning frame, the second positioning frame is corrected to obtain the corrected second positioning frame;
[0202] Since the electronic device may initially locate multiple battery cells within a quadrilateral when processing the battery string image, the resulting second positioning frame may include multiple battery cells. Therefore, the second positioning frame can be corrected based on the first quantity and the position information of the second positioning frame.
[0203] If the number of second positioning frames is less than the first number, the number of second positioning frames for each battery cell can be supplemented to make the number of second positioning frames the same as the first number. If the number of second positioning frames is the same as the first number, the second positioning frames can be corrected based on the position information of each battery cell to obtain corrected second positioning frames. The position information of the second positioning frames may include the coordinates of the center point of the second positioning frame, the size of the second positioning frame, etc., which are not specifically limited here.
[0204] For example, such as Figure 11 As shown, the first quantity is 11. The electronic device performs initial positioning processing on the battery cell image. If a second positioning frame obtained by the electronic device includes two battery cells, then the number of second positioning frames is 10, which is less than the first quantity of 11. The electronic device can complete the second positioning frames based on the position information of each second positioning frame to obtain corrected second positioning frames, that is, 11 second positioning frames can be obtained.
[0205] S1004, Based on the principle of straight line detection, the corrected second positioning frame is adjusted to obtain the position information of each battery cell.
[0206] The closer the positions of the four sides of the second positioning frame coincide with the boundaries of the battery cells, the more accurate the position information of each battery cell obtained by the electronic device based on the position information of the second positioning frame. Therefore, in order to improve the positioning accuracy of the battery cells, the electronic device can adjust the corrected second positioning frame based on the principle of straight line detection after obtaining the corrected second positioning frame, thereby obtaining the position information of each battery cell.
[0207] For example, such as Figure 11 As shown, the electronic device obtains 11 corrected second positioning frames. For the second positioning frame 1101, the electronic device can adjust the position of the four sides of the second positioning frame 1101 based on the principle of line detection to obtain the position information of the second battery cell in the battery string image.
[0208] As can be seen, in this embodiment, after the electronic device performs initial positioning processing on the battery cell image to obtain the second positioning frame of the battery cell, it can correct the second positioning frame based on the first number of battery cells actually included in the battery string in the image to be processed and the position information of the second positioning frame, to obtain the corrected second positioning frame. Based on the principle of line detection, the corrected second positioning frame is adjusted to obtain the position information of each battery cell. In this way, the area corresponding to each battery cell in the battery string image can be accurately determined to achieve the positioning of the battery cell.
[0209] As one embodiment of this application, the position information of the second positioning frame may include the center point coordinates, width, height, and angle of the second positioning frame.
[0210] like Figure 12 As shown, the step of correcting the second positioning frame based on the first quantity and the position information of the second positioning frame to obtain the corrected second positioning frame may include:
[0211] S1201, Sort the second positioning frame according to the preset order of the horizontal axis coordinate values of the center point to obtain the sorting result;
[0212] The preset order is either from smallest to largest or from largest to smallest.
[0213] Since the battery cells in the battery string image exhibit a one-dimensional array distribution, theoretically, the center points of all battery cells should be on the same horizontal axis, and the distance between the center points of any two adjacent battery cells should be the same. Therefore, for the second positioning frame obtained by the electronic device, the center points of each second positioning frame should also be on the same horizontal axis, and the distance between the center points of any two adjacent second positioning frames should also be the same. Thus, the electronic device can correct the second positioning frame based on the distance between any two adjacent second positioning frames.
[0214] In one embodiment, the electronic device can sort the second positioning frames according to a preset order of the horizontal axis coordinate values of their center points to obtain a sorting result. The preset order can be either ascending or descending order.
[0215] For example, the center point coordinates of the second positioning frame obtained by the electronic device are (x1, y1), (x2, y2), (x3, y3)...(x... 10 y 10 The electronic device can position the second positioning frame according to the horizontal coordinates x1, x2...x of its center point. 10 Sort the x values in ascending order, and get the sorted result x1 < x2 < x3 ... x9 < x 10 .
[0216] S1202, Calculate the distance between every two adjacent second positioning frames along the horizontal axis in the sorting result;
[0217] After obtaining the sorting results, the electronic device can calculate the difference between every two adjacent horizontal axis coordinate values in the sorting results to obtain the spacing between every two adjacent second positioning frames along the horizontal axis.
[0218] For example, the sorting result obtained by the electronic device is x1 < x2 < x3 ... x9 < x 10 The electronic device can calculate the difference d1 between x1 and x2, the difference d2 between x2 and x3, and so on, to obtain the spacing along the horizontal axis between every two adjacent second positioning frames, which are d1, d2...d1. q .
[0219] S1203, calculate the average value of the other spacings besides the maximum and minimum spacings to obtain the first average spacing;
[0220] Theoretically, the spacing between any two adjacent second positioning frames along the horizontal axis, calculated by the electronic device, should be the same. To maintain consistency, the average value between each spacing can be calculated. However, if a second positioning frame contains multiple battery cells, then the spacing between this second positioning frame and its adjacent second positioning frames along the horizontal axis will be much greater than the spacing between two adjacent second positioning frames that each contain only one battery cell.
[0221] To reduce the impact of excessively large or small spacing on the calculation of the average value between spacings, the electronic device can calculate the average value of all spacings except the maximum and minimum spacings to obtain a first average spacing. That is, the first average spacing is used to characterize the average spacing between every two adjacent second positioning frames along the horizontal axis.
[0222] For example, the electronic device obtains the spacing along the horizontal axis between every two adjacent second positioning frames, denoted as d1, d2, ... d... q Each of the second positioning frames includes a battery cell. The maximum spacing is d2 and the minimum spacing is d3. The electronic device can then calculate the average of the spacings other than d2 and d3 to obtain the first average spacing.
[0223] S1204, based on the ordinate coordinates, width, height and angle of the center point of each second positioning frame, calculate the average ordinate coordinates, average width, average height and average angle of the center point of the second positioning frame respectively.
[0224] When an electronic device locates battery cells in a battery string image, the second positioning bounding box may be inaccurate, or some second positioning boxes may include multiple battery cells, resulting in some battery cells not having a corresponding second positioning box. Therefore, the second positioning boxes need to be corrected. Since the battery cells in the battery string image exhibit a one-dimensional array distribution and all battery cells are of the same size, the electronic device can correct the second positioning boxes based on the center point coordinates and size of each second positioning box.
[0225] The electronic device can calculate the average value of the longitudinal coordinate, the average value of the width, the average value of the height, and the average value of the angle of the center point of each second positioning frame based on the longitudinal coordinate value, the width, the height, and the angle of the center point of each second positioning frame.
[0226] For example, the electronic device obtains the center point coordinates of the second positioning frame as (x1, y1), (x2, y2), (x3, y3)...(x...). 10 y 10 The heights are h1, h2...h 10 The widths are w1, w2...w10 The angles are θ1, θ2...θ 10 The electronic device can be based on the vertical coordinates y1, y2...y of the center point of each second positioning frame. 10 Widths w1, w2...w 10 Heights h1, h2...h 10 And angles θ1, θ2...θ 10 Calculate the average value of the vertical axis coordinate of the center point of the second positioning frame. Average width Average height and the average angle
[0227] s1205, based on the first average spacing, the average value of the vertical axis coordinate of the center point of the second positioning frame, the average width, the average height, and the average angle, the second positioning frame is corrected to obtain the corrected second positioning frame.
[0228] Among the multiple second positioning frames acquired by the electronic device, there may be second positioning frames with significant positional deviations, or there may be a missing second positioning frame corresponding to a specific battery cell. Therefore, the electronic device can correct the second positioning frames based on the first average spacing, the average vertical coordinate value of the center point of the second positioning frame, the average width, the average height, and the average angle, to obtain the corrected second positioning frames.
[0229] In one embodiment, if the battery cell has a corresponding second positioning frame, the electronic device can correct the horizontal axis coordinate value of the center point of the second positioning frame based on the horizontal axis coordinate value of the center point of the second positioning frame and the first average spacing. The vertical axis coordinate value, height, width and angle of the corrected second positioning frame remain unchanged.
[0230] In another implementation, if a certain battery cell does not have a corresponding second positioning frame and needs to be completed, the electronic device can determine the horizontal axis coordinate value of the center point of the second positioning frame based on the horizontal axis coordinate value of the center point of the second positioning frame and the first average spacing, and use the average value of the vertical axis coordinate value, the average value of the width, the average value of the height, and the average value of the angle of the second positioning frame as the corrected vertical axis coordinate value, width, height, and angle of the center point of the second positioning frame.
[0231] For example, the electronic device acquires multiple second bounding boxes, with center point coordinates of (x1, y1), (x2, y2), (x3, y3)...(x...). 10 y 10 The first average spacing was calculated. Average value of the vertical axis coordinate Average width Average height and the average angle Therefore, the electronic device can correct the second positioning frame based on whether the battery cell has a corresponding second positioning frame, and obtain the corrected second positioning frame.
[0232] As can be seen, in this embodiment, the electronic device can sort the second positioning frames according to a preset order of the horizontal axis coordinate values of their center points, obtain a sorting result, calculate the distance between every two adjacent second positioning frames along the horizontal axis, calculate the average value of all distances except the maximum and minimum distances, obtain a first average distance, and calculate the average value of the vertical axis coordinate values, average width, average height, and average angle of the center points of each second positioning frame based on the vertical axis coordinate values, width, height, and angle of each second positioning frame, respectively. Based on the first average distance, the average value of the vertical axis coordinate values, width, height, and angle of the center points of the second positioning frames, the second positioning frames are corrected to obtain a corrected second positioning frame. This allows for accurate positioning of the battery cells.
[0233] As one embodiment of this application, the step of correcting the second positioning frame based on the first average spacing, the average value of the vertical coordinate of the center point of the second positioning frame, the average width, the average height, and the average angle to obtain the corrected second positioning frame may include:
[0234] Based on the first average spacing and the horizontal axis coordinate value of the center point of the second positioning frame, the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame is determined according to the following formula.
[0235] or
[0236] Where, x i The x-axis coordinate of the center point of the i-th second positioning frame after being arranged in the preset order is given. The maximum value of i+1 is the number of battery cells, and the minimum value of i-1 is 1. This is the first average spacing;
[0237] For each corrected horizontal axis coordinate value, if there is a corresponding second positioning box for the corrected horizontal axis coordinate value, the corrected horizontal axis coordinate value corresponding to the second positioning box is used as the horizontal axis coordinate value of the center point of the corrected second positioning box, and the vertical axis coordinate value, width, height and angle of the center point of the second positioning box are used as the vertical axis coordinate value, width, height and angle of the center point of the corrected second positioning box, respectively, to obtain the corrected second positioning box corresponding to the corrected horizontal axis coordinate value.
[0238] If the corrected horizontal axis coordinate value does not correspond to a second positioning frame, the corrected horizontal axis coordinate value is used as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and the average value of the vertical axis coordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle are used as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value.
[0239] When an electronic device performs initial positioning processing on a battery string image, it may obtain a second positioning frame corresponding to the battery cell, or it may not obtain a second positioning frame corresponding to the battery cell. In order to obtain a corrected second positioning frame, the electronic device can first calculate the horizontal axis coordinate value of each corrected second positioning frame based on the first average spacing.
[0240] In one implementation, the electronic device can, based on the first average spacing and the horizontal axis coordinate value of the center point of the second positioning frame, according to... or Determine the horizontal axis coordinate value of the center point of the corrected second positioning frame. Thus, the number of horizontal axis coordinate values of the center point of the corrected second positioning frame is the same as the number of battery cells. Where x... i This represents the x-axis coordinate of the center point of the i-th second positioning frame after it has been arranged in a preset order. The maximum value of i+1 is the number of battery cells, and the minimum value of i-1 is 1. This is the first average spacing.
[0241] For example, the x-axis coordinates of the center point of the second positioning frame are x1, x2, ... x 10 The first average spacing is Therefore, the electronic device can start from x1, according to Calculate the next corrected x2, and so on, until the corrected x is obtained. 10 Electronic devices can be accessed from x 10 Begin, according to Calculate the next corrected x9, and so on, until the corrected x1 is calculated.
[0242] Electronic devices can also use the horizontal axis coordinate of the center point of the second positioning frame corresponding to any battery cell as a reference, according to... or Calculate the horizontal axis coordinates of the center point of each corrected second positioning frame.
[0243] For each corrected horizontal axis coordinate value, the electronic device can determine whether a corresponding second positioning box exists based on whether the corrected horizontal axis coordinate value falls within the position range of a certain second positioning box. If the corrected horizontal axis coordinate value falls within the position range of a certain second positioning box, then the corrected horizontal axis coordinate value has a corresponding second positioning box. This indicates that when the electronic device performed the initial positioning processing of the battery cells in the battery string image, it obtained the second positioning box corresponding to the battery cell with that horizontal axis coordinate value. Therefore, in order to more accurately determine the position of the battery cell in the battery string image, the electronic device can correct the second positioning box.
[0244] The electronic device can use the corrected horizontal axis coordinate value corresponding to the second positioning frame as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and use the vertical axis coordinate value, width, height, and angle of the center point of the second positioning frame as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value. This corrected second positioning frame is the correction frame of the second positioning frame. The correction frame of the second positioning frame is a frame used to correct the second positioning frame for a battery cell that has a corresponding second positioning frame.
[0245] If the corrected horizontal axis coordinate value does not fall within the position range of a certain second positioning box, then the corrected horizontal axis coordinate value does not have a corresponding second positioning box. This indicates that when the electronic device performs initial positioning processing on the battery cell in the battery string image, it does not obtain the second positioning box corresponding to the battery cell with the horizontal axis coordinate value. In order to more accurately determine the position of the battery cell in the battery string image, the electronic device can complete the second positioning box.
[0246] The electronic device can use the corrected horizontal axis coordinate value as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and use the average value of the vertical axis coordinate value, the average value of the width, the average value of the height, and the average value of the angle of the center point as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively. This results in the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value, which is the completed frame of the second positioning frame. The completed frame of the second positioning frame is determined after calculating the parameters of each second positioning frame for battery cells that do not have a corresponding second positioning frame.
[0247] For example, the electronic device acquires multiple second positioning frames and calculates the first average spacing. Average value of the vertical axis coordinate Average width Average height and the average angle
[0248] The first battery cell has a corresponding second positioning frame. The corrected second positioning frame is the correction frame. Then, the electronic device can use the vertical axis coordinate value y1, width w1, height h1 and angle θ1 of the center point of the second positioning frame as the vertical axis coordinate value, width, height and angle of the center point of the corrected second positioning frame, respectively.
[0249] The second battery cell does not have a corresponding second positioning frame. The corrected second positioning frame is a completed frame. Therefore, the electronic device can average the vertical coordinate value of the center point of the second positioning frame. Average width Average height and the average angle The vertical axis coordinates, width, height, and angle of the center point of the corrected second positioning frame are respectively used.
[0250] As can be seen, in this embodiment, the electronic device can determine the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame. If a corresponding second positioning frame exists for the corrected horizontal axis coordinate value, the corrected horizontal axis coordinate value corresponding to that second positioning frame can be used as the horizontal axis coordinate value of the center point of the corrected second positioning frame. The vertical axis coordinate value, width, height, and angle of the center point of that second positioning frame are also used as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively. If a corresponding second positioning frame does not exist for the corrected horizontal axis coordinate value, the corrected horizontal axis coordinate value can be used as the horizontal axis coordinate value of the center point of the corrected second positioning frame. The average vertical axis coordinate value, average width, average height, and average angle of the center point are also used as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively. This allows for the determination of the corrected second positioning frame corresponding to each battery cell, thus achieving accurate positioning of the battery cells.
[0251] As one implementation method of this application, such as Figure 13 As shown, the steps described above, based on the principle of line detection, to adjust the corrected second positioning frame to obtain the position information of each battery cell, may include:
[0252] S1301, For each corrected second positioning box, generate the line search area corresponding to the four sides of the corrected second positioning box;
[0253] S1302, perform line detection on the line search area according to the line detection principle to obtain the line detection result;
[0254] After obtaining each corrected second positioning frame, the electronic device can adjust the corrected second positioning frame to accurately determine the positions of its four sides. In one embodiment, the electronic device can generate a line lookup area corresponding to the four sides of each corrected second positioning frame, and then perform line detection in the line lookup area corresponding to the four sides according to the line detection principle to obtain the line detection result, thereby determining the line positions of the four sides closer to the battery cell. The detection result includes the intersection points of the lines.
[0255] For example, once the electronic device obtains the corrected second positioning frame, it can generate a line lookup area corresponding to the four sides of each corrected second positioning frame, such as area a corresponding to the top, area b corresponding to the bottom, area c corresponding to the left, and area d corresponding to the right. In this way, the electronic device can perform line detection on area a according to the line detection principle, obtain the line detection result, and determine the line close to the top of the battery cell. Then, it can determine the line close to the bottom of the battery cell in area b, the line close to the left of the battery cell in area c, and the line close to the right of the battery cell in area d.
[0256] S1303, the intersection of the straight lines included in the straight line detection result is determined as the position information of the battery cell corresponding to the corrected second positioning frame.
[0257] Since the line detection results include the intersection of the lines, the location of the battery cell can be determined based on the intersection of the lines. Therefore, the electronic device can determine the location information of the battery cell corresponding to the corrected second positioning frame by the intersection of the lines included in the line detection results.
[0258] For example, if an electronic device obtains a line detection result, which includes the intersection points of the lines O1(x1, y1), O2(x2, y2), O3(x3, y3), and O4(x4, y4), then the electronic device can determine the intersection points O1(x1, y1), O2(x2, y2), O3(x3, y3), and O4(x4, y4) of the lines included in the line detection result as the position information of the battery cell corresponding to the corrected second positioning frame.
[0259] As can be seen, in this embodiment, the electronic device can generate a line search area corresponding to the four sides of each corrected second positioning frame, perform line detection on the line search area according to the line detection principle, obtain the line detection result, and determine the position information of the battery cell corresponding to the corrected second positioning frame by the intersection of the lines included in the line detection result. In this way, the position of the four sides of the second positioning frame can be accurately determined, and the precise positioning of the battery cell can be achieved.
[0260] As one implementation method of this application, such as Figure 14 As shown, the step of performing main grid location processing on the corresponding cell region in the battery string image for each cell's location information to obtain the main grid location information in each cell region may include:
[0261] S1401, Obtain the second number of main grids actually included in each cell of the battery string included in the image to be processed;
[0262] During the production of battery strings using a string welding machine, the number of main grids in each battery cell is fixed, and users can adjust the settings according to their specific needs.
[0263] After the electronic device obtains the position information of each battery cell from the battery string image, it can locate the main grids included in each battery cell based on the corresponding battery cell region in the battery string image. If the boundaries between the main grids in the battery cell are unclear, the electronic device cannot accurately locate the main grids included in each battery cell, which may result in a large deviation in the main grid positioning. Therefore, the electronic device can obtain a second number of main grids actually included in each battery cell in the battery string included in the image to be processed, to ensure that the number of position information of the main grids included in each battery cell is the same as the second number.
[0264] S1402, for the battery cell area corresponding to the position information of each battery cell in the battery string image, perform main grid positioning processing to obtain the third positioning frame of each main grid;
[0265] In one implementation, for the battery cell region corresponding to the location information of each battery cell in the battery string image, the electronic device can use a deep learning algorithm to perform main grid localization processing to obtain a third localization box for each main grid. The deep learning algorithm can be a semantic segmentation algorithm, an instance segmentation algorithm, an object detection algorithm, etc., and is not specifically limited here.
[0266] In another implementation, for the cell region corresponding to the location information of each cell in the battery string image, the electronic device can use a conventional positioning algorithm to perform main grid positioning processing to obtain a third positioning box for each main grid. The conventional positioning algorithm can be template matching, etc., and is not specifically limited here.
[0267] For example, such as Figure 15 As shown, for the battery cell region corresponding to the location information of each battery cell in the battery string image, the electronic device can use a template matching algorithm to perform main grid positioning processing, that is, to frame the main grid included in the battery cell with a quadrilateral to obtain the third positioning frame of each battery cell, as shown in the third positioning frame 1501 in the second battery cell.
[0268] S1403, for each battery cell area, based on the second quantity and the position information of the third positioning frame, the third positioning frame is corrected to obtain the corrected third positioning frame;
[0269] Since the electronic device may not obtain the third positioning frame corresponding to the main grid when performing main grid positioning processing on the corresponding cell area in the battery string image for the position information of each cell, the electronic device can correct the obtained third positioning frame based on the second quantity and the position information of the third positioning frame.
[0270] If the number of third positioning frames is less than the number of first positioning frames, the number of third positioning frames for each battery cell can be supplemented to make the number of third positioning frames the same as the number of first positioning frames. If the number of third positioning frames is the same as the number of second positioning frames, the third positioning frames can be corrected based on the position information of each battery cell to obtain corrected third positioning frames. The position information of the third positioning frames may include the coordinates of the center point of the third positioning frame, the size of the third positioning frame, etc., which are not specifically limited here.
[0271] For example, if the second quantity is 10, the electronic device obtains multiple third positioning frames. If the number of third positioning frames is 10, the same as the second quantity, each third positioning frame can be corrected to obtain a corrected third positioning frame. If the number of third positioning frames is 9, less than the second quantity, each third positioning frame can be padded to obtain a corrected third positioning frame, thus obtaining 10 third positioning frames.
[0272] S1404, Based on the distribution pattern of the main grid in the battery string image and the principle of line detection, the corrected third positioning frame is adjusted to obtain the position information of the main grid.
[0273] The closer the positions of the four sides of the third positioning frame coincide with the position of the main grid boundary, the more accurate the position information of the main grid obtained by the electronic device based on the position information of the third positioning frame. Therefore, in order to improve the positioning accuracy of the main grid, the electronic device can adjust the corrected third positioning frame after obtaining it, based on the distribution pattern of the main grid in the battery string image and the principle of line detection, and then obtain the position information of the main grid.
[0274] For example, such as Figure 15 As shown, the electronic device corrects the third positioning frame 1501 based on the position information of the third positioning frame 1501 to obtain the corrected third positioning frame. Then, based on the distribution pattern of the main grid in the battery string image and the principle of line detection, the positions of the four sides of the corrected third positioning frame can be adjusted to obtain the position information of the main grid.
[0275] As can be seen, in this embodiment, the electronic device can obtain the second number of main grids actually included in each battery cell in the battery string included in the image to be processed. For the battery cell region corresponding to the position information of each battery cell in the battery string image, main grid positioning processing is performed to obtain a third positioning frame for each main grid. For each battery cell region, based on the second number and the position information of the third positioning frame, the third positioning frame is corrected to obtain a corrected third positioning frame. Based on the distribution pattern of the main grids in the battery string image and the principle of line detection, the corrected third positioning frame is adjusted to obtain the position information of the main grids. This allows for accurate determination of the position of each main grid in the battery string image, thereby achieving the positioning of the main grids.
[0276] As one embodiment of this application, the position information of the third positioning frame includes the center point coordinates, width, height, and angle of the third positioning frame;
[0277] like Figure 16 As shown, the step of correcting the third positioning frame for each battery cell region based on the second quantity and the position information of the third positioning frame to obtain the corrected third positioning frame may include:
[0278] S1601, for each battery cell area, the third positioning frame is sorted according to the preset order of the vertical axis coordinate values of the center point to obtain the sorting result;
[0279] The preset order is either from smallest to largest or from largest to smallest;
[0280] Since the main grids of each solar cell are arranged in a one-dimensional array, theoretically, the center points of all main grids should be on the same vertical axis, and the distance between the center points of any two adjacent main grids should be the same. Therefore, for the third positioning frame obtained by the electronic device, the center points of each third positioning frame should also be on the same vertical axis, and the distance between the center points of any two adjacent third positioning frames should also be the same. Thus, the electronic device can correct the third positioning frame based on the distance between any two adjacent third positioning frames.
[0281] In one implementation, for each battery cell region, the electronic device can sort the third positioning frames according to a preset order of the vertical coordinate values of the center point to obtain a sorting result. The preset order can be either ascending or descending order.
[0282] For example, the center point coordinates of the third positioning frame obtained by the electronic device are (x1, y1), (x2, y2), (x3, y3)...(x 10 y 10 The electronic device can position the third positioning frame according to the vertical coordinates y1, y2...y of its center point.10 Sort the values in ascending order, and get the sorted result y1 < y2 < y3 ... y9 < y 10 .
[0283] S1602, Calculate the distance between every two adjacent third positioning frames along the vertical axis in the sorting result;
[0284] After obtaining the sorting results, the electronic device can calculate the difference between every two adjacent vertical axis coordinate values in the sorting results to obtain the spacing between every two adjacent third positioning frames along the vertical axis.
[0285] For example, the sorting result obtained by the electronic device is y1 < y2 < y3 ... y9 < y 10 The electronic device can calculate the difference d1 between y1 and y2, the difference d2 between y2 and y3, and so on, to obtain the distance between each pair of adjacent third positioning frames along the vertical axis, which are d1, d2...d9 respectively.
[0286] S1603, calculate the average value of the other spacings besides the maximum and minimum spacings to obtain the second average spacing;
[0287] The spacing between any two adjacent third positioning frames along the vertical axis, calculated by the electronic device, should theoretically be similar. To maintain consistency, the average value between each spacing can be calculated. However, if the number of third positioning frames is less than the second number, it means that some main gates do not have corresponding third positioning frames, and thus the spacing between two adjacent third positioning frames along the vertical axis is too large.
[0288] To reduce the impact of excessively large or small spacing on the calculation of the average value between spacings, the electronic device can calculate the average value of all spacings other than the maximum and minimum spacings, obtaining a second average spacing. That is, the second average spacing is used to characterize the average spacing between every two adjacent second positioning frames along the horizontal axis.
[0289] For example, the electronic device obtains the spacing along the horizontal axis between every two adjacent second positioning frames, denoted as d1, d2, ..., d9. The maximum spacing is d2, and the minimum spacing is d3. The electronic device can then calculate the average of the spacings other than d2 and d3 to obtain the second average spacing.
[0290] S1604, based on the horizontal axis coordinates, width, height and angle of the center point of each third positioning frame, calculate the average horizontal axis coordinates, average width, average height and average angle of the center point of the third positioning frame respectively.
[0291] In the third positioning frames obtained by the electronic device, some third positioning frames are inaccurate in position, and some third positioning frames corresponding to main grids are missing. These third positioning frames can be corrected. Since the main grids included in each solar cell exhibit a one-dimensional array distribution pattern, and each main grid is the same size, the electronic device can correct the third positioning frames based on the center point coordinates of each third positioning frame and the size of each third positioning frame.
[0292] The electronic device can calculate the average value of the horizontal axis coordinate, the average value of the width, the average value of the height, and the average value of the angle of the center point of each third positioning frame based on the horizontal axis coordinate value, the width, the height, and the angle of the center point of each third positioning frame.
[0293] For example, the center point coordinates of the third positioning frame obtained by the electronic device are (x1, y1), (x2, y2), (x3, y3)...(x 10 y 10 The heights are h1, h2...h 10 The widths are w1, w2...w 10 The angles are θ1, θ2...θ 10 The electronic device can be based on the horizontal axis coordinates x1, x2...x of the center point of each third positioning frame. 10 Widths w1, w2...w 10 Heights h1, h2...h 10 And angles θ1, θ2...θ 10 Calculate the average horizontal coordinate of the center point of the third positioning frame. Average width Average height and the average angle
[0294] S1605, based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle, the third positioning frame is corrected to obtain the corrected third positioning frame.
[0295] The third positioning frame acquired by the electronic device may contain frames with significant positional deviations, or it may be missing a third positioning frame corresponding to a certain main grid. Therefore, the electronic device can correct the third positioning frame based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle, to obtain a corrected third positioning frame.
[0296] In one embodiment, if the battery cell has a corresponding third positioning frame, the electronic device can correct the vertical coordinate value of the center point of the third positioning frame based on the vertical coordinate value of the center point of the third positioning frame and the second average spacing. The vertical coordinate value, height, width and angle of the corrected third positioning frame remain unchanged.
[0297] In another implementation, if a certain battery cell does not have a corresponding third positioning frame and needs to be completed, the electronic device can determine the vertical coordinate value of the center point of the third positioning frame based on the vertical coordinate value of the center point of the third positioning frame and the first average spacing, and use the average value of the vertical coordinate value, the average value of the width, the average value of the height, and the average value of the angle of the third positioning frame as the corrected vertical coordinate value, width, height, and angle of the center point of the third positioning frame.
[0298] For example, an electronic device acquires multiple third bounding boxes, with center point coordinates of (x1, y1), (x2, y2), (x3, y3)...(x...). 10 y 10 The first average spacing was calculated. Average value of horizontal axis coordinate Average width Average height and the average angle Therefore, the electronic device can correct the third positioning frame based on whether the battery cell has a corresponding third positioning frame, and obtain the corrected third positioning frame.
[0299] As can be seen, in this embodiment, for each battery cell region, the electronic device can sort the third positioning frames according to a preset order of the vertical axis coordinate values of their center points, obtaining a sorting result. The distance between any two adjacent third positioning frames along the vertical axis is calculated, and the average value of all distances except the maximum and minimum distances is calculated to obtain a second average distance. Based on the horizontal axis coordinate values, width, height, and angle of the center points of each third positioning frame, the average horizontal axis coordinate values, average width, average height, and average angle of the center points of the third positioning frames are calculated respectively. Based on the second average distance, the average horizontal axis coordinate values, average width, average height, and average angle of the center points of the third positioning frames, the third positioning frames are corrected to obtain a corrected third positioning frame. This allows for accurate positioning of the main grids included in each battery cell.
[0300] As one embodiment of this application, the step of correcting the third positioning frame based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle to obtain the corrected third positioning frame may include:
[0301] Based on the second average spacing and the ordinate value of the center point of the third positioning frame, the corrected ordinate value of the center point of each third positioning frame is determined according to the following formula.
[0302] or
[0303] Among them, y i The value of i+1 is the ordinate of the center point of the i-th third positioning frame arranged in the preset order. The maximum value of i+1 is the number of main grids included in the battery cell, and the minimum value of i-1 is 1. This is the second average spacing;
[0304] For each corrected ordinate value, if there is a corresponding third positioning box for the corrected ordinate value, the corrected ordinate value corresponding to the third positioning box is used as the ordinate value of the center point of the corrected third positioning box, and the horizontal ordinate value, width, height and angle of the center point of the third positioning box are used as the horizontal ordinate value, width, height and angle of the center point of the corrected third positioning box, respectively, to obtain the corrected third positioning box corresponding to the corrected ordinate value.
[0305] If the corrected ordinate value does not correspond to a third positioning frame, the corrected ordinate value is used as the ordinate value of the center point of the corrected third positioning frame. The average value of the lateral ordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle are used as the lateral ordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected ordinate value.
[0306] When the electronic device performs main grid positioning processing on the corresponding cell area in the battery string image for the position information of each cell, it may obtain a third positioning box corresponding to the main grid, or it may not obtain a third positioning box corresponding to the main grid. In order to obtain the corrected third positioning box, the electronic device can first calculate the vertical axis coordinate value of the corrected third positioning box based on the second average spacing.
[0307] In one implementation, the electronic device can, based on the second average spacing and the ordinate value of the center point of the third positioning frame, according to... or Determine the y-axis coordinate value of the center point of the corrected third positioning frame. Thus, the number of y-axis coordinate values of the center point of the corrected third positioning frame is the same as the number of main busbars in the solar cell. Where, y iLet i+1 be the ordinate of the center point of the i-th third positioning frame arranged in a preset order. The maximum value of i+1 is the number of main grids included in the solar cell, and the minimum value of i-1 is 1. This is the second average spacing.
[0308] For example, the third positioning frame is defined by the vertical coordinates of its center point as y1, y2, ... y3. 10 The second average spacing is Therefore, electronic devices can start from y1, according to Calculate the next corrected y2, and so on, until the corrected y is obtained. 10 Electronic devices can be accessed from y 10 Begin, according to Calculate the next corrected y9, and so on, until the corrected y1 is calculated.
[0309] Electronic devices can also use the vertical axis coordinate of the center point of the third positioning frame corresponding to any main grid as a reference, according to... or Calculate the ordinate of the center point of each corrected third positioning frame.
[0310] For each corrected ordinate value, the electronic device can determine whether a corresponding third positioning box exists based on whether the corrected ordinate value falls within the position range of a certain third positioning box. If the corrected ordinate value falls within the position range of a certain third positioning box, then the corrected ordinate value has a corresponding third positioning box. This indicates that the electronic device has performed main grid positioning processing on the cell area corresponding to the cell position information of each cell in the cell string image, obtaining the third positioning box corresponding to the main grid corresponding to the ordinate value. Therefore, to more accurately determine the position of the main grid in the cell area, the electronic device can correct this third positioning box.
[0311] The electronic device can use the corrected vertical coordinate value corresponding to the third positioning frame as the vertical coordinate value of the center point of the corrected third positioning frame, and use the horizontal coordinate value, width, height, and angle of the center point of the third positioning frame as the horizontal coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical coordinate value. This corrected third positioning frame is the correction frame of the third positioning frame. The correction frame of the third positioning frame is a frame that corrects the third positioning frame for a main grid that has a corresponding third positioning frame.
[0312] If the corrected ordinate value does not fall within the position range of a certain third positioning box, then the corrected ordinate value does not have a corresponding third positioning box. This means that the electronic device performs main grid positioning processing on the cell area corresponding to the cell area in the cell string image for each cell's position information, but does not obtain the third positioning box corresponding to the main grid. In order to more accurately determine the position of the main grid in the cell area, the electronic device can complete the third positioning box.
[0313] The electronic device can use the corrected vertical axis coordinate value as the vertical axis coordinate value of the center point of the corrected third positioning frame, and use the average horizontal axis coordinate value, average width, average height, and average angle value of the center point as the horizontal axis coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively. This yields the corrected third positioning frame corresponding to the corrected vertical axis coordinate value, which is the completed third positioning frame. The completed third positioning frame is determined after calculating the parameters of each third positioning frame for main grids that do not have a corresponding third positioning frame.
[0314] For example, the electronic device acquires multiple third positioning frames and calculates the second average spacing. Average value of horizontal axis coordinate Average width Average height and the average angle
[0315] The first main grid has a corresponding third positioning frame. The corrected third positioning frame is the correction frame. Then, the electronic device can use the horizontal axis coordinate value x1, width w1, height h1 and angle θ1 of the center point of the third positioning frame as the horizontal axis coordinate value, width, height and angle of the center point of the corrected second positioning frame, respectively.
[0316] The second main grid does not have a corresponding third positioning frame. The corrected third positioning frame is a completed frame. Therefore, the electronic device can average the horizontal coordinate value of the center point of the third positioning frame. Average width Average height And the average angle θ, respectively, are used as the x-axis coordinate, width, height, and angle of the center point of the corrected third positioning frame.
[0317] As can be seen, in this embodiment, the electronic device can determine the corrected vertical coordinate value corresponding to the center point of each third positioning frame. If a corresponding third positioning frame exists for the corrected vertical coordinate value, the corrected vertical coordinate value corresponding to that third positioning frame can be used as the vertical coordinate value of the center point of the corrected third positioning frame. The horizontal coordinate value, width, height, and angle of the center point of that third positioning frame are then used as the horizontal coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively. If a corresponding third positioning frame does not exist for the corrected vertical coordinate value, the corrected vertical coordinate value can be used as the vertical coordinate value of the center point of the corrected third positioning frame. The average horizontal coordinate value, average width, average height, and average angle of the center point are then used as the horizontal coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively. This allows for the determination of the corrected third positioning frames corresponding to the main grids included in the battery cell, thus achieving accurate positioning of the main grids.
[0318] As one embodiment of this application, the position information of the modified third positioning frame includes the coordinates of the center point of the third positioning frame;
[0319] like Figure 17 As shown, the step of adjusting the corrected third positioning frame based on the distribution pattern of the main grid in the battery string image and the principle of line detection to obtain the position information of the main grid may include:
[0320] S1701, based on the center point of each corrected third positioning frame, perform vertical line detection to obtain the vertical line;
[0321] S1702, based on the center point of each corrected third positioning frame, perform horizontal line detection to obtain a horizontal line;
[0322] The distribution of main grids in a battery string image presents a two-dimensional array distribution. For example, if the number of battery cells is m and the number of main grids in each battery cell is n, then the main grids in the battery string image present an array distribution of n rows and m columns. Therefore, the position information of each main grid can be globally corrected based on the actual number of battery cells and the actual number of main grids in each battery cell.
[0323] After obtaining each corrected third positioning frame, the electronic device can further adjust the corrected third positioning frame to accurately determine the coordinates of the center point of the third positioning frame.
[0324] In one implementation, the electronic device can perform vertical line detection based on the center points of each corrected third positioning frame to obtain a vertical line, so that the center points of each corrected third positioning frame are distributed as much as possible on or near the vertical line. The electronic device can also perform horizontal line detection based on the center points of each corrected third positioning frame to obtain a horizontal line, so that the center points of each corrected third positioning frame are distributed as much as possible on or near the horizontal line.
[0325] For example, a battery string image may contain 13 battery cells, each containing 10 main grids. The electronic device can obtain corrected third-order bounding boxes. Then, based on the y-axis coordinates of the center points of each corrected third-order bounding box, the electronic device can detect vertical lines, resulting in 13 vertical lines. Similarly, based on the x-axis coordinates of the center points of each corrected third-order bounding box, the electronic device can detect horizontal lines, resulting in 10 horizontal lines.
[0326] S1703, the intersection of the vertical line and the horizontal line is determined as the position information of the main grid.
[0327] For each third positioning frame, when the vertical line and the horizontal line intersect, the electronic device can obtain the intersection point of the vertical line and the horizontal line. This intersection point may coincide with the center point of the third positioning frame, or it may be near the center point of the third positioning frame. Therefore, the center point of the third positioning frame can be adjusted based on this intersection point.
[0328] In one implementation, the electronic device can determine the position information of the main gate by the intersection of a vertical line and a horizontal line.
[0329] For example, for the first main grid in the main grid of the battery cell, the electronic device obtains the intersection point O1(x1, y1) of the vertical line and the horizontal line. Then, the electronic device can determine the position information of the main grid by the intersection point O1(x1, y1).
[0330] As can be seen, in this embodiment, the electronic device can perform line detection based on the vertical axis coordinates of the center points of each corrected third positioning frame to obtain a vertical line, and perform line detection based on the horizontal axis coordinates of the center points of each corrected third positioning frame to obtain a horizontal line. The intersection of the vertical and horizontal lines is then used to determine the position information of the main grid. This allows for accurate determination of the position of the center point of the third positioning frame, achieving precise positioning of the main grid.
[0331] As one embodiment of this application, after performing main grid positioning processing on the battery cell region corresponding to the position information of each battery cell in the battery string image to obtain the position information of the main grid in each battery cell region, the method may further include:
[0332] Based on the position information of each battery cell and the position information of the main grid, defect detection is performed on the battery string image to obtain the defect detection result.
[0333] Having obtained the positional information of the battery cells and the main grid, the electronic device accurately locates the batteries in an image. Based on the positional information of each battery cell and the main grid, the electronic device can then perform defect detection on the battery string image to obtain defect detection results. These defects include solder misalignment, short circuits, foreign objects, missing strips, edge chipping, and poor spacing.
[0334] For example, an electronic device can determine the boundaries of each battery cell in a battery string image based on the position information of each battery cell, and then detect edge chipping to obtain defect detection results. Similarly, an electronic device can determine the boundaries of each main grid in a battery string image based on the position information of each battery cell and the position information of the main grid, and then detect defects such as solder misalignment, missing bars, and short circuits to obtain defect detection results.
[0335] As can be seen, in this embodiment, the electronic device can perform defect detection on the battery string image based on the position information of each battery cell and the position information of the main grid, and obtain the defect detection result. This improves detection accuracy by accurately locating the batteries in the image and then performing defect detection on the battery string image.
[0336] Figure 18 This is a specific flowchart illustrating a method for locating a battery in an image according to an embodiment of this application. The following is in conjunction with... Figure 18 The method for locating batteries in images provided in the embodiments of this application will be illustrated with examples. For instance... Figure 18 As shown, the battery localization method in an image provided in this application embodiment may include the following steps:
[0337] S1801, serial positioning;
[0338] When an electronic device acquires an image of a battery to be processed, it can perform battery string localization processing on the image to obtain the position information of the battery string. Based on the position information of the battery string, it can determine the location of the battery string from the image to be processed and thus determine the battery string image.
[0339] S1802, chip positioning;
[0340] When a battery device obtains an image of a battery string, it can perform cell positioning processing on the image to obtain the position information of the cells included in the image, thereby enabling cell positioning.
[0341] S1803, main grid positioning.
[0342] Since each solar cell includes multiple main busbars, the electronic device can locate the main busbars in each cell region to obtain their position information, thus enabling the positioning of the main busbars. Based on the cell position information and the main busbar position information, the electronic device can perform defect detection on the solar cell string image to obtain the defect detection results.
[0343] As can be seen, in the solution provided in this application embodiment, the electronic device can acquire an image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, each battery cell includes multiple main grids, the battery string is located in the image to be processed to obtain the position information of the battery string, and the battery string image is determined from the image to be processed based on the position information of the battery string, the battery cell is located in the battery string image to obtain the position information of each battery cell, and the main grid is located in the battery cell area corresponding to the position information of each battery cell in the battery string image to obtain the position information of the main grid in each battery cell area. Since the image to be processed includes a battery string, the battery string is located in the image to be processed to obtain the battery string image, and then the battery cell and main grid are located based on the battery string image to obtain the position information of the battery cells and the position information of the main grids. This can reduce the interference of other areas in the image on the battery cell and main grid positioning, accurately locate the battery in the image, and achieve adaptive positioning of the battery in the image. It is not affected by the stringer model, battery cell type and main grid type, which can improve the robustness of battery positioning in the image.
[0344] Figure 19 This is a specific flowchart illustrating the acquisition of battery string images provided in an embodiment of this application. The following is in conjunction with... Figure 19 The following is an example illustrating the acquisition of battery string images provided in the embodiments of this application. Figure 19 As shown, the method for obtaining a battery string image provided in this application embodiment may include the following steps:
[0345] S1901, Image preprocessing;
[0346] After acquiring an image of a battery to be processed, an electronic device can preprocess the image to reduce the impact of noise and other factors, resulting in a preprocessed image. For example, the electronic device can perform morphological erosion processing on the battery image.
[0347] S1902, Battery string area positioning;
[0348] For the preprocessed image to be processed, the electronic device can locate the battery string region to obtain a first location bounding box, thus determining the position information of the battery string. The electronic device can use a deep learning algorithm or a traditional algorithm to locate the battery string region.
[0349] S1903, battery string area copy.
[0350] Once the electronic device obtains the location information of the battery string, it can determine the battery string region. Then, the electronic device can copy the battery string region to obtain an image of the battery string.
[0351] As can be seen, in the solution provided in this application embodiment, the electronic device can preprocess the image to be processed to obtain a preprocessed image to be processed, perform battery string positioning processing on the preprocessed image to obtain a first positioning box to determine the position information of the battery string, determine the battery string region based on the obtained position information of the battery string, and copy the battery string region to obtain a battery string image. This enables adaptive positioning of the battery cells, which is not affected by the model of the stringer, the type of battery cell, or the type of main grid, and can improve the robustness of battery positioning in the image.
[0352] Figure 20 This is a specific flowchart illustrating the acquisition of battery cell location information provided in an embodiment of this application. The following is in conjunction with... Figure 20 The following is an example illustrating the acquisition of battery cell location information provided in the embodiments of this application. For example... Figure 20 As shown, the method for obtaining the location information of the battery cell provided in this application embodiment may include the following steps:
[0353] S2001, Initial Positioning;
[0354] After obtaining the image of the battery string, the electronic device can use deep learning algorithms or template matching algorithms to perform initial positioning of the battery cells in the image, and obtain the second positioning box.
[0355] S2002, chip positioning correction;
[0356] After obtaining the second positioning frame, the electronic device can correct it, that is, correct the position information of the battery cell. The electronic device can calculate the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame. If a corresponding second positioning frame exists for the corrected horizontal axis coordinate value, the electronic device can use the corrected horizontal axis coordinate value corresponding to that second positioning frame as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and use the vertical axis coordinate value, width, height, and angle of the center point of that second positioning frame as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value.
[0357] If the corrected horizontal axis coordinate value does not correspond to a second positioning frame, the electronic device can use the corrected horizontal axis coordinate value as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and use the average value of the vertical axis coordinate value, the average value of the width, the average value of the height, and the average value of the angle of the center point as the vertical axis coordinate value, the width, the height, and the angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value.
[0358] S2003, Quadrilateral search.
[0359] To obtain a more accurate second positioning frame, the electronic device can adjust the corrected second positioning frame. For each corrected second positioning frame, a line search area corresponding to the four sides of the corrected second positioning frame is generated. According to the line detection principle, line detection is performed in each line search area to obtain the line detection result. Then, the intersection of the lines included in the line detection result is determined as the position information of the battery cell corresponding to the corrected second positioning frame.
[0360] As can be seen, in the solution provided in this application embodiment, after obtaining the battery string image, the electronic device can perform initial positioning processing on the battery cells to obtain a second positioning frame. The second positioning frame is then corrected, and further adjusted based on the principle of line detection to obtain the position information of each battery cell. This allows for accurate positioning of the battery cells.
[0361] Figure 21 This is a specific flowchart illustrating the acquisition of the main gate's position information provided in an embodiment of this application. The following is in conjunction with... Figure 21 The following is an example illustrating the acquisition of the main gate's position information provided in an embodiment of this application. For example... Figure 21 As shown, the method for obtaining the position information of the main gate provided in this application embodiment may include the following steps:
[0362] S2101, Initial positioning;
[0363] After the electronic device acquires the battery string image and the location information of the battery cells, it uses a deep learning algorithm or template matching algorithm to perform main grid localization processing for the battery cell region corresponding to the location information of each battery cell in the battery string image, and obtains the third localization box.
[0364] S2102, In-chip gate correction;
[0365] After obtaining the third positioning frame, the electronic device can correct it, that is, correct the position information of the main grid. The electronic device can calculate the corrected vertical axis coordinate value corresponding to the center point of each third positioning frame. If a corresponding third positioning frame exists for the corrected vertical axis coordinate value, the electronic device can use the corrected vertical axis coordinate value corresponding to the third positioning frame as the vertical axis coordinate value of the center point of the corrected third positioning frame, and use the horizontal axis coordinate value, width, height, and angle of the center point of the third positioning frame as the horizontal axis coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical axis coordinate value.
[0366] If the corrected vertical coordinate value does not have a corresponding third positioning frame, the electronic device can use the corrected vertical coordinate value as the vertical coordinate value of the center point of the corrected third positioning frame, and use the average value of the horizontal coordinate value, the average value of the width, the average value of the height, and the average value of the angle of the center point as the horizontal coordinate value, the width, the height, and the angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical coordinate value.
[0367] S2103, Global Gate Correction.
[0368] To obtain a more accurate third positioning frame, the electronic device can adjust the corrected third positioning frame based on the distribution pattern of the main grid in the battery string image and the principle of line detection, so as to obtain the position information of the main grid.
[0369] As can be seen, in the solution provided in this application embodiment, after obtaining the position information of the battery string, the electronic device performs main grid positioning processing on the battery cell area corresponding to the position information of each battery cell in the battery string image to obtain a third positioning frame. The third positioning frame is then corrected, and further adjusted based on the distribution pattern of the main grids in the battery string image and the principle of line detection to obtain the position information of the main grids. This allows for accurate positioning of the main grids included in the battery cell.
[0370] Corresponding to the above-described method for locating a battery in an image, this application also provides a device for locating a battery in an image. The following describes the device for locating a battery in an image provided by this application.
[0371] like Figure 22 As shown, a battery positioning device in an image includes:
[0372] The image acquisition module 2210 is used to acquire an image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, and each battery cell includes multiple main grids;
[0373] The battery string image acquisition module 2220 is used to perform battery string positioning processing on the image to be processed, obtain the position information of the battery string, and determine the battery string image from the image to be processed based on the position information of the battery string.
[0374] The battery cell location information acquisition module 2230 is used to perform battery cell positioning processing on the battery string image to obtain the location information of each battery cell.
[0375] The main grid position information acquisition module 2240 is used to perform main grid positioning processing on the corresponding battery cell area in the battery string image for the position information of each battery cell, so as to obtain the position information of the main grid in each battery cell area.
[0376] As can be seen, in the solution provided in this application embodiment, the electronic device can acquire an image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, each battery cell includes multiple main grids, the battery string is located in the image to be processed to obtain the position information of the battery string, and the battery string image is determined from the image to be processed based on the position information of the battery string, the battery cell is located in the battery string image to obtain the position information of each battery cell, and the main grid is located in the battery cell area corresponding to the position information of each battery cell in the battery string image to obtain the position information of the main grid in each battery cell area. Since the image to be processed includes a battery string, the battery string is located in the image to be processed to obtain the battery string image, and then the battery cell and main grid are located based on the battery string image to obtain the position information of the battery cells and the position information of the main grids. This can reduce the interference of other areas in the image on the battery cell and main grid positioning, accurately locate the battery in the image, and achieve adaptive positioning of the battery in the image. It is not affected by the stringer model, battery cell type and main grid type, which can improve the robustness of battery positioning in the image.
[0377] As one embodiment of this application, the battery string image acquisition module 2220 described above may include:
[0378] The first positioning box acquisition submodule is used to perform battery string positioning processing on the image to be processed based on the blank area between adjacent battery strings in the image to be processed, and obtain the first positioning box.
[0379] A battery string location information acquisition submodule is used to determine the location information of the first positioning frame as the location information of the battery string; or...
[0380] The first positioning frame is expanded to obtain an expanded first positioning frame; the position information of the expanded first positioning frame is determined as the position information of the battery string.
[0381] As one embodiment of this application, the above-mentioned battery cell location information acquisition module 2230 may include:
[0382] The first quantity acquisition submodule is used to acquire the first quantity of battery cells actually included in the battery string included in the image to be processed;
[0383] The second positioning frame acquisition submodule is used to perform initial positioning processing on the battery string image to obtain the second positioning frame of the battery cell.
[0384] The second positioning frame acquisition submodule is used to correct the second positioning frame based on the first quantity and the position information of the second positioning frame to obtain the corrected second positioning frame.
[0385] The cell position information acquisition submodule is used to adjust the corrected second positioning frame based on the straight line detection principle to obtain the position information of each cell.
[0386] As one embodiment of this application, the position information of the second positioning frame includes the center point coordinates, width, height, and angle of the second positioning frame;
[0387] The aforementioned modified second positioning box acquisition submodule may include:
[0388] The first acquisition unit is used to sort the second positioning frame according to a preset order of the horizontal axis coordinate values of the center point to obtain a sorting result, wherein the preset order is either from smallest to largest or from largest to smallest.
[0389] The first calculation unit is used to calculate the distance between every two adjacent second positioning frames along the horizontal axis in the sorting result;
[0390] The first average spacing acquisition unit is used to calculate the average value of the other spacings besides the maximum and minimum spacings, and obtain the first average spacing.
[0391] The second calculation unit is used to calculate the average value of the longitudinal coordinates, the average value of the width, the average value of the height, and the average value of the angle of the center point of each second positioning frame based on the longitudinal coordinates, width, height, and angle of the center point of each second positioning frame.
[0392] The second positioning frame acquisition unit is used to correct the second positioning frame based on the first average spacing, the average value of the vertical axis coordinate of the center point of the second positioning frame, the average width, the average height, and the average angle, so as to obtain the corrected second positioning frame.
[0393] As one embodiment of this application, the above-mentioned modified second positioning frame acquisition unit may include:
[0394] The horizontal axis coordinate value determination subunit is used to determine the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame based on the first average spacing and the horizontal axis coordinate value of the center point of the second positioning frame, according to the following formula.
[0395] or
[0396] Where, x i The x-axis coordinate of the center point of the i-th second positioning frame after being arranged in the preset order is given. The maximum value of i+1 is the number of battery cells, and the minimum value of i-1 is 1. This is the first average spacing;
[0397] The first correction subunit is used to, for each corrected horizontal axis coordinate value, if there is a corresponding second positioning box for the corrected horizontal axis coordinate value, take the corrected horizontal axis coordinate value corresponding to the second positioning box as the horizontal axis coordinate value of the center point of the corrected second positioning box, and take the vertical axis coordinate value, width, height and angle of the center point of the second positioning box as the vertical axis coordinate value, width, height and angle of the center point of the corrected second positioning box, respectively, to obtain the corrected second positioning box corresponding to the corrected horizontal axis coordinate value.
[0398] The first completion subunit is used to, if the corrected horizontal axis coordinate value does not have a corresponding second positioning frame, use the corrected horizontal axis coordinate value as the horizontal axis coordinate value of the center point of the corrected second positioning frame, and use the average value of the vertical axis coordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle as the vertical axis coordinate value, width, height, and angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value.
[0399] As one embodiment of this application, the above-mentioned battery cell location information acquisition submodule may include:
[0400] The line lookup region generation unit is used to generate the line lookup region corresponding to the four sides of each corrected second positioning box.
[0401] The line detection result acquisition unit is used to perform line detection on the line search area according to the line detection principle to obtain the line detection result;
[0402] The cell position information acquisition unit is used to determine the intersection of the straight lines included in the straight line detection result as the position information of the cell corresponding to the corrected second positioning frame.
[0403] As one embodiment of this application, the main grid position information acquisition module 2240 described above may include:
[0404] The second quantity acquisition submodule is used to acquire the second quantity of main grids actually included in each battery cell in the battery string included in the image to be processed;
[0405] The third positioning frame acquisition submodule is used to perform main grid positioning processing on the battery cell area corresponding to the position information of each battery cell in the battery string image, and obtain the third positioning frame of each main grid.
[0406] The third positioning frame acquisition submodule is modified to modify the third positioning frame for each battery cell area based on the second quantity and the position information of the third positioning frame, so as to obtain the modified third positioning frame.
[0407] The main grid position information acquisition submodule is used to adjust the corrected third positioning frame based on the distribution pattern of the main grid in the battery string image and the principle of line detection to obtain the position information of the main grid.
[0408] As one embodiment of this application, the position information of the third positioning frame includes the center point coordinates, width, height, and angle of the third positioning frame;
[0409] The aforementioned modified third positioning box acquisition submodule may include:
[0410] The second acquisition unit is used to sort the third positioning frame according to the preset order of the vertical axis coordinate values of the center point for each battery cell area to obtain the sorting result, wherein the preset order is either from small to large or from large to small.
[0411] The third calculation unit is used to calculate the distance between every two adjacent third positioning frames along the vertical axis in the sorting result;
[0412] The second average spacing acquisition unit is used to calculate the average value of the other spacings besides the maximum and minimum spacings, and obtain the second average spacing.
[0413] The fourth calculation unit is used to calculate the average horizontal coordinate value, average width, average height, and average angle of the center point of each third positioning frame based on the horizontal coordinate value, width, height, and angle of the center point of each third positioning frame.
[0414] The third positioning frame acquisition unit corrects the third positioning frame based on the second average spacing, the average horizontal coordinate value of the center point of the third positioning frame, the average width, the average height, and the average angle, to obtain the corrected third positioning frame.
[0415] As one embodiment of this application, the above-mentioned modified third positioning frame acquisition unit may include:
[0416] The vertical axis coordinate value determination subunit is used to determine the corrected vertical axis coordinate value corresponding to the center point of each third positioning frame based on the second average spacing and the vertical axis coordinate value of the center point of the third positioning frame, according to the following formula.
[0417] or
[0418] Among them, y i The value of i+1 is the ordinate of the center point of the i-th third positioning frame arranged in the preset order. The maximum value of i+1 is the number of main grids included in the battery cell, and the minimum value of i-1 is 1. This is the second average spacing;
[0419] The second correction subunit is used to, for each corrected ordinate value, if there is a corresponding third positioning box for the corrected ordinate value, take the corrected ordinate value corresponding to the third positioning box as the ordinate value of the center point of the corrected third positioning box, and take the horizontal coordinate value, width, height and angle of the center point of the third positioning box as the horizontal coordinate value, width, height and angle of the center point of the corrected third positioning box, respectively, to obtain the corrected third positioning box corresponding to the corrected ordinate value.
[0420] The second completion subunit is used to, if the corrected vertical axis coordinate value does not have a corresponding third positioning frame, use the corrected vertical axis coordinate value as the vertical axis coordinate value of the center point of the corrected third positioning frame, and use the average value of the horizontal axis coordinate value of the center point, the average value of the width, the average value of the height, and the average value of the angle as the horizontal axis coordinate value, width, height, and angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical axis coordinate value.
[0421] As one embodiment of this application, the position information of the modified third positioning frame includes the coordinates of the center point of the third positioning frame;
[0422] The aforementioned main grid position information acquisition submodule may include:
[0423] The vertical line acquisition unit is used to detect vertical lines based on the center points of each corrected third positioning frame to obtain vertical lines;
[0424] The horizontal line acquisition unit is used to detect horizontal lines based on the center points of each corrected third positioning box to obtain horizontal lines.
[0425] The main grid position information acquisition unit is used to determine the intersection of the vertical line and the horizontal line as the position information of the main grid.
[0426] As one embodiment of this application, the above-described apparatus may further include:
[0427] The defect detection result acquisition module is used to perform main grid location processing on the battery string image based on the location information of each battery cell in the corresponding battery cell area to obtain the location information of the main grid in each battery cell area, and then perform defect detection on the battery string image to obtain the defect detection result.
[0428] This application also provides an electronic device, such as... Figure 23 As shown, it includes:
[0429] Memory 2301 is used to store computer programs;
[0430] The processor 2302 is used to execute the program stored in the memory 2301 to implement the battery positioning method in the image described in any of the above embodiments.
[0431] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 2302, the communication interface, and the memory 2301 communicating with each other via the communication bus.
[0432] As can be seen, in the solution provided in this application embodiment, the electronic device can acquire an image to be processed, wherein the image to be processed includes a battery string, the battery string includes multiple battery cells, each battery cell includes multiple main grids, the battery string is located in the image to be processed to obtain the position information of the battery string, and the battery string image is determined from the image to be processed based on the position information of the battery string, the battery cell is located in the battery string image to obtain the position information of each battery cell, and the main grid is located in the battery cell area corresponding to the position information of each battery cell in the battery string image to obtain the position information of the main grid in each battery cell area. Since the image to be processed includes a battery string, the battery string is located in the image to be processed to obtain the battery string image, and then the battery cell and main grid are located based on the battery string image to obtain the position information of the battery cells and the position information of the main grids. This can reduce the interference of other areas in the image on the battery cell and main grid positioning, accurately locate the battery in the image, and achieve adaptive positioning of the battery in the image. It is not affected by the stringer model, battery cell type and main grid type, which can improve the robustness of battery positioning in the image.
[0433] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0434] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0435] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0436] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0437] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of the battery positioning method in any of the above images.
[0438] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the battery positioning method in any of the images described in the above embodiments.
[0439] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.
[0440] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0441] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0442] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A method of locating a battery in an image, characterized by, The method comprises: acquiring a to-be-processed image, wherein the to-be-processed image comprises a battery string, and the battery string comprises a plurality of battery pieces, and each battery piece comprises a plurality of main grids; performing battery string positioning processing on the to-be-processed image to obtain position information of the battery string, and determining a battery string image from the to-be-processed image according to the position information of the battery string; acquiring a first quantity of battery pieces actually comprised by the battery string comprised by the to-be-processed image; performing battery piece initial positioning processing on the battery string image to obtain a second positioning frame of the battery piece, wherein the position information of the second positioning frame comprises a center point coordinate, a width, a height and an angle of the second positioning frame; sorting the second positioning frame according to a preset order of the horizontal axis coordinate value of the center point to obtain a sorting result, wherein the preset order is from small to large or from large to small; calculating the interval of each two adjacent second positioning frames along the horizontal axis direction in the sorting result; calculating the average value of the interval other than the maximum interval and the minimum interval in the interval to obtain a first average interval; calculating the average value of the vertical axis coordinate value, the width, the height and the angle of the center point of the second positioning frame based on the vertical axis coordinate value, the width, the height and the angle of the center point of each second positioning frame; correcting the second positioning frame based on the first average interval, the average value of the vertical axis coordinate value of the center point of the second positioning frame, the average value of the width, the average value of the height and the average value of the angle to obtain a corrected second positioning frame; adjusting the corrected second positioning frame based on the principle of straight line detection to obtain the position information of each battery piece; performing main grid positioning processing on the battery piece region corresponding to the position information of each battery piece in the battery string image to obtain the position information of the main grid in each battery piece region.
2. The method of claim 1, wherein, The step of performing battery string positioning processing on the to-be-processed image to obtain the position information of the battery string comprises: performing battery string positioning processing on the to-be-processed image based on the blank area between adjacent battery strings to obtain a first positioning frame; determining the position information of the first positioning frame as the position information of the battery string; or, extending the first positioning frame to obtain an extended first positioning frame, and determining the position information of the extended first positioning frame as the position information of the battery string.
3. The method of claim 1, wherein, The step of correcting the second positioning frame based on the first average interval, the average value of the vertical axis coordinate value of the center point of the second positioning frame, the average value of the width, the average value of the height and the average value of the angle to obtain a corrected second positioning frame comprises: determining the corrected horizontal axis coordinate value corresponding to the center point of each second positioning frame based on the first average interval and the horizontal axis coordinate value of the center point of the second positioning frame according to the following formula; or ; wherein, is a horizontal axis coordinate value of a center point of the i-th second positioning frame arranged in the preset order, is a maximum value of the number of the battery pieces, is a minimum value of 1, is the first average interval; If the modified horizontal axis coordinate value exists a corresponding second positioning frame, taking the modified horizontal axis coordinate value corresponding to the second positioning frame as the horizontal axis coordinate value of the center point of the modified second positioning frame, and taking the vertical axis coordinate value, the width, the height and the angle of the center point of the second positioning frame as the vertical axis coordinate value, the width, the height and the angle of the center point of the modified second positioning frame respectively, to obtain the modified second positioning frame corresponding to the modified horizontal axis coordinate value. If the modified horizontal axis coordinate value does not exist a corresponding second positioning frame, taking the modified horizontal axis coordinate value as the horizontal axis coordinate value of the center point of the modified second positioning frame, and taking the average value of the vertical axis coordinate value, the average value of the width, the average value of the height and the average value of the angle of the center point as the vertical axis coordinate value, the width, the height and the angle of the center point of the modified second positioning frame respectively, to obtain the modified second positioning frame corresponding to the modified horizontal axis coordinate value.
4. The method of claim 1, wherein, The step of adjusting the modified second positioning frame based on the straight line detection principle to obtain the position information of each battery piece, comprises: For each modified second positioning frame, generating four straight line search areas corresponding to the four edges of the modified second positioning frame; Performing straight line detection on the straight line search areas according to the straight line detection principle to obtain a straight line detection result; Determining the intersection point of the straight lines included in the straight line detection result as the position information of the battery piece corresponding to the modified second positioning frame.
5. The method of claim 1, wherein, The step of performing main grid positioning processing on the battery piece region corresponding to the position information of each battery piece in the battery string image to obtain the position information of the main grid in each battery piece region, comprises: Obtaining the second number of main grids actually included in each battery piece in the battery string included in the to-be-processed image; For each battery piece region, performing main grid positioning processing on the battery piece region corresponding to the position information of each battery piece in the battery string image to obtain a third positioning frame of each main grid; For each battery piece region, based on the second number and the position information of the third positioning frame, modifying the third positioning frame to obtain a modified third positioning frame; Based on the distribution rule of the main grid in the battery string image and the straight line detection principle, adjusting the modified third positioning frame to obtain the position information of the main grid.
6. The method of claim 5, wherein, The position information of the third positioning frame comprises the center point coordinate, the width, the height and the angle of the third positioning frame; The step of modifying the third positioning frame based on the second number and the position information of the third positioning frame to obtain a modified third positioning frame for each battery piece region, comprises: For each battery piece region, sorting the third positioning frames according to the preset order of the vertical axis coordinate values of the center points to obtain a sorting result, wherein the preset order is from small to large or from large to small; Calculating the interval of every two adjacent third positioning frames in the sorting result along the vertical axis direction; Calculating the average value of the intervals other than the maximum interval and the minimum interval in the intervals to obtain a second average interval; The horizontal axis coordinate value average, the width average, the height average, and the angle average of the center point of the third positioning frame are calculated based on the horizontal axis coordinate value, the width, the height, and the angle of the center point of each third positioning frame. The third positioning frame is corrected based on the second average interval, the horizontal axis coordinate value average, the width average, the height average, and the angle average of the center point of the third positioning frame, to obtain a corrected third positioning frame.
7. The method of claim 6, wherein, The step of correcting the third positioning frame based on the second average interval, the horizontal axis coordinate value average, the width average, the height average, and the angle average of the center point of the third positioning frame, to obtain a corrected third positioning frame, includes: The corrected vertical axis coordinate value of each third positioning frame is determined based on the second average interval and the vertical axis coordinate value of the center point of the third positioning frame according to the following formula: or ; wherein, is a longitudinal axis coordinate value of a center point of a third positioning frame arranged in the preset order, is a longitudinal axis coordinate value of a center point of a third positioning frame arranged in the preset order, is a maximum value of the number of main grids included in the battery piece, is a minimum value of 1, is the second average interval; For each corrected vertical axis coordinate value, if the corrected vertical axis coordinate value corresponds to a third positioning frame, the corrected vertical axis coordinate value of the third positioning frame is taken as the vertical axis coordinate value of the center point of the corrected third positioning frame, and the horizontal axis coordinate value, the width, the height, and the angle of the center point of the third positioning frame are taken as the horizontal axis coordinate value, the width, the height, and the angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical axis coordinate value. If the corrected vertical axis coordinate value does not correspond to a third positioning frame, the corrected vertical axis coordinate value is taken as the vertical axis coordinate value of the center point of the corrected third positioning frame, and the horizontal axis coordinate value average, the width average, the height average, and the angle average of the center point are taken as the horizontal axis coordinate value, the width, the height, and the angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected vertical axis coordinate value.
8. The method of claim 7, wherein, The position information of the corrected third positioning frame includes the center point coordinate of the third positioning frame. The step of adjusting the corrected third positioning frame based on the distribution rule of the main grid in the battery string image and the straight line detection principle to obtain the position information of the main grid includes: Vertical straight lines are detected based on the center points of the corrected third positioning frames to obtain vertical straight lines. Horizontal straight lines are detected based on the center points of the corrected third positioning frames to obtain horizontal straight lines. The intersection of the vertical straight lines and the horizontal straight lines is determined as the position information of the main grid.
9. The method according to any one of claims 1 to 8, characterized in that, After the step of performing main grid positioning processing on the battery piece region corresponding to the position information of each battery piece in the battery string image to obtain the position information of the main grid in each battery piece region, the method further includes: Defect detection is performed on the battery string image based on the position information of each battery piece and the position information of the main grid to obtain a defect detection result.
10. A device for locating a battery in an image, characterized in that The device includes: The application relates to a battery string image processing method and device. An image to be processed is acquired, wherein the image to be processed comprises a battery string, the battery string comprises a plurality of battery pieces, and each battery piece comprises a plurality of main grids; A battery string image is acquired by performing battery string positioning processing on the image to be processed, and the position information of the battery string is obtained, and the battery string image is determined from the image to be processed according to the position information of the battery string; Battery piece position information is acquired by performing battery piece positioning processing on the battery string image; Main grid position information is acquired by performing main grid positioning processing on the battery piece region corresponding to the position information of each battery piece in the battery string image, and the position information of the main grid in each battery piece region is obtained; The battery piece position information acquisition module comprises: A first quantity acquisition sub-module is configured to acquire a first quantity of battery pieces actually included in the battery string included in the image to be processed; A second positioning frame acquisition sub-module is configured to perform initial positioning processing on the battery piece in the battery string image to obtain a second positioning frame of the battery piece, wherein the position information of the second positioning frame comprises the center point coordinate, width, height and angle of the second positioning frame; A corrected second positioning frame acquisition sub-module is configured to correct the second positioning frame based on the first quantity and the position information of the second positioning frame to obtain a corrected second positioning frame; A battery piece position information acquisition sub-module is configured to adjust the corrected second positioning frame based on a straight line detection principle to obtain the position information of each battery piece; The corrected second positioning frame acquisition sub-module comprises: A first acquisition unit is configured to sort the second positioning frames according to a preset order of the horizontal axis coordinate values of the center points to obtain a sorting result, wherein the preset order is from small to large or from large to small; A first calculation unit is configured to calculate the interval of each two adjacent second positioning frames in the sorting result along the horizontal axis direction; A first average interval acquisition unit is configured to calculate the average value of the intervals other than the maximum interval and the minimum interval in the intervals to obtain a first average interval; A second calculation unit is configured to calculate the average value of the vertical axis coordinate values, the width, the height and the angle of the center points of the second positioning frames, respectively, based on the vertical axis coordinate values, the width, the height and the angle of the center points of the second positioning frames; 11. The apparatus of claim 10, wherein, A corrected second positioning frame acquisition unit is configured to correct the second positioning frame based on the first average interval, the average value of the vertical axis coordinate values of the center points of the second positioning frames, the average value of the width, the average value of the height and the average value of the angle to obtain a corrected second positioning frame. The battery string image acquisition module comprises: A first positioning frame acquisition sub-module is configured to perform battery string positioning processing on the image to be processed based on the blank area between adjacent battery strings in the image to be processed to obtain a first positioning frame; A battery string position information acquisition sub-module is configured to determine the position information of the first positioning frame as the position information of the battery string; or, The first positioning frame is expanded outwardly to obtain an expanded first positioning frame, and position information of the expanded first positioning frame is determined as position information of the battery string; The corrected second positioning frame acquisition unit comprises: The horizontal axis coordinate value determination subunit is configured to determine a corrected horizontal axis coordinate value corresponding to a center point of each second positioning frame according to the following formula based on the first average interval and a horizontal axis coordinate value of the center point of the second positioning frame: or ; wherein, is a horizontal axis coordinate value of a center point of the second positioning frame arranged in the preset order, the maximum value of is the number of the battery pieces, the minimum value of is 1, is the first average interval; The first correction subunit is configured to, for each corrected horizontal axis coordinate value, if there is a second positioning frame corresponding to the corrected horizontal axis coordinate value, take a corrected horizontal axis coordinate value of the second positioning frame as a horizontal axis coordinate value of a center point of a corrected second positioning frame, and take a vertical axis coordinate value, a width, a height and an angle of the center point of the second positioning frame as a vertical axis coordinate value, a width, a height and an angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value. The first correction subunit is configured to, for each corrected horizontal axis coordinate value, if there is a second positioning frame corresponding to the corrected horizontal axis coordinate value, take a corrected horizontal axis coordinate value of the second positioning frame as a horizontal axis coordinate value of a center point of a corrected second positioning frame, and take a vertical axis coordinate value, a width, a height and an angle of the center point of the second positioning frame as a vertical axis coordinate value, a width, a height and an angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value. The first correction subunit is configured to, for each corrected horizontal axis coordinate value, if there is a second positioning frame corresponding to the corrected horizontal axis coordinate value, take a corrected horizontal axis coordinate value of the second positioning frame as a horizontal axis coordinate value of a center point of a corrected second positioning frame, and take a vertical axis coordinate value, a width, a height and an angle of the center point of the second positioning frame as a vertical axis coordinate value, a width, a height and an angle of the center point of the corrected second positioning frame, respectively, to obtain the corrected second positioning frame corresponding to the corrected horizontal axis coordinate value. The battery piece position information acquisition sub-module comprises: The straight line detection result acquisition unit is configured to perform straight line detection on the straight line search area according to a straight line detection principle to obtain a straight line detection result. The battery piece position information acquisition unit is configured to determine an intersection point of a straight line included in the straight line detection result as position information of a battery piece corresponding to the corrected second positioning frame. The main grid position information acquisition module comprises: The second quantity acquisition sub-module is configured to acquire a second quantity of main grids actually included in each battery piece in the battery string included in the to-be-processed image. The third positioning frame acquisition sub-module is configured to perform main grid positioning processing on a battery piece region corresponding to each battery piece position information in the battery string image to obtain a third positioning frame of each main grid. The main grid position information acquisition sub-module is configured to adjust the corrected third positioning frame based on a distribution rule of the main grid in the battery string image and a straight line detection principle to obtain the position information of the main grid. The position information of the third positioning frame comprises a center point coordinate, a width, a height and an angle of the third positioning frame. The corrected third positioning frame acquisition sub-module comprises: The second acquisition unit is configured to sort the third positioning frames according to a preset order of the longitudinal axis coordinate values of the center points of the third positioning frames for each cell region, to obtain a sorting result, wherein the preset order is from small to large or from large to small; The third calculation unit is configured to calculate a spacing between each two adjacent third positioning frames in the sorting result along the longitudinal axis direction; The second average spacing acquisition unit is configured to calculate an average value of the spacings other than the maximum spacing and the minimum spacing in the spacings, to obtain a second average spacing; The fourth calculation unit is configured to calculate an average value of the longitudinal axis coordinate values, an average value of the widths, an average value of the heights, and an average value of the angles of the center points of the third positioning frames, respectively, based on the longitudinal axis coordinate values, the widths, the heights, and the angles of the center points of the third positioning frames; The corrected third positioning frame acquisition unit is configured to correct the third positioning frames based on the second average spacing, the average value of the longitudinal axis coordinate values of the center points of the third positioning frames, the average value of the widths, the average value of the heights, and the average value of the angles, to obtain corrected third positioning frames; The corrected third positioning frame acquisition unit includes: The longitudinal axis coordinate value determination subunit is configured to determine a corrected longitudinal axis coordinate value corresponding to the center point of each third positioning frame according to the following formula based on the second average spacing and the longitudinal axis coordinate value of the center point of the third positioning frame; or ; in, The first one arranged according to the preset order The ordinate value of the center point of the third positioning frame. The maximum value is the number of main grids included in the solar cell. The minimum value is 1. This is the second average spacing; The second correction subunit is configured to, for each corrected longitudinal axis coordinate value, if there is a third positioning frame corresponding to the corrected longitudinal axis coordinate value, take the corrected longitudinal axis coordinate value of the third positioning frame as the longitudinal axis coordinate value of the center point of the corrected third positioning frame, and take the longitudinal axis coordinate value, the width, the height, and the angle of the center point of the third positioning frame as the longitudinal axis coordinate value, the width, the height, and the angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected longitudinal axis coordinate value; The second completion subunit is configured to, if there is no third positioning frame corresponding to the corrected longitudinal axis coordinate value, take the corrected longitudinal axis coordinate value as the longitudinal axis coordinate value of the center point of the corrected third positioning frame, and take the average value of the longitudinal axis coordinate value, the average value of the width, the average value of the height, and the average value of the angle of the center point as the longitudinal axis coordinate value, the width, the height, and the angle of the center point of the corrected third positioning frame, respectively, to obtain the corrected third positioning frame corresponding to the corrected longitudinal axis coordinate value; The position information of the corrected third positioning frame includes the center point coordinate of the third positioning frame; The main grid position information acquisition submodule includes: The vertical straight line acquisition unit is configured to perform vertical straight line detection based on the center points of the corrected third positioning frames, to obtain a vertical straight line; The horizontal straight line acquisition unit is configured to perform horizontal straight line detection based on the center points of the corrected third positioning frames, to obtain a horizontal straight line; The main grid position information acquisition unit is configured to determine the intersection point of the vertical straight line and the horizontal straight line as the position information of the main grid; The device further includes: The defect detection result acquisition module is configured to, after the step of obtaining the position information of the main grid in each cell region by performing the main grid positioning processing on the cell region corresponding to the position information of each cell in the battery string image, perform defect detection on the battery string image based on the position information of each cell and the position information of the main grid, and obtain a defect detection result.
12. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1-9. The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1-9. The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1-9.
13. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Method for detecting white exposure defect of main grid line of photovoltaic module
CN114596240A
Battery string detection method
CN115639214A