A battery coating defect detection method and device, and storage medium
Through automated image processing and neural network technology, accurate detection and classification of battery coating defects is achieved, the problems of low manual detection efficiency and insufficient accuracy are solved, and the ability of coating quality control is improved.
Patent Information
- Application Number
- CN202110911738.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-10
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2041-08-10
AI Technical Summary
In the prior art, battery coating defect detection relies on manual observation, is inefficient and not accurate enough to adapt to the needs of large-scale production, making it difficult to guarantee the coating quality.
A battery coating defect detection method is adopted to obtain the image to be detected, perform area positioning, morphological processing and feature analysis, and use neural networks to classify defects to realize automatic detection and classification of defects in the coating area and substrate area.
It improves the efficiency and accuracy of battery coating defect detection, improves the stability and robustness of detection, can detect and classify battery coating defects online in real time, and improves process quality control and equipment parameter adjustment.
Smart Images

Figure CN113592845B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a battery coating defect detection method and device, and a storage medium. Background Art
[0002] With the continuous development of science and technology and the continuous improvement of people's living standards, batteries have entered various fields of work and life. At present, in order to adapt to the rapid growth of battery demand, most battery manufacturers are producing battery plates more and more widely and quickly. Battery plates need to be coated during production, and the detection of coating surface defects is an important part of ensuring the quality of plates.
[0003] At present, the common method for detecting coating defects is still through manual observation. When a large defect is found, the coating line is stopped and the location of the defect is manually marked for subsequent processing. This traditional manual detection method is not only inefficient, but also increases labor costs. In addition, people are prone to visual fatigue and cannot detect all coating defects in time, or smaller defects are easily overlooked. Therefore, the manual detection method of battery coating defects can no longer meet the large-scale production needs of battery plates, nor can it guarantee the coating quality of battery plates. Summary of the invention
[0004] The main technical problem solved by this application is: how to improve the efficiency and accuracy of battery coating defect detection. In order to solve the above technical problem, this application proposes a lithium battery coating defect detection method and device, and a storage medium.
[0005] According to the first aspect, an embodiment provides a battery coating defect detection method, including: acquiring an image to be detected of the battery coating; performing regional positioning on the image to be detected to obtain at least one coating area and / or at least one substrate area; detecting image features of the coating area, and analyzing to obtain a first defect existing in the coating area; and / or detecting image features of the substrate area, and analyzing to obtain a second defect existing in the substrate area; performing feature classification processing on the first defect and / or the second defect to obtain corresponding defect classification results respectively.
[0006] The method of performing regional positioning on the image to be detected to obtain at least one coated area and / or at least one substrate area includes: performing binarization processing on the image to be detected to obtain a binary image; performing morphological image processing and regional contour segmentation processing on the binary image to segment at least one coated area and / or at least one substrate area.
[0007] The binary image is subjected to morphological image processing and regional contour segmentation processing to obtain at least one coating region and / or at least one substrate region, comprising: performing morphological transformation on the binary image, and obtaining a plurality of first regions and corresponding contour data respectively through connectivity analysis and feature screening; the morphological transformation comprises one or more of expansion, corrosion, opening operation, closing operation and gradient operation; calculating the angle change value of each pixel point in the contour data corresponding to the first region, and expressing it as
[0008] α i =arctan(y i+1 -y i ,x i+1 -x i );
[0009] Among them, (x i ,y i )(i=1,2,…,N1) is the coordinate of the i-th pixel point, N1 is the number of pixels in the contour data; the angle change threshold and pixel smoothing range about the angle change are calculated, and are expressed as
[0010]
[0011] Among them, κ is the weight parameter, l sum is the contour length of the first region, σ is a preset smoothing coefficient;
[0012] For any pixel point p in the contour data corresponding to the first area, if the difference between the angle change value of the pixel point p and the reference angle change value is greater than the angle change threshold, the pixel point p is determined to be a segmentation data point; the reference angle change value is the angle change value of the pixel point obtained by straight line fitting of each pixel point in the pixel smoothing range before and after the pixel point p; an approximate polygon is formed according to the determined multiple segmentation data points and the first area is segmented to obtain several segments of area edges; the average angle corresponding to each of the area edges is calculated, and if it is determined that the difference between the average angles corresponding to two adjacent area edges is less than or equal to a first preset threshold, the two area edges are merged to obtain a new area edge, and the average angle corresponding to the new area edge is calculated; the merging of area edges is continued until the first area can be represented by a quadrilateral contour; at least one coating area and / or at least one substrate area is determined according to the quadrilateral contour representation of each of the first areas and the grayscale value of the pixel points in the area.
[0013] The detecting of the image features of the coating area and analyzing the first defect in the coating area comprises: performing downsampling processing on the coating area for multiple times to obtain multiple pyramid images of different scales; calculating the feature value of each pixel in each pyramid image to form a feature map corresponding to each pyramid image, and performing upsampling processing on the feature map corresponding to each pyramid image to obtain a corresponding upsampled image; the upsampled image has the same scale as the coating area; for the upsampled images corresponding to each pyramid image, channel splicing the feature values of the same pixel position in each upsampled image to form a set of feature vectors; performing defect estimation on each feature vector according to a preset neural network to obtain a pixel point belonging to the defect; and performing dilation operation on the pixel points belonging to the defect in the coating area to obtain an expanded area as the first defect.
[0014] The calculating the characteristic value of each pixel in each of the pyramid images to form a characteristic map corresponding to each of the pyramid images includes: for any pixel (i, j) in each of the pyramid images, constructing a gray value set of the pixel within a preset pixel range, wherein the gray value set is expressed as N2 is the number of pixels within the preset pixel range; calculate the intermediate parameter about the pixel point (i, j), the intermediate parameter is expressed as
[0015]
[0016] The characteristic value of the pixel (i, j) is calculated according to the intermediate parameter and expressed as
[0017]
[0018] Among them, μ is the grayscale mean of each pixel grayscale set, ε is the grayscale value that promotes Σ ij The offset that can be reversibly operated, Q is the unit matrix, M is the operation function of the Mahalanobis distance; and a corresponding feature map is formed according to the feature value of each pixel point in each of the pyramid images.
[0019] The method of detecting the image features of the substrate area and analyzing the second defect existing in the substrate area includes: performing background estimation processing on the substrate area and obtaining a background estimation image by noise filtering; processing each pixel in the estimation image by image difference operation to obtain a differential image; comparing the difference value of each pixel in the differential image with a second preset threshold to obtain a plurality of candidate pixel points; obtaining a candidate area by using the plurality of candidate pixel points and performing feature screening, and using the screened candidate area as the second defect.
[0020] The background estimation process is performed on the substrate area to obtain a background estimation image by noise filtering, including: for any pixel point (i, j) in the substrate area, calculating the spatial distance and grayscale distance between the pixel point (i, j) and the center point (k, l) of the filtering template, and expressing them as
[0021]
[0022] The filter kernel coefficient is calculated according to the spatial distance and the grayscale distance, and is expressed as
[0023]
[0024] Among them, σ d , σ r The default standard deviations are all given, I(i,j) and I(k,l) are pixel grayscales, and exp is an exponential function with the natural constant e as the base;
[0025] The background estimation image is calculated according to the filter kernel coefficients and is expressed as
[0026]
[0027] The feature classification of the first defect and / or the second defect to obtain corresponding defect classification results includes: for the first defect and / or the second defect, calculating the feature vector of each defect, inputting the feature vector into a preset MLP network, and having the MLP network analyze the defect features and output the defect type; the feature vector includes one or more of grayscale value, normalized grayscale value, gradient direction feature, horizontal projection, vertical projection, needle-likeness, and grayscale co-occurrence matrix features; the defect type includes one or more of holes, tapes, scratches, cracks, wrinkles, breakages, tailings, decarburization, bubbling, bubbles, joints, and bright spots; and obtaining corresponding defect classification results according to the defect type.
[0028] According to the second aspect, an embodiment provides a defect detection device, comprising: a camera, used to capture images of battery coating to form an image to be detected; a processor, used to obtain defects and defect classification results in the image to be detected through the defect detection method described in the first aspect; a display, used to display the image to be detected and / or the defect classification results.
[0029] The processor includes: an acquisition module, which is used to acquire the image to be inspected of the battery coating from the camera; a positioning module, which is used to perform regional positioning on the image to be inspected to obtain at least one coating area and / or at least one substrate area; an analysis module, which is used to detect the image features of the coating area and analyze to obtain a first defect existing in the coating area; and / or, which is used to detect the image features of the substrate area and analyze to obtain a second defect existing in the substrate area; and a classification module, which is used to perform feature classification processing on the first defect and / or the second defect to obtain corresponding defect classification results respectively.
[0030] According to a third aspect, an embodiment provides a computer-readable storage medium, on which a program is stored, and the program can be executed by a processor to implement the method described in the first aspect above.
[0031] The beneficial effects of this application are:
[0032] According to the above-mentioned embodiment, a defect detection method, device and storage medium for battery coating are provided, wherein the defect detection method includes: obtaining an image to be detected of battery coating, performing regional positioning on the image to be detected, and obtaining at least one coating area and / or at least one substrate area; detecting the image features of the coating area to analyze and obtain the first defect existing in the coating area, and / or, detecting the image features of the substrate area to analyze and obtain the second defect existing in the substrate area; performing feature classification processing on the first defect and / or the second defect, and obtaining corresponding defect classification results respectively. On the one hand, the image to be detected of battery coating is subjected to regional positioning processing, and the defects existing in different areas are analyzed by distinguishing the coating area and / or the substrate area in the image, thereby improving the stability and robustness of battery coating defect detection; on the other hand, feature classification processing is performed on the first defect and / or the second defect, and the defect classification result is obtained according to the grayscale and texture features presented by the defect, which can not only enhance the defect recognition performance for battery coating, but also improve the accuracy of defect classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a structural diagram of a defect detection device in one embodiment of the present application;
[0034] Figure 2 A schematic diagram of imaging of battery coating;
[0035] Figure 3 This is a flow chart of a defect detection method for battery coating in one embodiment of the present application;
[0036] Figure 4 A flow chart for obtaining coating areas and / or substrate areas for area positioning;
[0037] Figure 5A flow chart for analyzing and obtaining a first defect existing in a coating area;
[0038] Figure 6 A flow chart for analyzing and obtaining a second defect existing in a substrate region;
[0039] Figure 7 It is a schematic diagram of the principle of outputting defect types;
[0040] Figure 8 Schematic diagram of the principle of spatial distance and grayscale distance;
[0041] Fig. 9 One of the schematic diagrams of defect types;
[0042] Fig.10 This is the second schematic diagram of the defect type;
[0043] Fig.11 A structural diagram of a defect detection device in another embodiment of the present application;
[0044] Fig.12 A schematic diagram of the structure of the processor;
[0045] Fig.13 This is a structural diagram of an image processing device in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The present application is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are intended to enable the present application to be better understood. However, those skilled in the art can easily recognize that some of the features can be omitted in different situations, or can be replaced by other elements, materials, and methods. In some cases, some operations related to the present application are not shown or described in the specification, in order to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations based on the description in the specification and the general technical knowledge in the art.
[0047] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0048] The serial numbers of the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0049] The coating defect detection of battery plates is to find out the defect location and defect type from the coated battery plates. Different battery plate manufacturers will produce different types of coating defects during the coating process. Even the same coating equipment will produce different defects after spraying the coating material on the battery plate using a spray gun or other coating instrument under different production conditions. Therefore, coating defects are complex and diverse. In general battery plate coating lines, battery plates are processed in sections. The surface of the plate is mainly divided into two parts: the coating area and the substrate area. There is a short substrate area as a gap between the two coating areas. The coating area can use the diaphragm material commonly used on the battery, and the substrate area can use aluminum foil, copper foil and other materials. It should be noted that the battery plate here can be the plate used on lithium batteries or other dry batteries. As long as it involves battery coating, it is fine, and there is no restriction on the application of battery coating on which battery.
[0050] In order to achieve the purpose of battery coating defect detection, in some schemes, the input image of battery coating can be preprocessed (such as mean filtering, median filtering, Gaussian filtering and other methods) to obtain the preprocessed image; the preprocessed image is binarized to obtain the defect area information; the defect area information is subjected to Blob analysis, and the image area features obtained after Blob analysis are screened and judged whether it is a defect; this method can only realize defect detection, but cannot classify the defects, and it is impossible to perform statistics and control of defect categories. In some schemes, the defect categories can be semantically segmented and classified based on convolutional neural networks to obtain the location and category of the defects; because the resolution of the line scan image of the battery coating is relatively large, basically reaching 8000 to 12000 pixels, the use of convolutional neural networks for detection will face the problem of long operation time, which cannot meet the requirements of online and real-time detection. Regardless of which method is used, the detection area information needs to be set in advance, but there is no automatic search for the detection area information, which will inevitably increase the difficulty of equipment debugging and the efficiency of product changeover. Therefore, how to automatically complete the search and detection of defect detection areas has become a key technology that needs to be solved urgently.
[0051] The purpose of the technical solution of this application is to provide a battery coating defect detection method that can realize real-time online detection and classification of battery plate coating defects, thereby solving the problem of defect detection and classification in the winding, die-cutting, lamination and other processes of lithium battery coating. However, in some simple detection tasks, only the defect detection is completed, and the defect category is not analyzed. The analysis and control of defect categories can improve the process and production quality of lithium batteries and guide the adjustment of equipment parameters; at the same time, defects can also be managed in a graded manner to track and trace the source.
[0052] Embodiment 1
[0053] Please refer to Figure 1 , this embodiment discloses a battery coating defect detection device, which mainly includes a rotating mechanism and a detection mechanism.
[0054] The rotating mechanism includes a plurality of rollers (as shown in the figure 101 to 110), on which the battery coating L is wound, and as the rollers rotate, the battery coating L in contact with the rollers is continuously transferred. The rollers 101, 102, 103, 104, 105, and 106 constitute a direction adjustment mechanism for the battery coating L, which can guide the battery coating L to be transferred along a preset direction of travel; the rollers 107, 108, 109, and 110 constitute a deviation correction adjustment mechanism for the battery coating L, which can correct the position deviation of the battery coating L during the transfer process.
[0055] The detection mechanism includes a light source 121 and a camera 122, which are arranged on one side of the battery coating L and close to position A. The light source 121 irradiates position A on the transmission path of the battery coating L, and then the camera 122 takes an image of one side of the battery coating passing through position A; for example, position A is set on the side of the roller 102, and the camera 122 collects an image of one side of the battery coating L. It can be understood that since the battery coating L is continuously transmitted, the camera 122 needs to be triggered to continuously take images, so that the camera 122 continuously shoots and generates images to be detected. Each frame of the image to be detected is the imaging result of a section of the battery coating L. As long as the transmission speed and the imaging frequency are reasonably configured, the complete defect detection of the battery coating L can be completed using the images to be detected in each frame.
[0056] Furthermore, the detection mechanism may also include a light source 131 and a camera 132, which are arranged on the other side of the battery coating L and close to the B position, and the light source 131 illuminates the B position on the transfer path of the battery coating L, and then the camera 132 takes an image of the other side of the battery coating passing through the B position; for example, the B position is set on the side of the roller 105, and the camera 122 collects the image of the other side of the battery coating L, and can also continuously shoot to generate the image to be detected. It can be understood that since the cameras 122 and 132 are arranged on both sides of the battery coating L, real-time imaging of the two sides of the battery coating L can be achieved, which provides a hardware basis for detecting defects on the two sides of the battery coating L.
[0057] Preferably, Figure 1 The cameras 122 and 132 in the image processing apparatus may be linear array cameras, that is, cameras using linear array image sensors. Linear array image sensors are mainly divided into two types: monochrome and color, so linear array cameras are also divided into two types: monochrome and color. Linear array cameras are very suitable for continuously detecting objects in a uniform motion state. One or more linear array cameras are used to continuously scan the surface of an object line by line. The imaging speed is fast and the resolution is high, and the uniform detection requirement of the entire surface of the object can be achieved.
[0058] Furthermore, the detection mechanism may also include a processor 14, which is connected to the camera 122 and the camera 132 by signals. On the one hand, the processor 14 can control the image capturing frequency and image capturing parameters of the camera 122 and the camera 132 respectively; on the other hand, the processor 14 can receive the images to be detected obtained by the cameras 122 and the camera 132 respectively, and process the images to be detected by a battery coating defect detection method to obtain defects in the images to be detected and defect classification results.
[0059] In a specific embodiment, a frame of image to be detected generated by the camera 122 or the camera 132 can refer to Figure 2 , which includes coating regions 21, 23, and a substrate region 22, and the substrate region 22 is just the interval between the coating regions 21, 23. Figure 2 In the image, the naked eye can find that there is a hole 211 on the coating area 21, and there are some scratches 221 on the substrate area 22. Then, the purpose of using the processor 14 is to accurately detect the coating defects (such as the hole 211 and the scratch 221) appearing in the image to be detected, and the battery coating defect detection method involved in the processor 14 will be specifically described in the second embodiment below.
[0060] Embodiment 2
[0061] Please refer to Figure 3, this embodiment discloses a battery coating defect detection method, which mainly includes steps 100-400, which are described below respectively.
[0062] Step 100, obtaining the image of the battery coating to be inspected. Figure 1 The processor 14 receives the images to be detected generated by the cameras 122 and 132 themselves.
[0063] Step 200 , performing region positioning on the image to be detected to obtain at least one coating region and / or at least one substrate region.
[0064] Since there is a shorter substrate area as an interval between the coated areas of the battery coating, and the coated area and the substrate area have significantly different imaging characteristics, it is necessary to perform regional positioning on the image to be detected, with the aim of finding the coated area and / or substrate area in the image to be detected, so as to perform different image feature analysis on different areas.
[0065] It can be understood that the image to be detected is the imaging result of a section of coating on the battery. The size and number of the coating area and the aluminum foil area in this section of coating are not fixed, so the result of the area positioning in the image to be detected is not unique. Therefore, at least one coating area and / or at least one substrate area can be obtained.
[0066] Step 300 , detecting image features of the coating area and analyzing to obtain a first defect existing in the coating area; and / or detecting image features of the substrate area and analyzing to obtain a second defect existing in the substrate area.
[0067] It should be noted that the coating and substrate have different reflective properties for light, so the coating area and the substrate area have different image features, and they need to be analyzed separately to detect the defects in the corresponding areas. The first defect mentioned here mainly refers to the defects detected in the coating area. The type and quantity of the first defect are not limited. For example, there may be 0, 1 or more first defects of the same type or even different types. Moreover, the second defect mentioned here mainly refers to the defects detected in the substrate area. The type and quantity of the second defect are also not limited. For example, there may be 0, 1 or more second defects of the same type or even different types. In addition, whether it is the first defect or the second defect, the defect type may include one or more of holes, tapes, scratches, cracks, wrinkles, breakage, tailing, decarburization, bubbling, bubbles, joints, and bright spots.
[0068] Step 400: Perform feature classification processing on the first defect and / or the second defect to obtain corresponding defect classification results.
[0069] It should be noted that, since the number and type of the first defect and the second defect are not unique, as long as the first defect and / or the second defect are found, feature classification is performed on them to obtain the defect classification result corresponding to each defect.
[0070] In this embodiment, the above step 200 mainly involves the process of locating the image area to be detected, so please refer to Figure 4 , the step 200 may specifically include steps 210-230, which are described as follows respectively.
[0071] Step 210: binarize the image to be detected to obtain a binarized image.
[0072] It should be noted that the binarization processing of the image to be detected is to set the grayscale value of the pixel on the image to be detected to 0 or 255, so that the entire image presents an obvious black and white effect, that is, the grayscale image of 256 brightness levels is selected through an appropriate threshold to obtain a binary image that can still reflect the overall and local features of the image.
[0073] In digital image processing, binary images play a very important role. First, the grayscale image must be binarized, and then the binary image can be processed and analyzed. At this time, the collective properties of the image are only related to the position of the pixel points with a pixel value of 0 or 255, and no longer involve the multi-level values of the pixel, making the processing process simple. In order to obtain an ideal binary image, all pixels with a grayscale greater than or equal to a certain threshold are judged to belong to a specific object, and their grayscale value is represented by 255. Otherwise, these pixels are excluded from the object area and the grayscale value is represented by 0.
[0074] Step 220, performing morphological image processing, connectivity analysis and feature screening on the binary image to obtain a plurality of first regions and corresponding contour data.
[0075] In a specific embodiment, a morphological transformation can be performed on the binary image, for example, the morphological transformation used includes one or more of dilation, erosion, opening operation, closing operation and gradient operation, the purpose of which is to remove holes and small-area interference pixels in the binary image, thereby obtaining some de-interfered pixel sets. Connectivity analysis of these pixel sets can obtain some connected areas, and further feature screening of these connected areas can obtain several first areas. Since each first area has a clear edge contour, the corresponding contour data can be obtained by extracting the pixel points on the edge contour of each first area.
[0076] It should be noted that connectivity analysis refers to analyzing the connectivity between multiple adjacent pixels, finding pixel areas whose pixel grayscale meets similarity conditions and is connected, and uniquely marking the pixel areas. Feature screening refers to using the grayscale average, area, roundness, circumscribed rectangle, enclosing rectangle, length, width and other parameters of the connected area as screening objects, retaining the connected areas that meet the requirements; for example, the area of the connected area is screened, and the connected area greater than or equal to the preset area threshold is considered to meet the area screening conditions, so the area that meets the area screening conditions is taken as the first area.
[0077] Step 230 , performing a region contour segmentation process on each first region to segment at least one coating region and / or at least one substrate region.
[0078] It should be noted that the contour data of each first region can be represented in the form of a run, including (r i ,c b,i ,c e,i ), r i is the row coordinate of the run in the region, c b,i is the starting column of the run, c e,i is the end column of the run, and i represents the subscript of the run index, b represents the start of the run, and e represents the end of the run. Then, according to the input run set, the first area can be converted into contour data represented by edge pixels. The contour data is represented as a set of a series of data points, consisting of horizontal and vertical coordinates, (x i ,y i )(i=1,2,…,N). In order to achieve the purpose of regional contour segmentation, it is necessary to segment the contour data corresponding to each first region so as to complete the rectangular fitting. During the segmentation process, the segmentation data points can be obtained according to the angle change of the adjacent point set and the corresponding smoothing.
[0079] In a specific embodiment, the angle change value of each pixel point in the contour data corresponding to each first region is calculated and expressed as
[0080] α i =arctan(y i+1 -y i ,x i+1 -x i );
[0081] Among them, (x i ,y i )(i=1,2,…,N1) is the coordinate of the i-th pixel point, and N1 is the number of pixels in the contour data.
[0082] Furthermore, the angle change threshold and pixel smoothing range with respect to the angle change are calculated and expressed as
[0083]
[0084] Among them, κ is the weight parameter, l sum is the contour length of the first region, and σ is the smoothing coefficient.
[0085] Then, for any pixel point p in the contour data corresponding to the first area, if the difference between the angle change value of the pixel point p and the reference angle change value is greater than the angle change threshold, the pixel point p is determined to be a segmentation data point. The reference angle change value is the angle change value of the pixel point obtained by straight line fitting of each pixel point in the pixel smoothing range before and after the pixel point p. For example, the least squares method is used to perform straight line fitting on L0 pixel points before and after the pixel point p to obtain the coordinates of each pixel on the fitted straight line or the normalization coefficient of the straight line, and then the angle change value about the straight line is calculated, and the reference angle change value corresponding to the pixel point p is obtained. It can be understood that when it is determined that the difference between the angle change value of a certain pixel point and the corresponding reference angle change value is greater than α t =2κπ / l sum (For example, the angle threshold ), it indicates that there is a large angle change difference between the pixel point and the pixels before and after it, and the pixel point can be determined as a segmentation data point. At this time, an approximate polygon can be formed according to the determined multiple segmentation data points, and the first area can be segmented to obtain several segments of area edges; the area contour of each segment contains several pixels and can form a straight line segment, and the area contour of each segment can be represented by C i Next, the average angle of each region edge is calculated (the average angle is the average calculation result of the angle of each pixel point in the region edge relative to the coordinate axis). If the difference between the average angles of two adjacent region edges is less than or equal to a first preset threshold (such as the angle threshold ), then the two region edges are merged to obtain a new region edge, and the average angle corresponding to the new region edge is calculated. Then, the region edges are merged in this way until the merged region edges are represented by C i ′(i=1,2,3,4), four intersection points of a quadrilateral (such as a rectangle) can be obtained by performing straight line fitting on the edge of each region, so that the first region can be represented by a quadrilateral outline. The region represented by the quadrilateral outline here is the candidate region.
[0086] Since the quadrilateral outline representations (i.e., candidate areas) corresponding to each first area can be obtained, at least one coating area and / or at least one substrate area can be determined based on the grayscale values of the pixels in each quadrilateral outline representation and the area. It can be understood that in the binary image, there is an obvious grayscale difference between the pixels in the coating area and the substrate area (for example, the grayscale range of the pixels in the coating area is 50-100, and the grayscale range of the pixels in the substrate area is 225-250). Therefore, as long as the area represented by each quadrilateral outline is obtained, it is possible to determine whether the candidate area belongs to the coating area or the substrate area based on the grayscale of the pixels in the area.
[0087] In this embodiment, the above step 300 mainly involves the image feature analysis process of the coating area and the image feature analysis process of the substrate area. Then, the image feature analysis process of the coating area can be referred to Figure 5 , specifically including steps 311-314, which are described as follows respectively.
[0088] Step 311 , performing downsampling processing on the coated area for multiple times continuously to obtain multiple pyramid images of different scales.
[0089] It should be noted that, through multiple consecutive downsampling processes, the original image (such as the image represented by the coated area) can be generated into an image pyramid of multiple levels, which contains multiple pyramid images of different resolutions, and is a way to express the coated area at multiple scales. It can be understood that the image pyramid is actually a series of image processing processes that are gradually reduced in the shape of a pyramid (from bottom to top) and are derived from the same original image, obtained by stepwise downsampling, and the sampling is stopped until a certain termination condition is reached. Therefore, the images composed of layers are likened to an image pyramid. The higher the level, the smaller the pyramid image and the lower the resolution; that is, the bottom of the image pyramid is a high-resolution representation of the coated area, and the top is a low-resolution approximation. When moving to the upper layer of the pyramid, the size and resolution will decrease.
[0090] It should be noted that for an image represented by a coated area, and the size can be expressed as M×N, it is downsampled by 2 times to obtain Dimensions of the pyramid image.
[0091] Step 312, calculate the feature value of each pixel in each pyramid image to form a feature map corresponding to each pyramid image, perform upsampling processing on the feature map corresponding to each pyramid image, and obtain a corresponding upsampled image. Here, the upsampled image has the same scale as the coated area.
[0092] In a specific embodiment, in order to obtain the feature map corresponding to each pyramid image, for any pixel point (i, j) in each pyramid image, a gray value set of the pixel point in a preset pixel range (such as any corresponding image patch of 5×5, 1×11, 11×1, 7×7, 1×15, 15×1) is constructed, and the gray value set is expressed as N2 is the number of pixels within the preset pixel range.
[0093] Then, the intermediate parameter about the pixel point (i, j) can be calculated, which is expressed as
[0094]
[0095] The eigenvalue of pixel (i, j) is calculated based on the intermediate parameters and expressed as
[0096]
[0097] Among them, μ is the grayscale mean of the grayscale value set of each pixel, ε is the grayscale value that promotes Σ ij The offset that can be reversibly calculated, Q is the unit matrix, and M is the operation function of the Mahalanobis distance.
[0098] Since the characteristic value of each pixel is calculated, a corresponding feature map is formed according to the characteristic value of each pixel in each pyramid image.
[0099] When a feature map corresponding to each pyramid image is obtained, the feature map can be upsampled to obtain an upsampled image of the same scale as the coated area.
[0100] It should be noted that upsampling can be used to enlarge the feature map, and interpolation methods are mostly used, that is, new elements are inserted between pixels based on the original image using a suitable interpolation algorithm, such as edge-based image interpolation algorithms and region-based image interpolation algorithms.
[0101] Step 313, for the upsampled images corresponding to the pyramid images, the feature values at the same pixel position in each upsampled image are channel-joined to form a set of feature vectors; and defect estimation is performed on each feature vector according to a preset neural network to obtain pixel points belonging to the defect.
[0102] It should be noted that, for each upsampled image, the eigenvalue of each pixel can be calculated by the method in step 312, so the corresponding eigenvector can be obtained by simply concatenating the eigenvalues of each pixel at the same pixel position; all the obtained eigenvectors can constitute a set of eigenvectors.
[0103] For each feature vector in the feature vector set, when estimating the defect of each eigenvector, each feature vector can be input into the MLP network or trained and judged using SVM, and the defect judgment is made according to the probability output by the softmax function. It should be noted that MLP (Multi-Layer Perceptron) is a forward-structured artificial neural network that maps a set of input vectors to a set of output vectors. MLP can be regarded as a directed graph consisting of multiple node layers, each layer is fully connected to the next layer, and except for the input node, each node is a neuron with a nonlinear activation function. Since MLP is a conventional artificial neural network, its structure and principle will not be described in detail here.
[0104] It should be noted that Support Vector Machine (SVM) is a generalized linear classifier that performs binary classification of data in a supervised learning manner, and its decision boundary is the maximum margin hyperplane solved for the learning sample. SVM can be regarded as a binary classification model, which maps the feature vector of the instance to some points in space, with the purpose of drawing a line to "best" distinguish the two types of points, so that if there are new points in the future, this line can also make a good classification. Since SVM is a common classification model, its structure and principle will not be explained in detail here.
[0105] Step 314: Perform a dilation operation on the pixel points in the coating area that are defects to obtain a dilated area as the first defect. The dilation operation is a method of image morphological transformation, which will not be described in detail here.
[0106] In this embodiment, the above step 300 mainly involves the image feature analysis process of the coating area and the image feature analysis process of the substrate area. Then, the image feature analysis process of the substrate area can be referred to Figure 6 , specifically including steps 321-324, which are described as follows.
[0107] Step 321 , performing background estimation processing on the substrate area, and obtaining a background estimation image by noise filtering.
[0108] In a specific embodiment, for any pixel point (i, j) in the substrate area, the spatial distance and grayscale distance between the pixel point (i, j) and the center point (k, l) of the filter template are calculated and expressed as
[0109]
[0110] In the process of background estimation, the spatial area and pixel range are mainly considered. The closer the pixel is to the filter point, the greater its attraction should be, and the greater its influence should be. The grayscale value of the neighboring pixel should also change less. Therefore, when estimating the background, it is necessary to comprehensively consider the spatial distance and the grayscale distance. Figure 8 The spatial distance and grayscale distance are respectively illustrated in FIG. 1 , where the spatial distance refers to the Euclidean distance from the current point to the center point of the filter template, and the grayscale distance refers to the absolute value of the difference in grayscale between the current point and the center point of the filter template.
[0111] For the pixel point (i, j) and the center point of the filter template (k, l), the filter kernel coefficient can be calculated according to the spatial distance and grayscale distance, and is expressed as
[0112]
[0113] Among them, σ d , σ r are preset standard deviations, I(i,j) and I(k,l) are pixel grayscales, and exp is an exponential function with the natural constant e as the base.
[0114] It should be noted that the kernel function is the comprehensive result of the spatial domain kernel and the pixel range domain kernel. 1) In the flat area of the image, the pixel value changes very little, so the pixel difference is close to 0, and the corresponding pixel range domain weight is close to 1. At this time, the spatial domain weight plays a major role, which is equivalent to Gaussian blur; 2) In the edge area of the image, the pixel value changes greatly, so the pixel difference is large, and the corresponding pixel range domain weight becomes larger. Even if the spatial domain weight is small at a long distance, the total coefficient of the pixel domain weight is also large, thereby protecting the edge information.
[0115] Next, the background estimation image can be calculated based on the filter kernel coefficients and is expressed as
[0116]
[0117] Step 322, estimate each pixel in the image by performing image difference calculation to obtain a difference image.
[0118] It should be noted that the image difference operation is to subtract the corresponding pixel values of two images to weaken the similar parts of the images and highlight the changed parts of the images. For example, the difference image can often detect the contour of the target object and extract the contour information.
[0119] It should be noted that the purpose of background estimation is to eliminate the noise in the background while retaining the defects. The background can be almost reduced to 0 by difference, and the difference of the defects is relatively large, and then it can be judged and analyzed by binarization. For example, background estimation is carried out by low-pass filtering. The coordinates closer to the pixel can be considered to have a stronger gravitational field, so it is hoped that the weight will be larger, and the weight will be smaller if the distance is far. In the local range, if the low-frequency area is considered to be a uniformly distributed form, the grayscale difference between the two should be relatively small, and the weight should be relatively large; if it is a high-frequency area, it is hoped that this high-frequency component will continue to be maintained, and the weight should have a relatively small effect on the grayscale value of the pixel. Therefore, here is a combination of two considerations to form a dual weight coefficient design method.
[0120] Step 323: Compare the difference of each pixel in the differential image with the second preset threshold to obtain multiple candidate pixels. The second preset threshold can be set by the user, and the specific threshold value is not limited.
[0121] Step 324, using multiple candidate pixels to obtain a candidate area and perform feature screening, and the screened candidate area is used as the second defect.
[0122] It should be noted that connectivity analysis can be performed based on the multiple candidate pixel points obtained to obtain some connected areas, such as marking those adjacent candidate pixel points that meet the similarity conditions as a connected area; then, feature screening is performed on each connected area, such as using the grayscale average, area, roundness, circumscribed rectangle, enclosing rectangle, length, width and other parameters of the connected area as screening objects, and those retained are candidate areas.
[0123] In this embodiment, step 400 mainly involves the process of obtaining defect classification results by feature classification. The principle of feature classification of the first defect and / or the second defect can be referred to in Figure 7 .
[0124] exist Figure 7 In the method, for the first defect and / or the second defect, a feature vector of each defect is calculated, and the feature vectors are respectively input into a preset MLP network, and the MLP network analyzes the defect characteristics and outputs the defect type.
[0125] It should be noted that the eigenvector corresponding to the first defect (or the second defect) can be composed of a combination of eigenvalues, such as one or more of grayscale value, normalized grayscale value, gradient direction feature, horizontal projection, vertical projection, needle-likeness, and gray-level co-occurrence matrix features. The various representations of eigenvalues are briefly described below.
[0126] Grayscale value: Assume that the size of the regional image (i.e., the upsampled image) is w×h, and the grayscale feature is represented by the set of grayscale values of each pixel, which is a vector of w×h elements in total.
[0127] Normalized grayscale value: Normalized grayscale is represented as a vector consisting of the ratio of the grayscale value within the region to the maximum grayscale value of the region, with a total of w×h elements.
[0128] Gradient direction feature: The regional image is divided into a 5×5 grid structure, and the number of gradient directions of each grid is counted (the gradient direction is divided into 8), so there are a total of 200 element dimensions.
[0129] Horizontal projection: Get the average grayscale value of each row of the regional image, and form a vector with the average value. The vector dimension is the number of rows in the region.
[0130] Vertical projection: Get the average grayscale value of each column of the regional image, and form a vector with the average value. The vector dimension is the number of columns in the region.
[0131] Needle shape: Where r0 and c0 represent the center of gravity of the region, so some process parameters can be obtained, such as
[0132]
[0133] The acicularity can be expressed as R a / R b .
[0134] Gray-level co-occurrence matrix characteristics: Let the element value of the gray-level co-occurrence matrix be represented by c ij , then the energy of the co-occurrence matrix can be expressed as
[0135]
[0136] The correlation can be expressed as
[0137]
[0138] in, width represents the width of the gray-level co-occurrence matrix.
[0139] The consistency can be expressed as
[0140]
[0141] The contrast can be expressed as
[0142]
[0143] In a specific embodiment, the feature vector corresponding to each defect can be a one-dimensional vector composed of several eigenvalues above, such as n×1 or 1×n. When performing feature classification, it is only necessary to input each eigenvector into the MLP network, and the defect category can be estimated according to the probability output by the softmax function.
[0144] It should be noted that the MLP (Multi-Layer Perceptron) network mainly consists of three parts: input layer, hidden layer, and output layer. Each layer is composed of several neurons. Neurons are connected in a fully connected manner. Parameters are transferred between each connection through weights and biases. The parameter optimization process is optimized through the back propagation algorithm. The structure and principle of the MLP network will not be explained in detail here.
[0145] Here, the defect types output by the MLP network include one or more of holes, tapes, scratches, cracks, wrinkles, breaks, tailing, decarbonization, blistering, bubbles, joints, and bright spots.
[0146] For example, in Fig. 9 and Fig.10 The various defect types are shown in their physical form. Fig. 9 In the figure, the six images show the defect types of holes, tape, scratches, damage, cracks, and wrinkles; Fig.10 In the figure, the six pictures show the defect types of tailing, decarburization, blistering, bubbles, splicing, and bright spots. Fig. 9 and Fig.10 As for the defects existing on the battery coating shown in the figure, by simply processing the image of the battery coating to be inspected using the defect detection method disclosed in this embodiment, it is possible to know what type of defect is present at which position on the battery coating, thereby providing convenience for users to understand the product quality of the battery coating and repair defects.
[0147] Those skilled in the art can understand that, when the defect types corresponding to the first defect and the second defect are obtained, it is easy to form corresponding defect classification results according to the defect types. For example, if the type of the first defect is a vulnerability, the defect classification result corresponding to the first defect is a vulnerability.
[0148] Those skilled in the art can understand that the technical solution disclosed in this embodiment can obtain the regional location information of defects through defect detection, and then screen and calculate features based on the regional location information, and then perform classification processing based on the feature vector. The technical solution essentially adopts the form of a decision tree, combined with fuzzy control and machine learning methods, to reduce the complexity of feature selection, thereby improving detection efficiency.
[0149] Embodiment 3
[0150] Please refer to Fig.11 Based on the battery coating defect detection method disclosed in Example 2, this embodiment discloses a defect detection device, which mainly includes a camera 51, a processor 52 and a display 53, which are described below respectively.
[0151] The camera 51 is used to obtain the image to be tested of the battery coating by taking an image. The camera 51 here can be Figure 1 The camera 122 or the camera 132 can realize real-time imaging of the surface coated with the battery, and each frame of image formed by the imaging is used as an image to be detected.
[0152] The processor 52 is connected to the camera 51 and is used to detect the image to be detected by the defect detection method disclosed in the first embodiment to obtain defects in the image to be detected and defect classification results. It can be understood that the processor 52 can be a CPU, GPU, FPGA, microcontroller or digital integrated circuit with data processing function, as long as it can implement the defect detection method implemented in steps 100-400 in the second embodiment above according to its own logic instructions.
[0153] The display 53 is connected to the processor 52 and is used to display the image to be inspected and / or the defect classification result. It is understood that the display 53 can be a screen with an image display function, which can display the image to be inspected and the defect classification result separately or together, and the specific screen type and display layout are not limited.
[0154] In a specific embodiment, see Fig.12 The processor 52 may include an acquisition module 52-1, a positioning module 52-2, an analysis module 52-3 and a classification module 52-4, which are described as follows.
[0155] Acquisition module 52-1 and Fig.11 The 51 camera communication connection is mainly used to obtain the image to be inspected of the battery coating from the camera 51.
[0156] The positioning module 52-2 is connected to the acquisition module 52-1, and is mainly used to perform regional positioning on the image to be detected to obtain at least one coating area and / or at least one substrate area. For example, the positioning module 52-2 performs binarization processing on the image to be detected to obtain a binarized image; then, the binarized image is subjected to morphological image processing and regional contour segmentation processing to segment at least one coating area and / or at least one substrate area. The functions of the positioning module 52-2 can be specifically referred to steps 210-230 in Example 2, which will not be repeated here.
[0157] The analysis module 52-3 is connected to the positioning module 52-2, and is mainly used to detect the image features of the coating area, and analyze to obtain the first defect existing in the coating area; and / or, to detect the image features of the substrate area, and analyze to obtain the second defect existing in the substrate area. For example, for the coating area, the analysis module 52-3 performs downsampling processing on the coating area for multiple times in a row to obtain multiple pyramid images of different scales; calculates the characteristic value of each pixel point in each pyramid image to form a characteristic map corresponding to each pyramid image, and performs upsampling processing on the characteristic map corresponding to each pyramid image to obtain a corresponding upsampled image; for the upsampled images corresponding to each pyramid image, the characteristic values of the same pixel position in each upsampled image are channel-joined to form a set of characteristic vectors; each characteristic vector is defect-estimated according to a preset neural network to obtain a pixel point belonging to a defect; the pixel point belonging to the defect in the coating area is dilated to obtain an expanded area as the first defect. The processing process of the coating area by the analysis module 52-3 can be specifically referred to steps 311-314 in Example 2, which will not be repeated here.
[0158] For another example, for the substrate area, the analysis module 52-3 performs background estimation processing on the substrate area, obtains a background estimation image by noise filtering; estimates each pixel in the image by image differential operation to obtain a differential image; compares the difference of each pixel in the differential image with a second preset threshold to obtain multiple candidate pixels; obtains a candidate area using multiple candidate pixels and performs feature screening, and uses the screened candidate area as the second defect. For the processing process of the substrate area by the analysis module 52-3, please refer to steps 321-324 in Example 2, which will not be repeated here.
[0159] The classification module 52-4 and the analysis module 52-3 are mainly used to perform feature classification processing on the first defect and / or the second defect to obtain corresponding defect classification results. The function of the classification module 52-4 can be specifically referred to step 400 in the second embodiment, which will not be repeated here.
[0160] Those skilled in the art can understand that when the processor 52 executes the defect detection method in the second embodiment, it can perform regional positioning processing on the image to be detected of the battery coating, and analyze the defects existing in different areas by distinguishing the coating area and / or substrate area in the image, thereby improving the stability and robustness of the battery coating defect detection. In addition, when the processor 52 performs feature classification processing on the first defect and / or the second defect, it can obtain the defect classification result according to the grayscale and texture features presented by the defect, which can not only enhance the defect recognition performance for the battery coating, but also improve the accuracy of defect classification.
[0161] Embodiment 4:
[0162] Please refer to Fig.13 This embodiment discloses an image processing device, which mainly includes a memory 61 and a processor 42.
[0163] The main components of the image processing device 6 are a memory 61 and a processor 62. The memory 61 is a computer-readable storage medium, mainly used to store a program, which may be a program code corresponding to the defect detection method in the second embodiment.
[0164] The processor 62 is connected to the memory 61 and is used to execute the program stored in the memory 61 to implement the defect detection method. The functions implemented by the processor 62 can refer to the processor 52 in the third embodiment, and will not be described in detail here.
[0165] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0166] The above specific examples are used to illustrate the present application, which is only used to help understand the technical solution of the present application and is not intended to limit the present application. For technicians in the relevant technical field, according to the idea of the present application, several simple deductions, deformations or substitutions can also be made.
Claims
1. A battery coating defect detection method, characterized in that: include: Acquire the image to be inspected of the battery coating; Performing regional positioning on the image to be detected to obtain at least one coating area and / or at least one substrate area; The regional positioning includes: Binarization is performed on the image to be detected to obtain a binary image, and morphological image processing and regional contour segmentation are performed on the binary image; wherein the morphological image processing and regional contour segmentation processing include: Performing morphological transformation on the image to be detected after binarization processing, and obtaining a plurality of first regions and corresponding contour data respectively through connectivity analysis and feature screening; Calculating an angle change value of each pixel point in the contour data corresponding to the first area, as well as an angle change threshold and a pixel smoothing range related to the angle change; Determine a segmentation data point in the contour data corresponding to the first area according to the angle change value, the angle change threshold and the pixel smoothing range; forming an approximate polygon according to the determined multiple segmentation data points and segmenting the edge contour of the first region to obtain a plurality of segments of region edges; Calculating an average angle corresponding to each edge of the region, and merging edges of two adjacent regions according to the average angle until the first region can be represented by a quadrilateral outline; Determine at least one coating area and / or at least one substrate area according to the quadrilateral outline representation of each of the first areas and the grayscale values of the pixels in the area; Detecting the image features of the coating area and analyzing to obtain a first defect existing in the coating area; and / or detecting the image features of the substrate area and analyzing to obtain a second defect existing in the substrate area; the first defect is analyzed by a feature map of each pyramid image corresponding to the coating area, wherein, for any pixel point in each of the pyramid images, an intermediate parameter of the pixel point is calculated based on a weighted sum of a covariance matrix of a gray value set of the pixel point within a preset pixel range and a unit matrix, a characteristic value of the pixel point is calculated based on the intermediate parameter and expressed as a Mahalanobis distance, and a corresponding feature map is formed based on the characteristic value of each pixel point in each of the pyramid images; Perform feature classification processing on the first defect and / or the second defect to obtain corresponding defect classification results respectively.
2. The defect detection method according to claim 1, characterized in that: The step of performing morphological image processing and regional contour segmentation processing on the binary image to obtain at least one coating area and / or at least one substrate area comprises: Performing morphological transformation on the binary image, and obtaining a plurality of first regions and corresponding contour data respectively through connectivity analysis and feature screening; the morphological transformation includes one or more of dilation, erosion, opening operation, closing operation and gradient operation; Calculate the angle change value of each pixel in the contour data corresponding to the first area, and express it as a i =arctan(and i+1 -and i ,x i+1 -x i ); Among them, (x i ,y i )(i=1,2,…,N1) is the coordinate of the i-th pixel point, and N1 is the number of pixels in the contour data; The angle change threshold and pixel smoothing range about the angle change are calculated and expressed as Among them, κ is the weight parameter, l sum is the contour length of the first region, σ is a preset smoothing coefficient; For any pixel point p in the contour data corresponding to the first area, if the difference between the angle change value of the pixel point p and the reference angle change value is greater than the angle change threshold, the pixel point p is determined to be a segmentation data point; the reference angle change value is the angle change value of the pixel point obtained by straight line fitting of each pixel point in the pixel smoothing range before and after the pixel point p; forming an approximate polygon according to the determined multiple segmentation data points and segmenting the edge contour of the first region to obtain a plurality of segments of region edges; Calculating the average angle corresponding to each of the region edges, and if it is determined that the difference between the average angles corresponding to two adjacent region edges is less than or equal to a first preset threshold, merging the two region edges to obtain a new region edge, and calculating the average angle corresponding to the new region edge; continuing to merge the region edges until the first region can be represented by a quadrilateral outline; At least one coating region and / or at least one substrate region is determined based on the quadrilateral outline representation of each of the first regions and the grayscale values of the pixels within the region.
3. The defect detection method according to claim 1, characterized in that: The detecting the image feature of the coating area and analyzing to obtain the first defect existing in the coating area comprises: Performing downsampling processing on the coated area for multiple times continuously to obtain multiple pyramid images of different scales; Calculating the characteristic value of each pixel in each of the pyramid images to form a characteristic map corresponding to each of the pyramid images, and performing upsampling processing on the characteristic map corresponding to each of the pyramid images to obtain a corresponding upsampled image; wherein the upsampled image has the same scale as the coated area; For upsampled images corresponding to the pyramid images, the feature values at the same pixel position in each upsampled image are channel-joined to form a set of feature vectors; and defect estimation is performed on each feature vector according to a preset neural network to obtain pixel points belonging to the defect; A dilation operation is performed on the pixel points belonging to the defect in the coating area to obtain a dilated area as the first defect.
4. The defect detection method according to claim 3, characterized in that: The calculating the feature value of each pixel in each of the pyramid images to form a feature map corresponding to each of the pyramid images includes: For any pixel point (i, j) in each of the pyramid images, a grayscale value set of the pixel point within a preset pixel range is constructed. The grayscale value set is expressed as N2 is the number of pixels within the preset pixel range; Calculate the intermediate parameter about the pixel point (i, j), which is expressed as The characteristic value of the pixel (i, j) is calculated according to the intermediate parameter and expressed as Among them, μ is the grayscale mean of each pixel grayscale set, ε is the grayscale value that promotes Σ ij The offset that can be reversibly calculated, Q is the unit matrix, and M is the operation function of the Mahalanobis distance; A corresponding feature map is formed according to the feature value of each pixel point in each of the pyramid images.
5. The defect detection method according to claim 1, characterized in that: The detecting the image feature of the substrate region and analyzing to obtain the second defect existing in the substrate region comprises: Performing background estimation processing on the substrate area, and obtaining a background estimation image by noise filtering; Processing each pixel in the estimated image by image difference operation to obtain a difference image; Compare the difference value of each pixel in the differential image with a second preset threshold value to obtain a plurality of candidate pixels; A candidate region is obtained by using a plurality of candidate pixels and feature screening is performed, and the screened feature region is used as the second defect.
6. The defect detection method according to claim 5, characterized in that: The performing background estimation processing on the substrate area to obtain a background estimation image by noise filtering includes: For any pixel point (i, j) in the substrate area, the spatial distance and grayscale distance between the pixel point (i, j) and the center point (k, l) of the filter template are calculated and expressed as The filter kernel coefficient is calculated according to the spatial distance and the grayscale distance, and is expressed as Among them, σ d , σ r The default standard deviations are all given, I(i,j) and I(k,l) are pixel grayscales, and exp is an exponential function with the natural constant e as the base; The background estimation image is calculated according to the filter kernel coefficients and is expressed as 7. The defect detection method according to claim 1, characterized in that: The performing feature classification on the first defect and / or the second defect to obtain corresponding defect classification results respectively includes: For the first defect and / or the second defect, a feature vector of each defect is calculated, and the feature vector is input into a preset MLP network, and the MLP network analyzes the defect characteristics and outputs the defect type; the feature vector includes one or more of gray value, normalized gray value, gradient direction feature, horizontal projection, vertical projection, needle shape, and gray level co-occurrence matrix features; the defect type includes one or more of holes, tapes, scratches, cracks, wrinkles, damage, tailing, decarburization, blistering, bubbles, joints, and bright spots; A corresponding defect classification result is obtained according to the defect type.
8. A defect detection device, characterized in that: include: A camera, used to capture images of the battery coating to form an image to be inspected; A processor, configured to obtain defects and defect classification results in the image to be detected by processing the defect detection method according to any one of claims 1 to 7; A display is used to display the image to be inspected and / or the defect classification result, and to display the confidence level of the defect through pseudo-color display.
9. The defect detection device according to claim 8, characterized in that: The processor comprises: An acquisition module, used for acquiring the image to be inspected of the battery coating from the camera; A positioning module is used to perform regional positioning on the image to be detected to obtain at least one coating area and / or at least one substrate area; the regional positioning includes: Binarization is performed on the image to be detected to obtain a binary image, and morphological image processing and regional contour segmentation are performed on the binary image; wherein the morphological image processing and regional contour segmentation processing include: Performing morphological transformation on the image to be detected after binarization processing, and obtaining a plurality of first regions and corresponding contour data respectively through connectivity analysis and feature screening; Calculating an angle change value of each pixel point in the contour data corresponding to the first area, as well as an angle change threshold and a pixel smoothing range related to the angle change; Determine a segmentation data point in the contour data corresponding to the first area according to the angle change value, the angle change threshold and the pixel smoothing range; forming an approximate polygon according to the determined multiple segmentation data points and segmenting the edge contour of the first region to obtain a plurality of segments of region edges; Calculating an average angle corresponding to each edge of the region, and merging edges of two adjacent regions according to the average angle until the first region can be represented by a quadrilateral outline; Determine at least one coating area and / or at least one substrate area according to the quadrilateral outline representation of each of the first areas and the grayscale values of the pixels in the area; An analysis module is used to detect the image features of the coating area and obtain a first defect in the coating area through analysis; and / or to detect the image features of the substrate area and obtain a second defect in the substrate area through analysis; the first defect is analyzed through a feature map of each pyramid image corresponding to the coating area, wherein for any pixel point in each of the pyramid images, an intermediate parameter of the pixel point is calculated based on a weighted sum of a covariance matrix of a gray value set of the pixel point within a preset pixel range and a unit matrix, a characteristic value of the pixel point is calculated based on the intermediate parameter and expressed as a Mahalanobis distance, and a corresponding feature map is formed based on the characteristic value of each pixel point in each of the pyramid images; The classification module is used to perform feature classification processing on the first defect and / or the second defect to obtain corresponding defect classification results respectively.
10. A computer-readable storage medium, characterized in that: The medium stores a program, which can be executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Strip-shaped article surface defect on-line visual attention detection method
CN104166986A
Lithium battery coating defect detection method, system and device and storage medium
CN109613000A
AA-gate-Unet-based offshore wind power tower drum coating defect detection method
CN112365468A
