Welding area detection method, device and equipment and storage medium
By obtaining the actual position information of the welding points, welding point images are cropped and detected, and the pre-trained model is used for automated detection, which solves the problems of low manual detection efficiency and poor accuracy, and achieves efficient and accurate welding point quality detection.
Patent Information
- Application Number
- CN202310333629.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-01
AI Technical Summary
Existing solder joint detection mainly relies on manual labor, which has problems of missed detection and false detection. In addition, detection efficiency is low under low light or obstruction conditions, making it difficult to avoid missed detection and confusion.
By obtaining the actual position information of the welding points, welding point images are cropped and detected, and the pre-trained welding point classification model is used for automated detection, which reduces the amount of calculation and increases the calculation speed.
It realizes automated welding point quality inspection, improves inspection efficiency, reduces missed inspections and false inspections, and enhances the accuracy of inspection results.
Smart Images

Figure CN118735839A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle detection technology, and in particular to a welding area detection method, device, equipment and storage medium. Background Art
[0002] During the vehicle production process, it is necessary to manage the materials or data involved in each process. For example, after the vehicle completes the welding procedures of all stud welding points in the welding workshop, all stud welding points need to be inspected. For example, whether there are any abnormal conditions such as missing welding studs or whether welding studs have fallen off.
[0003] In the related art, the quality inspection method of welding points is manual inspection, which wastes a lot of manpower and material resources. In addition, in actual scenarios, due to the possible existence of weak light, occlusion and other problems, it is easy for inspectors to miss or mis-inspect welding areas.
[0004] Therefore, how to improve vehicle inspection efficiency, avoid missed inspections, and avoid confusion in inspection standards has become an urgent problem to be solved. Summary of the invention
[0005] The present disclosure provides a welding area detection method, device, equipment and storage medium. After cutting out the welding point images according to the actual position information of the welding point, the obtained welding point images are subjected to category detection. This can reduce the amount of calculation and improve the calculation speed on the basis of realizing automatic detection of welding point quality.
[0006] In a first aspect, an embodiment of the present disclosure provides a welding area detection method, the method comprising:
[0007] Acquire a detection image corresponding to the area to be detected and a template image corresponding to the area to be detected;
[0008] Acquiring actual position information of welding points included in the template image;
[0009] Based on the actual position information, cropping is performed at a corresponding position of the detection image to obtain at least one welding point image;
[0010] For each of the welding point images, the welding point image is detected to obtain a detection result corresponding to the area to be detected.
[0011] In one embodiment of the present disclosure, for each welding point image, detecting the welding point image to obtain a detection result corresponding to the area to be detected includes:
[0012] For each welding point image, detect the welding point image using a pre-trained welding point classification model to obtain the category to which the welding point image belongs;
[0013] If the category to which the welding point image belongs is the first category, determining that the welding point in the welding point image is normal;
[0014] If the category to which the welding point image belongs is the second category, determining that the welding point in the welding point image is abnormal;
[0015] The welding point conditions corresponding to at least one or more welding point images are summarized to obtain a detection result corresponding to the area to be detected.
[0016] In one embodiment of the present disclosure, cropping is performed at a corresponding position of the detection image based on the actual position information to obtain at least one welding point image, including:
[0017] Calculate the mapping relationship between the template image and the detection image based on a computer vision model;
[0018] Mapping the actual position information onto the detection image according to the mapping relationship to obtain the detection position information in the detection image;
[0019] The detection image is cropped according to the detection position information to obtain at least one welding point map.
[0020] In one embodiment of the present disclosure, the detection image is cropped according to the detection position information to obtain at least one welding point map, including:
[0021] Cropping the detection image according to the detection position information to obtain a cropped area image;
[0022] The cropped area image is scaled to a set resolution to obtain a welding point image.
[0023] In one embodiment of the present disclosure, calculating the mapping relationship between the template image and the detection image based on a computer vision model includes:
[0024] Extracting feature points in the template image using a preset feature point extraction strategy to obtain a plurality of first target feature points;
[0025] Extracting feature points in the detection image using a preset feature point extraction strategy to obtain a plurality of second target feature points;
[0026] Determine a relationship matrix based on a computer vision model, wherein the relationship matrix is used to represent the correspondence between each set of feature points on an image obtained by photographing the same object at different angles each time by a camera;
[0027] The relationship matrix is solved by jointly using the first target feature point and the second target feature point to obtain a mapping relationship between the template image and the detection image.
[0028] In one embodiment of the present disclosure, the preset feature point extraction strategy includes:
[0029] Extract feature points from the image;
[0030] Sort the feature points in descending order according to the confidence levels corresponding to the feature points;
[0031] The feature points ranked in the top n positions of the confidence are taken as target feature points.
[0032] In one embodiment of the present disclosure, the training process of the welding point classification model includes:
[0033] Acquire multiple sample images;
[0034] For each sample image, extract the welding point area of the sample image to obtain an interest point area image, and extract the background area of the sample image to obtain a non-interest point area image, wherein the annotation information corresponding to the interest point area image is of the first category, and the annotation information corresponding to the non-interest point area image is of the second category;
[0035] The interest point area image and its corresponding annotation information, the non-interest point area image and its corresponding annotation information are used to train a preset network model to obtain a welding point classification model.
[0036] In a second aspect, an embodiment of the present disclosure provides a welding area detection device, the device comprising:
[0037] An image acquisition module is used to acquire a detection image corresponding to the area to be detected and a template image corresponding to the area to be detected;
[0038] An actual position information acquisition module, used to acquire actual position information of the welding point included in the template image;
[0039] A welding point image determination module, configured to perform cropping at a corresponding position of the detection image based on the actual position information to obtain at least one welding point image;
[0040] The detection result determination module is used to detect each of the welding point images to obtain the detection result corresponding to the area to be detected.
[0041] In one embodiment of the present disclosure, the detection result determination module includes: a welding point image detection unit, which is used to detect the welding point image using a pre-trained welding point classification model for each welding point image to obtain the category to which the welding point image belongs; a normal welding point determination unit, which is used to determine that the welding points in the welding point image are normal if the category to which the welding point image belongs is the first category; an abnormal welding point determination unit, which is used to determine that the welding points in the welding point image are abnormal if the category to which the welding point image belongs is the second category; and a welding point situation summary unit, which is used to summarize the welding point situations corresponding to at least one or more welding point images to obtain the detection result corresponding to the area to be detected.
[0042] In one embodiment of the present disclosure, a welding point image determination module includes: an image mapping relationship determination unit, which is used to calculate the mapping relationship between the template image and the detection image based on a computer vision model; a detection position information determination unit, which is used to map the actual position information to the detection image according to the mapping relationship to obtain the detection position information in the detection image; and a welding point image determination unit, which is used to crop the detection image according to the detection position information to obtain at least one welding point image.
[0043] In one embodiment of the present disclosure, the welding point image determination unit is specifically used to crop the detection image according to the detection position information to obtain a cropped area image; and scale the cropped area image to a set resolution to obtain a welding point image.
[0044] In one embodiment of the present disclosure, an image mapping relationship determination unit includes: a feature point extraction subunit, used to extract feature points in the template image using a preset feature point extraction strategy to obtain a plurality of first target feature points; and to extract feature points in the detection image using a preset feature point extraction strategy to obtain a plurality of second target feature points; a relationship matrix determination subunit, used to determine a relationship matrix based on a computer vision model, wherein the relationship matrix is used to represent the correspondence between each group of feature points on an image obtained by photographing the same object at different angles each time by a camera; and a mapping relationship determination subunit, used to solve the relationship matrix using the first target feature points and the second target feature points to obtain a mapping relationship between the template image and the detection image.
[0045] In one embodiment of the present disclosure, the preset feature point extraction strategy includes: extracting feature points from an image; sorting the feature points in descending order according to the confidences corresponding to the feature points; and taking the feature points whose confidences are ranked in the top n as target feature points.
[0046] In one embodiment of the present disclosure, a model training module is used to train a welding point classification model, including: a sample image acquisition unit, used to acquire multiple sample images; a region image extraction unit, used to perform welding point region extraction on the sample image for each sample image to obtain an interest point region image, and extract the background region of the sample image to obtain a non-interest point region image, wherein the annotation information corresponding to the interest point region image is of a first category, and the annotation information corresponding to the non-interest point region image is of a second category; the model training unit is used to train a preset network model using the interest point region image and its corresponding annotation information, and the non-interest point region image and its corresponding annotation information to obtain a welding point classification model.
[0047] In a third aspect, an embodiment of the present disclosure provides an electronic device, the electronic device comprising:
[0048] one or more processors;
[0049] A storage device for storing one or more programs;
[0050] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of the first aspects above.
[0051] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements a method as described in any one of the above-mentioned first aspects.
[0052] The welding area detection method, device, equipment and storage medium provided by the embodiments of the present disclosure include: obtaining a detection image corresponding to the area to be detected and a template image corresponding to the area to be detected; obtaining the actual position information of the welding point included in the template image; cropping the corresponding position of the detection image based on the actual position information to obtain at least one welding point image; for each welding point image, detecting the welding point image to obtain the detection result corresponding to the area to be detected. The embodiments of the present disclosure can reduce the amount of calculation and improve the calculation speed on the basis of realizing automatic detection of welding point quality by performing category detection on the obtained welding point image after cropping according to the actual position information of the welding point. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0055] Figure 1 A schematic flow chart of a welding area detection method provided in an embodiment of the present disclosure;
[0056] Figure 2 A schematic diagram of the location of a welding point area in an image provided in an embodiment of the present disclosure;
[0057] Figure 3 A schematic diagram of a detection result display provided in an embodiment of the present disclosure;
[0058] Figure 4 A schematic flow chart of a welding area detection method provided in an embodiment of the present disclosure;
[0059] Figure 5 A schematic diagram of comparison of images before and after alignment provided in an embodiment of the present disclosure;
[0060] Figure 6 A training flow chart of a welding point classification model provided in an embodiment of the present disclosure;
[0061] Figure 7 A schematic diagram of a model training process and a use process provided in an embodiment of the present disclosure;
[0062] Figure 8 A structural schematic diagram of a welding area detection device provided in an embodiment of the present disclosure;
[0063] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0064] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0065] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0066] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0067] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0068] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0069] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0070] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0071] The following embodiments describe in detail the welding area detection method provided in the embodiments of the present disclosure in conjunction with the accompanying drawings.
[0072] Figure 1 The figure is a flow chart of a welding area detection method in an embodiment of the present disclosure. The embodiment can be applied to the situation of detecting the quality of welding points in the area. The welding area detection method is executed by a welding area detection device. The welding area detection device can be implemented in software and / or hardware, and the welding area detection device can be configured in an electronic device.
[0073] For example: the electronic device can be a mobile terminal, a fixed terminal or a portable terminal, such as a mobile phone, a station, a unit, a device, a multimedia computer, a multimedia tablet, an Internet module, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof.
[0074] For another example: the electronic device may be a server, wherein the server may be a physical server or a cloud server, and the server may be a server or a server cluster.
[0075] Specifically, Figure 1 As shown, the welding point detection method provided by the embodiment of the present disclosure mainly includes steps S101-S104.
[0076] S101, obtaining a detection image corresponding to a to-be-detected area and a template image corresponding to the to-be-detected area.
[0077] The area to be inspected can be understood as an area where the quality of the stud welding points in the area needs to be inspected. Furthermore, the area to be inspected can be a part of a device or an object, or the entire visible area of a device or an object. For example, the area to be inspected can be the bottom area of a vehicle, or the area to be inspected can be the wheel hub area of a vehicle. For another example, the area to be inspected can be a circuit board with welding points.
[0078] Among them, the detection image corresponding to the area to be detected refers to the image obtained after the acquisition device shoots the area to be detected, wherein the detection image can be a two-dimensional image or a three-dimensional image, which is not specifically limited in the embodiments of the present disclosure.
[0079] The template image corresponding to the area to be detected is an image pre-set to calibrate the actual position of the stud welding point in the area to be detected. It should be noted that the detection image corresponding to the area to be detected and the template image corresponding to the area to be detected are images taken for the same area.
[0080] In one embodiment of the present disclosure, in response to the device to be detected reaching a specified position, an image acquisition instruction is generated to control the acquisition device to photograph the area to be detected to obtain a detection image.
[0081] In one embodiment of the present disclosure, after obtaining the detection image corresponding to the area to be detected, the area identifier of the area to be detected is obtained, and a query is performed in the correspondence between the area identifier and the template image to obtain the template image corresponding to the area to be detected. One area corresponds to one template image.
[0082] In one embodiment of the present disclosure, the camera that generates the template image corresponding to the area to be detected and the camera that generates the detection image corresponding to the area to be detected can be the same camera or different cameras. It should be noted that whether it is the same camera or different cameras, it is necessary to ensure that the internal and external parameters of the camera are the same. Furthermore, when the above-mentioned cameras are different cameras, the external installation conditions of the cameras should remain consistent.
[0083] S102: Acquire actual position information of welding points included in the template image.
[0084] In the embodiment of the present disclosure, the actual position information of the welding point refers to the position information used to represent the stud welding point in the template image. The position information of the welding point can be a circular area represented by the center and radius, or a square area represented by two coordinate points. In the embodiment of the present disclosure, the position information of the welding point is a square area represented by two coordinate points as an example. Figure 2 As shown, the position information of the welding point is represented by a square frame. For example, the coordinate value of the upper left vertex and the coordinate value of the lower right vertex of the square frame can be used to represent the position information of the welding point.
[0085] In one embodiment of the present disclosure, the position information of the welding point is marked in the template image by pre-marking. After the template image is acquired, the corresponding marked position information is acquired as the actual position information of the welding point.
[0086] In the embodiment of the present disclosure, each welding point corresponds to one piece of actual position information, and the number of welding points included in the template image is consistent with the number of actual position information. In other words, if the template image includes several welding points, several corresponding actual position information can be obtained. For example, if the template image includes 3 welding points, 3 pieces of actual position information can be obtained.
[0087] In one embodiment of the present disclosure, after acquiring the template image, feature extraction and image recognition are performed on the template image to obtain actual position information of the welding points included in the template image.
[0088] S103: Crop the corresponding position of the detection image based on the actual position information to obtain at least one welding point image.
[0089] In the disclosed embodiment, the corresponding position of the detection image refers to the area corresponding to the actual position information in the detection image. Taking the actual position information as (U0, V0) and (U1, V1) as an example, the square area formed by the coordinate value of the upper left vertex (U0, V0) and the coordinate value of the lower right vertex (U1, V1) in the detection image is the corresponding position of the actual position information in the detection image. The square area formed by the coordinate value of the upper left vertex (U0, V0) and the coordinate value of the lower right vertex (U1, V1) is cropped to obtain a regional image including the welding point, which is the welding point image.
[0090] In the embodiment of the present disclosure, the above-mentioned cropping operation is performed for each actual position information, and a plurality of welding point images can be obtained.
[0091] S104: for each of the welding point images, detect the welding point image to obtain a detection result corresponding to the area to be detected.
[0092] In the embodiment of the present disclosure, the welding point image is inspected to determine whether there are any abnormalities in the welding points included in the welding point image. If each welding point image is inspected normally, the inspection result corresponding to the area to be inspected is determined to be qualified; if any welding point image is inspected abnormally, the inspection result corresponding to the inspection area is determined to be unqualified.
[0093] In the embodiment of the present disclosure, for each of the welding point images, the welding point image is detected to obtain the detection result corresponding to the area to be detected, including: for each of the welding point images, the welding point image is detected using a pre-trained welding point classification model to obtain the category to which the welding point image belongs; if the category to which the welding point image belongs is the first category, it is determined that the welding points in the welding point image are normal; if the category to which the welding point image belongs is the second category, it is determined that the welding points in the welding point image are abnormal; and the welding point conditions corresponding to at least one or more of the welding point images are summarized to obtain the detection result corresponding to the area to be detected.
[0094] The first category and the second category are set during the training process of the welding point classification model, wherein the welding point classification model is obtained by training a binary classification detection network. For example, the first category can be "1" and the second category can be "0".
[0095] Among them, a normal welding point in the welding point image means that the welding point included in the welding point image does not have a leaking weld, a missing weld, or a situation where the stud falls off after welding, and an abnormal welding point in the welding point image means that the welding point included in the welding point image has a leaking weld, a missing weld, or a situation where the stud falls off after welding.
[0096] In one embodiment of the present disclosure, each welding point image is inspected, and the welding point inspection results of each welding point image are obtained and then summarized as the inspection results corresponding to the area to be inspected.
[0097] Based on the above embodiment, the method further includes: marking in the detection image based on each actual position information; and displaying the marked detection image.
[0098] In the disclosed embodiment, the area corresponding to the position information in the detection image is marked based on the actual position information, and the marked detection image is displayed for the staff to view, so that the staff can further manually check the condition of the welding point to improve the accuracy of welding quality detection. In addition, when there is a welding leak or welding point drop in the welding point to be detected, the staff can intuitively view the welding point with abnormal conditions, which is convenient for the staff to perform repair welding operations. The specific display method is as follows: Figure 3 As shown, the welding points in area 1 are normal, the welding points in area 2 are normal, and the welding points in area 3 are abnormal.
[0099] On the basis of the above embodiments, the embodiment of the present disclosure optimizes the welding area detection method, and the optimized welding area detection method mainly includes the following steps:
[0100] S201, obtaining a detection image corresponding to a to-be-detected area and a template image corresponding to the to-be-detected area.
[0101] S202: Acquire actual position information of welding points included in the template image.
[0102] The specific execution process of steps S201-S202 in the embodiment of the present disclosure is the same as that of steps S101-S102 in the above embodiment. For details, please refer to the description in the above embodiment, and the embodiment of the present disclosure will not be specifically limited.
[0103] S203: Calculate a mapping relationship between the template image and the detection image based on a computer vision model.
[0104] In the embodiments of the present disclosure, computer vision refers to a simulation of biological vision using cameras, computers and other related equipment. Its main task is to enable computers to understand the content in pictures or videos. Computer vision models refer to network structures that enable computers to understand the content in pictures or videos.
[0105] In the embodiment of the present disclosure, when the camera shoots the same object at slightly different angles, the feature points on the obtained image may be slightly different. In order to avoid the above differences, which may result in the inability to collect the welding point image corresponding to the welding point area, the template image and the detection image are aligned in the embodiment of the present disclosure.
[0106] like Figure 5 As shown, the template image includes three regional images GROI_1, GROI_2, and GROI_3 including welding points ( Figure 5 The solid line box in the left template image in the middle), the three regional images GROI_4, GROI_5, and GROI_6 including the welding points in the detection image ( Figure 5 The dotted box in the detection image before alignment is shown in Figure 5 It can be seen that the welding point area in the template image and the detection image will have a certain deviation from the marked position on the template image due to the positioning of the target object, so the detection image needs to be aligned.
[0107] In an embodiment of the present disclosure, a mapping relationship between the template image and the detection image is calculated based on a computer vision model, wherein the mapping relationship can be represented in the form of a matrix.
[0108] In one embodiment of the present disclosure, the mapping relationship between the template image and the detection image is calculated based on a computer vision model, including: extracting feature points in the template image using a preset feature point extraction strategy to obtain a plurality of first target feature points; extracting feature points in the detection image using a preset feature point extraction strategy to obtain a plurality of second target feature points; determining a relationship matrix based on the computer vision model, wherein the relationship matrix is used to represent the correspondence between each group of feature points on an image obtained by photographing the same object at different angles each time by the camera; and solving the relationship matrix using the first target feature points and the second target feature points to obtain the mapping relationship between the template image and the detection image.
[0109] In the disclosed embodiment, feature points are extracted from the detection image and the template image respectively to obtain first target feature points and second target feature points, wherein the types of feature points include but are not limited to sift, orb, etc.
[0110] Furthermore, in the application scenario of the embodiment of the present disclosure, the average distance between the camera and the target is much greater than the difference in distances between each feature point on the target surface and the camera, so it can be considered that the selected target feature points are all on the same plane; in addition, each time the camera captures a detection image, the target is restricted to the slide rail, so although there are differences between each detection image captured and the template image captured in advance, the differences are small.
[0111] Under the above assumptions, according to the computer vision model, the 3x3 matrix H can be used to represent the correspondence between each set of feature points on the image obtained by the camera shooting the same object at slightly different angles each time:
[0112]
[0113] Furthermore, the above equation matrix H is solved by combining the known n groups of target feature points to obtain the mapping relationship P between the template image and the detection image. Furthermore, since n>9, the above equation is an overdetermined equation, and the optimal solution is obtained by the least squares method to obtain P.
[0114] In one embodiment of the present disclosure, the preset feature point extraction strategy includes: extracting feature points from an image; sorting the feature points in descending order according to the confidences corresponding to the feature points; and taking the feature points whose confidences are ranked in the top n as target feature points.
[0115] In the disclosed embodiment, the extracted feature points are sorted according to confidence, and the feature points ranked in the top n in confidence are selected respectively, where each feature point is represented by its position (ui, vi) in the corresponding image, where i=0,1,…n-1.
[0116] S204: Map the actual position information onto the detection image according to the mapping relationship to obtain the detection position information in the detection image.
[0117] In the disclosed embodiment, a coordinate value (xs, ys) in the actual position information of the known welding point area on the template image can be mapped to (x's, y's) on the detection image through the mapping relationship H, so that the detection position information corresponding to the welding point area on the detection image can be directly found.
[0118] In the embodiment of the present disclosure, each coordinate value in each actual detection position information is mapped in the above manner, thereby obtaining the detection position information corresponding to the welding point area in the detection image, such as Figure 5 shown.
[0119] S205: Crop the detection image according to the detection position information to obtain at least one welding point image.
[0120] In the embodiment of the present disclosure, the step of cropping in the detection image according to the detection position information is the same as the specific method of cropping in the detection image according to the actual position information in the above embodiment. Please refer to the description in the above embodiment for details, and no specific limitation is given in the embodiment of the present disclosure.
[0121] In one embodiment of the present disclosure, cropping is performed in the detection image according to the detection position information to obtain at least one welding point image, including: cropping is performed in the detection image according to the detection position information to obtain a cropped area image; scaling the cropped area image to a set resolution to obtain a welding point image.
[0122] The set resolution refers to the image resolution set in the model training stage. In other words, the resolution of the cropped area image obtained by cropping is scaled to the image resolution set in the model training stage to increase the speed of the welding point model processing the welding point image.
[0123] S206: For each of the welding point images, detect the welding point image to obtain a detection result corresponding to the area to be detected.
[0124] The specific execution process of step S206 in the embodiment of the present disclosure is the same as that of step S104 in the above embodiment. For details, please refer to the description in the above embodiment, and the embodiment of the present disclosure will not be specifically limited.
[0125] In the disclosed embodiment, the stud welding point area is inspected by an artificial intelligence method based on big data and a pre-marked template image to determine whether there are abnormal conditions such as leaking welding and stud falling in these areas. The detection task is completed by using a classification method combined with template alignment, so that the input resolution is smaller, and the input image resolution is generally about 10% of the input image of the detection task, and the calculation amount is smaller. Since the classification task only needs to input the area to be classified, the calculation amount is smaller than that of the detection task.
[0126] Based on the above embodiments, the present disclosure provides a training process for a welding point classification model, such as Figure 6 As shown in Figure 1, the training process of the welding point classification model mainly includes the following steps:
[0127] S301, obtaining a plurality of sample images.
[0128] In the embodiment of the present disclosure, a certain number of images containing stud welding point areas are collected as sample images. A typical range of the number of sample images is 100-1000. The typical range of the number of stud welding point ROIs contained in each image is 0-50. The image content includes the studs in the stud welding point area and the black welding mark area. Figure 4 As shown, there are five welding points included in the sample image.
[0129] S302. For each sample image, extract the welding point area of the sample image to obtain an interest point area image, and extract the background area of the sample image to obtain a non-interest point area image, wherein the annotation information corresponding to the interest point area image is of the first category, and the annotation information corresponding to the non-interest point area image is of the second category.
[0130] In the disclosed embodiment, interest point regions are extracted from each captured image, and the extracted interest point regions are classified as the first category, and each interest point region image is uniformly scaled to a resolution of W*H, where typical values of W and H include but are not limited to W=64, H=64 or W=128, H=128.
[0131] In one embodiment of the present disclosure, an interest point region detection model is used to extract features from the sample image, and after image recognition, an interest point image is obtained.
[0132] In one embodiment of the present disclosure, the image cropper receives the coordinates of the cropping area input by the user, and in response to the input operation, the image cropper crops the area corresponding to the coordinates of the cropping area in the sample image to obtain an image of the area of interest. The coordinates of the cropping area may be input by the user directly inputting the coordinate values, or by the user drawing the cropping area on the sample image.
[0133] In the disclosed embodiment, the background area of each captured image is extracted, and the extracted background area is called a non-interest area. The non-interest area is classified as the second category and does not overlap with any ROI area classified as 1. The non-interest area is also uniformly scaled to the same resolution as the region of interest image classified as the first category, and the number of region images classified as the first category and the second category remains roughly consistent.
[0134] In one embodiment of the present disclosure, for a sample image after extracting the interest point region image, the background region in the sample image is arbitrarily cropped, and the obtained region image is used as the non-interest point region.
[0135] S303: training a preset network model using the interest point region image and its corresponding annotation information, and the non-interest point region image and its corresponding annotation information to obtain a welding point classification model.
[0136] In the disclosed embodiment, a currently existing CNN-based classification network is selected to build a training framework, wherein the classification network is but not limited to ResNet series, MobileNet series, ShuffleNet series, SENet series, and Transformer series.
[0137] In the disclosed embodiment, the classification network is trained under the established training framework using the interest point region image and its corresponding annotation information, the non-interest point region image and its corresponding annotation information, and the parameter value of each node in the detection network is corrected based on error back propagation (BP) or other similar methods, so that the classification network takes two categories of regional images scaled to the same resolution as input, and the category of the ROI output in each training round is closer and closer to the annotated category. When the degree of closeness reaches a preset threshold, the classification network training is considered to be completed. When the training is completed, the structure of the classification network and the parameter value of each node in the structure are saved, and a trained welding point classification model is obtained.
[0138] Furthermore, an actually required inspection image is collected, the position information of the welding point area classified as the first category is marked, and the image and the position information are used as a template image and the template image includes the actual position information.
[0139] In the disclosed embodiment, the above 2D classification network only needs to predict the attribute category of the welding point in the image, and often directly uses the convolution downsampling method to ensure that the attribute feature information of the main target object in the image can have a greater impact on the weight of each neuron during the training process. Furthermore, the last layer of the above 2D classification network often uses a softmax layer to ensure that the prediction result is a certain classification attribute value. For example, in this embodiment, the detection result can only be 0 or 1. Among them, 0 indicates that the stud welding point is abnormal, and 1 indicates that the stud welding point is normal.
[0140] The welding area detection method provided in the embodiment of the present disclosure uses a classification task process with a simpler design and faster speed to process images compared to directly processing images according to the process of the detection task. It can also achieve the result (category + position) obtained by processing according to the detection task process, and can mark the missed position when there is a stud welding missed. The main process is as follows Figure 7As shown. The training process mainly includes 6 steps: acquisition of 2D sample images containing welding point areas, category labeling of welding point area images, construction of classification network, training of classification network, generation of classification model, and generation of template data. The use process mainly includes 4 steps: acquisition of test images, alignment of test images with reference to template images, classification of aligned test images, and obtaining classification results of test images.
[0141] In the embodiments of the present disclosure, the classification task is implemented by using a CNN-based method in deep learning as an example for explanation. The actual classification task can also be implemented by other technical routes in machine learning or traditional learning, and the above overview and comparison of the characteristics of the classification task and the detection task are also applicable under these non-deep learning technical routes.
[0142] Figure 8 1 is a schematic diagram of the structure of a welding area detection device in an embodiment of the present disclosure. This embodiment can be applied to the situation of detecting the quality of welding points in the area. The welding area detection device can be implemented in software and / or hardware, and the welding area detection device can be configured in an electronic device.
[0143] like Figure 8 As shown, the welding area detection device 80 provided in the embodiment of the present disclosure includes: an image acquisition module 81, an actual position information acquisition module 82, a welding point image determination module 83 and a detection result determination module 84.
[0144] Among them, the image acquisition module 81 is used to obtain the detection image corresponding to the area to be detected and the template image corresponding to the area to be detected; the actual position information acquisition module 82 is used to obtain the actual position information of the welding point included in the template image; the welding point image determination module 83 is used to crop the corresponding position of the detection image based on the actual position information to obtain at least one welding point image; the detection result determination module 84 is used to detect the welding point image for each of the welding point images to obtain the detection result corresponding to the area to be detected.
[0145] In one embodiment of the present disclosure, the detection result determination module includes: a welding point image detection unit, which is used to detect the welding point image using a pre-trained welding point classification model for each welding point image to obtain the category to which the welding point image belongs; a normal welding point determination unit, which is used to determine that the welding points in the welding point image are normal if the category to which the welding point image belongs is the first category; an abnormal welding point determination unit, which is used to determine that the welding points in the welding point image are abnormal if the category to which the welding point image belongs is the second category; and a welding point situation summary unit, which is used to summarize the welding point situations corresponding to at least one or more welding point images to obtain the detection result corresponding to the area to be detected.
[0146] In one embodiment of the present disclosure, a welding point image determination module includes: an image mapping relationship determination unit, which is used to calculate the mapping relationship between the template image and the detection image based on a computer vision model; a detection position information determination unit, which is used to map the actual position information to the detection image according to the mapping relationship to obtain the detection position information in the detection image; and a welding point image determination unit, which is used to crop the detection image according to the detection position information to obtain at least one welding point image.
[0147] In one embodiment of the present disclosure, the welding point image determination unit is specifically used to crop the detection image according to the detection position information to obtain a cropped area image; and scale the cropped area image to a set resolution to obtain a welding point image.
[0148] In one embodiment of the present disclosure, an image mapping relationship determination unit includes: a feature point extraction subunit, used to extract feature points in the template image using a preset feature point extraction strategy to obtain a plurality of first target feature points; and to extract feature points in the detection image using a preset feature point extraction strategy to obtain a plurality of second target feature points; a relationship matrix determination subunit, used to determine a relationship matrix based on a computer vision model, wherein the relationship matrix is used to represent the correspondence between each group of feature points on an image obtained by photographing the same object at different angles each time by a camera; and a mapping relationship determination subunit, used to solve the relationship matrix using the first target feature points and the second target feature points to obtain a mapping relationship between the template image and the detection image.
[0149] In one embodiment of the present disclosure, the preset feature point extraction strategy includes: extracting feature points from an image; sorting the feature points in descending order according to the confidences corresponding to the feature points; and taking the feature points whose confidences are ranked in the top n as target feature points.
[0150] In one embodiment of the present disclosure, a model training module is used to train a welding point classification model, including: a sample image acquisition unit, used to acquire multiple sample images; a region image extraction unit, used to perform welding point region extraction on the sample image for each sample image to obtain an interest point region image, and extract the background region of the sample image to obtain a non-interest point region image, wherein the annotation information corresponding to the interest point region image is of a first category, and the annotation information corresponding to the non-interest point region image is of a second category; the model training unit is used to train a preset network model using the interest point region image and its corresponding annotation information, and the non-interest point region image and its corresponding annotation information to obtain a welding point classification model.
[0151] Figure 8 The welding area detection device of the illustrated embodiment is used to execute the welding area detection method in the above method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0152] Fig. 9 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Fig. 9 , which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure. The electronic device 900 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), wearable terminal devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0153] like Fig. 9 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 to a random access memory (RAM) 903 to implement the welding area detection method of the embodiment described in the present disclosure. In RAM 903, various programs and data required for the operation of the terminal device 900 are also stored. The processing device 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0154] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the terminal device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig. 9 The terminal device 900 is shown to have various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0155] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the welding area detection method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 904, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above functions defined in the method of the embodiment of the present disclosure are executed.
[0156] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0157] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperTextTransferProtocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an adhoc peer-to-peer network), as well as any currently known or future developed network.
[0158] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0159] The computer-readable medium carries one or more programs. When the one or more programs are executed by the terminal device, the terminal device implements the method described in any one of the embodiments.
[0160] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0161] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0162] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0163] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0164] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0165] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0166] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0167] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A welding area detection method, characterized in that: The method comprises: Acquire a detection image corresponding to the area to be detected and a template image corresponding to the area to be detected; Acquiring actual position information of welding points included in the template image; Based on the actual position information, cropping is performed at a corresponding position of the detection image to obtain at least one welding point image; For each of the welding point images, the welding point image is detected to obtain a detection result corresponding to the area to be detected.
2. The method according to claim 1, characterized in that: The step of detecting each welding point image to obtain a detection result corresponding to the area to be detected includes: For each welding point image, detect the welding point image using a pre-trained welding point classification model to obtain the category to which the welding point image belongs; If the category to which the welding point image belongs is the first category, determining that the welding point in the welding point image is normal; If the category to which the welding point image belongs is the second category, determining that the welding point in the welding point image is abnormal; The welding point conditions corresponding to at least one or more welding point images are summarized to obtain a detection result corresponding to the area to be detected.
3. The method according to claim 1, characterized in that The step of performing cropping at a corresponding position of the detection image based on the actual position information to obtain at least one welding point image comprises: Calculate the mapping relationship between the template image and the detection image based on a computer vision model; Mapping the actual position information onto the detection image according to the mapping relationship to obtain the detection position information in the detection image; The detection image is cropped according to the detection position information to obtain at least one welding point image.
4. The method according to claim 3, characterized in that: The step of cropping the detected image according to the detected position information to obtain at least one welding point image comprises: Cropping the detection image according to the detection position information to obtain a cropped area image; The cropped area image is scaled to a set resolution to obtain a welding point image.
5. The method according to claim 3, characterized in that: The calculating the mapping relationship between the template image and the detection image based on the computer vision model includes: Extracting feature points in the template image using a preset feature point extraction strategy to obtain a plurality of first target feature points; Extracting feature points in the detection image using a preset feature point extraction strategy to obtain a plurality of second target feature points; Determine a relationship matrix based on a computer vision model, wherein the relationship matrix is used to represent the correspondence between each set of feature points on an image obtained by photographing the same object at different angles each time by a camera; The relationship matrix is solved by jointly using the first target feature point and the second target feature point to obtain a mapping relationship between the template image and the detection image.
6. The method according to claim 5, characterized in that The preset feature point extraction strategy includes: Extract feature points from the image; Sort the feature points in descending order according to the confidence levels corresponding to the feature points; The feature points ranked in the top n positions of the confidence are taken as target feature points.
7. The method according to claim 2, characterized in that The training process of the welding point classification model includes: Acquire multiple sample images; For each sample image, extract the welding point area of the sample image to obtain an interest point area image, and extract the background area of the sample image to obtain a non-interest point area image, wherein the annotation information corresponding to the interest point area image is of the first category, and the annotation information corresponding to the non-interest point area image is of the second category; The interest point region image and its corresponding annotation information, the non-interest point region image and its corresponding annotation information are used to train a preset network model to obtain a welding point classification model.
8. A welding area detection device, characterized in that: The device comprises: An image acquisition module is used to acquire a detection image corresponding to the area to be detected and a template image corresponding to the area to be detected; An actual position information acquisition module, used to acquire actual position information of the welding point included in the template image; A welding point image determination module, configured to perform cropping at a corresponding position of the detection image based on the actual position information to obtain at least one welding point image; The detection result determination module is used to detect each of the welding point images to obtain the detection result corresponding to the area to be detected.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
automatic PCB (Printed Circuit Board) scan image matching method and system
CN105243663A
Method for detecting appearance of PCBA through rapid convolutional neural network
CN109859164A
Welding spot defect detection method, system and equipment
CN110880175A
Electronic device and solder joint detection method
CN112734706A
Cylindrical cell welding quality detection method, device, electronic equipment and storage medium
CN113744269A
