Welding spot image marking method and device and electronic device
Through image preprocessing and annotation, a solder point labeling model is constructed, which solves the problem of time and subjectivity in solder point labeling, achieves efficient and accurate production of solder point data sets, and improves the application efficiency of deep learning models.
Patent Information
- Application Number
- CN202410821753.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-01
AI Technical Summary
Solder spot labeling in the existing technology is time-consuming and labor-intensive, subjective and has a high error rate, which affects the accuracy of the deep learning model.
By obtaining the vehicle's solder spot image set for image preprocessing and labeling, an initial solder spot labeling model is constructed, and the target solder spot labeling model is used for automatic labeling to improve the efficiency and accuracy of data set production.
It significantly reduces the annotation time, improves the consistency and accuracy of annotation, reduces manual annotation errors, and improves the application efficiency of deep learning models in solder joint inspection.
Smart Images

Figure CN118736348A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent manufacturing of automobile bodies, and in particular to a method, device and electronic device for marking welding spot images. Background Art
[0002] With the rapid development of the automobile industry and the popularization of intelligent manufacturing, the degree of automation of body welding has gradually increased, and manual intervention has been reduced, which has put forward higher requirements for production efficiency and quality. However, traditional body welding quality inspection mainly relies on manual operation, which is time-consuming and labor-intensive, and is easily interfered by subjective factors, and cannot meet the needs of modern production. Especially in body welding, the resistance spot welding process occupies a dominant position. Therefore, realizing rapid and automated detection of welds has become an important research direction in the field of body manufacturing.
[0003] At present, some OEMs have applied machine vision technology to collect solder joint images in real time and use the detection model trained by the deep learning framework for real-time online detection. This method has met the actual needs to a certain extent. Good data and optimized algorithms work together to help reduce the amount of training calculations and reduce the demand for computing resources. However, although this research field has made considerable progress in algorithm optimization, there are relatively few studies on solder joint image datasets. Traditional methods for producing solder joint datasets usually rely on manual operations, which are time-consuming and labor-intensive, and may lead to extended production cycles and increased costs. In addition, there are subjective factors in manual labeling. Different labelers may have different labeling styles and accuracy levels, which may lead to inconsistent labels and affect the performance of the model. At the same time, errors may occur during manual labeling, such as missing labels and wrong labels. These errors will be passed to the deep learning model, reducing the accuracy of the model.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method, device and electronic device for marking a solder joint image, so as to at least solve the technical problems in the related art that solder joint marking is time-consuming and labor-intensive, subjective and has a high error rate.
[0006] According to one aspect of an embodiment of the present invention, a method for annotating weld images is provided, comprising: acquiring a first weld image set of a vehicle, wherein the first weld image set is obtained by photographing welds of a vehicle body based on a photographing device; performing image preprocessing on the first weld image set to obtain a second weld image set and a third weld image set; annotating the second weld image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate weld positions in the second weld image set; training an initial weld annotation model based on the first annotation result to obtain a target weld annotation model; annotating the third weld image set based on the target weld annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate weld positions in the third weld image set.
[0007] Optionally, performing image preprocessing on the first weld point image set to obtain a second weld point image set and a third weld point image set includes: performing filtering processing on the first weld point image set to obtain a fourth weld point image set, wherein the image quality of the fourth weld point image set is higher than the image quality of the first weld point image set; sampling the fourth weld point image set based on a preset sampling ratio to obtain a fifth weld point image set and a sixth weld point image set, wherein the fifth weld point image set is the sampled image set, and the sixth weld point image set is the image set in the fourth weld point image set excluding the fifth weld point image set; performing image compression processing on the fifth weld point image set to obtain a second weld point image set; performing image compression processing on the sixth weld point image set to obtain a third weld point image set.
[0008] Optionally, the second weld point image set is annotated based on the first annotation method to obtain a first annotation result, including: performing grayscale processing on the second weld point image set to obtain a seventh weld point image set; performing Gaussian filtering on the seventh weld point image set to obtain an eighth weld point image set; using a Hough circle detection algorithm to identify the eighth weld point image set to obtain a recognition result, wherein the recognition result is used to represent a circular contour in the eighth weld point image set; and annotating the eighth weld point image set based on the recognition result to obtain a first annotation result.
[0009] Optionally, annotating the eighth weld point image set based on the recognition result to obtain a first annotation result includes: annotating the eighth weld point image set based on the recognition result to obtain a third annotation result, wherein the third annotation result is used to annotate the position of the circular object in the eighth weld point image set; filtering the third annotation result to obtain a fourth annotation result; and verifying the fourth annotation result based on the actual weld point position to obtain the first annotation result.
[0010] Optionally, filtering the third annotation result to obtain a fourth annotation result includes: adjusting the Hough circle detection parameter value of the Hough circle detection algorithm to obtain an adjusted Hough circle detection algorithm; filtering the third annotation result based on the adjusted Hough circle detection algorithm to obtain a fifth annotation result; filtering the fifth annotation result based on a filter function to obtain a fourth annotation result.
[0011] Optionally, training the initial solder point labeling model based on the first labeling result to obtain the target solder point labeling model includes: constructing the initial solder point labeling model based on the target detection algorithm and the target weight file; training the initial solder point labeling model based on the first labeling result, and adjusting the hyperparameters of the initial solder point labeling model based on the training result to obtain the target solder point labeling model.
[0012] Optionally, the method further includes: storing the third annotation result in a target folder, wherein the target folder is a folder storing the first welding spot image set, and the name of the third annotation result is consistent with the name of the corresponding welding spot image.
[0013] Optionally, the number of weld points in any weld point image in the first weld point image set is within a preset value range.
[0014] According to another aspect of an embodiment of the present invention, a welding point image annotation device is also provided, including: an acquisition module, used to acquire a first welding point image set of a vehicle, wherein the first welding point image set is obtained based on photographing the welding points of the vehicle body by a photographing device; a processing module, used to perform image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set; a first annotation module, used to annotate the second welding point image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the welding point positions in the second welding point image set; a training module, used to train an initial welding point annotation model based on the first annotation result to obtain a target welding point annotation model; a second annotation module, used to annotate the third welding point image set based on the target welding point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the welding point positions in the third welding point image set.
[0015] Optionally, the processing module is also used to filter the first weld point image set to obtain a fourth weld point image set, wherein the image quality of the fourth weld point image set is higher than the image quality of the first weld point image set; sample the fourth weld point image set based on a preset sampling ratio to obtain a fifth weld point image set and a sixth weld point image set, wherein the fifth weld point image set is the sampled image set, and the sixth weld point image set is the image set in the fourth weld point image set excluding the fifth weld point image set; perform image compression processing on the fifth weld point image set to obtain a second weld point image set; perform image compression processing on the sixth weld point image set to obtain a third weld point image set.
[0016] Optionally, the first labeling module is also used to perform grayscale processing on the second weld point image set to obtain a seventh weld point image set; perform Gaussian filtering on the seventh weld point image set to obtain an eighth weld point image set; use a Hough circle detection algorithm to identify the eighth weld point image set to obtain a recognition result, wherein the recognition result is used to represent a circular contour in the eighth weld point image set; and label the eighth weld point image set based on the recognition result to obtain a first labeling result.
[0017] Optionally, the first annotation module is also used to annotate the eighth weld point image set based on the recognition result to obtain a third annotation result, wherein the third annotation result is used to annotate the position of the circular object in the eighth weld point image set; filter the third annotation result to obtain a fourth annotation result; and verify the fourth annotation result based on the actual weld point position to obtain the first annotation result.
[0018] Optionally, the first labeling module is also used to adjust the Hough circle detection parameter value of the Hough circle detection algorithm to obtain an adjusted Hough circle detection algorithm; filter the third labeling result based on the adjusted Hough circle detection algorithm to obtain a fifth labeling result; filter the fifth labeling result based on the filter function to obtain a fourth labeling result.
[0019] Optionally, the training module is also used to construct an initial solder point labeling model based on the target detection algorithm and the target weight file; train the initial solder point labeling model based on the first labeling result, and adjust the hyperparameters of the initial solder point labeling model based on the training result to obtain the target solder point labeling model.
[0020] Optionally, the device further includes: a saving module, storing the third annotation result into a target folder, wherein the target folder is a folder storing the first welding point image set, and the name of the third annotation result is consistent with the name of the corresponding welding point image.
[0021] According to one embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute any of the above-mentioned solder joint image labeling methods when running on a computer or a processor.
[0022] According to one embodiment of the present invention, a computer program product is further provided, including a computer program, and when the computer program is executed by a processor, the solder joint image marking method in the embodiment of the present invention is implemented.
[0023] According to one embodiment of the present invention, there is also provided an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any of the above-mentioned solder joint image marking methods.
[0024] In an embodiment of the present invention, a first weld point image set of a vehicle is obtained, wherein the first weld point image set is obtained by photographing the weld points of the vehicle body based on a photographing device; the first weld point image set is image preprocessed to obtain a second weld point image set and a third weld point image set; the second weld point image set is annotated based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the weld point positions in the second weld point image set; an initial weld point annotation model is trained based on the first annotation result to obtain a target weld point annotation model; the third weld point image set is annotated based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set. A technical solution achieves the technical effect of improving the production efficiency and accuracy of the data set, thereby accelerating the application of deep learning models in weld point detection, thereby solving the technical problems in the related art that weld point annotation is time-consuming, labor-intensive, subjective, and has a high error rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0026] Figure 1 is a flow chart of a welding spot image marking method according to an embodiment of the present invention;
[0027] Figure 2 is a flow chart of labeling and optimizing a compressed image sample set according to an embodiment of the present invention;
[0028] Figure 3 It is a structural block diagram of a welding spot image annotation device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] According to an embodiment of the present invention, a method embodiment of solder joint image annotation is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0032] The method embodiment can be executed in an electronic device, a similar control device or a system including a memory and a processor. Taking an electronic device as an example, the electronic device may include one or more processors and a memory for storing data. Optionally, the electronic device may also include a communication device and a display device for communication functions. It can be understood by a person of ordinary skill in the art that the above structural description is only illustrative and does not limit the structure of the above electronic device. For example, the electronic device may also include more or fewer components than the above structural description, or have a configuration different from the above structural description.
[0033] The processor may include one or more processing units. For example, the processor may include a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microcontroller unit (MCU), a field-programmable gate array (FPGA), a neural network processor (NPU), a tensor processing unit (TPU), an artificial intelligence (AI) type processor, and the like. Among them, different processing units may be independent components or integrated into one or more processors. In some instances, the electronic device may also include one or more processors.
[0034] The memory can be used to store computer programs, such as storing a computer program corresponding to the solder joint image annotation method in the embodiment of the present invention. The processor implements the above-mentioned solder joint image annotation method by running the computer program stored in the memory. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0035] The communication device is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the communication device includes a network adapter (network interface controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the communication device can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0036] The display device may be, for example, a touch screen type liquid crystal display (LCD) and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of a mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contact and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music and / or web browsing, etc. The executable instructions for executing the above human-computer interaction functions are configured / stored in a computer program product or a readable storage medium executable by one or more processors.
[0037] Figure 1 FIG. 1 is a flow chart of a method for marking a solder joint image according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0038] Step S11, obtaining a first welding point image set of the vehicle, wherein the first welding point image set is obtained by photographing the welding points of the vehicle body with a photographing device;
[0039] Step S13, performing image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set;
[0040] Step S15, annotating the second welding point image set based on the first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the welding point positions in the second welding point image set;
[0041] Step S17, training the initial solder joint labeling model based on the first labeling result to obtain a target solder joint labeling model;
[0042] Step S19, annotating the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set.
[0043] The welding spot image annotation first needs to use a shooting tool to shoot the first welding spot image of the vehicle, that is, the original image of the welding spot of the vehicle body. The shooting tool includes but is not limited to industrial cameras, mobile phones and video cameras. Then, the first welding spot image is image preprocessed to obtain a second welding spot image set and a third welding spot image set to improve the quality and clarity of the welding spot image, improve the accuracy of image segmentation and feature extraction, and thus improve the performance of machine learning and deep learning algorithms. Among them, the second welding spot image set is a welding spot image sampling set obtained after image preprocessing the first welding spot image, and the third welding spot image set is a welding spot image sampling residual set obtained after image preprocessing the first welding spot image.
[0044] Then, the second welding spot image set is annotated using a first annotation method to obtain a first annotation result, wherein the first annotation method is an algorithm based on a preset rule, that is, the image sampling set is roughly annotated based on an algorithm based on a preset rule to obtain a first annotation result for annotating the welding spot positions in the image sampling set.
[0045] Then, the initial weld annotation model used to annotate and identify the initial welds in the welding process is trained according to the first annotation result to obtain the target weld annotation model. Both the initial weld annotation model and the target weld annotation model are based on deep learning technology, and the weld positions and features in the welding process are identified by analyzing and processing the weld images or video data. This model can improve welding quality and efficiency, reduce human errors, and also help to realize the automation and intelligence of the welding process.
[0046] It is understandable that the size of the number of training sets will directly affect the performance and accuracy of the model. Generally speaking, the larger the number of training sets, the higher the generalization ability and prediction accuracy of the model. However, too large a number of training sets will also increase training time and computing costs. Therefore, it is necessary to determine the appropriate number of training sets based on the specific problem and data set situation. Specifically in the present invention, in order to meet the training requirements for training the initial weld annotation model, the first weld images obtained should be no less than a preset number, for example, no less than 4000 first weld images.
[0047] Finally, the third weld image set is annotated based on the target weld annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld positions in the third weld image set. That is, the weld positions in the image sampling residual set are automatically and accurately annotated based on the target weld annotation model.
[0048] Based on the above steps, by obtaining a first weld point image set of a vehicle, wherein the first weld point image set is obtained by photographing the weld points of the vehicle body based on a photographing device; performing image preprocessing on the first weld point image set to obtain a second weld point image set and a third weld point image set; annotating the second weld point image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the weld point positions in the second weld point image set; training an initial weld point annotation model based on the first annotation result to obtain a target weld point annotation model; annotating the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set. The technical solution achieves the technical effect of improving the production efficiency and accuracy of the data set, thereby accelerating the application of deep learning models in weld point detection, thereby solving the technical problems in the related art that weld point annotation is time-consuming, labor-intensive, subjective, and has a high error rate.
[0049] Optionally, in step S13, performing image preprocessing on the first welding point image set to obtain the second welding point image set and the third welding point image set includes executing the following steps:
[0050] Step S131, filtering the first welding point image set to obtain a fourth welding point image set, wherein the image quality of the fourth welding point image set is higher than the image quality of the first welding point image set;
[0051] Step S132, sampling the fourth weld image set based on a preset sampling ratio to obtain a fifth weld image set and a sixth weld image set, wherein the fifth weld image set is an image set obtained by sampling, and the sixth weld image set is an image set in the fourth weld image set excluding the fifth weld image set;
[0052] Step S133, performing image compression processing on the fifth welding point image set to obtain a second welding point image set;
[0053] Step S134, performing image compression processing on the sixth welding point image set to obtain a third welding point image set.
[0054] Image preprocessing of the first weld point image set includes filtering the first weld point image set, screening and removing blurred images and images without weld points to obtain a fourth weld point image set. The filtered weld point images do not contain blurred images, images without weld points, and other images that may affect model training. Therefore, the image quality of the fourth weld point image set is higher than that of the first weld point image set.
[0055] After filtering, the fourth weld image set is sampled according to a preset sampling ratio to obtain a fifth weld image set and a sixth weld image set. The preset sampling ratio is determined according to the actual weld situation and the model used, and is not limited here. The fifth weld image set is an image set obtained by sampling the fourth weld image set, and the sixth weld image is an image set in the fourth weld image set except the fifth weld image set. Exemplarily, 10% of the fourth weld image set is sampled to obtain the fifth weld image set, and the remaining 90% is the sixth weld image set.
[0056] Then, the fifth welding spot image set and the sixth welding spot image set are subjected to image compression processing to obtain the second welding spot image and the third welding spot image set, that is, to obtain a compressed welding spot image sampling set and a compressed welding spot image sampling residual set with reasonable resolution size. Exemplarily, the size of the image after compression processing is a resolution of 800x600 or 600x800. Image compression is to reduce the size of the image file through a compression algorithm to save storage space or speed up the transmission speed. Common image compression methods include lossy compression and lossless compression. Lossy compression reduces the file size by sacrificing a certain image quality. Common lossy compression algorithms include JPEG, WebP, etc. Lossless compression reduces the file size while keeping the image quality unchanged. Common lossless compression algorithms include PNG, GIF, etc. Image compression processing can be implemented through special compression software or online tools. Users can select appropriate compression methods and parameters for processing according to their needs, which are not limited here.
[0057] Optionally, in step S15, annotating the second welding point image set based on the first annotation method to obtain a first annotation result includes performing the following steps:
[0058] Step S151, grayscale processing is performed on the second welding point image set to obtain a seventh welding point image set;
[0059] Step S152, performing Gaussian filtering on the seventh welding point image set to obtain an eighth welding point image set;
[0060] Step S153, using a Hough circle detection algorithm to identify the eighth solder joint image set to obtain a recognition result, wherein the recognition result is used to represent a circular contour in the eighth solder joint image set;
[0061] Step S154: annotate the eighth welding point image set based on the recognition result to obtain a first annotation result.
[0062] The second welding point image set is annotated based on the first annotation method. First, the second welding point image set is gray-scaled to obtain the seventh welding point image set. Gray-scale processing is the process of converting a color image into a gray-scale image so that the image contains only black and white. There are many ways to implement gray-scale processing. For example, a weighted method is used to weight and sum the pixel values of the three RGB channels in a certain proportion to obtain a gray-scale value. The average method is used to take the average value of the pixel values of the three RGB channels as the gray-scale value. The maximum value method is used to take the maximum value of the pixel values of the three RGB channels as the gray-scale value. The minimum value method is used to take the minimum value of the pixel values of the three RGB channels as the gray-scale value. Different methods can be selected for gray-scale processing according to actual needs and application scenarios, which are not limited here.
[0063] Then, the seventh solder joint image set is subjected to Gaussian filtering to obtain the eighth solder joint image set. Gaussian filtering is a commonly used image processing method for smoothing images and reducing noise in images. In Gaussian filtering, the pixel value is replaced by the weighted average of the surrounding pixels, where the weight is determined by a Gaussian kernel function. This method can perform blur processing, effectively smooth the image and retain the edge information of the image, and is a commonly used image denoising technology.
[0064] After Gaussian filtering, the Hough circle detection algorithm is used to identify the eighth solder joint image set, and the identified circular contour is extracted, which includes circular or similar circular contours such as solder joints, holes, and standard parts. Finally, the eighth solder joint image set is annotated based on the identified circular contour to obtain the first annotation result.
[0065] Figure 2 is a flow chart of labeling and optimizing a compressed image sample set according to an embodiment of the present invention. Figure 2 As shown in the figure, the image is first gray-scaled to convert the color image into a gray-scale image, and then Gaussian filtering is used for blurring to smooth the edges and reduce noise. Then the Hough circle detection algorithm is used to extract the recognized circular contours, and finally the annotation results are output.
[0066] Optionally, in step S154, the eighth welding point image set is annotated based on the recognition result, and obtaining a first annotation result includes:
[0067] Step S1541, annotating the eighth welding point image set based on the recognition result to obtain a third annotation result, wherein the third annotation result is used to annotate the position of the circular object in the eighth welding point image set;
[0068] Step S1542, filtering the third annotation result to obtain a fourth annotation result;
[0069] Step S1543, verifying the fourth marking result based on the actual welding point position to obtain the first marking result.
[0070] Based on the recognition results, the eighth weld image set is annotated to obtain the third annotation result, wherein the third annotation result is used to annotate the position of circular objects in the eighth weld image set. In addition to welds, there are also circular or quasi-circular contours such as holes and standard parts. Then, the third annotation result is filtered to remove circular objects other than welds to obtain the fourth annotation result, which is the weld position in the eighth weld image set. Finally, the annotation software is opened, and a small number of false detections and missed detections that still exist in the fourth annotation result are manually adjusted based on the actual weld position, and circular or quasi-circular contours such as holes and standard parts that are prone to interfere with weld detection are manually annotated and uniformly named "HOLE". After verification, the first annotation result is obtained, thereby improving the detection precision and accuracy of the system and optimizing the algorithm.
[0071] Optionally, in step S1542, filtering is performed on the third annotation result to obtain a fourth annotation result including:
[0072] Step S15421, adjusting the Hough circle detection parameter value of the Hough circle detection algorithm to obtain an adjusted Hough circle detection algorithm;
[0073] Step S15422, filtering the third labeling result based on the adjusted Hough circle detection algorithm to obtain a fifth labeling result;
[0074] Step S15423, filtering the fifth marking result based on the filtering function to obtain a fourth marking result.
[0075] The Hough circle detection algorithm is used to filter the third annotation result. The Hough circle detection algorithm is an algorithm for detecting circles in an image. It is an extension of the Hough transform and can be used to detect circles of different sizes and positions in an image. The basic idea of the algorithm is to regard each pixel in the image as a potential center of a circle, and then search for possible circles within different radii around the pixel. By accumulating these circles in the Hough space, the circle with the highest cumulative value can be found to determine the circle in the image. The advantage of the Hough circle detection algorithm is that it can detect circles of different sizes and positions, and it also has good robustness for images with noise. However, the algorithm has a high computational complexity and needs to search all possible circles in the Hough space, so it needs to be optimized in practical applications.
[0076] Adjust the Hough circle detection parameter values of the Hough circle detection algorithm to obtain the adjusted Hough circle detection algorithm. The parameters of the Hough circle detection algorithm include the minimum radius of the circle center, the maximum radius, the resolution of the Hough space, etc. Adjusting these parameters can affect the performance of the algorithm and the detection results. Among them, the minimum radius and the maximum radius of the circle center can be set according to the size range of the circle to be detected. If the size range of the circle to be detected is known, the minimum radius and the maximum radius can be set according to the actual situation to improve the accuracy and efficiency of the detection. Setting the resolution of the Hough space can affect the accuracy and calculation speed of the detection. Generally speaking, the higher the resolution, the higher the detection accuracy, but the calculation speed will also be slower. It can be adjusted according to actual needs. Setting the threshold of the Hough circle detection can control the quantity and quality of the detection results. A lower threshold makes it easier for the algorithm to detect circles, but may cause false detections. A higher threshold reduces the number of detection results, but the results are more reliable. The threshold can be adjusted according to specific application scenarios and needs. In general, adjusting the parameters of the Hough circle detection algorithm needs to be carried out according to specific application needs and actual conditions. By constantly trying and adjusting the parameters, better detection effects and performance can be obtained.
[0077] The third annotation result is filtered based on the adjusted Hough circle detection algorithm to obtain the fifth annotation result. Then, by adding a filter function to filter the samples in the fifth annotation result that are obviously deviated from the mean value of the detected circle radius, most of the false detections are filtered out to obtain the fourth annotation result. The filter function is used to filter out the data that meets the conditions according to specific conditions when processing the fifth annotation result, and discard the data that does not meet the conditions.
[0078] Optionally, in step S17, training the initial solder joint annotation model based on the first annotation result to obtain the target solder joint annotation model includes performing the following steps:
[0079] Step S171, constructing an initial solder joint annotation model based on a target detection algorithm and a target weight file;
[0080] Step S172: training the initial solder joint labeling model based on the first labeling result, and adjusting the hyperparameters of the initial solder joint labeling model based on the training result to obtain a target solder joint labeling model.
[0081] Detection algorithm is an algorithm used to detect target objects or specific features, usually a technology used in the field of computer vision or image processing. These algorithms can detect the location, shape, size and other information of the target object by analyzing image or video data. Weight file refers to a set of parameter values obtained during the model training process, which is used to initialize or adjust the initial solder joint annotation model. These parameter values usually contain information such as the connection weights and bias values of each neuron in the model, and are key parameters learned by the model during the training process. When using the detection algorithm, the weight file is usually used to load the pre-trained model to achieve detection and recognition of the target.
[0082] Exemplarily, the YOLOV5 target detection algorithm and its weight file yolov5s.pt are selected as the initial solder joint labeling model. YOLOV5 is a target detection algorithm that uses a single-stage detection method. By dividing the entire image into grids and then predicting the bounding box and category of the target in each grid, a suitable model can be selected for target detection tasks according to needs. The yolov5s.pt file contains the weights and parameters learned during the training process and can be used for target detection tasks on new data sets. Users can use the yolov5s.pt model for rapid deployment without having to train the model from scratch.
[0083] The initial solder joint annotation model is trained based on the first annotation result, and the model parameters are continuously adjusted to minimize the loss according to the model's loss function and optimization algorithm. The model performance is evaluated and the hyperparameters of the initial solder joint annotation model are adjusted repeatedly based on the training results until satisfactory performance is achieved to improve the generalization ability of the model and obtain the target solder joint annotation model. Among them, common hyperparameters include learning rate, batch size, regularization parameter, etc.
[0084] Optionally, the method further includes step S16, specifically including: storing the third annotation result into a target folder, wherein the target folder is a folder storing the first weld point image set, and the name of the third annotation result is consistent with the name of the corresponding weld point image.
[0085] Draw the recognized contour on the solder joint image, draw the annotation box and the annotation category "HD" on the solder joint image, and save the third annotation results to a target folder, which is used to store the first solder joint image set. The name of the third annotation result is consistent with the name of the corresponding solder joint image, which is convenient for visualizing the annotation effect; at the same time, output the XML format annotation file with the same name as the solder joint image but different suffix to another folder.
[0086] The center coordinates of the identified circle contour (circle[0], circle[1]) and the radius parameter circle[2] are used to calculate the coordinate values of the two corner points of the annotation box (the opposite corners of the annotation box rectangle). The formula is as follows:
[0087] xmin = circle[0] - circle[2] Formula (1)
[0088] ymin = circle[1] - circle[2] formula (2)
[0089] xmax = circle[0] + circle[2] Formula (3)
[0090] ymax = circle[1] + circle[2] formula (4)
[0091] Then output the annotation box information, image file name, image path, and label category name together.
[0092] Optionally, the number of welds in any weld image in the first weld image set is within a preset value range. The preset value range is a preset acceptable value range for the number of welds in any weld image, for example, the number of welds in any weld image in the first weld image set is 2-5.
[0093] Compared with pure manual labeling, the present invention significantly reduces the labeling time. Taking a data set of 4,000 pictures as an example, the labeling time is reduced by about 80%-90% by applying the solder joint image labeling method. The larger the data set, the higher the efficiency. And the labeling consistency is good. Compared with pure manual labeling, manual labeling has subjective factors, and different labelers may have different labeling styles and accuracy levels. The use of solder joint image labeling methods can avoid such problems. In addition, the labeling error rate is low. Since manual labeling is prone to missing labels and mislabeling due to fatigue or mistakes, the use of solder joint image labeling methods can avoid the problems introduced by these reasons, and the labeling error rate is low.
[0094] In summary, the present invention obtains a first weld point image set of a vehicle, wherein the first weld point image set is obtained by photographing the weld points of the vehicle body based on a photographing device; performs image preprocessing on the first weld point image set to obtain a second weld point image set and a third weld point image set; annotates the second weld point image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the weld point positions in the second weld point image set; trains an initial weld point annotation model based on the first annotation result to obtain a target weld point annotation model; annotates the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set. The technical solution achieves the technical effect of improving the production efficiency and accuracy of the data set, thereby accelerating the application of deep learning models in weld point detection, thereby solving the technical problems in the related art that weld point annotation is time-consuming, labor-intensive, subjective, and has a high error rate.
[0095] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0096] In this embodiment, a solder joint image annotation device is also provided, which is used to implement the above embodiments and preferred implementations, and will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0097] Figure 3 is a flow chart of a welding spot image marking device according to an embodiment of the present invention. Figure 3As shown, a welding spot image annotation device 30 is used as an example, and the device includes: an acquisition module 31, which is used to acquire a first welding spot image set of a vehicle, wherein the first welding spot image set is obtained by photographing the welding spots of the vehicle body based on a photographing device; a processing module 33, which is used to perform image preprocessing on the first welding spot image set to obtain a second welding spot image set and a third welding spot image set; a first annotation module 35, which is used to annotate the second welding spot image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the welding spot positions in the second welding spot image set; a training module 37, which is used to train an initial welding spot annotation model based on the first annotation result to obtain a target welding spot annotation model; a second annotation module 39, which is used to annotate the third welding spot image set based on the target welding spot annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the welding spot positions in the third welding spot image set.
[0098] Optionally, the processing module 33 is also used to filter the first weld point image set to obtain a fourth weld point image set, wherein the image quality of the fourth weld point image set is higher than the image quality of the first weld point image set; sample the fourth weld point image set based on a preset sampling ratio to obtain a fifth weld point image set and a sixth weld point image set, wherein the fifth weld point image set is the sampled image set, and the sixth weld point image set is the image set in the fourth weld point image set excluding the fifth weld point image set; perform image compression processing on the fifth weld point image set to obtain a second weld point image set; perform image compression processing on the sixth weld point image set to obtain a third weld point image set.
[0099] Optionally, the first labeling module 35 is also used to perform grayscale processing on the second weld point image set to obtain a seventh weld point image set; perform Gaussian filtering on the seventh weld point image set to obtain an eighth weld point image set; use a Hough circle detection algorithm to identify the eighth weld point image set to obtain a recognition result, wherein the recognition result is used to represent a circular contour in the eighth weld point image set; and label the eighth weld point image set based on the recognition result to obtain a first labeling result.
[0100] Optionally, the first annotation module 35 is also used to annotate the eighth weld point image set based on the recognition result to obtain a third annotation result, wherein the third annotation result is used to annotate the position of the circular object in the eighth weld point image set; filter the third annotation result to obtain a fourth annotation result; and verify the fourth annotation result based on the actual weld point position to obtain the first annotation result.
[0101] Optionally, the first labeling module 35 is also used to adjust the Hough circle detection parameter value of the Hough circle detection algorithm to obtain an adjusted Hough circle detection algorithm; filter the third labeling result based on the adjusted Hough circle detection algorithm to obtain a fifth labeling result; filter the fifth labeling result based on the filter function to obtain a fourth labeling result.
[0102] Optionally, the training module 37 is also used to construct an initial weld point labeling model based on the target detection algorithm and the target weight file; train the initial weld point labeling model based on the first labeling result, and adjust the hyperparameters of the initial weld point labeling model based on the training result to obtain the target weld point labeling model.
[0103] Optionally, the device further includes: a saving module, storing the third annotation result into a target folder, wherein the target folder is a folder storing the first welding point image set, and the name of the third annotation result is consistent with the name of the corresponding welding point image.
[0104] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0105] According to one embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in any of the above-mentioned embodiments of the solder joint image annotation method when running on a computer or a processor.
[0106] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0107] Step S11, obtaining a first welding point image set of the vehicle, wherein the first welding point image set is obtained by photographing the welding points of the vehicle body with a photographing device;
[0108] Step S13, performing image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set;
[0109] Step S15, annotating the second welding point image set based on the first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the welding point positions in the second welding point image set;
[0110] Step S17, training the initial solder joint labeling model based on the first labeling result to obtain a target solder joint labeling model;
[0111] Step S19, annotating the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set.
[0112] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0113] According to an embodiment of the present invention, a computer program product is further provided, including a computer program, and when the computer program is executed by a processor, the welding spot image marking method in embodiment 1 of the present invention is implemented.
[0114] Exemplarily, when the computer program is running, the following steps are performed:
[0115] Step S11, obtaining a first welding point image set of the vehicle, wherein the first welding point image set is obtained by photographing the welding points of the vehicle body with a photographing device;
[0116] Step S13, performing image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set;
[0117] Step S15, annotating the second welding point image set based on the first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the welding point positions in the second welding point image set;
[0118] Step S17, training the initial solder joint labeling model based on the first labeling result to obtain a target solder joint labeling model;
[0119] Step S19, annotating the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set.
[0120] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0121] Optionally, in this embodiment, the processor in the above electronic device may be configured to run a computer program to perform the following steps:
[0122] Step S11, obtaining a first welding point image set of the vehicle, wherein the first welding point image set is obtained by photographing the welding points of the vehicle body with a photographing device;
[0123] Step S13, performing image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set;
[0124] Step S15, annotating the second welding point image set based on the first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate the welding point positions in the second welding point image set;
[0125] Step S17, training the initial solder joint labeling model based on the first labeling result to obtain a target solder joint labeling model;
[0126] Step S19, annotating the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set.
[0127] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0128] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0129] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0130] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0132] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0133] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0134] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for marking a solder joint image, characterized in that: include: Acquire a first welding point image set of the vehicle, wherein the first welding point image set is obtained by photographing the welding points of the vehicle body with a photographing device; Performing image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set; Annotate the second weld point image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate weld point positions in the second weld point image set; Training the initial solder joint annotation model based on the first annotation result to obtain a target solder joint annotation model; The third weld point image set is annotated based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate weld point positions in the third weld point image set.
2. The method according to claim 1, characterized in that The performing image preprocessing on the first welding point image set to obtain the second welding point image set and the third welding point image set comprises: filtering the first welding point image set to obtain a fourth welding point image set, wherein the image quality of the fourth welding point image set is higher than the image quality of the first welding point image set; Sampling the fourth weld image set based on a preset sampling ratio to obtain a fifth weld image set and a sixth weld image set, wherein the fifth weld image set is an image set obtained by sampling, and the sixth weld image set is an image set in the fourth weld image set excluding the fifth weld image set; Performing image compression processing on the fifth welding point image set to obtain the second welding point image set; The sixth welding point image set is subjected to image compression processing to obtain the third welding point image set.
3. The method according to claim 1, characterized in that: The step of labeling the second welding point image set based on the first labeling method to obtain a first labeling result includes: Performing grayscale processing on the second welding point image set to obtain a seventh welding point image set; Performing Gaussian filtering on the seventh welding point image set to obtain an eighth welding point image set; Using a Hough circle detection algorithm to identify the eighth solder joint image set, to obtain a recognition result, wherein the recognition result is used to represent a circular contour in the eighth solder joint image set; The eighth welding point image set is annotated based on the recognition result to obtain the first annotation result.
4. The method according to claim 3, characterized in that The labeling of the eighth welding point image set based on the recognition result to obtain the first labeling result includes: Annotating the eighth welding point image set based on the recognition result to obtain a third annotation result, wherein the third annotation result is used to annotate the position of the circular object in the eighth welding point image set; Filtering the third annotation result to obtain a fourth annotation result; The fourth marking result is verified based on the actual welding point position to obtain the first marking result.
5. The method according to claim 4, characterized in that The filtering process on the third annotation result to obtain the fourth annotation result includes: Adjusting a Hough circle detection parameter value of the Hough circle detection algorithm to obtain an adjusted Hough circle detection algorithm; Filtering the third labeling result based on the adjusted Hough circle detection algorithm to obtain a fifth labeling result; The fifth marking result is filtered based on a filtering function to obtain the fourth marking result.
6. The method according to claim 1, characterized in that The initial solder joint annotation model is trained based on the first annotation result to obtain the target solder joint annotation model including: Constructing the initial solder joint annotation model based on the target detection algorithm and the target weight file; The initial solder joint labeling model is trained based on the first labeling result, and the hyper parameters of the initial solder joint labeling model are adjusted based on the training result to obtain a target solder joint labeling model.
7. The method according to claim 4, characterized in that Also includes: The third annotation result is stored in a target folder, wherein the target folder is a folder storing the first welding point image set, and the name of the third annotation result is consistent with the name of the corresponding welding point image.
8. The method according to any one of claims 1 to 7, characterized in that The number of weld points in any weld point image in the first weld point image set is within a preset value range.
9. A welding spot image marking device, characterized in that: include: An acquisition module, configured to acquire a first welding point image set of a vehicle, wherein the first welding point image is obtained by photographing the vehicle with a photographing device; A processing module, configured to perform image preprocessing on the first welding point image set to obtain a second welding point image set and a third welding point image set; A first annotation module, configured to annotate the second welding point image set based on a first annotation method to obtain a first annotation result, wherein the first annotation result is used to annotate welding point positions in the second welding point image set; A training module, used for training the initial solder joint annotation model based on the first annotation result to obtain a target solder joint annotation model; The second annotation module is used to annotate the third weld point image set based on the target weld point annotation model to obtain a second annotation result, wherein the second annotation result is used to annotate the weld point positions in the third weld point image set.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the solder joint image marking method described in any one of claims 1 to 8 when running on a computer or a processor.
11. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the solder joint image marking method described in any one of claims 1 to 8.
12. A computer program product, characterized in that The invention comprises a computer program, which implements the welding spot image marking method described in any one of claims 1 to 8 when being executed by a processor.
