Image recognition method, device and computer readable storage medium

By employing a coarse-to-fine image recognition method, utilizing initial segmentation, feature extraction, and contextual representation, combined with convolution operations and parameter fitting, the problem of inaccurate weld bead positioning is solved, improving the accuracy of weld bead defect detection and enhancing battery safety.

CN116508057BActive Publication Date: 2026-02-24CONTEMPORARY AMPEREX TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202180065003.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-23
Publication Date
2026-02-24
Estimated Expiration
2041-11-23

AI Technical Summary

Technical Problem

In the existing technology, the weld bead positioning is not accurate, resulting in low accuracy of weld bead defect detection and affecting battery safety performance.

Method used

A coarse-to-fine image recognition method is adopted, which improves the recognition accuracy of weld area by combining initial segmentation, feature extraction and context representation with convolution operation and parameter fitting.

Benefits of technology

It improves the accuracy of weld bead positioning and the rate of defect detection, thereby enhancing battery safety and the independence of identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116508057B_ABST
    Figure CN116508057B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of image processing, and provide an image recognition method, device and computer readable storage medium. The image recognition method comprises: acquiring a target image, the target image comprising a weld area; performing initial segmentation on the target image to obtain a first recognition result, the first recognition result comprising first recognition information of the weld area in the target image; performing feature extraction on the target image to obtain a region representation; obtaining a context representation according to the first recognition result and the region representation, the context representation being used to represent the correlation between each pixel and the remaining pixels in the target image; and obtaining a second recognition result according to the context representation, the second recognition result comprising second recognition information of the weld area in the target image. The embodiments of the present application improve the accuracy of image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to an image recognition method, apparatus, and computer-readable storage medium. Background Technology

[0002] During battery manufacturing, after electrolyte filling, the filling hole needs to be sealed to prevent electrolyte leakage. This is typically done using sealing pins, which are inserted into the filling hole and then welded to the battery. Therefore, sealing pin welding is an indispensable step in battery production, and its quality directly affects the battery's safety performance.

[0003] The area where sealing nails are welded is called the weld bead. Due to environmental factors such as temperature changes during welding, defects such as pinholes, bursts, burst lines (also known as cold welds), incomplete welds, and molten beads often exist on the weld bead. During defect detection, the weld bead must first be located. The accuracy of weld bead location directly affects the accuracy of defect detection. Therefore, improving the accuracy of weld bead location is a technical problem that needs to be solved. Summary of the Invention

[0004] In view of the above problems, embodiments of this application provide an image recognition method, apparatus and computer-readable storage medium, which can improve the accuracy of image recognition.

[0005] According to a first aspect of the embodiments of this application, an image recognition method is provided, comprising: acquiring a target image, the target image including a weld bead region; performing initial segmentation on the target image to obtain a first recognition result, the first recognition result including first recognition information of the weld bead region in the target image; performing feature extraction on the target image to obtain a region representation; obtaining a context representation based on the first recognition result and the region representation, the context representation being used to characterize the correlation between each pixel and the remaining pixels in the target image; and obtaining a second recognition result based on the context representation, the second recognition result including second recognition information of the weld bead region in the target image.

[0006] By employing a coarse-to-fine segmentation approach, the target image is first identified. The results of this first identification are then used to enhance the features in the target image, obtaining a contextual representation that characterizes the correlation between each pixel and the remaining pixels. This contextual representation is then used for a second identification. Because the contextual information is fully utilized, a more accurate identification result can be obtained. The method of this application, when applied to the identification of sealing nail welds in batteries, can improve battery safety.

[0007] In some embodiments, the step of extracting features from the target image to obtain a region representation includes: extracting features from the target image to obtain a category representation matrix; and multiplying the matrix used to represent the first recognition result with the category representation matrix to obtain a region representation matrix used to represent the region representation.

[0008] Since the category representation includes feature information from different regions, and the first recognition result also includes feature information from different regions, the accuracy of the final region representation is improved by comprehensively utilizing the regional feature information included in both.

[0009] In some embodiments, obtaining a context representation based on the first recognition result and the region representation includes: multiplying a matrix representing the first recognition result with a region representation matrix representing the region representation to obtain a pixel correlation matrix, wherein the pixel correlation matrix is ​​used to represent the correlation between each pixel in the target image and other pixels in the region to which the pixel belongs; and multiplying the pixel correlation matrix with the region representation matrix to obtain a context representation matrix representing the context representation.

[0010] The context representation matrix, obtained based on the pixel correlation matrix and the region representation matrix, integrates the correlation between each pixel in the target image and other pixels in the region to which that pixel belongs. It has the ability to automatically perceive the context. The second identification of the weld area based on this context representation matrix can further improve the recognition accuracy.

[0011] In some embodiments, obtaining a second recognition result based on the context representation includes: performing a convolution operation on the context representation matrix used to represent the context representation to obtain the second recognition result.

[0012] By employing convolution operations, the original image data structure is preserved, avoiding the loss of spatial information caused by unfolding the image into vectors. Neurons in convolutional layers connect only to a small region in the previous layer via the convolution kernel, rather than using fully connected connections, which reduces training parameters and improves efficiency.

[0013] In some embodiments, the method further includes: extracting contour points of the weld area from the second recognition result; performing parameter fitting on the contour points to obtain a third recognition result, the third recognition result including third recognition information of the weld area in the target image.

[0014] By fitting parameters to the extracted contour points, the weld contour is smoothed, and a third recognition result is obtained, thereby improving the smoothness of weld area recognition.

[0015] In some embodiments, the weld bead region includes a first contour line and a second contour line, which enclose the weld bead region. The step of performing parameter fitting on the contour points to obtain a third recognition result includes: selecting N contour points from the contour points and adding them to a contour point set, where N > 1; performing parameter fitting on the contour point set to obtain a fitting model; using the fitting model to match the remaining contour points in the contour points other than those in the contour point set; adding the matching contour points that match the fitting model to the contour point set; repeating this step until a preset condition is met to obtain a final contour point set; performing parameter fitting on the final contour point set to obtain a final fitting model; and using the final fitting model as the third recognition result.

[0016] Initial inlier points are randomly sampled, and the model is gradually expanded and optimized after fitting. After multiple iterations, a better fitting model is obtained, which reduces the sensitivity to noise, makes the weld area positioning more accurate, and improves the accuracy of the fitting results.

[0017] In some embodiments, the first contour line is a circle or an ellipse, the second contour line includes a circular arc or an elliptical arc, and the parameter fitting is an ellipse fitting.

[0018] Ellipse fitting can effectively fit weld areas that are stretched or twisted, and a single fitting method can simultaneously meet the fitting requirements of 2D or 3D images.

[0019] According to a second aspect of the embodiments of this application, an image recognition apparatus is provided, comprising: an image acquisition module for acquiring a target image, the target image including a weld bead region; a first acquisition module for performing initial segmentation on the target image to obtain a first recognition result, the first recognition result including first recognition information of the weld bead region in the target image; a second acquisition module for performing feature extraction on the target image to obtain a region representation; a third acquisition module for obtaining a context representation based on the first recognition result and the region representation, the context representation being used to characterize the correlation between each pixel and the remaining pixels in the target image; and a fourth acquisition module for obtaining a second recognition result based on the context representation, the second recognition result including second recognition information of the weld bead region in the target image.

[0020] According to a third aspect of the present application, an image recognition device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, wherein the executable instruction causes the processor to perform the operation of the image recognition method as described above.

[0021] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided, characterized in that the storage medium stores at least one executable instruction, which, when executed on an image recognition device, causes the image recognition device to perform the operation of the image recognition method as described above.

[0022] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0023] The features, advantages, and technical effects of exemplary embodiments of this application will now be described with reference to the accompanying drawings.

[0024] Figure 1 This is a flowchart illustrating some embodiments of the image recognition method provided in this application;

[0025] Figure 2 These are schematic diagrams of sample images and recognition results annotated in some embodiments of this application;

[0026] Figure 3 This is a flowchart illustrating step S13 in some embodiments of this application;

[0027] Figure 4 This is a flowchart illustrating step S14 in some embodiments of this application;

[0028] Figure 5 This is a flowchart illustrating some embodiments of the image recognition method provided in this application;

[0029] Figure 6 This is a flowchart illustrating step S17 in some embodiments of this application;

[0030] Figure 7 These are schematic diagrams of the structure of an image recognition device provided in some embodiments of this application;

[0031] Figure 8 This is a schematic diagram of the structure of an image recognition device provided in some embodiments of this application. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0033] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used in the description of this application is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms "comprising" and "having," and any variations thereof, in the description, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the description, claims, or accompanying drawings of this application are used to distinguish different objects, not to describe a specific order or hierarchy. In the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0034] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.

[0035] As mentioned above, it should be emphasized that when the term "comprising / including" is used in this specification, it is used to explicitly indicate the presence of the stated feature, integer, step, or component, but does not exclude the presence or addition of one or more other features, integers, steps, components, or groups of features, integers, steps, or components. As used in this application, the singular forms "a," "an," and "the" also include the plural forms, unless the context clearly indicates otherwise.

[0036] The terms “a” and “an” used in this specification may mean one, but may also be used interchangeably with “at least one” or “one or more”. The term “about” generally means the mentioned value plus or minus 10%, or more specifically, plus or minus 5%. The term “or” used in the claims means “and / or” unless it is explicitly stated that it refers only to alternatives.

[0037] During battery manufacturing, after electrolyte filling, the filling hole needs to be sealed to prevent electrolyte leakage. This is typically done using sealing pins, which are inserted into the filling hole and then welded to the battery. Therefore, sealing pin welding is an indispensable step in battery production, and its quality directly affects the battery's safety performance.

[0038] The area where sealing nails are welded is called the weld bead, specifically the weld seam formed by each deposition or melting during welding. Due to changes in environmental factors such as temperature during welding, defects such as pinholes, bursts, burst lines (also known as cold welds), incomplete welds, and molten beads often exist on the weld bead. Visual AI (Artificial Intelligence) can automatically detect the presence of defects on the weld bead. During defect detection, the weld bead must first be located; the accuracy of the weld bead location directly affects the accuracy of defect detection.

[0039] Current weld bead localization schemes first specify the search range based on prior information about the weld bead position in the initial weld bead image, and perform two edge detections to obtain two initial edges. Then, a region growing algorithm is used to obtain the final weld bead contour region.

[0040] However, the weld bead search range determined based on prior information is easily affected by changes in processes and product models, potentially failing to cover the entire weld bead area or resulting in incorrect weld bead area positioning, leading to incomplete or offset weld bead localization. Furthermore, edge detection algorithms are susceptible to noise (e.g., molten beads or protrusions on the weld bead), causing inaccurate edge extraction. The lack of post-processing in the double edge detection method further amplifies the positioning error, resulting in unstable weld bead extraction performance.

[0041] Based on the findings of the above-mentioned problems, the inventors of this application have improved the weld bead positioning method to enhance the accuracy of weld bead positioning and improve battery safety performance. The various embodiments of this application will be further described below with reference to the accompanying drawings.

[0042] This application provides an image recognition method, apparatus, and computer-readable storage medium. It is understood that the image recognition method, apparatus, and computer-readable storage medium described in this application are applicable to the recognition of weld beads, wherein the weld bead can be a sealing nail weld bead of a battery or a weld bead in other areas, or a weld bead in other products. For ease of explanation, the following embodiments use the recognition of a battery sealing nail weld bead as an example.

[0043] Figure 1This is a schematic flowchart illustrating an image recognition method provided in some embodiments of this application. The method can be executed on an image recognition device, which can be a computer, server, or other electronic device capable of running a program and automatically and rapidly processing massive amounts of data. Image recognition software can be installed on the image recognition device to execute the image recognition method of the embodiments of this application. The method includes the following steps:

[0044] S11: Acquire the target image, which includes the weld area;

[0045] S12: Perform initial segmentation on the target image to obtain a first recognition result, which includes first recognition information of the weld area in the target image;

[0046] S13: Extract features from the target image to obtain region representation;

[0047] S14: Based on the first recognition result and the region representation, obtain the context representation, which is used to represent the correlation between each pixel and the remaining pixels in the target image;

[0048] S15: Based on the contextual representation, obtain the second recognition result, which includes the second recognition information of the weld area in the target image.

[0049] The purpose of this application embodiment is to identify weld beads in the sealing nail welding area of ​​the battery. Based on the identified weld beads, further detection of defects such as pinholes, burst points, burst lines (also known as cold welds), missing welds, and molten beads can be performed. Therefore, it is first necessary to acquire an image of the sealing nail welding area of ​​the battery to be tested, and then identify the weld beads based on this image. In step S11, the target image is an image including the weld bead area to be detected, for example... Figure 2 Image (a) is the target image, where region R1 is the weld bead region.

[0050] The target image can be acquired by the image acquisition device on the image recognition device, or by an image acquisition device other than the image recognition device, and then sent to the image recognition device. The image acquisition device can be a camera, LiDAR, or other device with image acquisition capabilities. Those skilled in the art should understand that the images acquired by the image acquisition device in the embodiments of this application can be processed, for example, by cropping the image outside the weld area, to improve the efficiency of image recognition.

[0051] In step S12, initial segmentation refers to the first identification of the weld bead region in the target image. The first identification result includes information about the weld bead region identified in the first identification. The segmentation method can employ existing image recognition methods, such as various neural network algorithms, including but not limited to fully connected neural networks and convolutional neural networks. It can be understood that the first identification information of the weld bead region included in the first identification result is the contour information of the weld bead region.

[0052] In step S13, feature extraction can also employ various existing feature extraction methods, such as deep learning-based neural network algorithms, scale-invariant feature transform (SIFT) algorithms, histogram of oriented gradients (HOG) algorithms, speeded uprobust features (SURF) algorithms, oriented fast and rotated brief (ORB) algorithms, local binary pattern (LBP) algorithms, etc.

[0053] In image recognition, there are various representation methods when segmenting an image into multiple regions. Region representation methods include array representation, hierarchical representation, and feature-based region representation. Among feature-based region representation methods, commonly used features include minimum bounding rectangle, geometric center, moments, Euler number, gray-level mean, and variance. Additionally, application-related region features can also be used to represent regions; for example, to interpret an image, the image representation should also include the relationships between adjacent regions. The target image includes not only weld bead regions but also other regions, such as cleaning regions and the circular protrusion region at the center of the sealing nail. This application embodiment obtains the region representation of each region based on feature extraction and obtains the contextual representation of pixels in subsequent steps based on the region representation.

[0054] In image recognition, by identifying useful global contextual information and effectively utilizing information from the area surrounding the target, it is possible to better detect and infer target content. Therefore, step S14 obtains a contextual representation based on the initially segmented weld bead region information and region representation, which characterizes the correlation between each pixel and the remaining pixels in the target image, for use in the second recognition, resulting in the second recognition result. Figure 2 As shown in (b), the second identification result includes the outer circular area R2 of the cleaning area, the weld area R1, and the circular protrusion area R3 at the center of the sealing nail.

[0055] The image recognition method of this application embodiment first performs a coarse-to-fine segmentation of the target image. The results of this first recognition are then used to enhance the features in the target image, obtaining a contextual representation that characterizes the correlation between each pixel and the remaining pixels in the target image. A second recognition is then performed using this contextual representation. By fully utilizing the contextual information, a more accurate recognition result can be obtained. When applied to the recognition of sealing stud welds in batteries, the method of this application embodiment can improve battery safety.

[0056] Furthermore, the image recognition method in this application embodiment does not rely on prior weld position information, thus improving the independence and efficiency of recognition.

[0057] The specific processes of image feature extraction, representation, and recognition in some embodiments of this application will be further described below. Specifically, a convolutional neural network will be used as an example for further description.

[0058] Please see Figure 3 , Figure 3 This is a flowchart illustrating step S13 in some embodiments of this application. As shown in the figure, feature extraction is performed on the target image to obtain region representation, including:

[0059] S131: Extract features from the target image to obtain the category representation matrix;

[0060] S132: Multiply the matrix used to represent the first recognition result with the category representation matrix to obtain the region representation matrix used to represent the region.

[0061] Different regions in the target image, such as the weld bead region, the cleaning region, and the circular protrusion at the center of the sealing nail, are represented as different features during image recognition. When identifying weld bead regions, feature extraction can obtain category representations of various features, also known as classification.

[0062] In convolutional neural networks (CNNs), when an image is input into the CNN, its original data structure is preserved, such as an M×N two-dimensional matrix (for black and white images) or an L×M×N three-dimensional matrix (for color images). Feature extraction and classification are then performed on this basis. Therefore, the data obtained after various image processing operations in this embodiment are all in matrix form. For example, the category representations of various features obtained through feature extraction are also in matrix form, called category representation matrices; the first recognition result obtained after initial segmentation of the target image is also represented by a matrix.

[0063] Based on the initial segmentation, the first identification result, and the category representation, a region representation can be obtained. Step S132 involves multiplying (i.e., weighted summing) the matrix used to represent the first identification result with the category representation matrix to obtain the region representation matrix.

[0064] Since the category representation includes feature information from different regions, and the first recognition result also includes feature information from different regions, the accuracy of the final region representation is improved by comprehensively utilizing the regional feature information included in both.

[0065] Please see Figure 4 , Figure 4 This is a flowchart illustrating step S14 in some embodiments of this application. As shown in the figure, based on the first identification result and the region representation, a context representation is obtained, including:

[0066] S141: Multiply the matrix used to represent the first recognition result with the region representation matrix used to represent the region representation to obtain the pixel correlation matrix. The pixel correlation matrix is ​​used to represent the correlation between each pixel in the target image and other pixels in the region to which the pixel belongs.

[0067] S142: Multiply the pixel correlation matrix with the region representation matrix to obtain the context representation matrix used to represent the context representation.

[0068] Images are composed of pixels, and these pixels are not independent; they are interconnected, a relationship known as pixel correlation. Noise in images often manifests as isolated pixels or pixel blocks that cause strong visual effects. Normally, noise signals are uncorrelated with valid pixel signals, appearing as useless information. Therefore, by considering pixel correlations, a single pixel can provide reference information about other pixels during image processing, thus enabling more efficient image processing.

[0069] The first recognition result includes feature information of each pixel, and the region representation includes feature information of different regions. The matrix used to represent the first recognition result is multiplied with the region representation matrix used to represent the region representation to obtain a pixel correlation matrix used to represent the correlation between each pixel in the target image and other pixels in the region to which the pixel belongs. This is then further multiplied with the region representation matrix to obtain a context representation matrix used to represent the context representation.

[0070] The context representation matrix, obtained based on the pixel correlation matrix and the region representation matrix, integrates the correlation between each pixel in the target image and other pixels in the region to which that pixel belongs. It has the ability to automatically perceive the context. The second identification of the weld area based on this context representation matrix can further improve the recognition accuracy.

[0071] In some embodiments, obtaining a second identification result based on contextual representation includes:

[0072] S151: Perform a convolution operation on the context representation matrix used to represent the context representation to obtain the second recognition result.

[0073] A second weld bead recognition is achieved by performing a convolution operation on the context representation matrix, resulting in a second recognition result. The convolution operation preserves the original image data structure, such as an M×N two-dimensional matrix or an L×M×N three-dimensional matrix, without unfolding the image into vectors and losing spatial information. Instead of fully connected layers, neurons in the convolutional layer connect only to a small region in the previous layer via the convolution kernel, reducing training parameters and improving efficiency.

[0074] Those skilled in the art should understand that the above steps S12 to S15 can be implemented using a trained image recognition model. A deep learning-based neural network model is trained using sample images to obtain a trained image recognition model. The target image to be detected is then input into this trained image recognition model, and the model outputs a second recognition result, which can be used as the initial segmentation result for weld bead recognition.

[0075] The sample images need to be labeled, which means manually labeling the weld bead areas on the sample images acquired by the image acquisition device. The weights of the neural network model are then optimized based on the manually labeled weld bead areas to complete the model training. When labeling the weld bead areas, a discrete point labeling method is generally used, requiring the labeling of a complete area.

[0076] In this embodiment, when annotating the weld area in the sample image, discrete points can be annotated only at certain intervals within the weld area, cleaning area, and sealing nail area. This improves annotation efficiency compared to annotating the entire outer edge of the area. Furthermore, areas other than the weld area may not be fully preserved in the target image; for example... Figure 2 The region represented by contour L1 shown in (a) is an example. If only a single contour line is annotated for this region, the contour line will be broken. For this type of contour, if the contour itself has a certain width, the problem of a broken contour line can be solved by annotating the entire width edge of the contour to form a non-broken contour line.

[0077] Please see Figure 5 , Figure 5 This is a schematic flowchart of an image recognition method provided in some embodiments of this application. As shown in the figure, in Figure 1 Based on the illustrated embodiment, the method further includes:

[0078] S16: Extract the contour points of the weld area from the second recognition result;

[0079] S17: Perform parameter fitting on the contour points to obtain the third recognition result, which includes the third recognition information of the weld area in the target image.

[0080] pass Figure 1 In the illustrated embodiment, the second identification result includes the outer circle of the cleaning area, the weld bead, and the circular protrusion at the center of the sealing nail. To further improve the accuracy of the identification result, morphological post-processing can be used to obtain more regular weld bead parameters, for example... Figure 2 In (b), the weld bead is annular, and the weld bead parameters are the parameters of the inner and outer circles of the weld bead. Those skilled in the art should understand that the figure shown is only an example, and in other embodiments, the weld bead may also be arc-shaped, strip-shaped, or other shapes, and the corresponding weld bead parameters are the parameters corresponding to the shape of the weld bead.

[0081] First, the contour points of the weld bead region in the second recognition result are searched and extracted. For example, for... Figure 2 In section (b), the inner and outer circular contour points of the weld bead are searched. Then, the searched contour points are fitted with parameters to obtain the third identification result of the weld bead region.

[0082] By fitting parameters to the extracted contour points, the weld contour is smoothed, and a third recognition result is obtained, thereby improving the smoothness of weld area recognition.

[0083] Since the weld bead area is usually an area with a certain width, the weld bead area usually includes at least a first contour line and a second contour line, which together form the weld bead area. Figure 2 In (b), the first contour line is the circle (outer circle) of region R2, and the second contour line is the circle (inner circle) of region R3.

[0084] Please see Figure 6 , Figure 6 This is a flowchart illustrating step S17 in some embodiments of this application. As shown in the figure, when the weld area typically includes a first contour line and a second contour line, parameter fitting is performed on the contour points to obtain a third identification result, including:

[0085] S171: Select N contour points from the contour points and add them to the contour point set, where N > 1;

[0086] S172: Perform parameter fitting on the contour point set to obtain a fitting model. Use the fitting model to match the remaining contour points in the contour points other than those in the contour point set. Add the matching contour points that match the fitting model to the contour point set.

[0087] S173: Determine whether the preset conditions are met. If yes, proceed to step S174; otherwise, proceed to step S172.

[0088] The preset conditions can be reaching a predetermined number of iterations or the number of contour points in the contour point set reaching a set threshold.

[0089] Step S173 can be used to repeat step S172 until the preset conditions are met, and the final set of contour points is obtained.

[0090] S174: Perform parameter fitting on the final contour point set to obtain the final fitted model, and use the final fitted model as the third recognition result.

[0091] Typically, the first and second contour lines obtained from the contour points extracted in step S106 are quite irregular, and the weld area enclosed by the first and second contour lines is also irregular. Therefore, contour points (i.e. noise points) at irregular positions can be further identified and removed, so that the remaining contour points can form a smoother contour line.

[0092] This application embodiment uses a parameter fitting method. For the entire contour point set, a small portion of the data is first randomly selected as inliers, and parameter fitting is performed on the selected inliers to obtain a fitting model. The fitting model is then used to predict the remaining points in the contour point set (also called outliers). If the remaining points also fit the fitting model, they are considered inliers, thus expanding the inlier set. If a sufficient number of points are classified as inliers, the current estimated fitting model is considered reasonable. Subsequently, the current inlier set is used to fit a new fitting model, thereby continuously optimizing the fitting model and obtaining more inliers. When a predetermined number of iterations is reached or the number of inliers increases to a set threshold, the iteration of the fitting model is stopped. The final outliers are considered noise points and are thus removed. For the inlier set obtained after removing the final outliers, a fitting algorithm is used for parameter fitting, and the obtained fitting result is used as the final recognition result.

[0093] Initial inlier points are randomly sampled, and the model is gradually expanded and optimized after fitting. After multiple iterations, a better fitting model is obtained, which reduces the sensitivity to noise, makes the weld area positioning more accurate, and improves the accuracy of the fitting results.

[0094] In some embodiments, the first profile is a circle or an ellipse, and the second profile includes a circular arc or an elliptical arc, with parameter fitting being ellipse fitting. The standard equations for the inner and outer circles (or ellipses) of the weld bead can be obtained through ellipse fitting.

[0095] In practical applications, when the image acquisition device is a camera, due to camera imaging, the circular or elliptical weld bead areas in the 3D target image containing 3D information exhibit stretching, distortion, and other deformations. Using circle fitting will not perfectly capture the weld bead contour; in other words, a circle cannot accurately depict the entire weld bead area. Ellipse fitting, on the other hand, can better fit weld bead areas that are stretched or distorted, allowing a single fitting method to simultaneously meet the fitting requirements of both 2D and 3D images.

[0096] The above text combines Figures 1 to 6 The image recognition method of this application embodiment is described below, and will be combined with Figure 7 The image recognition apparatus described in this application refers to the foregoing embodiments for parts not described in detail. Figure 7 This is a schematic diagram of the structure of an image recognition device provided in some embodiments of this application. As shown in the figure, the image recognition device 700 includes: an image acquisition module 701, a first acquisition module 702, a second acquisition module 703, a third acquisition module 704, and a fourth acquisition module 705. Wherein:

[0097] Image acquisition module 701 is used to acquire a target image, which includes the weld area;

[0098] The first acquisition module 702 is used to perform initial segmentation on the target image and obtain a first recognition result, the first recognition result including first recognition information of the weld area in the target image;

[0099] The second acquisition module 703 is used to extract features from the target image and obtain region representation;

[0100] The third obtaining module 704 is used to obtain a contextual representation based on the first recognition result and the region representation. The contextual representation is used to represent the correlation between each pixel and the remaining pixels in the target image.

[0101] The fourth obtaining module 705 is used to obtain a second recognition result based on the context representation. The second recognition result includes second recognition information of the weld area in the target image.

[0102] The image recognition device of this application embodiment first performs a coarse-to-fine segmentation of the target image, then uses the result of the first recognition to enhance the features in the target image, obtaining a contextual representation that characterizes the correlation between each pixel and the other pixels in the target image. A second recognition is then performed using this contextual representation. Because the contextual information is fully utilized, a more accurate recognition result can be obtained. When applied to the recognition of sealing nail welds in batteries, the method of this application embodiment can improve battery safety.

[0103] In some embodiments, feature extraction is performed on the target image to obtain a region representation, including:

[0104] Feature extraction is performed on the target image to obtain the category representation matrix;

[0105] Multiply the matrix used to represent the first identification result with the category representation matrix to obtain the region representation matrix used to represent the region.

[0106] In some embodiments, a contextual representation is obtained based on the first identification result and the region representation, including:

[0107] The matrix representing the first recognition result is multiplied by the region representation matrix representing the region to obtain the pixel correlation matrix. The pixel correlation matrix is ​​used to represent the correlation between each pixel in the target image and other pixels in the region to which the pixel belongs.

[0108] Multiplying the pixel correlation matrix by the region representation matrix yields the context representation matrix used to represent the context.

[0109] In some embodiments, obtaining a second identification result based on contextual representation includes:

[0110] A convolution operation is performed on the context representation matrix used to represent the context representation to obtain the second recognition result.

[0111] In some embodiments, the apparatus further includes an extraction module and a fitting module. Wherein:

[0112] The extraction module is used to extract the contour points of the weld area from the second recognition result;

[0113] The fitting module is used to perform parameter fitting on the contour points to obtain the third recognition result, which includes the third recognition information of the weld area in the target image.

[0114] In some embodiments, the weld bead region includes a first contour line and a second contour line, which together form the weld bead region.

[0115] By fitting parameters to the contour points, a third recognition result is obtained, including:

[0116] Select N contour points from the contour points and add them to the contour point set, where N > 1;

[0117] Perform parameter fitting on the contour point set to obtain a fitting model. Use the fitting model to match the remaining contour points in the contour point set other than the contour points in the contour point set. Add the matching contour points that match the fitting model to the contour point set. Repeat this step until the preset conditions are met to obtain the final contour point set.

[0118] The final set of contour points is fitted with parameters to obtain the final fitted model, which is then used as the third recognition result.

[0119] In some embodiments, the first contour line is a circle or an ellipse, the second contour line includes a circular arc or an elliptical arc, and the parameter fitting is an ellipse fitting.

[0120] The above text combines Figures 1 to 6 The image recognition method of this application embodiment is described below, and will be combined with Figure 8 The image recognition apparatus described in this application refers to the foregoing embodiments for parts not described in detail. Figure 8 This is a schematic diagram of the structure of an image recognition device provided in some embodiments of this application. As shown in the figure, the image recognition device 800 includes a processor 801, a memory 802, a communication interface 803, and a communication bus 804. The processor 801, the memory 802, and the communication interface 803 communicate with each other through the communication bus 804.

[0121] The memory 802 is used to store at least one executable instruction, which causes the processor 801 to perform the operation of the image recognition method in the above embodiment.

[0122] This application also provides a computer-readable storage medium storing at least one executable instruction. When the executable instruction is run on an image recognition device, it causes the image recognition device to perform the operation of the image recognition method described above.

[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and they should all be covered within the scope of the claims and specification of this application. In particular, as long as there is no structural conflict, the various technical features mentioned in the embodiments can be combined in any way. This application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. An image recognition method characterized by, The method comprises: acquiring a target image, the target image comprising a weld area; performing initial segmentation on the target image to obtain a first recognition result, the first recognition result comprising first recognition information of the weld area in the target image; performing feature extraction on the target image to obtain a region representation; obtaining a context representation according to the first recognition result and the region representation, the context representation being used to represent the relevance of each pixel and other pixels in the target image; obtaining a second recognition result according to the context representation, the second recognition result comprising second recognition information of the weld area in the target image; the step of obtaining a context representation according to the first recognition result and the region representation comprises: multiplying a matrix used to represent the first recognition result by a region representation matrix used to represent the region representation to obtain a pixel relevance matrix, the pixel relevance matrix being used to represent the relevance of each pixel and other pixels in the region to which the pixel belongs in the target image; and multiplying the pixel relevance matrix by the region representation matrix to obtain a context representation matrix used to represent the context representation; the step of obtaining a second recognition result according to the context representation comprises: performing convolution operation on the context representation matrix used to represent the context representation to obtain the second recognition result.

2. The method of claim 1, wherein, The step of performing feature extraction on the target image to obtain a region representation comprises: performing feature extraction on the target image to obtain a category representation matrix; multiplying the category representation matrix by a matrix used to represent the first recognition result to obtain a region representation matrix used to represent the region representation.

3. The method according to any one of claims 1 to 2, wherein, The method further comprises: extracting contour points of the weld area in the second recognition result; performing parameter fitting on the contour points to obtain a third recognition result, the third recognition result comprising third recognition information of the weld area in the target image.

4. The method of claim 3, wherein, The weld area comprises a first contour line and a second contour line, the first contour line and the second contour line enclosing the weld area, the step of performing parameter fitting on the contour points to obtain a third recognition result comprises: selecting N contour points from the contour points to form a contour point set, N>1; performing parameter fitting on the contour point set to obtain a fitting model, matching the contour points other than the contour points in the contour point set with the fitting model, adding the matched contour points to the contour point set, and repeating the step until a preset condition is met to obtain a final contour point set; performing parameter fitting on the final contour point set to obtain a final fitting model, and taking the final fitting model as the third recognition result.

5. The method of claim 4, wherein, The first contour line is a circle or an ellipse, the second contour line comprises a circular arc or an elliptical arc, and the parameter fitting is elliptical fitting.

6. An image recognition apparatus characterized by comprising: The method comprises: an image acquisition module configured to acquire a target image, the target image comprising a weld area; A first obtaining module is configured to perform initial segmentation on the target image to obtain a first recognition result, the first recognition result comprising first recognition information of the weld bead region in the target image; A second obtaining module is configured to perform feature extraction on the target image to obtain a region representation; A third obtaining module is configured to obtain a context representation according to the first recognition result and the region representation, the context representation being used to represent the correlation between each pixel and other pixels in the target image; A fourth obtaining module is configured to obtain a second recognition result according to the context representation, the second recognition result comprising second recognition information of the weld bead region in the target image; The third obtaining module is configured to multiply a matrix used to represent the first recognition result by a region representation matrix used to represent the region representation to obtain a pixel correlation matrix, the pixel correlation matrix being used to represent the correlation between each pixel and other pixels in the region to which the pixel belongs in the target image; The pixel correlation matrix is multiplied by the region representation matrix to obtain a context representation matrix used to represent the context representation; The fourth obtaining module is configured to perform convolution operation on the context representation matrix used to represent the context representation to obtain the second recognition result.

7. An image recognition apparatus characterized by comprising: Comprise: A processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete the communication among each other through the communication bus; The memory is used to store at least one executable instruction, and the executable instruction makes the processor execute the operation of the image recognition method in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The storage medium has at least one executable instruction stored therein, and the executable instruction makes the image recognition device execute the operation of the image recognition method in any one of claims 1-5 when the image recognition device runs.

Citation Information

Patent Citations

  • Face image segmentation method and segmentation network combining object context information

    CN112508032A

  • Image processing method and image processing system

    JP2014014856A