Defect detection methods, model training methods, devices, equipment, media and products
By constructing data and extracting features from images of battery cell sealing rings, and using adversarial classification to generate a detection model, the problem of low detection efficiency of battery cell sealing rings is solved, and efficient and low-cost surface defect detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, the inspection of battery cell sealing rings relies on manual inspection, which is inefficient and inaccurate, making it difficult to meet high-quality requirements. Furthermore, deep network models require a large number of training samples, making them difficult to apply effectively in real-world environments.
By acquiring images of the battery cell's sealing ring and defect-free images, data construction and feature extraction are performed. Adversarial classification and convolutional neural networks are used to generate a surface defect detection model, reducing the need for training samples and improving detection efficiency.
It enables efficient detection of surface defects in battery cell sealing rings with fewer training samples, reducing costs, improving detection accuracy and efficiency, and reducing memory usage.
Smart Images

Figure CN115393267B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, and in particular to a surface defect detection method, a training method for a surface defect detection model, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] Sealing rings (such as rubber sealing rings) are essential industrial products, serving as fundamental components in multiple industries and widely used in various fields. Therefore, after production or before use, sealing rings must undergo surface inspection to determine if they exhibit any defects. These defects include burrs, impurities, dents, scratches, damage, breakage, missing parts, or dirt. The presence of defects indicates a substandard sealing ring; otherwise, it is considered a good product.
[0003] In related technologies, the inspection of battery cell sealing rings typically relies on manual inspection, especially for large-scale inspections. This process is time-consuming, inefficient, and inaccurate, and the results are also susceptible to subjective influences. Therefore, the inspection effectiveness and efficiency of these technologies are clearly inadequate to meet increasingly stringent quality requirements and rising labor costs. Consequently, a deep neural network model for surface defect detection has been proposed. However, training deep neural network models requires a massive amount of data and depends heavily on the number of labeled samples. In real-world production environments, battery cell sealing ring defects exhibit diverse morphologies, different characteristics on the front and back sides, and varying defect sizes, making it difficult to obtain a large number of defective products.
[0004] Therefore, how to achieve better surface defect detection results with fewer training samples and improve the detection efficiency of battery cell sealing rings is a technical problem that needs to be solved. Summary of the Invention
[0005] This invention provides a surface defect detection method, a detection model training method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product, to at least solve the technical problems in related technologies where the need to rely on a large number of training samples to detect surface defects leads to increased costs and low defect detection efficiency. The technical solution of this invention is as follows:
[0006] According to a first aspect of the present invention, a surface defect detection method is provided, comprising:
[0007] Acquire images of the sealing ring of the battery cell to be inspected, as well as defect-free front images, defect-free front images, and defect-free back images of the sealing ring of the sample battery cell;
[0008] Data is constructed from the foreground target pixels of the sealing ring image of the battery cell to be inspected, as well as the defect-free front image and defect-free back image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image.
[0009] High-level features are extracted from the multi-channel foreground target image, including: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image;
[0010] The high-level features of the sealing ring image of the battery cell under test are adversarially classified against the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value that the sealing ring image of the battery cell under test contains surface defects.
[0011] Optionally, the step of constructing a multi-channel foreground target image from the image of the sealing ring of the battery cell under inspection, as well as the foreground target pixels of the defect-free front and defect-free back images of the sample battery cell sealing ring, includes:
[0012] The image of the sealing ring of the battery cell to be inspected, as well as the defect-free front image and defect-free back image of the sample battery cell sealing ring, are subjected to Blob preprocessing to obtain the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free back image.
[0013] Extract the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image;
[0014] By performing a patch operation, the foreground target pixels of the sealing ring image of the battery cell under inspection, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image are transformed in terms of spatial dimension to obtain a multi-channel foreground target image.
[0015] Optionally, determining the high-level features of the multi-channel foreground target image includes:
[0016] The multi-channel foreground target image is processed by convolutional neural network;
[0017] Based on the first result of the convolution process, low-level features of the multi-channel foreground target image are extracted;
[0018] The low-level features of the multi-channel foreground target image are recombined and inversely transformed according to the patch operation;
[0019] The features after the inverse transformation of the recombination are then subjected to convolution processing;
[0020] Based on the second result of the convolution process, high-level features of the multi-channel foreground target image are extracted.
[0021] Optionally, the step of performing a reconstructive inverse transform on the low-level features of the multi-channel foreground target image according to the patch operation includes:
[0022] The low-level features of the multi-channel foreground target image are horizontally reassembled according to the patch operation;
[0023] Vertical recombination is performed on all low-level features after horizontal recombination to obtain the low-level features of the vertically recombined multi-channel foreground target image.
[0024] Optionally, the step of performing adversarial classification on the high-level features of the sealing ring image of the battery cell under inspection with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image of the battery cell under inspection containing surface defects, includes:
[0025] Based on the data construction, the determined high-level features are divided into high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0026] By performing branch prediction on the high-level features of the sealing ring image of the battery cell under test, the front and back characteristics of the sealing ring image of the battery cell under test, as well as the high-level features of the corresponding surfaces, are obtained.
[0027] The front and back characteristics of the sealing ring image of the battery cell under test are combined with the high-level features of the corresponding surfaces, and then subjected to feature adversarial analysis with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of surface defects in the sealing ring image of the battery cell under test.
[0028] According to a second aspect of the present invention, a method for training a surface defect detection model is provided, comprising:
[0029] In response to multiple data samples of the acquired cell sealing ring image, the multiple data samples are classified into defect-free images and defective images according to category, and the defect-free images are further classified into defect-free front images and defect-free back images.
[0030] Multiple data samples of the cell sealing ring image, as well as the defect-free front and defect-free back images in the defect-free image, are input into the data generator for data construction processing to obtain the processed multi-channel foreground target image.
[0031] High-level features of the multi-channel foreground target image are extracted using a feature extractor;
[0032] The extracted high-level features are classified into high-level features of the battery cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image using a feature classifier, thereby obtaining the defective or defect-free category of the battery cell sealing ring image and generating a first-type loss; and
[0033] By performing branch prediction on the high-level features of the battery cell sealing ring image, the front and back characteristics of the battery cell sealing ring image and the high-level features of the corresponding face are obtained, resulting in a second type of loss; when the distance between the high-level features of the battery cell sealing ring image and the high-level features of the corresponding face of the defect-free image is much smaller than the distance to the opposite face of the battery cell sealing ring image, a third type of loss is generated.
[0034] Based on the sum of the first type of loss, the second type of loss, and the third type of loss, the parameters of the feature extractor and the feature classifier are iteratively trained to generate a surface defect detection model.
[0035] According to a third aspect of the present invention, a surface defect detection device is provided, comprising:
[0036] The acquisition module is used to acquire images of the sealing ring of the battery cell to be inspected, as well as defect-free front and defect-free back images of the sealing ring of the sample battery cell.
[0037] The data construction module is used to construct data from the foreground target pixels of the sealing ring image of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image.
[0038] The feature extraction module is used to extract high-level features of the multi-channel foreground target image. The high-level features include: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0039] The adversarial module is used to perform adversarial classification on the high-level features of the sealing ring image of the battery cell under test against the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value that the sealing ring image of the battery cell under test contains surface defects.
[0040] Optionally, the data construction module includes:
[0041] The preprocessing module is used to perform Blob preprocessing on the image of the sealing ring of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to obtain the foreground target pixels of the image of the sealing ring of the battery cell to be inspected, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image.
[0042] The target extraction module is used to extract the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image;
[0043] The spatial dimension conversion module is used to perform spatial dimension conversion on the foreground target pixels of the sealing ring image of the battery cell under inspection, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image through a patch operation, so as to obtain a multi-channel foreground target image.
[0044] Optionally, the feature extraction module includes:
[0045] The first convolution processing module is used to perform convolution processing on the multi-channel foreground target image through a convolutional neural network;
[0046] The first feature extraction module is used to extract low-level features of the multi-channel foreground target image based on the first result of the convolution processing of the first convolution processing module.
[0047] The recombination inverse transform module is used to perform recombination inverse transform on the low-level features of the multi-channel foreground target image according to the patch operation;
[0048] The second convolution processing module is used to perform convolution processing on the features after the inverse transformation of recombination;
[0049] The second feature extraction module is used to extract high-level features of the multi-channel foreground target image based on the second result of the convolution processing of the second convolution processing module.
[0050] Optionally, the recombination inverse transformation module includes:
[0051] The horizontal reconstruction module is used to horizontally reconstruct the low-level features of the multi-channel foreground target image according to the patch operation;
[0052] The vertical reconstruction module is used to vertically reconstruct the hierarchical features after horizontal reconstruction to obtain the low-level features of the vertically reconstructed multi-channel foreground target image.
[0053] Optionally, the adversarial module includes:
[0054] The segmentation module is used to segment the high-level features of the sealing ring image of the battery cell under inspection, the high-level features of the defect-free front image, and the high-level features of the defect-free back image according to the determined high-level features constructed by the data.
[0055] The branch prediction module is used to perform branch prediction on the high-level features of the sealing ring image of the battery cell under test, so as to obtain the front and back characteristics of the sealing ring image of the battery cell under test, and the high-level features of the corresponding face.
[0056] The adversarial classification module is used to combine the front and back characteristics of the sealing ring image of the battery cell under inspection with the high-level features of the corresponding surface, and to perform feature adversarial analysis with the high-level features of the defect-free front image or the high-level features of the defect-free back image to obtain the probability value of surface defects in the sealing ring image of the battery cell under inspection.
[0057] According to a fourth aspect of the present invention, a training apparatus for a surface defect detection model is provided, comprising:
[0058] The first segmentation module is used to, in response to multiple data samples of the acquired cell sealing ring image, segment the multiple data samples into defect-free images and defective images according to categories, and segment the defect-free images into defect-free front images and defect-free back images.
[0059] The data construction module is used to input multiple data samples of the cell sealing ring image, as well as the defect-free front image and defect-free back image in the defect-free image, into the data generator for data construction processing to obtain the processed multi-channel foreground target image.
[0060] The extraction module is used to extract high-level features of the multi-channel foreground target image through a feature extractor. The high-level features include: high-level features of multiple data samples of the cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0061] The second segmentation module is used to segment the extracted high-level features into high-level features of the battery cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image through a feature classifier, thereby obtaining the defective or defect-free category of the battery cell sealing ring image and generating a first type of loss.
[0062] An adversarial module is used to perform branch prediction on the high-level features of the battery cell sealing ring image to obtain the front and back characteristics of the battery cell sealing ring image and the high-level features of the corresponding face, generating a second type of loss; when the distance between the high-level features of the battery cell sealing ring image and the high-level features of the corresponding face of the defect-free image is much smaller than the distance to the opposite face of the battery cell sealing ring image, a third type of loss is generated.
[0063] The training module is used to iteratively train the parameters of the feature extractor and the feature classifier based on the sum of the first type of loss, the second type of loss and the third type of loss, to generate a surface defect detection model.
[0064] According to a fifth aspect of the present invention, an electronic device is provided, comprising:
[0065] processor;
[0066] Memory used to store the processor's executable instructions;
[0067] The processor is configured to execute the instructions to implement the surface defect detection method or the surface defect detection model training method as described above.
[0068] According to a sixth aspect of the present invention, a computer-readable storage medium is provided, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the surface defect detection method as described above or the surface defect detection model training method as described above.
[0069] According to a seventh aspect of the present invention, a computer program product is provided, comprising a computer program or instructions, wherein when the computer program or instructions are executed by a processor, they implement the surface defect detection method as described above or the surface defect detection model training method as described above.
[0070] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects:
[0071] In this embodiment of the invention, an image of the sealing ring of a battery cell to be inspected, as well as defect-free front images, defect-free front images, and defect-free back images of a sample battery cell sealing ring are acquired. Data construction is performed on the foreground target pixels of the image of the sealing ring to be inspected, as well as the defect-free front and defect-free back images of the sample battery cell sealing ring, to obtain a constructed multi-channel foreground target image. High-level features of the multi-channel foreground target image are extracted, including: high-level features of the sealing ring image to be inspected, high-level features of the defect-free front image, and high-level features of the defect-free back image. The high-level features of the sealing ring image to be inspected are then adversarially classified against the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image to be inspected containing surface defects. In other words, in this embodiment of the invention, by constructing data, not only is the problem of increased cost caused by the need to rely on a large number of training samples in related technologies solved, but also the problems of low processing speed and excessive memory usage caused by high image resolution are solved. By introducing feature adversarial mechanisms, the network is prompted to fully learn the defect features of the battery cell sealing ring, thereby improving the defect detection rate and reducing the defect over-detection rate, which improves the efficiency of defect detection.
[0072] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0073] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention, but do not constitute an undue limitation of the invention.
[0074] Figure 1 This is a flowchart of a surface defect detection method provided in an embodiment of the present invention.
[0075] Figure 2 This is a schematic diagram of a data construction provided by an embodiment of the present invention.
[0076] Figure 3A This is a schematic diagram of a feature extraction method provided in an embodiment of the present invention.
[0077] Figure 3B This is a schematic diagram of a recombination provided in an embodiment of the present invention.
[0078] Figure 4 This is a schematic diagram of a feature classification process provided in an embodiment of the present invention.
[0079] Figure 5 This is a flowchart of a training method for a surface defect detection model provided in an embodiment of the present invention.
[0080] Figure 6 This is a structural block diagram of a surface defect detection device provided in an embodiment of the present invention.
[0081] Figure 7 This is a structural block diagram of the data construction module provided in an embodiment of the present invention.
[0082] Figure 8 This is a structural block diagram of the determining module provided in an embodiment of the present invention.
[0083] Figure 9 This is a structural block diagram of the recombination module provided in an embodiment of the present invention.
[0084] Figure 10 This is a structural block diagram of the anti-countermeasure module provided in an embodiment of the present invention.
[0085] Figure 11 This is a structural block diagram of a surface defect detection model training device provided in an embodiment of the present invention.
[0086] Figure 12 This is an application example diagram of a surface defect detection device provided in an embodiment of the present invention.
[0087] Figure 13 This is a structural block diagram of an electronic device provided in an embodiment of the present invention.
[0088] Figure 14This is a structural block diagram of a device for surface defect detection provided in an embodiment of the present invention. Detailed Implementation
[0089] To enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.
[0090] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0091] In recent years, significant progress has been made in research on technologies based on artificial intelligence, such as computer vision, deep learning, machine learning, image processing, and image recognition. Artificial intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies, and application systems to simulate and extend human intelligence. AI is a comprehensive discipline involving numerous technologies, including chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, and neural networks. Computer vision, as an important branch of AI, specifically enables machines to recognize the world. Computer vision technologies typically include face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, object detection, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, and robot navigation and localization. With the research and advancement of artificial intelligence technology, this technology has been applied in numerous fields, such as security, urban management, traffic management, building management, park management, facial recognition access control, facial recognition attendance, logistics management, warehouse management, robotics, intelligent marketing, computational photography, mobile imaging, cloud services, smart homes, wearable devices, autonomous driving, autonomous driving, smart healthcare, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile internet, live streaming, beautification, makeup, medical aesthetics, and intelligent temperature measurement.
[0092] Figure 1 This is a flowchart of a surface defect detection method provided in an embodiment of the present invention, such as... Figure 1 As shown, the surface defect detection method includes the following steps:
[0093] Step 101: Obtain the image of the sealing ring of the battery cell to be inspected, as well as the defect-free front and defect-free back images of the sealing ring of the sample battery cell.
[0094] Step 102: Data construction is performed on the foreground target pixels of the image of the sealing ring of the battery cell to be inspected, as well as the defect-free front image and defect-free back image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image.
[0095] Step 103: Extract the high-level features of the multi-channel foreground target image, the high-level features including: high-level features of the sealing ring image of the battery cell to be inspected, high-level features of the defect-free front image and high-level features of the defect-free back image;
[0096] Step 104: Perform adversarial classification on the high-level features of the sealing ring image of the battery cell under inspection with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image of the battery cell under inspection containing surface defects.
[0097] The surface defect detection method described in this invention can be applied to terminals, servers, etc., without limitation. The terminal implementation device can be an electronic device such as a computer, smartphone, laptop, or tablet computer, without limitation.
[0098] The following is combined Figure 1 The specific implementation steps of a surface defect detection method provided in this embodiment of the invention will be described in detail.
[0099] In step 101, an image of the sealing ring of the battery cell to be inspected, as well as a defect-free front image and a defect-free back image of the sealing ring of the sample battery cell are obtained.
[0100] In this step, the image of the battery cell sealing ring to be tested acquired by the terminal can be a single image or multiple images. If it is a single image, it can be an image without surface defects (i.e., an OK image) or an image with surface defects (i.e., an NG image). If it is multiple images, they can include one or more images without surface defects or one or more images with surface defects. This embodiment is not limited in this respect.
[0101] In this embodiment, the "cell" refers to a single electrochemical cell containing positive and negative electrodes. It is generally not used directly and is usually protected by a cell sealing ring, which can be a rubber sealing ring, etc. Unlike a battery, which contains a protection circuit and a casing and can be used directly.
[0102] Battery cells are classified into three types: aluminum-cased cells, pouch cells (also known as polymer cells), and cylindrical cells. Mobile phone batteries typically use aluminum-cased cells, while Bluetooth and other digital products often use pouch cells. Laptop batteries use a series-parallel combination of cylindrical cells.
[0103] In this embodiment, the sample cell sealing ring refers to a defect-free cell sealing ring, which includes a defect-free front image and a defect-free back image.
[0104] The methods for acquiring images of the sealing ring of the battery cell under inspection, as well as defect-free front and defect-free back images of the sealing ring of the sample battery cell, are well known to those skilled in the art and will not be described in detail here.
[0105] In step 102, data is constructed from the foreground target pixels of the image of the sealing ring of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image.
[0106] In this step, the terminal can input the foreground target pixels of the sealing ring image of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, into the data generator for data construction, thereby obtaining a multi-channel foreground target image. The data construction process includes:
[0107] 1) Perform blob preprocessing on the image of the sealing ring of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to obtain the foreground target pixels (and background pixels) of the image of the sealing ring of the battery cell to be inspected, the foreground target pixels and background pixels of the defect-free image, and the foreground target pixels and background pixels of the defect-free reverse image.
[0108] In this step, the image of the sealing ring of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, are loaded into the data loader, and then Blob preprocessing is performed.
[0109] In computer vision images, a blob refers to a connected region composed of similar colors, textures, and other features. In this embodiment, blob preprocessing is the process of blob analysis. Blob analysis analyzes connected components of the same pixels in an image. The process involves binarizing the image of the battery cell sealing ring to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to segment the corresponding foreground target pixels and background pixels. Then, connected component detection is performed to obtain the blob blocks.
[0110] It should be noted that Blob analysis is a fundamental method for analyzing the shape of closed targets. Before performing Blob analysis, the image needs to be segmented into sets of pixels that constitute blobs and local background. Blob analysis is generally performed from a grayscale image of the scene. Before Blob analysis, each pixel in the image must be assigned either a target pixel or a background pixel. Typically, foreground target pixels are assigned a value of 1, and background pixels are assigned a value of 0; however, the reverse is also possible. It should be noted that segmenting the image of the battery cell sealing ring under inspection, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, into foreground target pixels and background pixels is a well-known technique to those skilled in the art, such as binary thresholding and spatial quantization error.
[0111] 2) Extract the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image;
[0112] This step involves cropping the foreground target pixels of the battery cell sealing ring image, for example, to 1400*1400, the purpose of which is to reduce the image resolution. It also involves cropping the foreground target pixels of the defect-free image and the defect-free reverse image.
[0113] 3) By performing a patch operation, the foreground target pixels of the sealing ring image of the battery cell under inspection, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image are transformed in terms of spatial dimension to obtain a multi-channel foreground target image.
[0114] In this step, the foreground target pixels of the image of the sealing ring of the battery cell under inspection, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image are aligned and connected. Then, through a block patch operation, the data dimension is converted from spatial dimension information to multi-channel dimension. Specifically, the spatial dimension M*N*3 is converted to the multi-channel dimension M / k*N / k*(3*k*k), where M and N are the image size, and k is the conversion coefficient. For example, in this embodiment, the spatial dimension is 1400*1400*3, which is converted to a multi-channel dimension of 700*700*12. The purpose of this data dimension conversion is to reduce image resolution and improve subsequent calculation speed. This dimension conversion has no effect on the morphology or size of defects on the surface of the battery cell sealing ring. Specifically, as shown... Figure 2 As shown, Figure 2 This is a schematic diagram illustrating a data construction method provided in an embodiment of the present invention.
[0115] like Figure 2 As shown, the image of the sealing ring of the battery cell under test (can be an OK or NG image). Figure 2 (represented as Sample in Chinese) Defect-free front view (i.e., OK front view) Figure 2 (represented by Ok_front in Chinese) and defect-free reverse images (i.e., OK reverse images). Figure 2 The data (represented by Ok_verso) is loaded through a data loader, and then color blob preprocessing is performed to obtain the foreground target pixels and background pixels in the grayscale image. The foreground target pixels (1400*1400) of the sealing ring of the battery cell under test are cropped, as are the foreground target pixels of the defect-free image and the foreground target pixels of the defect-free reverse image. Then, the foreground target pixels of the sealing ring of the battery cell under test, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image are aligned and connected. Then, through a block patch operation, the spatial dimension information is converted to a multi-channel dimension. Based on this, the data dimension has been converted from M*N*3 to M / k*N / k*(3*k*k). In this embodiment, it can be converted from 1600*1600*3 to 800*800*12.
[0116] In this step, the dimensionality expansion operation is performed through patch, which not only reduces the image resolution, the number of network parameters and the amount of computation, but also improves the inference speed and reduces the memory usage.
[0117] In step 103, high-level features of the multi-channel foreground target image are extracted. The high-level features include: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0118] In this step, a feature extractor can be used to extract high-level features from the multi-channel foreground target image. The feature extractor extracts these high-level features through a feature extraction network, which refers to a specific convolutional layer of a convolutional neural network. After the image is fed into the convolutional neural network, the output vector at the designated convolutional layer is calculated. The training process of the feature extractor is detailed below and will not be repeated here.
[0119] Specifically, in this embodiment, the multi-channel foreground target image is first processed by a convolutional neural network; based on the first result of the convolution processing, low-level features of the multi-channel foreground target image are extracted; then, the low-level features of the multi-channel foreground target image are reconstructed using a patch operation; and the reconstructed features are then convolved. Based on the second result of the convolution processing, high-level features of the multi-channel foreground target image are extracted. Specifically, as follows... Figure 3A As shown, Figure 3A This is a schematic diagram of feature extraction provided in an embodiment of the present invention.
[0120] Depend on Figure 3A As can be seen, the feature extraction process consists of four stages. Stage 1 includes a CBR component and a Pool component. CBR = Conv + BN + ReLU, and Pool = CBR + AvgPool. The CBR component is a common model structure in convolutional neural networks. During model inference and training, the BN layer is often merged with other layers to reduce image resolution and subsequent computation. Conv is the convolution operation, AvgPool is the average pooling, ReLU is the ReLU activation function, and BN (batch normalization) is the batch normalization function.
[0121] Stage 2 includes Block 1_2 and Pool, where Block 1_2 = CBR + CBR + SE. The composition of the SE component is shown below.
[0122]
[0123] In this framework, GAvgPool is global mean pooling, Sigmoid is the sigmoid activation function, Fc is a fully connected layer, Conv is a convolution operation, and Mul is an element-wise multiplication operation. SE is used to extract low-level features of the image (such as edges and points in the target image) while reducing the resolution.
[0124] Stage 3 includes Block 2_3 and Pool, where Block 2_3 = Res + Res + Res + SE, and the Res component is composed of:
[0125]
[0126] Here, Add is the element-wise summation operation. Res further extracts image features, extracting features of surfaces extending from points, such as texture features, while further reducing the resolution.
[0127] Stage 4 includes: Regrouping, Concatenation (C concat), Block2_4, and Pool. Regrouping involves recombining three sets of data: the foreground target pixel image of the sealing ring of the battery cell under inspection, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image. A schematic diagram of the recombining process is shown below. Figure 3B As shown, Figure 3B This is a schematic diagram of a regrouping process provided by an embodiment of the present invention. In this embodiment, the low-level features of the multi-channel foreground target image are regrouped and inversely transformed according to a patch operation. This includes: horizontally regrouping (H concat) the low-level features (channel slices) of the multi-channel foreground target image according to the patch operation; and vertically regrouping (V concat) all the horizontally regrouped low-level features to obtain the low-level features of the vertically regrouped multi-channel foreground target image. Wherein, Block2_4 = Res + Res + Res + Res + SE. Then, an inverse regrouping transformation is performed through patch, that is, the three sets of regrouped data are converted from multi-channel features to spatial features, and high-level features (feature maps) of the regrouped foreground target are extracted. The high-level features include: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0128] In step 104, the high-level features of the sealing ring image of the battery cell under test are adversarially classified with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image of the battery cell under test containing surface defects.
[0129] In this step, the high-level features of the sealing ring image of the battery cell under inspection are input into a trained feature classifier along with the high-level features of the defect-free front image and the defect-free back image, respectively, for adversarial classification to obtain the probability value that the sealing ring image of the battery cell under inspection contains surface defects. The training process of the feature classifier is detailed below and will not be repeated here.
[0130] The feature classifier process is as follows: First, according to the data construction, the high-level features are divided into high-level features of the battery cell sealing ring image under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image. Then, the high-level features of the battery cell sealing ring image under inspection are used for branch prediction to obtain the front and back characteristics of the battery cell sealing ring image under inspection, as well as the high-level features of the corresponding faces. Finally, the front and back characteristics of the battery cell sealing ring image under inspection are combined with the high-level features of the corresponding faces, and feature adversarial analysis is performed with the high-level features of the defect-free front image and the defect-free back image respectively to obtain the probability value of surface defects in the battery cell sealing ring image under inspection. Wherein, branch = GAvgPool + CBR + FC.
[0131] In other words, if the branch predicts that the image of the sealing ring of the battery cell under inspection has frontal characteristics and the corresponding high-level features of the frontal image, then the high-level features of the frontal image of the sealing ring of the battery cell under inspection are counteracted against the high-level features of the defect-free frontal image. If the branch predicts that the image of the sealing ring of the battery cell under inspection has backal characteristics and the corresponding high-level features of the backal image, then the high-level features of the backal image of the sealing ring of the battery cell under inspection are counteracted against the high-level features of the defect-free backal image to obtain the probability value that the front or back of the sealing ring image of the battery cell under inspection contains surface defects. Specifically, as follows... Figure 4 As shown, Figure 4 This is a schematic diagram illustrating a feature classification process provided in an embodiment of the present invention;
[0132] like Figure 4 As shown, the high-level features are first input into the data constructor, and then divided into three groups according to the structure of the data constructor: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image. The high-level features of the sealing ring image of the battery cell under inspection form one group and are input into the branch; the high-level features of the defect-free front image form one group, and the high-level features of the defect-free back image form another group. In this embodiment, the high-level features of the defect-free front image and the defect-free back image are collectively referred to as CBR.
[0133] Then, the high-level features of the sealing ring image of the battery cell under test are subjected to branch prediction to obtain the front and back characteristics of the sealing ring image of the battery cell under test, as well as the high-level features of the corresponding face.
[0134] Next, the front and back characteristics of the sealing ring image of the battery cell under inspection are combined with the high-level features of the corresponding sides (i.e., high-level features of the front image or high-level features of the back image), along with CBR, and then input into a GAN (Generative Adversarial Network) for adversarial classification to obtain the probability values of surface defects on the front and back sides of the sealing ring image of the battery cell under inspection. The GAN network is an unsupervised deep learning network with two modules: a generator and a discriminator. By having the two modules compete against each other during training, the parameters of each module are optimized to simulate the best image generation effect.
[0135] The adversarial components include: compete + Block2_5 + pool, where Block2_5 = Res + Res + Res + Res + Res + SE. After adversarial processing through convolutional layers, a defect Flateen + fully connected layer Fc is obtained, which yields the probability value that the target image to be inspected contains surface defects.
[0136] In this embodiment of the invention, an image of the sealing ring of a battery cell to be inspected, as well as defect-free front images, defect-free front images, and defect-free back images of a sample battery cell sealing ring are acquired. Data construction is performed on the foreground target pixels of the image of the sealing ring to be inspected, as well as the defect-free front and defect-free back images of the sample battery cell sealing ring, to obtain a constructed multi-channel foreground target image. High-level features of the multi-channel foreground target image are extracted, including: high-level features of the sealing ring image to be inspected, high-level features of the defect-free front image, and high-level features of the defect-free back image. The high-level features of the sealing ring image to be inspected are then adversarially classified against the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image to be inspected containing surface defects. In other words, in this embodiment of the invention, by constructing data, not only is the problem of increased cost caused by the need to rely on a large number of training samples in related technologies solved, but also the problems of low processing speed and excessive memory usage caused by high image resolution are solved. By introducing feature adversarial mechanisms, the network is prompted to fully learn the defect features of the battery cell sealing ring, thereby improving the defect detection rate and reducing the defect over-detection rate, which improves the efficiency of defect detection.
[0137] Please also see Figure 5This is a flowchart illustrating a training method for a surface defect detection model provided in an embodiment of the present invention. The method first classifies data samples of battery cell sealing rings into OK (ok) and NG (ng) categories based on whether or not they have defects. Then, OK data is classified into front and reverse categories based on whether it is front or back. Next, the data is loaded by a data generator, and a feature extractor extracts high-level features from the loaded image. Finally, the extracted high-level features are fed into a feature classifier for adversarial classification, thereby completing the defect detection of the data samples. It should be noted that three types of losses occur during the detection process: the loss for determining the front and back of the battery cell ring under inspection. ct The characteristics of the tested cell coil and the resistance loss of the defect-free map compete And the final classification loss of the network c The parameters of the feature extractor and feature classifier are optimized by summing these three types of losses, thereby completing the training of the feature extractor and feature classifier until the probability values of surface defects on the front and back sides of multiple data samples of the battery cell sealing ring image are obtained, thus generating a surface defect detection model. The method specifically includes:
[0138] Step 501: In response to multiple data samples of the acquired cell sealing ring image, the multiple data samples are classified into defect-free images and defective images according to category, and the defect-free images are classified into defect-free front images and defect-free back images.
[0139] In this step, multiple data samples of the battery cell sealing ring image are classified into defect-free images (OK) and defective images (NG) according to whether there are defects. The classification method can be done manually or by a classification device. The specific classification method is well known to those skilled in the art and will not be described in detail here.
[0140] Specifically, dividing the defect-free images into defect-free front images and defect-free back images includes: after classification, classifying the data of defect-free images ok into defect-free front images (front) and defect-free back images (verso) according to their front and back sides.
[0141] Step 502: Input multiple data samples of the cell sealing ring image, as well as the defect-free front image and defect-free back image from the defect-free image, into the data generator for data construction processing to obtain the processed multi-channel foreground target image;
[0142] The specific implementation process of this step is similar to the process in the above embodiment of constructing a multi-channel foreground target image by data construction of the foreground target pixels of the image of the sealing ring of the battery cell to be inspected, as well as the front and back images of the sample battery cell sealing ring without defects. The difference is that one is multiple sample data of the battery cell sealing ring image, and the other is the image of the sealing ring of the battery cell to be inspected. For details, please refer to the above and will not be repeated here.
[0143] Step 503: Extract high-level features of the multi-channel foreground target image using a feature extractor.
[0144] Step 504: The extracted high-level features are divided into high-level features of the battery cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image by a feature classifier, thereby obtaining the defective or defect-free category of the battery cell sealing ring image and generating the first type of loss.
[0145] In this step, when dividing the high-level features into high-level features of a defect-free frontal image and high-level features of a defect-free backal image, a first-type loss (Loss) is generated. ct Loss ct This represents the loss for determining the front and back sides of a high-level feature image of a defect-free battery cell coil. The Loss value is... ct The formula is as follows:
[0146]
[0147] In this formula, N is the number of samples, yit is the predicted positive and negative labels of the current sample, and yit^ is the true positive and negative labels of the current sample.
[0148] Step 505: Perform branch prediction on the high-level features of the battery cell sealing ring image to obtain the front and back characteristics of the battery cell sealing ring image and the high-level features of the corresponding face, generating a second type of loss; when the distance between the high-level features of the battery cell sealing ring image and the high-level features of the corresponding face of the defect-free image is much smaller than the distance to the opposite face of the battery cell sealing ring image, a third type of loss is generated.
[0149] Among them, the second type of loss compete t represents the resistance loss between the features of the tested electrode coil and the defect-free map, and the formula for calculating this loss is:
[0150]
[0151] In this formula, N is the sample size, and x i For the current sample, f(x) i f(x) represents the high-level features of the current sample. i ff(x) represents the high-level positive feature corresponding to the current sample. i v ) represents the high-level features of the ok opposite side corresponding to the current sample, and α is the minimum threshold for the distance between the current sample and the corresponding side and the other side.
[0152] Here, the third type of loss, Lossc, represents the final classification loss of the network, and its formula is as follows:
[0153]
[0154] In this formula, N is the number of samples, and y i For the predicted ok or ng label of the current sample, y i ^ represents the actual ok or ng tag for the current sample.
[0155] Step 506: Based on the sum of the first type of loss, the second type of loss, and the third type of loss, iteratively train the parameters of the feature extractor and the feature classifier respectively to generate a surface defect detection model.
[0156] In this step, the Loss formula is used.
[0157] loss = loss c +λ1loss ct +λ2loss comvete
[0158] In this formula, λ1 and λ2 are constants, representing the weights of the two losses in the total loss. Typically, they are taken as 1 and 0.5, respectively. However, these weight values can be modified adaptively according to the actual situation.
[0159] In this embodiment of the invention, network optimization is achieved through weak supervision. It is only necessary to obtain whether the sample image is defective or not. The loss function constructed in this invention is used to achieve iterative optimization of the network, which reduces the sample labeling cost of strong supervision and improves the training efficiency of the model.
[0160] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the present invention.
[0161] Please also see Figure 6This is a block diagram of a surface defect detection device provided in an embodiment of the present invention. The device includes: an acquisition module 601, a data construction module 602, a feature extraction module 603, and an adversarial module 604, wherein...
[0162] The acquisition module 601 is used to acquire images of the sealing ring of the battery cell to be inspected, as well as defect-free front and defect-free back images of the sealing ring of the sample battery cell.
[0163] The data construction module 602 is used to construct data on the foreground target pixels of the sealing ring image of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image.
[0164] The feature extraction module 603 is used to extract high-level features of the multi-channel foreground target image. The high-level features include: high-level features of the sealing ring image of the battery cell to be inspected, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0165] The adversarial module 604 is used to perform adversarial classification on the high-level features of the sealing ring image of the battery cell under test against the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value that the sealing ring image of the battery cell under test contains surface defects.
[0166] Optionally, in another embodiment, based on the above embodiments, the data construction module 602 includes: a preprocessing module 701, a target extraction module 702, and a spatial dimension transformation module 703, as shown in the schematic diagram below. Figure 7 As shown, where,
[0167] The preprocessing module 701 is used to perform blob preprocessing on the image of the sealing ring of the battery cell to be inspected, as well as the defect-free image and defect-free reverse image of the sample battery cell sealing ring, to segment and obtain the foreground target pixels and background pixels of the image of the sealing ring of the battery cell to be inspected, the foreground target pixels and background pixels of the defect-free image, and the foreground target pixels and background pixels of the defect-free reverse image.
[0168] The target extraction module 702 is used to extract the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image;
[0169] The spatial dimension conversion module 703 is used to perform spatial dimension conversion on the foreground target pixels of the sealing ring image of the battery cell under inspection, the foreground target pixels of the defect-free image, and the foreground target pixels of the defect-free reverse image through a patch operation, so as to obtain a multi-channel foreground target image.
[0170] Optionally, in another embodiment, based on the above embodiment, the feature extraction module 603 includes: a first convolution processing module 801, a first feature extraction module 802, a recombination inverse transform module 803, a second convolution processing module 804, and a second feature extraction module 805, as shown in the schematic diagram below. Figure 8 As shown, where,
[0171] The first convolution processing module 801 is used to perform convolution processing on the multi-channel foreground target image through a convolutional neural network;
[0172] The first feature extraction module 802 is used to extract low-level features of the multi-channel foreground target image based on the first result of the convolution processing of the first convolution processing module.
[0173] The reconstructing inverse transform module 803 is used to reconstruct the low-level features of the multi-channel foreground target image according to the patch operation;
[0174] The second convolution processing module 804 is used to perform convolution processing on the merged multi-channel foreground target image;
[0175] The second feature extraction module 805 is used to extract high-level features of the multi-channel foreground target image based on the second result of the convolution processing of the second convolution processing module.
[0176] Optionally, in another embodiment, based on the above embodiment, the recombination inverse transformation module 803 includes: a horizontal recombination module 901 and a vertical recombination module 902, the structural diagram of which is shown below. Figure 9 As shown, where,
[0177] The horizontal reconstruction module 901 is used to horizontally reconstruct the low-level features of the multi-channel foreground target image according to the block patch operation;
[0178] The vertical reconstruction module 902 is used to vertically reconstruct the hierarchical features after horizontal reconstruction to obtain the low-level features of the vertically reconstructed multi-channel foreground target image.
[0179] Optionally, in another embodiment, based on the above embodiment, the adversarial module 604 includes: a partitioning module 1001, a branch prediction module 1002, and an adversarial classification module 1003, as shown in the schematic diagram below. Figure 10 As shown, where,
[0180] The segmentation module 1001 is used to construct and segment the high-level features of the sealing ring image of the battery cell under inspection, the high-level features of the defect-free front image, and the high-level features of the defect-free back image according to the data.
[0181] The branch prediction module 1002 is used to perform branch prediction on the high-level features of the sealing ring image of the battery cell under test, so as to obtain the front and back features of the sealing ring image of the battery cell under test, and the high-level features of the corresponding face.
[0182] The adversarial classification module 1003 is used to combine the front and back characteristics of the sealing ring image of the battery cell under test with the high-level features of the corresponding surface, and to perform feature adversarial analysis with the high-level features of the defect-free front image and the high-level features of the defect-free back image respectively, so as to obtain the probability value of the surface defects of the sealing ring image of the battery cell under test.
[0183] Please also see Figure 11 The present invention provides a structural block diagram of a training device for a surface defect detection model, comprising: a first partitioning module 1101, a data construction module 1102, an extraction module 1103, a second partitioning module 1104, an adversarial module 1105, and a training module 1106.
[0184] The first division module 1101 is used to, in response to multiple data samples of the acquired cell sealing ring image, divide the multiple data samples into defect-free images and defective images according to categories, and divide the defect-free images into defect-free front images and defect-free back images.
[0185] The data construction module 1102 is used to input multiple data samples of the cell sealing ring image, as well as the defect-free front image and defect-free back image in the defect-free image, into the data generator for data construction processing to obtain the processed multi-channel foreground target image.
[0186] The extraction module 1103 is used to extract high-level features of the multi-channel foreground target image through a feature extractor. The high-level features include: high-level features of multiple data samples of the cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0187] The second segmentation module 1104 is used to classify the extracted high-level features into high-level features of the battery cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image using a feature classifier, thereby obtaining the defective or defect-free category of the battery cell sealing ring image and generating a first type of loss; and
[0188] The adversarial module 1105 is used to perform branch prediction on the high-level features of the battery cell sealing ring image to obtain the front and back characteristics of the battery cell sealing ring image and the high-level features of the corresponding face, generating a second type of loss; when the distance between the high-level features of the battery cell sealing ring image and the high-level features of the corresponding face of the defect-free image is much smaller than the distance to the opposite face of the battery cell sealing ring image, a third type of loss is generated.
[0189] The training module 1106 is used to iteratively train the parameters of the feature extractor and the feature classifier based on the sum of the first type of loss, the second type of loss and the third type of loss, to generate a surface defect detection model.
[0190] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0191] Please also see Figure 12 This is an application example diagram of a surface defect detection device provided in an embodiment of the present invention. The device includes, for example, a data generator 1201, a feature extractor 1202, and a feature classifier 1203. Both the feature extractor 1202 and the feature classifier 1203 are pre-trained feature extractors 1202 and 1203.
[0192] The data generator 1201 is used to acquire the image of the sealing ring of the battery cell to be inspected, as well as the defect-free front image, defect-free front image and defect-free back image of the sample battery cell sealing ring, and to perform data construction on the foreground target pixels of the image of the sealing ring of the battery cell to be inspected, as well as the defect-free front image and defect-free back image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image, and input the multi-channel foreground target image into the feature extractor 1202;
[0193] The feature extractor 1202 is used to determine the high-level features of the multi-channel foreground target image when it receives the multi-channel foreground target image input by the data generator 1201. The high-level features include: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image.
[0194] The feature classifier 1203 is used to perform adversarial classification on the high-level features of the sealing ring image of the battery cell under test extracted by the feature extractor 1202 with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image of the battery cell under test containing surface defects.
[0195] The implementation process of the functions and roles of each device in this apparatus is detailed in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0196] Optionally, embodiments of the present invention also provide an electronic device, comprising:
[0197] processor;
[0198] Memory used to store the processor's executable instructions;
[0199] The processor is configured to execute the instructions to implement the surface defect detection method or the surface defect detection model training method as described above.
[0200] Optionally, embodiments of the present invention also provide a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the surface defect detection method or the surface defect detection model training method described above. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.
[0201] Optionally, embodiments of the present invention also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the surface defect detection method or the surface defect detection model training method as described above.
[0202] Figure 13 This is a block diagram of an electronic device 1300 provided in an embodiment of the present invention. For example, the electronic device 1300 can be a mobile terminal or a server; in this embodiment, a mobile terminal is used as an example for explanation. For example, the electronic device 1300 can be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0203] Reference Figure 13 The electronic device 1300 may include one or more of the following components: a processing component 1302, a memory 1304, a power component 1306, a multimedia component 1308, an audio component 1310, an input / output (I / O) interface 1312, a sensor component 1314, and a communication component 1316.
[0204] Processing component 1302 typically controls the overall operation of electronic device 1300, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1302 may include one or more processors 1320 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1302 may include one or more modules to facilitate interaction between processing component 1302 and other components. For example, processing component 1302 may include a multimedia module to facilitate interaction between multimedia component 1308 and processing component 1302.
[0205] Memory 1304 is configured to store various types of data to support the operation of device 1300. Examples of this data include instructions for any application or method operating on electronic device 1300, contact data, phonebook data, messages, pictures, videos, etc. Memory 1304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0206] Power supply component 1306 provides power to various components of electronic device 1300. Power supply component 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1300.
[0207] Multimedia component 1308 includes a screen that provides an output interface between the electronic device 1300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1308 includes a front-facing camera and / or a rear-facing camera. When the device 1300 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0208] Audio component 1310 is configured to output and / or input audio signals. For example, audio component 1310 includes a microphone (MIC) configured to receive external audio signals when electronic device 1300 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1304 or transmitted via communication component 1316. In some embodiments, audio component 1310 also includes a speaker for outputting audio signals.
[0209] I / O interface 1312 provides an interface between processing component 1302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0210] Sensor assembly 1314 includes one or more sensors for providing state assessments of various aspects of electronic device 1300. For example, sensor assembly 1314 may detect the on / off state of device 1300, the relative positioning of components such as the display and keypad of electronic device 1300, changes in position of electronic device 1300 or a component of electronic device 1300, the presence or absence of user contact with electronic device 1300, the orientation or acceleration / deceleration of electronic device 1300, and temperature changes of electronic device 1300. Sensor assembly 1314 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1314 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1314 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0211] Communication component 1316 is configured to facilitate wired or wireless communication between electronic device 1300 and other devices. Electronic device 1300 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 1316 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1316 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0212] In an embodiment, the electronic device 1300 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the surface defect detection method or the training method for the surface defect detection model described above.
[0213] In this embodiment, a computer-readable storage medium is also provided, such as a memory 1304 including instructions that can be executed by a processor 820 of an electronic device 800 to complete the surface defect detection method or the surface defect detection model training method described above. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.
[0214] In this embodiment, a computer program product is also provided, which, when executed by the processor 1320 of the electronic device 1300, causes the electronic device 1300 to execute the surface defect detection method or the surface defect detection model training method described above.
[0215] Figure 14 This is a block diagram of an apparatus 1400 for surface defect detection according to an embodiment of the present invention. For example, apparatus 1400 can be provided as a server. (Refer to...) Figure 14 The apparatus 1400 includes a processing component 1422, which further includes one or more processors, and memory resources represented by memory 1432 for storing instructions, such as application programs, that can be executed by the processing component 1422. The application programs stored in memory 1432 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1422 is configured to execute instructions to perform the methods described above.
[0216] Device 1400 may also include a power supply component 1426 configured to perform power management of device 1400, a wired or wireless network interface 1450 configured to connect device 1400 to a network, and an input / output (I / O) interface 1458. Device 1400 may operate on an operating system stored in memory 1432, such as Windows Server™, MacOS X™, Unix™, Linux™, FreeBSD™, or similar.
[0217] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0218] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for detecting surface defects, characterized in that, include: Acquire images of the sealing ring of the battery cell to be inspected, as well as defect-free front and defect-free back images of the sealing ring of the sample battery cell; Data is constructed from the foreground target pixels of the image of the sealing ring of the battery cell to be inspected, as well as the defect-free front and defect-free back images of the sample battery cell sealing ring, to obtain a constructed multi-channel foreground target image. High-level features are extracted from the multi-channel foreground target image, including: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image; The high-level features of the sealing ring image of the battery cell under test are adversarially classified with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image of the battery cell under test containing surface defects. The step of performing adversarial classification on the high-level features of the sealing ring image of the battery cell under inspection with the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of the sealing ring image of the battery cell under inspection containing surface defects, includes: Based on the data construction, the determined high-level features are divided into high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image. By performing branch prediction on the high-level features of the sealing ring image of the battery cell under test, the front and back characteristics of the sealing ring image of the battery cell under test, as well as the high-level features of the corresponding face, are obtained. The front and back characteristics of the sealing ring image of the battery cell under test are combined with the high-level features of the corresponding surface, and then subjected to feature adversarial analysis with the corresponding high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value of surface defects in the sealing ring image of the battery cell under test.
2. The surface defect detection method according to claim 1, characterized in that, The process of constructing a multi-channel foreground target image from the image of the sealing ring of the battery cell under inspection, as well as the defect-free front and defect-free back images of the sample battery cell sealing ring, includes: The image of the sealing ring of the battery cell to be inspected, as well as the defect-free front image and defect-free back image of the sample battery cell sealing ring, are subjected to Blob preprocessing to obtain the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free front image, and the foreground target pixels of the defect-free back image. Extract the foreground target pixels of the sealing ring image of the battery cell to be inspected, the foreground target pixels of the defect-free front image, and the foreground target pixels of the defect-free back image; By performing a patch operation, the foreground target pixels of the sealing ring image of the battery cell under inspection, the foreground target pixels of the defect-free front image, and the foreground target pixels of the defect-free back image are transformed in terms of spatial dimension to obtain a multi-channel foreground target image.
3. The surface defect detection method according to claim 1 or 2, characterized in that, The extraction of high-level features from the multi-channel foreground target image includes: The multi-channel foreground target image is processed by convolutional neural network; Based on the first result of convolution processing, low-level features of the multi-channel foreground target image are extracted; The low-level features of the multi-channel foreground target image are recombined and inversely transformed according to the patch operation; The features after the inverse transformation of recombination are processed by convolution; Based on the second result of convolution processing, high-level features of the multi-channel foreground target image are extracted.
4. The surface defect detection method according to claim 3, characterized in that, The step of performing a reconstructed inverse transform on the low-level features of the multi-channel foreground target image according to the patch operation includes: The low-level features of the multi-channel foreground target image are horizontally reassembled according to the patch operation; Vertical recombination is performed on all low-level features after horizontal recombination to obtain the low-level features of the vertically recombined multi-channel foreground target image.
5. A training method for a surface defect detection model, characterized in that, include: In response to multiple data samples of the acquired cell sealing ring image, the multiple data samples are classified into defect-free images and defective images according to category, and the defect-free images are further classified into defect-free front images and defect-free back images. Multiple data samples of the cell sealing ring image, as well as the defect-free front and defect-free back images in the defect-free image, are input into the data generator for data construction processing to obtain the processed multi-channel foreground target image. High-level features of the multi-channel foreground target image are extracted using a feature extractor; The extracted high-level features are divided into high-level features of the battery cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image by a feature classifier, thereby obtaining the defective or defect-free category of the battery cell sealing ring image and generating the first type of loss. By performing branch prediction on the high-level features of the battery cell sealing ring image, the front and back characteristics of the battery cell sealing ring image and the high-level features of the corresponding face are obtained, resulting in a second type of loss; when the distance between the high-level features of the battery cell sealing ring image and the high-level features of the corresponding face of the defect-free image is much smaller than the distance to the opposite face of the battery cell sealing ring image, a third type of loss is generated. Based on the sum of the first type of loss, the second type of loss, and the third type of loss, the parameters of the feature extractor and the feature classifier are iteratively trained to generate a surface defect detection model.
6. A surface defect detection device, characterized in that, include: The acquisition module is used to acquire images of the sealing ring of the battery cell to be inspected, as well as defect-free front and defect-free back images of the sealing ring of the sample battery cell. The data construction module is used to construct data from the foreground target pixels of the sealing ring image of the battery cell to be inspected, as well as the defect-free front image and defect-free back image of the sample battery cell sealing ring, to obtain the constructed multi-channel foreground target image. The extraction module is used to extract high-level features of the multi-channel foreground target image. The high-level features include: high-level features of the sealing ring image of the battery cell under inspection, high-level features of the defect-free front image, and high-level features of the defect-free back image. The adversarial module is used to perform adversarial classification on the high-level features of the sealing ring image of the battery cell under test against the high-level features of the defect-free front image and the defect-free back image, respectively, to obtain the probability value that the sealing ring image of the battery cell under test contains surface defects. The adversarial module includes: The segmentation module is used to segment the high-level features of the sealing ring image of the battery cell under inspection, the high-level features of the defect-free front image, and the high-level features of the defect-free back image according to the determined high-level features constructed by the data. The branch prediction module is used to perform branch prediction on the high-level features of the sealing ring image of the battery cell under test, so as to obtain the front and back characteristics of the sealing ring image of the battery cell under test, and the high-level features of the corresponding face. The adversarial classification module is used to combine the front and back characteristics of the sealing ring image of the battery cell under inspection with the high-level features of the corresponding surface, and to perform feature adversarial analysis with the high-level features of the defect-free front image or the high-level features of the defect-free back image to obtain the probability value of surface defects in the sealing ring image of the battery cell under inspection.
7. A training device for a surface defect detection model, characterized in that, include: The first segmentation module is used to, in response to multiple data samples of the acquired cell sealing ring image, segment the multiple data samples into defect-free images and defective images according to categories, and segment the defect-free images into defect-free front images and defect-free back images. The data construction module is used to input multiple data samples of the cell sealing ring image, as well as the defect-free front image and defect-free back image of the defect-free image, into the data generator for data construction processing to obtain the processed multi-channel foreground target image. An extraction module is used to extract high-level features of the multi-channel foreground target image using a feature extractor; The second partitioning module is used to partition the extracted high-level features into high-level features of the battery cell sealing ring image, high-level features of the defect-free front image, and high-level features of the defect-free back image through a feature classifier, thereby generating a first type of loss. An adversarial module is used to perform branch prediction on the high-level features of the battery cell sealing ring image to obtain the front and back characteristics of the battery cell sealing ring image and the high-level features of the corresponding face, generating a second type of loss; when the distance between the high-level features of the battery cell sealing ring image and the high-level features of the corresponding face of the defect-free image is much smaller than the distance to the opposite face of the battery cell sealing ring image, a third type of loss is generated. The training module is used to iteratively train the parameters of the feature extractor and the feature classifier based on the sum of the first type of loss, the second type of loss and the third type of loss, to generate a surface defect detection model.
8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the surface defect detection method as described in any one of claims 1 to 4 or the training method for the surface defect detection model as described in claim 5.
9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the surface defect detection method as described in any one of claims 1 to 4 or the training method of the surface defect detection model as described in claim 5.
10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the surface defect detection method as described in any one of claims 1 to 4 or the training method for the surface defect detection model as described in claim 5.
Citation Information
Patent Citations
Rubber sealing ring defect detection method based on deep learning
CN113034494A
Defect detection network training method, defect detection method and storage medium
CN113344857A