Alloy resistance welding defect visual detection method and system based on image analysis
By dividing the welding area into multiple sub-regions, prioritizing the detection of high-frequency regions based on historical defect frequencies, and utilizing image analysis and deep learning to optimize parameters, the problem of low accuracy and efficiency in manual inspection is solved, achieving efficient and intelligent welding defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FOSHAN HAOYUN ELECTRICAL APPLIANCE ACCESSORIES CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-04-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing methods for detecting defects in alloy resistance welding rely on manual inspection, resulting in low accuracy, low efficiency, and poor reliability, making it difficult to meet the real-time inspection needs of large-scale production.
The welding area is divided into multiple detection sub-regions. High-frequency areas are detected first based on historical defect frequency. The acquisition parameters are optimized through image analysis and deep learning algorithms, the detection order is dynamically adjusted, and defect identification is performed by combining surface features and transfer learning.
It has achieved automation, intelligence and high precision in the detection of defects in alloy resistance welding, improved detection efficiency and accuracy, optimized the detection process and reduced manual intervention.
Smart Images

Figure CN121937458A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image recognition technology, specifically to a visual inspection method and system for alloy resistance welding defects based on image analysis. Background Technology
[0002] With the rapid development of industrial automation, the welding quality of alloy resistors affects the performance and reliability of electronic equipment. However, traditional methods for detecting welding defects in alloy resistors mainly rely on manual visual inspection, which is difficult to meet the real-time inspection needs of large-scale production, resulting in inconsistent inspection standards and low inspection efficiency.
[0003] Furthermore, manual inspection is susceptible to subjective factors and lacks the accuracy to identify hidden defects such as minute cracks and pores, potentially leading to defective products being released and increasing subsequent quality risks. Additionally, manual inspection requires significant manpower, and prolonged work can cause fatigue, further reducing the stability of the inspection process. Summary of the Invention
[0004] This application provides a visual inspection method and system for alloy resistance welding defects based on image analysis, which solves the technical problems of low accuracy, low efficiency and poor reliability in existing alloy resistance welding defect detection methods that rely heavily on manual inspection.
[0005] The technical solution to the above-mentioned technical problems in this application is as follows: In a first aspect, this application provides a visual inspection method for alloy resistance welding defects based on image analysis, the method comprising: The alloy resistance welding area is divided into multiple inspection sub-areas, and the sub-area with the highest frequency of historical defects is set as the first inspection sub-area based on historical welding quality inspection logs. The welding surface features of the first detection sub-region are obtained, and the light source and camera parameters in the image acquisition process are optimized based on the welding surface features to output the first adaptive acquisition parameters. The image acquisition device is controlled according to the first adaptive acquisition parameters to acquire images of the welding area, and the image processing algorithm is used to perform defect detection in the first detection sub-region, and the first detection result is output. Based on the first detection result, predict the probability of defects occurring in the remaining sub-regions, and select the sub-region with the highest probability as the second detection sub-region; Based on a loop mechanism of sub-region setting, parameter optimization, and defect detection, the welding defect detection results are output until all sub-regions have been detected.
[0006] Secondly, this application provides a visual inspection system for alloy resistance welding defects based on image analysis, including: The image acquisition module is used to divide the alloy resistance welding area into multiple detection sub-regions, and based on the historical welding quality inspection log, the sub-region with the highest frequency of historical defects is set as the first detection sub-region. The feature acquisition module is used to acquire the welding surface features of the first detection sub-region, optimize the light source and camera parameters during the image acquisition process based on the welding surface features, and output the first adaptive acquisition parameters. The image processing module is used to control the image acquisition device according to the first adaptive acquisition parameters, acquire the image of the welding area, and use the image processing algorithm to perform defect detection in the first detection sub-region, and output the first detection result. The defect probability prediction module is used to predict the probability of defect occurrence in the remaining sub-regions based on the first detection result, and select the sub-region with the highest probability as the second detection sub-region. The results output module is used for a loop mechanism based on sub-region setting, parameter optimization, and defect detection until all sub-regions have been detected, and then outputs the welding defect detection results.
[0007] This application provides one or more technical solutions, which have at least the following technical effects or advantages: This application provides a visual inspection method and system for alloy resistance welding defects based on image analysis. First, the alloy resistance welding area is divided into multiple detection sub-regions. Based on historical welding quality inspection logs, the sub-region with the highest frequency of historical defects is designated as the first detection sub-region, avoiding the inefficiency caused by indiscriminate inspection of the entire welding area. Second, the welding surface features of the first detection sub-region are acquired, and the light source and camera parameters during image acquisition are optimized accordingly, outputting first adaptive acquisition parameters. This improves the contrast and clarity of the acquired images, providing high-quality image data for subsequent defect identification. Then, the image acquisition device is controlled to acquire images of the welding area according to the first adaptive acquisition parameters, and image processing algorithms are used to perform defect detection in the first detection sub-region, outputting the first detection result. The high-resolution industrial camera, combined with the optimized parameters, ensures the capture of image details. Based on transfer learning and fine-tuning using the current batch of samples, the accuracy of defect identification and classification is effectively improved. Subsequently, based on the first detection result, the probability of defects occurring in the remaining sub-regions is predicted. The sub-region with the highest probability is selected as the second detection sub-region. The results of the detected sub-regions are used to assess the defect risk of the undetected regions, achieving dynamic optimization of the detection sequence. This makes the detection process more intelligent and efficient, prioritizing high-risk areas. Finally, based on the cyclical mechanism of sub-region setting, acquisition parameter optimization, and defect detection, the detection process continues until all sub-regions have been detected, outputting the welding defect detection results. This ensures that each sub-region receives acquisition parameters and a detection process that matches its characteristics.
[0008] Through the above technical solution, this application performs dynamic detection of the welding area in different regions, optimizes the acquisition parameters by combining surface features, and uses deep learning algorithms for defect identification, thereby solving the problems of low accuracy, low efficiency and poor reliability of manual detection, and realizing the automation, intelligence and high precision of alloy resistance welding defect detection. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a schematic flowchart of the image analysis-based visual inspection method for alloy resistance welding defects provided in the embodiments of this application; Figure 2 This is a schematic diagram of the structure of the image analysis-based visual inspection system for alloy resistance welding defects provided in the embodiments of this application.
[0011] The components represented by each number in the attached diagram are explained below: Image acquisition module 11, feature acquisition module 12, image processing module 13, defect probability prediction module 14, and result output module 15. Detailed Implementation
[0012] This application provides a visual inspection method and system for alloy resistance welding defects based on image analysis, which addresses the technical problem that existing alloy resistance welding defect detection methods rely heavily on manual inspection, resulting in low accuracy, low efficiency, and poor reliability in welding defect detection.
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0015] In the description of this application, the term "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid unnecessarily obscuring the description of this application. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0016] Example 1, as Figure 1 As shown in the embodiments of this application, a visual inspection method for alloy resistance welding defects based on image analysis is provided, including: S10: Divide the alloy resistance welding area into multiple inspection sub-areas, and set the sub-area with the highest frequency of historical defects as the first inspection sub-area based on historical welding quality inspection logs. In this embodiment, the alloy resistance welding area is first divided into grids. For example, a circular welding area with a diameter of 5mm is divided into 25 square detection sub-areas with a size of 1mm×1mm to ensure that the boundaries of the sub-areas cover the entire welding area.
[0017] Secondly, by retrieving the welding quality inspection logs of the same model of products in the past, the cumulative number of defects such as cracks, porosity, and incomplete welds in each sub-area is counted, the defect frequency of each sub-area is calculated, and the sub-area with the highest defect frequency is marked as the first inspection sub-area and inspected first.
[0018] Specifically, step S10 in the method includes: The welding area is divided into three sub-regions: the weld center area, the fusion zone, and the heat-affected zone. Based on welding quality inspection logs within a historical time range, the frequency of welding defects in each sub-region is statistically analyzed, and the sub-region with the highest frequency is selected as the first inspection sub-region.
[0019] In this embodiment, firstly, based on the process characteristics and defect distribution patterns of alloy resistance welding, the welding area is divided into three characteristic sub-regions: the weld center area, the fusion zone, and the heat-affected zone.
[0020] The weld center zone is the core area directly affected by the electrode during the welding process. It is the main site of metal melting and solidification, and is commonly found to have internal defects such as porosity and inclusions. The fusion zone is located in the transition zone between the weld center zone and the base metal. Due to the large temperature gradient, it is prone to defects such as cracks and lack of fusion. The heat-affected zone refers to the area where the base metal undergoes changes in its microstructure and properties due to the welding thermal cycle. Problems such as coarse grains and softening may occur.
[0021] Secondly, based on welding quality inspection logs within a historical timeframe, such as the past 6 months, the frequency of welding defects in each sub-region is statistically analyzed on a daily basis. Specifically, the defect records in the logs are structured to extract key information such as defect type, location coordinates, and corresponding batch / product model. Defects are then assigned to their corresponding sub-regions through coordinate matching.
[0022] Finally, the defect frequency of each sub-region is calculated according to the formula "Defect frequency of each sub-region = (Number of defects / Total number of inspections)", and the sub-region with the highest frequency is selected as the first inspection sub-region.
[0023] For example, if the frequency of defects in the fusion zone is 23%, which is higher than the 18% in the weld center zone and the 10% in the heat-affected zone, then the fusion zone is set as the first detection sub-region.
[0024] S20: Obtain the welding surface features of the first detection sub-region, optimize the light source and camera parameters during the image acquisition process based on the welding surface features, and output the first adaptive acquisition parameters; In this embodiment, a hyperspectral camera is used to acquire images of the welding surface of the first detection sub-region. Surface feature parameters are extracted, and texture feature values are calculated using the gray-level co-occurrence matrix to obtain surface roughness. The average reflectance or vehicle reflectivity is calculated based on the RGB channel gray-level value distribution, and color uniformity is quantified using the color variance index. Based on the extracted surface features, the light source parameters and camera parameters are optimized in multiple dimensions.
[0025] Furthermore, by establishing a mapping model between surface features and acquisition parameters, the first adapted acquisition parameters that match the characteristics of the first detection sub-region are finally output.
[0026] Specifically, step S20 in the method includes: Surface images of the first detection sub-region of the same batch of welded samples were collected, and surface gloss, texture complexity, and reflective properties were extracted as welded surface features. Within the preset parameter adjustment range, multiple sets of acquisition parameters are randomly selected. Each set of parameters includes light source intensity, light source angle, camera exposure time, and focal length. Based on the aforementioned welding surface characteristics, the set of parameters with the highest score is selected from multiple sets of parameters as the first set of adaptive acquisition parameters.
[0027] In this embodiment, firstly, 10 samples are randomly selected from the same batch of welded samples, and surface images of the first detection sub-region are acquired using initial parameters, namely, a light source intensity of 500 lux, a light source angle of 45°, a camera exposure time of 10 ms, and a focal length of 50 mm. Surface gloss, texture complexity, and reflectivity are extracted as core welded surface features using image analysis algorithms.
[0028] Secondly, multiple sets of acquisition parameters were randomly selected within the preset parameter adjustment range. Specifically, the adjustment range of the light source intensity was set to 300-800 lux with a step size of 50 lux, the light source angle to 30°-60° with a step size of 5°, the camera exposure time to 5-20 ms with a step size of 1 ms, and the focal length to 45-55 mm with a step size of 1 mm. An orthogonal experimental method was used to generate 100 sets of candidate acquisition parameters within the preset parameter adjustment range.
[0029] Then, for each set of candidate parameters, images of the fusion zone of the corresponding samples are acquired, and the images are scored from two dimensions: image clarity and image contrast. The set of parameters with the highest comprehensive score is selected as the first set of adaptive acquisition parameters.
[0030] Specifically, based on the weld surface characteristics, the set of parameters with the highest score is selected from multiple sets of parameters as the first set of adaptive acquisition parameters, including: Train the evaluation model using historically collected data; Multiple sets of collected parameters and welding surface features are input into the evaluation model, which outputs multiple image contrast scores and multiple image sharpness scores. Multiple image comprehensive scores are obtained through weighted calculation, and the set of parameters with the highest comprehensive image score is selected as the first set of adaptive acquisition parameters.
[0031] In this embodiment of the application, firstly, 5000 sets of acquisition parameters and image quality data corresponding to different welding surface features over the past 3 months are collected to construct a training dataset. The image quality data includes manually labeled contrast scores of 1-10 and sharpness scores of 1-10.
[0032] Then, a neural network is used to construct an evaluation model. The number of nodes in the input layer is equal to the dimension of the input features. There are four features: gloss, texture complexity, reflectivity, and acquisition parameters. The input layer contains four nodes. One to three hidden layers are set, and the number of nodes in each layer is adjusted experimentally, such as 64 or 32. The activation function is ReLU. The output layer generally does not use an activation function. If the output takes two nodes, a continuous value is directly output. The contrast score and sharpness score are used as output labels. The model parameters are optimized through 5-fold cross-validation to make the mean squared error of the model on the validation set less than 0.5.
[0033] Furthermore, the training framework is constructed using the Adam optimizer and mean squared error loss function, with a batch size of 32 and a total training round of 50. An early stopping mechanism with a patience of 5 is introduced. When the validation set loss does not decrease for 5 consecutive rounds, the training process is automatically terminated. The welding surface features of the current first detection sub-region and 100 sets of candidate acquisition parameters are input into the trained evaluation model. The model outputs the image contrast score and sharpness score corresponding to each set of parameters.
[0034] For example, the output image has a contrast score of 7.2 and a sharpness score of 8.5. The scores are weighted by 0.6 for contrast and 0.4 for sharpness, and the overall score is 7.2×0.6+8.5×0.4=7.72. The set of parameters with the highest overall score is selected as the first set of adaptive acquisition parameters.
[0035] S30: Control the image acquisition device according to the first adaptive acquisition parameters, acquire the image of the welding area, and use the image processing algorithm to perform defect detection in the first detection sub-region, and output the first detection result; In this embodiment of the application, the welding area is image acquired according to the first adaptive acquisition parameters to ensure that the first detection sub-region occupies at least 30% of the effective pixel area in the image.
[0036] The acquired images are first preprocessed, including removing salt-and-pepper noise based on median filtering, enhancing local contrast through Gamma correction, and extracting the contours of the welding area using the Canny edge detection algorithm to achieve regional cropping of the image.
[0037] Subsequently, a YOLOv5 defect detection model optimized based on transfer learning was used to perform defect detection in the first detection sub-region. This model is based on weights pre-trained on public welding defect datasets, such as NEU-DET, and fine-tuned using 2000 labeled images of this batch of products, including defects such as cracks, porosity, and lack of fusion. The model outputs the defect type, location coordinates, confidence level, and defect size of the first detection sub-region, which are then integrated into the first detection result.
[0038] Specifically, step S30 in the method includes: Welding images were acquired using a high-resolution industrial camera with the first adapter acquisition parameters. Image preprocessing includes denoising, enhancement, and segmentation. A convolutional neural network is used to identify and classify defects in the preprocessed image, and the defect type, location and severity information are output as the first detection result.
[0039] The convolutional neural network employs transfer learning, pre-training on a publicly available welding defect dataset and then fine-tuning using the current batch of welding samples.
[0040] In this embodiment, firstly, a high-resolution industrial camera is used to acquire images of the welding area according to the first adaptive acquisition parameters, ensuring that the details of the first detection sub-region in the image are clearly distinguishable, and the actual size of a single pixel is no greater than 0.01mm.
[0041] Secondly, the acquired raw images are preprocessed. A 3×3 median filtering algorithm is used to remove salt-and-pepper noise that may be generated during the welding process. This algorithm effectively suppresses isolated noise points by replacing the center pixel value with the median value of the neighboring pixels. Gamma correction is then applied, with the Gamma value dynamically adjusted according to the surface reflectivity. For example, when the reflectivity is strong, the Gamma value is set to 0.8 to enhance the local contrast of the image and make the grayscale difference between the defect area and the normal area more significant. Then, an image segmentation method based on threshold segmentation and morphological operations is used, combined with the Canny edge detection algorithm, to extract the complete contour of the welding area. The area within the contour is cropped into the region of interest to reduce background interference.
[0042] Furthermore, convolutional neural networks are used for defect identification and classification. This network uses a ResNet50 pre-trained on the publicly available welding defect dataset NEU-DET as the base model, retains its first 10 convolutional layers as feature extractors, and replaces the fully connected layers with output layers adapted to the defect categories of this application, such as cracks, porosity, lack of fusion, inclusion defects, and one normal category.
[0043] Furthermore, the model was fine-tuned using 1500 labeled images from this batch of products. A cosine annealing learning rate strategy was employed during fine-tuning, with an initial learning rate of 0.001, decaying to 0.8 times the current rate every 5 epochs. The batch size was set to 16, and the training run consisted of 50 epochs. The model performed feature extraction and classification on the preprocessed ROI images, outputting the type, location, and severity information for each detected defect. Severity was determined by combining the percentage of the defect area to the total area of the sub-region with the confidence level. For example, when the defect area percentage was ≥5% and the confidence level was ≥0.85, it was classified as a "severe defect"; when the area percentage was 2%-5% and the confidence level was ≥0.75, it was classified as a "moderate defect"; and when the area percentage was <2% or the confidence level was <0.75, it was classified as a "minor defect" or "suspected defect." These results were ultimately integrated into a structured first detection result.
[0044] S40: Based on the first detection result, predict the probability of defects occurring in the remaining sub-regions, and select the sub-region with the highest probability as the second detection sub-region; In this embodiment of the application, based on the defect type, location and severity information in the first detection result, a sub-region defect correlation prediction model is constructed. The defect features of the first detected sub-region are used as input to predict the probability of defects appearing in the remaining sub-regions. Then, the sub-region with the highest probability is selected as the second detected sub-region.
[0045] The step of predicting the probability of defects occurring in the remaining sub-regions based on the first detection result includes: Based on historical welding logs, a correlation model is established between the results of the first inspection sub-region and the probability of defects in the remaining sub-regions. The correlation model is used to predict the defect probability distribution of the remaining sub-regions based on the current first detection result.
[0046] In this embodiment, firstly, welding defect correlation data of the same type of alloy resistor products within the past 24 months are extracted from historical welding logs, including the defect type and severity of the first detection sub-region and the defect occurrence status of the remaining sub-regions in the corresponding batch. The data is cleaned and feature-engineered to convert the defect features of the first detection sub-region into discretized variables. For example, "crack-severe" is marked as a feature vector [1,0,0,1], where the first three digits represent the defect type and the last digit represents the severity. The defect occurrence status of the remaining sub-regions is used as a binary label, where 1 indicates the presence of a defect and 0 indicates no defect.
[0047] A logistic regression algorithm is used to construct an association model. The defect feature vector of the first detection sub-region is used as input, and the defect occurrence probability of each of the remaining sub-regions is used as output. L1 regularization is applied for feature selection, eliminating redundant variables and retaining the top 5 features with the highest contribution to prediction. For example, if the calculated output defect probability in the weld center area is 32% and the defect probability in the heat-affected zone is 15%, then the weld center area is determined as the second detection sub-region.
[0048] Furthermore, a correlation model is established between the results of the first detection sub-region and the probability of defects occurring in the remaining sub-regions, including: Based on historical welding quality inspection logs, multiple historical inspection samples were collected. Using historical detection samples as input features and the actual defect ratio as supervision label, a probabilistic prediction model is constructed and trained.
[0049] The process involves constructing and training a probabilistic prediction model using a neural network model, which is then trained using historical data until convergence.
[0050] In this embodiment of the application, firstly, 5,000 historical inspection samples containing complete sub-region defect records are selected from the historical welding quality inspection log. Each sample contains the sample inspection result of the first inspection sub-region and the actual defect ratio of the other sub-regions under the condition of the sample inspection result.
[0051] Subsequently, a probabilistic prediction model was constructed using a neural network model. The input layer of this model has 6 nodes, corresponding to the dimension of the input feature vector; two hidden layers are set, with the first layer having 32 nodes and the second layer having 16 nodes, both using the ReLU activation function; the number of nodes in the output layer is equal to the number of remaining sub-regions, and the Sigmoid activation function is used to map the output values to the range of 0-1, representing the probability of defects occurring in each sub-region.
[0052] During model training, mean squared error was used as the loss function, and the Adam optimizer was employed. The initial learning rate was set to 0.001, which was dynamically adjusted based on the validation set loss during training. The batch size was 64, and the total number of training epochs was 100. A Dropout layer with a dropout rate of 0.2 was introduced to prevent overfitting, and an early stopping mechanism with a patience of 8 was used, stopping training when the validation set loss failed to improve for eight consecutive epochs.
[0053] Furthermore, the model is iteratively trained using historical data until the root mean square error on the test set is below 0.05 and the prediction accuracy stabilizes, at which point the model is considered converged. The converged probabilistic prediction model can then quickly output the probability of defects occurring in other sub-regions based on the defect characteristics of the current first detected sub-region.
[0054] S50: Based on a loop mechanism of sub-region setting - acquisition parameter optimization - defect detection, the welding defect detection results are output until all sub-regions have been detected.
[0055] In this embodiment, the second detection sub-region is treated as a new "first detection sub-region," and steps S20 to S40 are repeated. Specifically, for the second detection sub-region, an image of its welding surface is first acquired using a hyperspectral camera, and surface feature parameters of the region are extracted, including surface gloss, texture complexity, and reflectivity.
[0056] Then, using the pre-trained mapping model between surface features and acquisition parameters, combined with the characteristics of the second detection sub-region, the light source parameters and camera parameters are optimized again, and the second adapted acquisition parameters that match the second detection sub-region are output.
[0057] Subsequently, the image acquisition device is controlled according to the second adaptive acquisition parameters to acquire the welding image of the sub-region. After preprocessing, the YOLOv5 defect detection model optimized based on transfer learning is used to perform defect detection and output the second detection result.
[0058] Next, taking the second detection result into consideration, the probability of defects appearing in the remaining undetected sub-regions is predicted again using the sub-region defect correlation prediction model, and the sub-region with the highest probability is selected as the next sub-region to be detected.
[0059] This process is repeated continuously, optimizing acquisition parameters, acquiring images, and detecting defects in newly selected high-probability defect sub-regions, until all preset sub-regions within the welding area have been detected.
[0060] Finally, the detection results of all sub-regions are integrated, including information such as defect type, location coordinates, confidence level, defect size and severity of each sub-region, to form a complete welding defect detection report, which serves as the final welding defect detection result of the method in this application.
[0061] In summary, compared with existing technologies, this application achieves precise matching between acquisition parameters and welding surface features through a dynamic parameter optimization mechanism, thus solving the problem of unstable image quality caused by traditional fixed parameter acquisition.
[0062] In summary, the embodiments of this application have at least the following technical effects: This application provides an image analysis-based visual inspection method for defects in alloy resistance welding. First, the alloy resistance welding area is divided into multiple detection sub-regions. Based on historical welding quality inspection logs, the sub-region with the highest frequency of historical defects is designated as the first detection sub-region, avoiding the inefficiency caused by indiscriminate inspection of the entire welding area. Second, the welding surface features of the first detection sub-region are acquired, and the light source and camera parameters during image acquisition are optimized accordingly, outputting first adaptive acquisition parameters. This improves the contrast and clarity of the acquired images, providing high-quality image data for subsequent defect identification. Then, the image acquisition device is controlled to acquire images of the welding area according to the first adaptive acquisition parameters, and image processing algorithms are used to perform defect detection in the first detection sub-region, outputting the first detection result. The high-resolution industrial camera, combined with the optimized parameters, ensures the capture of image details. Based on transfer learning and fine-tuning using the current batch of samples, the accuracy of defect identification and classification is effectively improved. Subsequently, based on the first detection result, the probability of defects occurring in the remaining sub-regions is predicted. The sub-region with the highest probability is selected as the second detection sub-region. The results of the detected sub-regions are used to assess the defect risk of the undetected regions, achieving dynamic optimization of the detection order. This makes the detection process more intelligent and efficient, prioritizing high-risk areas. Finally, based on the cyclical mechanism of sub-region setting, acquisition parameter optimization, and defect detection, the detection process continues until all sub-regions have been detected, outputting the welding defect detection results. This ensures that each sub-region receives acquisition parameters and a detection process that matches its characteristics.
[0063] Through the above technical solution, this application performs dynamic detection of the welding area in different regions, optimizes the acquisition parameters by combining surface features, and uses deep learning algorithms for defect identification, thereby solving the problems of low accuracy, low efficiency and poor reliability of manual detection, and realizing the automation, intelligence and high precision of alloy resistance welding defect detection.
[0064] Example 2, as Figure 2 As shown, based on the same inventive concept as the image analysis-based visual inspection method for alloy resistance welding defects provided in Embodiment 1, this application also provides an image analysis-based visual inspection system for alloy resistance welding defects, including: Image acquisition module 11 is used to divide the alloy resistance welding area into multiple detection sub-areas, and set the sub-area with the highest frequency of historical defects as the first detection sub-area based on historical welding quality inspection logs. The feature acquisition module 12 is used to acquire the welding surface features of the first detection sub-region, optimize the light source and camera parameters in the image acquisition process based on the welding surface features, and output the first adaptive acquisition parameters. Image processing module 13 is used to control the image acquisition device according to the first adaptive acquisition parameters, acquire the image of the welding area, and use the image processing algorithm to perform defect detection of the first detection sub-region and output the first detection result; Defect probability prediction module 14 is used to predict the probability of defect occurrence in the remaining sub-regions based on the first detection result, and select the sub-region with the highest probability as the second detection sub-region. The result output module 15 is used for a loop mechanism based on sub-region setting, acquisition parameter optimization, and defect detection until all sub-regions have been detected, and then outputs the welding defect detection results.
[0065] In one embodiment, the image acquisition module 11 is specifically used for: The welding area is divided into three sub-regions: the weld center area, the fusion zone, and the heat-affected zone. Based on welding quality inspection logs within a historical time range, the frequency of welding defects in each sub-region is statistically analyzed, and the sub-region with the highest frequency is selected as the first inspection sub-region.
[0066] In one embodiment, the feature acquisition module 12 is specifically used for: Surface images of the first detection sub-region of the same batch of welded samples were collected, and surface gloss, texture complexity, and reflective properties were extracted as welded surface features. Within the preset parameter adjustment range, multiple sets of acquisition parameters are randomly selected. Each set of parameters includes light source intensity, light source angle, camera exposure time, and focal length. Based on the aforementioned welding surface characteristics, the set of parameters with the highest score is selected from multiple sets of parameters as the first set of adaptive acquisition parameters.
[0067] Furthermore, in one embodiment, based on the weld surface features, the set of parameters with the highest score is selected from multiple sets of parameters as the first set of adaptive acquisition parameters, including: Train the evaluation model using historically collected data; Multiple sets of collected parameters and welding surface features are input into the evaluation model, which outputs multiple image contrast scores and multiple image sharpness scores. Multiple image comprehensive scores are obtained through weighted calculation, and the set of parameters with the highest comprehensive image score is selected as the first set of adaptive acquisition parameters.
[0068] In one embodiment, the image processing module 13 is specifically used for: Welding images were acquired using a high-resolution industrial camera with the first adapter acquisition parameters. Image preprocessing includes denoising, enhancement, and segmentation. A convolutional neural network is used to identify and classify defects in the preprocessed image, and the defect type, location and severity information are output as the first detection result.
[0069] The convolutional neural network employs transfer learning, pre-training on a publicly available welding defect dataset and then fine-tuning using the current batch of welding samples.
[0070] Further, in one embodiment of the application, predicting the probability of defects occurring in the remaining sub-regions based on the first detection result includes: Based on historical welding logs, a correlation model is established between the results of the first inspection sub-region and the probability of defects in the remaining sub-regions. The correlation model is used to predict the defect probability distribution of the remaining sub-regions based on the current first detection result.
[0071] Furthermore, a correlation model is established between the results of the first detection sub-region and the probability of defects occurring in the remaining sub-regions, including: Based on historical welding quality inspection logs, multiple historical inspection samples were collected. Using historical detection samples as input features and the actual defect ratio as supervision label, a probabilistic prediction model is constructed and trained.
[0072] The process involves constructing and training a probabilistic prediction model using a neural network model, which is then trained using historical data until convergence.
[0073] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. Additionally, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.
[0074] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0075] This specification and accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and modifications fall within the scope of this application and its equivalents, this application intends to include such modifications and modifications.
Claims
1. A visual inspection method for defects in alloy resistance welding based on image analysis, characterized in that, The method includes: The alloy resistance welding area is divided into multiple inspection sub-areas, and the sub-area with the highest frequency of historical defects is set as the first inspection sub-area based on historical welding quality inspection logs. The welding surface features of the first detection sub-region are obtained, and the light source and camera parameters in the image acquisition process are optimized based on the welding surface features to output the first adaptive acquisition parameters. The image acquisition device is controlled according to the first adaptive acquisition parameters to acquire images of the welding area, and the image processing algorithm is used to perform defect detection in the first detection sub-region, and the first detection result is output. Based on the first detection result, predict the probability of defects occurring in the remaining sub-regions, and select the sub-region with the highest probability as the second detection sub-region; Based on a loop mechanism of sub-region setting, parameter optimization, and defect detection, the welding defect detection results are output until all sub-regions have been detected.
2. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 1, characterized in that, The visual inspection of the alloy resistance welding area is divided into multiple inspection sub-regions. Based on historical welding quality inspection logs, the sub-region with the highest frequency of historical defects is designated as the first inspection sub-region, including: The welding area is divided into three sub-regions: the weld center area, the fusion zone, and the heat-affected zone. Based on welding quality inspection logs within a historical time range, the frequency of welding defects in each sub-region is statistically analyzed, and the sub-region with the highest frequency is selected as the first inspection sub-region.
3. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 2, characterized in that, The process of acquiring the welding surface features of the first detection sub-region, optimizing the light source and camera parameters during image acquisition based on the welding surface features, and outputting the first adaptive acquisition parameters includes: Surface images of the first detection sub-region of the same batch of welded samples were collected, and surface gloss, texture complexity, and reflective properties were extracted as welded surface features. Within the preset parameter adjustment range, multiple sets of acquisition parameters are randomly selected. Each set of parameters includes light source intensity, light source angle, camera exposure time, and focal length. Based on the aforementioned welding surface characteristics, the set of parameters with the highest score is selected from multiple sets of parameters as the first set of adaptive acquisition parameters.
4. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 3, characterized in that, The step of combining the weld surface features and selecting the highest-scoring set of parameters from multiple sets as the first set of adaptive acquisition parameters includes: Train the evaluation model using historically collected data; Multiple sets of collected parameters and welding surface features are input into the evaluation model, which outputs multiple image contrast scores and multiple image sharpness scores. Multiple image comprehensive scores are obtained through weighted calculation, and the set of parameters with the highest comprehensive image score is selected as the first set of adaptive acquisition parameters.
5. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 1, characterized in that, The step of controlling the image acquisition device according to the first adaptive acquisition parameters, acquiring images of the welding area, and using an image processing algorithm to perform defect detection in the first detection sub-region, and outputting a first detection result, includes: Welding images were acquired using a high-resolution industrial camera with the first adapter acquisition parameters. Image preprocessing includes denoising, enhancement, and segmentation. A convolutional neural network is used to identify and classify defects in the preprocessed image, and the defect type, location and severity information are output as the first detection result.
6. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 5, characterized in that, The convolutional neural network employs transfer learning, pre-training on a publicly available welding defect dataset and then fine-tuning using the current batch of welding samples.
7. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 1, characterized in that, The step of predicting the probability of defects occurring in the remaining sub-regions based on the first detection result includes: Based on historical welding logs, a correlation model is established between the results of the first inspection sub-region and the probability of defects in the remaining sub-regions. The correlation model is used to predict the defect probability distribution of the remaining sub-regions based on the current first detection result.
8. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 7, characterized in that, Establish a correlation model between the results of the first detection sub-region and the probability of defects occurring in the remaining sub-regions, including: Based on historical welding quality inspection logs, multiple historical inspection samples were collected. Using historical detection samples as input features and the actual defect ratio as supervision label, a probabilistic prediction model is constructed and trained.
9. The image analysis-based visual inspection method for defects in alloy resistance welding according to claim 8, characterized in that, A probabilistic prediction model is constructed and trained using a neural network model, and trained on historical data until convergence.
10. A visual inspection system for defects in alloy resistance welding based on image analysis, characterized in that, The method for visual inspection of defects in alloy resistance welding according to any one of claims 1-9 includes: The image acquisition module is used to divide the alloy resistance welding area into multiple detection sub-regions, and based on the historical welding quality inspection log, the sub-region with the highest frequency of historical defects is set as the first detection sub-region. The feature acquisition module is used to acquire the welding surface features of the first detection sub-region, optimize the light source and camera parameters during the image acquisition process based on the welding surface features, and output the first adaptive acquisition parameters. The image processing module is used to control the image acquisition device according to the first adaptive acquisition parameters, acquire the image of the welding area, and use the image processing algorithm to perform defect detection in the first detection sub-region, and output the first detection result. The defect probability prediction module is used to predict the probability of defect occurrence in the remaining sub-regions based on the first detection result, and select the sub-region with the highest probability as the second detection sub-region. The results output module is used for a loop mechanism based on sub-region setting, parameter optimization, and defect detection until all sub-regions have been detected, and then outputs the welding defect detection results.