A method of welding a ball valve assembly based on image recognition
By quantifying the contour irregularity and abnormal hot zones of the ball valve assembly using image recognition technology, an adaptive welding trajectory is generated, which solves the welding defects caused by the irregular contour of the incoming material and improves the scientific nature and consistency of welding accuracy and quality control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANJIN CARLS VALVE CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-07-21
Smart Images

Figure CN121883960B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent welding technology, and in particular to a welding method for ball valve assemblies based on image recognition. Background Technology
[0002] As a critical fluid control component, the welding quality of ball valve components directly affects the product's sealing performance, strength, and service life. Currently, the welding of ball valve components, especially those with complex contours, still heavily relies on manual welding by skilled workers or robot welding via teach-programmed instructions. The former suffers from low efficiency, poor quality consistency, and high labor intensity; the latter, when faced with fluctuations in incoming material dimensions or irregular contours (such as casting burrs or local geometric variations caused by machining errors), often cannot adaptively adjust the preset fixed welding trajectory, easily leading to defects such as weld deviation, uneven penetration, and improper heat input. In severe cases, this can affect the geometric integrity of critical sealing surfaces, causing product leakage.
[0003] With the development of machine vision and intelligent manufacturing technologies, image recognition technology has become an important direction for assisting welding. However, existing technologies are mostly limited to simple workpiece positioning or weld seam location through images, lacking in-depth quantitative analysis of the overall complexity of the workpiece contour and its correlation with welding quality.
[0004] Chinese Patent Application Publication No. CN117206674A discloses a welding method for a ball valve assembly. The welding method includes: providing a ball valve and a pistol, inserting one end of the pistol into one end of the ball valve; determining the welding position based on the inserted pistol and ball valve; welding the position using a laser beam; performing flaw detection on the welded position; and performing airtightness testing on the pistol and ball valve after flaw detection. Applying this invention can improve the technical problems of easy leakage and low production efficiency in ball valve assemblies.
[0005] However, existing technologies still have the following problems: Relying on fixed-trajectory welding post-inspection fails to solve the problem of real-time welding path deviation caused by irregular incoming material contours, which can easily lead to defects such as weld deviation and uneven heat input. Summary of the Invention
[0006] To address this, the present invention provides a welding method for ball valve components based on image recognition, which overcomes the problem in the prior art that relies on fixed trajectory welding and subsequent inspection, failing to solve the problem of real-time welding path deviation caused by irregular material contours, and easily leading to defects such as weld deviation and uneven heat input.
[0007] To achieve the above objectives, the present invention provides a welding method for ball valve assemblies based on image recognition, comprising: Step S1: Acquire image data of the ball valve assembly to be welded, and determine the contour feature data of the ball valve assembly to be welded based on the image data; Step S2: Determine the contour irregularity of the ball valve assembly to be welded based on the contour feature data, and determine the welding type of the ball valve assembly to be welded based on the contour irregularity, wherein the welding type of the ball valve assembly to be welded includes complex welding type and simple welding type. Step S3: In response to the fact that the welding type of the ball valve assembly to be welded is complex, the contour of the ball valve assembly to be welded is divided into several analysis units, and the abnormal hot zone of the contour is determined based on the local irregularity index of each analysis unit. Step S4: Spatial mapping of each profile abnormal hot zone to the preset weld trajectory; Based on the first minimum distance between each profile abnormal hot zone and the preset weld trajectory and the angle between the trajectory directions, the complex welding area is determined. Step S5: Based on the local average curvature of each welding complex area and the second minimum distance from each welding complex area to the critical sealing surface, determine the position sensitivity coefficient of each welding complex area, and determine the welding trajectory of the ball valve assembly to be welded based on the position sensitivity coefficient of each welding complex area.
[0008] Further, in step S1, determining the contour feature data of the ball valve assembly to be welded based on the image data includes: Step S11: Preprocess the acquired image data; Step S12: Perform edge detection and image segmentation on the preprocessed image to extract the foreground region of the ball valve assembly to be welded in the image; Step S13: Based on the foreground region, the outer contour of the ball valve assembly to be welded is obtained through a contour tracking algorithm, and the coordinates, curvature and tangent direction of each point on the outer contour are calculated to form the contour feature data.
[0009] Further, in step S2, determining the contour irregularity of the ball valve assembly to be welded based on the contour feature data includes: Step S21: Determine the ratio of the outline perimeter of the ball valve assembly to be welded to the circumference of a circle with equal area, as the first irregularity factor. Step S22: Determine the ratio of the actual contour area of the ball valve assembly to be welded to its convex hull area, as the second irregularity factor; Step S23: Extract the curvature of all points on the contour and calculate its standard deviation as the third irregularity factor; Step S24: The first irregularity factor, the second irregularity factor and the third irregularity factor are weighted and summed to obtain the contour irregularity.
[0010] Further, in step S2, determining the welding type of the ball valve assembly to be welded based on the contour irregularity includes: If the contour irregularity is greater than or equal to the preset contour irregularity, the welding type of the ball valve assembly to be welded is determined to be a complex welding type. If the contour irregularity is less than the preset contour irregularity, the welding type of the ball valve assembly to be welded is determined to be a simple welding type.
[0011] Furthermore, in step S2, the preset contour irregularity is determined based on the contour irregularity data of several qualified welded parts.
[0012] Further, in step S3, the contour of the ball valve assembly to be welded is divided into several analysis units, and the abnormal hot zone of the contour is determined based on the local irregularity index of each analysis unit, including: Step S31: Slide along the contour of the ball valve assembly to be welded with a preset fixed arc length to divide the contour into multiple continuous analysis units. Step S32: For each analysis unit, calculate the absolute value of the difference between the average curvature of its inner contour points and the average curvature of the overall contour, and use it as the local irregularity index of the analysis unit. Step S33: The analysis units whose local irregularity index is greater than the preset index threshold are marked as preliminary abnormal units; Step S34: Merge adjacent preliminary abnormal units in spatial location to form a continuous contour abnormal hot zone.
[0013] Further, in step S4, each profile abnormal hot zone is spatially mapped to a preset weld trajectory. Based on the first minimum distance between each profile abnormal hot zone and the preset weld trajectory and the angle between the trajectory directions, the complex welding area is determined, including: Step S41: For each of the contour abnormal hot zones, calculate the vertical distance from its geometric center point to the preset weld trajectory, and use it as the first minimum distance; Step S42: Obtain the contour tangent direction of each of the contour abnormal hot zones at the geometric center point, and calculate the absolute value of the angle between the contour tangent direction and the tangent direction of the preset weld trajectory at the nearest projection point, as the trajectory direction angle. Step S43: Determine the contour abnormal hot zone where the first minimum distance is less than the preset first minimum distance or the trajectory direction angle is greater than the preset angle as the welding complex area.
[0014] Further, in step S42, the absolute value of the angle between the contour tangent direction and the tangent direction of the preset weld trajectory at the nearest projection point is calculated as the trajectory direction angle, including: Step S421: Project the geometric center point of the abnormal hot zone of the contour vertically onto the preset weld trajectory to obtain the nearest projection point; Step S422: At the geometric center point, obtain the contour tangent direction vector at the nearest projection point based on the contour feature data; Step S423: At the nearest projection point, based on the discrete point sequence of the preset weld trajectory, calculate the tangent direction vector of the weld trajectory at the nearest projection point. Step S424: Based on the dot product of the contour tangent direction vector and the weld trajectory tangent direction vector, calculate the angle between the two vectors using inverse trigonometric functions, and take the absolute value of the angle as the trajectory direction angle.
[0015] Further, in step S5, based on the local average curvature of each complex weld region and the second minimum distance from each complex weld region to the critical sealing surface, a position sensitivity coefficient for each complex weld region is determined, including: Step S511: For each complex welding area, determine the average value of the absolute curvature of all points on its contour line as the local average curvature. Step S512: Determine the vertical distance from the geometric center point of each complex welding area to the critical sealing surface, as the second minimum distance; Step S513: Normalize the local average curvature and the second minimum distance respectively to obtain the corresponding normalized curvature value and normalized distance value; Step S514: Determine the position sensitivity coefficient based on the normalized curvature value and the normalized distance value.
[0016] Further, in step S5, the welding trajectory of the ball valve assembly to be welded is determined based on the position sensitivity coefficient of each complex welding area, including: Step S521: Calculate the Euclidean distance between the geometric center points of any two complex welding areas. If the distance is less than the preset Euclidean distance, determine that the two complex welding areas are adjacent areas. Step S522: Determine the position sensitivity coefficient of each region in the adjacent regions. If the position sensitivity coefficient of any region in the adjacent regions is greater than the preset sensitivity coefficient, merge the group of adjacent regions into a trajectory planning unit. Step S523: Using the preset weld trajectory as the reference trajectory, for each complex welding area or merged trajectory planning unit, calculate its corresponding local welding trajectory point set according to its position sensitivity coefficient through the trajectory adjustment function, and smoothly connect all the adjusted local welding trajectory point sets with the reference trajectory segment to generate the welding trajectory of the ball valve assembly to be welded.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: by analyzing the irregularity and local anomalies of the incoming material profile in real time, the present invention proactively identifies high-risk areas that are prone to welding defects before welding, significantly advancing the quality control process and effectively avoiding defects such as weld deviation and uneven penetration caused by path deviation. By quantitatively evaluating the spatial geometric relationship between the abnormal profile area and the preset trajectory, and combining its curvature characteristics and distance from the key sealing surface, a targeted adaptive welding trajectory is generated, which significantly improves the adaptability of the welding path to individual workpiece profile differences and the overall welding accuracy.
[0018] Furthermore, this invention achieves objective and comprehensive quantification of workpiece contour irregularity by integrating three geometric factors: contour perimeter ratio, degree of concavity, and curvature fluctuation, and introducing weights and thresholds determined based on historical data statistics. The welding type is automatically determined based on the quantification results, providing a reliable basis for subsequent detailed analysis and realizing intelligent classification of welding strategies. The preset contour irregularity thresholds and weight coefficients are determined based on statistical analysis of historical qualified samples, ensuring that the classification criteria have an objective data foundation and can be iteratively optimized with the accumulation of production data. This guarantees the scientific validity and consistency of the judgment criteria and makes the quality control process quantifiable and traceable.
[0019] Furthermore, based on the overall determination of a complex contour, this invention accurately identifies specific abnormal segments on the contour through local sliding window analysis and index calculation, laying a solid foundation for subsequent targeted intervention. The local irregularity index directly compares the curvature characteristics of the local area with the overall area, and is highly sensitive to defects such as protruding burrs and recessed pits that cause significant local changes in curvature, avoiding the problem of missing local risks when relying solely on overall parameters. The division of analysis units and the anomaly threshold are both set based on process-related feature lengths and historical statistical data, enabling this method to adapt to different specifications of ball valve components and specific production quality levels, rather than using fixed parameters.
[0020] Furthermore, this invention precisely transforms the identified, abstract geometrically anomalous hot zones into quantifiable risk indicators that directly affect welding stability and quality by calculating two key parameters: the first minimum distance and the angle between the trajectory directions. It uses an "OR" relationship of "too close" or "too large directional difference" as the judgment criterion, ensuring that no potential welding defect risk point is overlooked. Whether it's a protrusion adjacent to the weld or a corner causing the welding torch to turn sharply, both can be effectively identified as "complex welding areas," significantly improving the comprehensiveness and accuracy of risk screening. Clearly identifying the areas that truly require trajectory adjustment allows subsequent resource allocation and trajectory optimization to be highly focused on these key areas, avoiding indiscriminate global calculations and improving efficiency. Each ultimately determined "complex welding area" is accompanied by a specific risk type (distance problem or direction problem) and quantification level. This makes the trajectory planning process more targeted, scientific, and executable, thereby fundamentally improving the welding trajectory's adaptability to individual workpiece geometric deviations and overall welding quality.
[0021] Furthermore, this invention uses an abstract position sensitivity coefficient as input, and through explicit adjustment functions and merging logic, directly outputs executable machine instructions, ensuring that the analysis conclusions can be accurately translated into practical actions to improve welding quality. By merging adjacent and high-risk areas to form planning units, multiple potentially conflicting trajectory adjustments within a very small area are avoided, resulting in a more reasonable and smoother trajectory. This also reduces the number of independent adjustment segments that need to be processed, improving the overall efficiency and robustness of the planning algorithm. Local adjustments are made based on a preset standard trajectory, and smooth connections are enforced, ensuring the overall coordination of the final trajectory. This avoids sudden jumps or turns in the trajectory, guaranteeing the stability of the welding torch movement and heat input during welding, which is a crucial prerequisite for obtaining uniform and reliable welds. Attached Figure Description
[0022] Fig. 1 This is a flowchart illustrating the welding method for ball valve components based on image recognition according to the present invention. Fig. 2 This is a flowchart illustrating the process of determining the contour irregularity of the ball valve assembly to be welded in the image recognition-based ball valve assembly welding method of the present invention. Detailed Implementation
[0023] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0024] It should be noted that the data in this embodiment are all obtained through comprehensive analysis and evaluation of historical data from the six months prior to this determination and the corresponding historical determination results using the method described in this invention. Those skilled in the art will understand that the method described in this invention can determine the above-mentioned parameters for a single item by selecting the value with the highest proportion based on the data distribution as the preset standard parameter, using weighted summation to obtain the value as the preset standard parameter, substituting each historical data point into a specific formula and using the value obtained by that formula as the preset standard parameter, or other selection methods, as long as the method described in this invention can clearly define different specific situations in the single-item determination process through the obtained values.
[0025] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0026] Please see Figs. 1-2 As shown, Fig. 1 This is a flowchart illustrating the welding method for ball valve components based on image recognition according to the present invention. Fig. 2 This is a flowchart illustrating the process of determining the contour irregularity of the ball valve assembly to be welded in the image recognition-based ball valve assembly welding method of the present invention.
[0027] The present invention relates to a welding method for ball valve assemblies based on image recognition, comprising: Step S1: Acquire image data of the ball valve assembly to be welded, and determine the contour feature data of the ball valve assembly to be welded based on the image data; Step S2: Determine the contour irregularity of the ball valve assembly to be welded based on the contour feature data, and determine the welding type of the ball valve assembly to be welded based on the contour irregularity, wherein the welding type of the ball valve assembly to be welded includes complex welding type and simple welding type. Step S3: In response to the fact that the welding type of the ball valve assembly to be welded is complex, the contour of the ball valve assembly to be welded is divided into several analysis units, and the abnormal hot zone of the contour is determined based on the local irregularity index of each analysis unit. Step S4: Spatial mapping of each profile abnormal hot zone to the preset weld trajectory; Based on the first minimum distance between each profile abnormal hot zone and the preset weld trajectory and the angle between the trajectory directions, the complex welding area is determined. Step S5: Based on the local average curvature of each welding complex area and the second minimum distance from each welding complex area to the critical sealing surface, determine the position sensitivity coefficient of each welding complex area, and determine the welding trajectory of the ball valve assembly to be welded based on the position sensitivity coefficient of each welding complex area.
[0028] In this embodiment of the invention, acquiring image data of the ball valve assembly to be welded includes using one or more calibrated high-resolution industrial cameras (such as CCD or CMOS cameras) equipped with lenses of appropriate focal lengths to ensure clear imaging and controllable distortion. A controllable active light source (such as an LED ring light source, coaxial light source, or structured light) is used to uniformly illuminate the ball valve assembly, aiming to enhance the contrast between the assembly edges and the background and minimize interference such as shadows and reflections. Acquisition is performed in a fixed, stable lighting environment. The ball valve assembly is typically placed on a fixture or worktable at a known location to ensure its approximate pose (position and orientation) relative to the camera is determined, facilitating subsequent conversion from image coordinates to world coordinates. The acquired image data is a two-dimensional digital image (typically a grayscale or color image) containing the complete external contour of the ball valve assembly. In some embodiments, it may also include three-dimensional point cloud data acquired from multiple angles or using a binocular / 3D camera to provide richer spatial geometric information.
[0029] In this embodiment of the invention, the welding method adopted for simple welding type ball valve components is to directly call the preset weld trajectory in the system for welding, without having to start the subsequent complex contour analysis and adaptive trajectory planning process.
[0030] Specifically, in step S1, determining the contour feature data of the ball valve assembly to be welded based on the image data includes: Step S11: Preprocess the acquired image data; Step S12: Perform edge detection and image segmentation on the preprocessed image to extract the foreground region of the ball valve assembly to be welded in the image; Step S13: Based on the foreground region, the outer contour of the ball valve assembly to be welded is obtained through a contour tracking algorithm, and the coordinates, curvature and tangent direction of each point on the outer contour are calculated to form the contour feature data.
[0031] In this embodiment of the invention, Gaussian filtering and median filtering are used to suppress noise introduced during image acquisition. Histogram equalization is used to enhance the contrast between the foreground (ball valve assembly) and the background, making the edges clearer. Image distortion caused by lens optical characteristics is corrected according to camera calibration parameters to ensure the accuracy of geometric measurements. Algorithms such as Canny and Sobel are used to detect pixels in the image where grayscale values change drastically (i.e., edges). Thresholding segmentation (such as Otsu's method), region growing, or deep learning-based segmentation models are comprehensively applied to classify all pixels belonging to the ball valve assembly into the "foreground region" and separate them from the background, fixtures, or other interference objects. For the binarized foreground region, contour tracking algorithms such as Suzuki-Abe are used to obtain an ordered sequence of pixels of its outer contour. This constitutes a discrete digital representation of the contour. The image coordinates of the contour pixels are converted to coordinates in the real-world coordinate system according to the camera calibration parameters. For each point on the contour, its curvature value is calculated based on the coordinates of its neighboring points by difference or fitting a local curve (such as an arc or polynomial). Curvature quantifies the degree of curvature of the profile at a given point (positive values indicate convexity, negative values indicate concavity, and zero indicates straightness), and is a core geometric quantity for determining "irregularity" and "abrupt changes." Based on the coordinates of this point and its preceding and following points, the tangent direction vector of the profile at that point is calculated. This direction defines the local orientation of the profile and is the basis for evaluating the weld trajectory fit (direction angle). Ultimately, these calculated coordinate, curvature, and tangent direction data collectively constitute the profile feature data.
[0032] This invention proactively identifies high-risk areas prone to welding defects before welding by analyzing the irregularity and local anomalies of the incoming material profile in real time. This significantly advances the quality control process, effectively avoiding defects such as weld deviation and uneven penetration caused by path deviation. By quantitatively evaluating the spatial geometric relationship between the abnormal profile area and the preset trajectory, and combining its curvature characteristics and distance from the key sealing surface, a targeted adaptive welding trajectory is generated. This significantly improves the adaptability of the welding path to individual workpiece profile differences and the overall welding accuracy.
[0033] Specifically, in step S2, determining the contour irregularity of the ball valve assembly to be welded based on the contour feature data includes: Step S21: Determine the ratio of the outline perimeter of the ball valve assembly to be welded to the circumference of a circle with equal area, as the first irregularity factor. Step S22: Determine the ratio of the actual contour area of the ball valve assembly to be welded to its convex hull area, as the second irregularity factor; Step S23: Extract the curvature of all points on the contour and calculate its standard deviation as the third irregularity factor; Step S24: The first irregularity factor, the second irregularity factor and the third irregularity factor are weighted and summed to obtain the contour irregularity.
[0034] In this embodiment of the invention, a first irregularity factor is calculated, which measures the complexity and meandering of the contour relative to a standard circle. First, the total perimeter P of the contour is obtained from the contour feature data. Then, the perimeter C_ideal of the ideal circle with the same actual area A as the contour is calculated (the formula is: C_ideal = 2 × π × sqrt(A / π)). Finally, the first irregularity factor F1 = P / C_ideal is calculated. For a perfect circle, F1 equals 1; the more complex and less smooth the contour, the larger the F1 value. A second irregularity factor is calculated, which measures the degree of concavity or gaps in the contour. First, the area A_convex of the convex hull (i.e., the smallest convex polygon that can completely enclose all contour points) is calculated based on the contour point set. Then, the second irregularity factor F2 = A / A_convex is calculated. For a completely convex contour, its area equals the area of the convex hull, and F2 equals 1; the deeper and more numerous the concavities in the contour, the smaller the F2 value (closer to 0). The third irregularity factor is calculated to measure the fluctuation of the local curvature of the contour. The curvature values of all contour points are extracted directly from the contour feature data, and the standard deviation σ of these curvature values is calculated. This standard deviation σ is the third irregularity factor F3. The smoother and more uniform the change in contour curvature, the smaller F3; the more sharp bends and abrupt changes occur on the contour, the larger F3. The contour irregularity is calculated by combining the three factors that reflect irregular characteristics from different perspectives, and obtaining the final contour irregularity D through weighted summation. The calculation formula is: D = w1 × F1 + w2 × (1 - F2) + w3 × F3. Where w1, w2, and w3 are the weight coefficients of each factor, and w1 + w2 + w3 = 1.
[0035] In this embodiment of the invention, the weighting coefficients are determined as follows: the weights reflect the importance of each factor to the welding quality. They can be determined based on historical experience or experimental data. For example, if the complex and circuitous profile (F1) and local abrupt changes (F3) are considered the main risks, then w1 and w3 can be assigned larger values (e.g., 0.4 each), while the concavity factor w2 can be assigned a smaller value (e.g., 0.2). A practical method is to collect a batch of samples with known welding results (qualified / unqualified), calculate their F1, F2, and F3, and then use statistical analysis (e.g., logistic regression) to deduce the weight combination that best distinguishes the results.
[0036] Specifically, in step S2, determining the welding type of the ball valve assembly to be welded based on the contour irregularity includes: If the contour irregularity is greater than or equal to the preset contour irregularity, the welding type of the ball valve assembly to be welded is determined to be a complex welding type. If the contour irregularity is less than the preset contour irregularity, the welding type of the ball valve assembly to be welded is determined to be a simple welding type.
[0037] Specifically, in step S2, the preset contour irregularity is determined based on the contour irregularity data of several qualified welded parts.
[0038] In this embodiment of the invention, the preset profile irregularity is determined based on statistical analysis of historical production data. A number of ball valve assemblies (e.g., 50-100) that have been verified as having qualified welding quality in past production are selected as samples. The profile irregularity of each of these qualified samples is calculated, thus obtaining a dataset of profile irregularities for qualified parts. Statistical analysis is then performed on this dataset. A direct and effective method is to calculate the statistical upper limit of this dataset. For example, the mean (μ) and standard deviation (S) of the irregularities of these qualified parts can be calculated, and then the preset threshold is set to μ + n × S. Here, n is a coefficient selected according to the stringency of quality requirements; typically, n can be 2 or 3.
[0039] This invention achieves objective and comprehensive quantification of workpiece contour irregularity by integrating three geometric factors: contour perimeter ratio, degree of concavity, and curvature fluctuation, and introducing weights and thresholds determined based on historical data statistics. The quantification results automatically determine the welding type, providing a reliable basis for subsequent detailed analysis and enabling intelligent classification of welding strategies. The preset contour irregularity thresholds and weight coefficients are determined based on statistical analysis of historical qualified samples, ensuring an objective data foundation for the classification criteria. Furthermore, the criteria can be iteratively optimized with accumulated production data, guaranteeing the scientific validity and consistency of the judgment standards and making the quality control process quantifiable and traceable.
[0040] Specifically, in step S3, the contour of the ball valve assembly to be welded is divided into several analysis units, and the abnormal hot zone of the contour is determined based on the local irregularity index of each analysis unit, including: Step S31: Slide along the contour of the ball valve assembly to be welded with a preset fixed arc length to divide the contour into multiple continuous analysis units. Step S32: For each analysis unit, calculate the absolute value of the difference between the average curvature of its inner contour points and the average curvature of the overall contour, and use it as the local irregularity index of the analysis unit. Step S33: The analysis units whose local irregularity index is greater than the preset index threshold are marked as preliminary abnormal units; Step S34: Merge adjacent preliminary abnormal units in spatial location to form a continuous contour abnormal hot zone.
[0041] In this embodiment of the invention, the contour is continuously slid along a preset fixed arc length L, dividing the contour into a series of connected segments, each segment being an analysis unit. The method for determining the preset fixed arc length L is as follows: the setting of L needs to balance analysis accuracy and computational load. A practical method is to associate it with the characteristic length of the welding process. For example, L can be set to 1 / 2 to 1 times the diameter of the welding torch nozzle, or set to the typical width of the weld pool. This ensures that the scale of the analysis unit matches the physical influence range of the welding process. Alternatively, an experimental length that effectively captures common contour defects (such as burrs and pits) can be selected. For each analysis unit, the average curvature of all contour points within it is calculated. Simultaneously, the average curvature of all points in the entire contour is calculated. The local irregularity index of this analysis unit is the absolute value of the difference between the average curvature of all contour points within it and the average curvature of all points in the entire contour. This index effectively measures the degree of deviation of the bending characteristics of this local contour segment from the overall average level. The local irregularity index is compared with a preset index threshold. Analytical units with a local irregularity index greater than the preset threshold are marked as preliminary anomalous units. The preset index threshold is determined similarly to the overall irregularity threshold, based on historical qualified sample data. The local irregularity index of all analytical units on the contours of these qualified samples is calculated, and the higher percentile (e.g., 95th or 98th percentile) of the index distribution is taken as the preset index threshold. Spatially adjacent preliminary anomalous units are merged to form a continuous, larger contour anomalous hotspot.
[0042] This invention, based on the overall determination of a complex contour, accurately identifies specific abnormal segments on the contour through local sliding window analysis and index calculation, laying a solid foundation for subsequent targeted intervention. The local irregularity index directly compares the curvature characteristics of the local area with the overall area, and is highly sensitive to defects such as protruding burrs and recessed pits that cause significant local changes in curvature, avoiding the problem of missing local risks when relying solely on overall parameters. The division of analysis units and the anomaly threshold are set based on process-related feature lengths and historical statistical data, enabling the method to adapt to different specifications of ball valve components and specific production quality levels, rather than using fixed parameters.
[0043] Specifically, in step S4, each contour-abnormal hot zone is spatially mapped to a preset weld trajectory. Based on the first minimum distance between each contour-abnormal hot zone and the preset weld trajectory and the angle between the trajectory directions, the complex welding area is determined, including: Step S41: For each of the contour abnormal heat zones, calculate the perpendicular distance from its geometric center point to the preset weld seam trajectory as the first minimum distance. Step S42: Obtain the contour tangent direction at the geometric center point of each of the contour abnormal heat zones, and calculate the absolute value of the included angle between the contour tangent direction and the tangent direction of the preset weld seam trajectory at the nearest projection point as the trajectory direction included angle. Step S43: Determine the welding complex area as the contour abnormal heat zone where the first minimum distance is less than the preset first minimum distance or the trajectory direction included angle is greater than the preset included angle.
[0044] In the embodiment of the present invention, calculate the coordinate average value of all contour points of each contour abnormal heat zone as its geometric center point. This point represents the average position of this heat zone. First minimum distance (d_min): Calculate the perpendicular distance (i.e., the shortest perpendicular distance) from this geometric center point to the preset weld seam trajectory. This distance quantifies the position deviation between this abnormal area and the ideal weld position. Trajectory direction included angle (θ): First, at this geometric center point, obtain the tangent direction (T_contour) of the contour according to the contour feature data. Second, project this point vertically onto the preset weld seam trajectory to obtain the projection point, and calculate the tangent direction (T_path) of the trajectory at this projection point. Finally, calculate the absolute value of the included angle between these two direction vectors. This included angle quantifies the attitude deviation between the workpiece contour trend and the preset welding travel direction near the abnormal area. Determine the welding complex area: Compare the calculated parameters (d_min, θ) of each abnormal heat zone with the preset thresholds: If d_min < D_th (preset first minimum distance threshold), it indicates that this abnormal area is very close to the predetermined weld seam, and the welding torch must pass through or be adjacent to this area, and its geometric abnormality can easily directly cause the weld seam to shift. If θ > θ1 (preset included angle threshold), it indicates that even if the position is close, the contour direction at this place is very different from the welding direction, and the welding torch needs to sharply adjust its attitude here, which is likely to cause unstable welding speed and uneven heat input. The contour abnormal heat zone that meets any one of the conditions is determined as the "welding complex area". Preset first minimum distance threshold D_th: Usually related to the tolerance ability of the welding process. It can be set as a certain multiple (such as 1.5 - 2 times) of the allowable deviation of the welding torch centering, or based on the statistical value of the maximum position deviation of the abnormal areas that did not cause defects in historical data. Preset included angle threshold θ1: Usually related to the ability of the robot or the welding torch to smoothly adjust the attitude. It can be set according to the welding process requirements, for example, 15° to 30°. It can also be determined by analyzing the samples that cause welding defects and statistically analyzing the distribution of their direction included angles to determine the lower limit.
[0045] Specifically, in step S42, calculating the absolute value of the included angle between the contour tangent direction and the tangent direction of the preset weld seam trajectory at the nearest projection point as the trajectory direction included angle includes: Step S421: Project the geometric center point of the abnormal hot zone of the contour vertically onto the preset weld trajectory to obtain the nearest projection point; Step S422: At the geometric center point, obtain the contour tangent direction vector at the nearest projection point based on the contour feature data; Step S423: At the nearest projection point, based on the discrete point sequence of the preset weld trajectory, calculate the tangent direction vector of the weld trajectory at the nearest projection point. Step S424: Based on the dot product of the contour tangent direction vector and the weld trajectory tangent direction vector, calculate the angle between the two vectors using inverse trigonometric functions, and take the absolute value of the angle as the trajectory direction angle.
[0046] In this embodiment of the invention, the geometric center point of the abnormal hot zone is vertically projected onto a preset weld trajectory curve, thereby obtaining the point closest to the center point on the preset trajectory, called the nearest projection point. Next, based on the contour feature data calculated and stored in step S1, the contour tangent direction at the geometric center point of the abnormal hot zone is obtained, i.e., the instantaneous extension direction of the contour at that point, and represented as a first direction vector. Then, the preset weld trajectory is typically represented internally by a series of ordered discrete point coordinates. Based on these discrete point sequences, numerical calculation methods (such as forward difference or central difference) are used to calculate the tangent direction at the nearest projection point obtained in step S421, i.e., the instantaneous travel direction of the preset welding path at that point, and represented as a second direction vector. Finally, according to the principle of vector operation, a dot product operation is performed on the first and second direction vectors obtained above. The result of the dot product operation, combined with the magnitudes of the two vectors, is substituted into an inverse trigonometric function (such as an inverse cosine function) to calculate the spatial angle between the two direction vectors. To ensure consistency in measurement, the absolute value of the calculated angle is taken as the final "trajectory direction angle". The smaller the angle value, the more consistent the contour of the abnormal area is with the preset welding direction; the larger the angle value, the greater the difference between the two directions, and the more drastic the posture adjustment of the welding torch needs to be made during welding.
[0047] This invention precisely transforms identified, abstract geometrically anomalous hot zones into quantifiable risk indicators that directly impact welding stability and quality by calculating two key parameters: the first minimum distance and the angle between the trajectory directions. It employs an "OR" relationship between "too close" and "too large directional difference" as the judgment criterion, ensuring that no potential welding defect risk point is overlooked. Whether it's a protrusion adjacent to the weld seam or a corner causing a sharp turn of the welding torch, both can be effectively identified as "complex welding areas," significantly improving the comprehensiveness and accuracy of risk screening. Clearly identifying areas that truly require trajectory adjustment allows subsequent resource allocation and trajectory optimization to be highly focused on these key areas, avoiding indiscriminate global calculations and improving efficiency. Each ultimately determined "complex welding area" is accompanied by a specific risk type (distance or direction problem) and quantification level. This makes the trajectory planning process more targeted, scientific, and executable, fundamentally improving the welding trajectory's adaptability to individual workpiece geometric deviations and overall welding quality.
[0048] Specifically, in step S5, based on the local average curvature of each complex welding region and the second minimum distance from each complex welding region to the critical sealing surface, the position sensitivity coefficient of each complex welding region is determined, including: Step S511: For each complex welding area, determine the average value of the absolute curvature of all points on its contour line as the local average curvature. Step S512: Determine the vertical distance from the geometric center point of each complex welding area to the critical sealing surface, as the second minimum distance; Step S513: Normalize the local average curvature and the second minimum distance respectively to obtain the corresponding normalized curvature value and normalized distance value; Step S514: Determine the position sensitivity coefficient based on the normalized curvature value and the normalized distance value.
[0049] In this embodiment of the invention, the critical sealing surface typically refers to the valve seat sealing surface on the valve body that forms a sealing fit with the ball (valve core). This surface is usually precision machined and has specific geometric shapes (such as spherical or conical surfaces) and roughness requirements to ensure a tight fit with the ball and achieve a reliable fluid seal. In the initial system setup phase, a standard three-dimensional computer-aided design (CAD) model of the ball valve assembly to be welded is imported into the system. In this model, the geometric region of the "valve seat sealing surface" and its position in the world coordinate system are clearly marked according to the design drawings. After the system acquires the image of the actual workpiece in step S1 and calculates its contour coordinates in the real world, it spatially aligns the contour data of the actual workpiece with the standard three-dimensional model through point cloud registration or feature matching algorithms. Once registration is completed, the predefined "critical sealing surface" region in the model is automatically mapped onto the image of the actual workpiece and thus determined.
[0050] In this embodiment of the invention, for each complex welding area, the curvature values of all contour points constituting that area are obtained. The absolute values of these curvature values are taken, and then the average value of these absolute values is calculated to obtain the local average curvature of that area. The larger this value is, the more severe the contour curvature change in that area, and the more difficult it is to control the welding torch posture and speed during welding. Next, the geometric center point of each complex welding area is determined, and the shortest vertical distance from this point to the specified key sealing surface (such as the valve seat sealing surface) on the ball valve assembly is calculated as the second minimum distance. The shorter this distance is, the easier it is for the heat generated in this abnormal area during welding to be conducted to the sealing surface, leading to a greater risk of deformation or performance degradation. Next, in order to integrate the above two indicators with different physical meanings and dimensions, they need to be normalized separately. The specific method is to find the maximum and minimum values of the "local average curvature" and the maximum and minimum values of the "second minimum distance" for all complex welding areas in the current batch or historical statistics. For the "local average curvature" of a certain area, its normalized value is equal to the curvature value of that area minus the global minimum value, and then divided by the difference between the global maximum and minimum values. The normalized value for the "second minimum distance" is calculated in the same way. Through this process, both are converted into dimensionless values between zero and one. A larger normalized curvature value indicates a sharper local geometry; a larger normalized distance value indicates that the area is relatively farther from the critical sealing surface, and the risk is relatively lower. Finally, based on the normalized curvature and distance values, the "position sensitivity coefficient" for this complex welding area is calculated. A common calculation method is: the position sensitivity coefficient equals the "normalized curvature value" multiplied by a weighting coefficient, plus "one minus the normalized distance value" multiplied by another weighting coefficient, and then the two are added together. Here, "one minus the normalized distance value" reflects the logic that closer distances contribute more risk. The two weighting coefficients are used to balance the relative importance of local curvature and the adjacent sealing surface on weld quality, and their sum is usually one.
[0051] The method for determining the preset weighting coefficients in this embodiment of the invention is as follows: These two weighting coefficients can be determined based on specific welding process requirements and quality feedback. For example, if experience indicates that thermal deformation of the sealing surface is the main failure mode, then a higher value should be assigned to the distance factor (i.e., the weight corresponding to "one minus the normalized distance value"); if uneven weld bead caused by abrupt contour changes is the main problem, then a higher weight should be assigned to the curvature factor. A quantitative method is to collect a batch of samples with known welding quality and back-calculate the weight combination that best distinguishes between good and bad quality.
[0052] Specifically, in step S5, the welding trajectory of the ball valve assembly to be welded is determined based on the position sensitivity coefficient of each complex welding area, including: Step S521: Calculate the Euclidean distance between the geometric center points of any two complex welding areas. If the distance is less than the preset Euclidean distance, determine that the two complex welding areas are adjacent areas. Step S522: Determine the position sensitivity coefficient of each region in the adjacent regions. If the position sensitivity coefficient of any region in the adjacent regions is greater than the preset sensitivity coefficient, merge the group of adjacent regions into a trajectory planning unit. Step S523: Using the preset weld trajectory as the reference trajectory, for each complex welding area or merged trajectory planning unit, calculate its corresponding local welding trajectory point set according to its position sensitivity coefficient through the trajectory adjustment function, and smoothly connect all the adjusted local welding trajectory point sets with the reference trajectory segment to generate the welding trajectory of the ball valve assembly to be welded.
[0053] In this embodiment of the invention, firstly, the straight-line distance between each pair of geometric center points of all complex welding areas is calculated. A preset Euclidean distance is set. If the distance between the center points of two areas is less than this preset Euclidean distance, they are determined to be spatially adjacent. The method for determining the preset Euclidean distance is: this distance should match the local influence range of the welding process. A practical method is to set it to 1.5 to 2 times the effective diameter of the welding arc or laser spot. This means that if two abnormal areas are very close, their welding heat effects will overlap, so they should be planned as a whole unit. This threshold can also be determined by analyzing the spacing of typical areas that need to be merged and adjusted in historical welding. For groups of areas determined to be adjacent, the position sensitivity coefficient of each area in the group is checked. A preset sensitivity coefficient is set. If the position sensitivity coefficient of any area in the adjacent area group is greater than this preset value, all adjacent areas in the group are merged into a single trajectory planning unit. The method for determining the preset sensitivity coefficient is: this coefficient is a risk level threshold. It can be obtained by retrospectively analyzing historical welding quality data (excellent, good, poor). The distribution of the position sensitivity coefficient in the complex welding areas of the workpiece sample that caused welding defects (such as seal failure) is calculated, and the lower limit of this distribution (e.g., the minimum value or a lower percentile value) is selected as the preset threshold. This means that if the risk level of any adjacent area reaches the level that has historically caused defects, the entire adjacent area group will be considered a high-risk unit and undergo unified enhanced trajectory adjustment. The preset weld trajectory for standard contour workpieces, pre-stored in the system, is used as the global benchmark. For each independent complex welding area or merged trajectory planning unit, the trajectory adjustment function is called to calculate its corresponding adjusted local welding trajectory point set based on its calculated position sensitivity coefficient. The simple principle of the trajectory adjustment function is that it establishes a mapping relationship between the "position sensitivity coefficient" and the "trajectory adjustment amount". For example, a higher coefficient may mean that the benchmark trajectory for that area needs to be "offset" to a greater extent (to avoid anomalies or adapt to the contour), or a more significant "deceleration" is needed (to ensure penetration depth in complex geometries). The specific form (e.g., linear or nonlinear) and parameters of the function can be determined through process experiments to ensure that the adjusted trajectory meets the welding quality requirements. Finally, all these adjusted local trajectory point sets are smoothly connected with the unaffected baseline trajectory segments using a curve fitting algorithm (such as B-spline curve interpolation) to generate a complete, continuous, and smooth final welding trajectory, which can be directly sent to the welding robot for execution.
[0054] This invention uses an abstract position sensitivity coefficient as input, and through explicit adjustment functions and merging logic, directly outputs executable machine instructions, ensuring that the analysis conclusions are accurately translated into practical actions to improve welding quality. By merging adjacent and high-risk areas to form planning units, multiple potentially conflicting trajectory adjustments within a very small area are avoided, resulting in a more reasonable and smoother trajectory. This also reduces the number of independent adjustment segments that need to be processed, improving the overall efficiency and robustness of the planning algorithm. Local adjustments are made based on a preset standard trajectory, and smooth connections are enforced, ensuring the overall coordination of the final trajectory. This avoids sudden jumps or turns in the trajectory, guaranteeing the stability of the welding torch movement and heat input during welding, which is a crucial prerequisite for obtaining uniform and reliable welds.
[0055] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A welding method for a ball valve assembly based on image recognition, characterized in that, include: Step S1: Acquire image data of the ball valve assembly to be welded, and determine the contour feature data of the ball valve assembly to be welded based on the image data; Step S2: Determine the contour irregularity of the ball valve assembly to be welded based on the contour feature data, and determine the welding type of the ball valve assembly to be welded based on the contour irregularity, wherein the welding type of the ball valve assembly to be welded includes complex welding type and simple welding type. Step S3: In response to the fact that the welding type of the ball valve assembly to be welded is complex, the contour of the ball valve assembly to be welded is divided into several analysis units, and the abnormal hot zone of the contour is determined based on the local irregularity index of each analysis unit. Step S4: Spatial mapping of each profile abnormal hot zone to the preset weld trajectory; Based on the first minimum distance between each profile abnormal hot zone and the preset weld trajectory and the angle between the trajectory directions, the complex welding area is determined. Step S5: Based on the local average curvature of each welding complex area and the second minimum distance from each welding complex area to the critical sealing surface, determine the position sensitivity coefficient of each welding complex area, and determine the welding trajectory of the ball valve assembly to be welded based on the position sensitivity coefficient of each welding complex area. In step S5, the welding trajectory of the ball valve assembly to be welded is determined based on the position sensitivity coefficient of each complex welding area, including: Step S521: Calculate the Euclidean distance between the geometric center points of any two complex welding areas. If the distance is less than the preset Euclidean distance, determine that the two complex welding areas are adjacent areas. Step S522: Determine the position sensitivity coefficient of each region in the adjacent regions. If the position sensitivity coefficient of any region in the adjacent regions is greater than the preset sensitivity coefficient, merge the group of adjacent regions into a trajectory planning unit. Step S523: Using the preset weld trajectory as the reference trajectory, for each complex welding area or merged trajectory planning unit, calculate its corresponding local welding trajectory point set according to its position sensitivity coefficient through the trajectory adjustment function, and smoothly connect all the adjusted local welding trajectory point sets with the reference trajectory segment to generate the welding trajectory of the ball valve assembly to be welded.
2. The welding method for a ball valve assembly based on image recognition according to claim 1, characterized in that, In step S1, the contour feature data of the ball valve assembly to be welded is determined based on the image data, including: Step S11: Preprocess the acquired image data; Step S12: Perform edge detection and image segmentation on the preprocessed image to extract the foreground region of the ball valve assembly to be welded in the image; Step S13: Based on the foreground region, the outer contour of the ball valve assembly to be welded is obtained through a contour tracking algorithm, and the coordinates, curvature and tangent direction of each point on the outer contour are calculated to form the contour feature data.
3. The welding method for a ball valve assembly based on image recognition according to claim 1, characterized in that, In step S2, the contour irregularity of the ball valve assembly to be welded is determined based on the contour feature data, including: Step S21: Determine the ratio of the outline perimeter of the ball valve assembly to be welded to the circumference of a circle with equal area, as the first irregularity factor; Step S22: Determine the ratio of the actual contour area of the ball valve assembly to be welded to its convex hull area, as the second irregularity factor; Step S23: Extract the curvature of all points on the contour and calculate its standard deviation as the third irregularity factor; Step S24: The first irregularity factor, the second irregularity factor, and the third irregularity factor are weighted and summed to obtain the contour irregularity.
4. The welding method for a ball valve assembly based on image recognition according to claim 1, characterized in that, In step S2, the welding type of the ball valve assembly to be welded is determined based on the contour irregularity, including: If the contour irregularity is greater than or equal to the preset contour irregularity, the welding type of the ball valve assembly to be welded is determined to be a complex welding type. If the contour irregularity is less than the preset contour irregularity, the welding type of the ball valve assembly to be welded is determined to be a simple welding type.
5. The welding method for a ball valve assembly based on image recognition according to claim 4, characterized in that, In step S2, the preset contour irregularity is determined based on the contour irregularity data of several qualified welded parts.
6. The welding method for a ball valve assembly based on image recognition according to claim 1, characterized in that, In step S3, the contour of the ball valve assembly to be welded is divided into several analysis units, and the abnormal hot zone of the contour is determined based on the local irregularity index of each analysis unit, including: Step S31: Slide along the contour of the ball valve assembly to be welded with a preset fixed arc length to divide the contour into multiple continuous analysis units. Step S32: For each analysis unit, calculate the absolute value of the difference between the average curvature of its inner contour points and the average curvature of the overall contour, and use it as the local irregularity index of the analysis unit. Step S33: The analysis units whose local irregularity index is greater than the preset index threshold are marked as preliminary abnormal units; Step S34: Merge adjacent preliminary abnormal units in spatial location to form a continuous contour abnormal hot zone.
7. The welding method for a ball valve assembly based on image recognition according to claim 1, characterized in that, In step S4, each profile abnormal hot zone is spatially mapped to a preset weld trajectory. Based on the first minimum distance between each profile abnormal hot zone and the preset weld trajectory and the angle between the trajectory directions, the complex welding area is determined, including: Step S41: For each of the contour abnormal hot zones, calculate the vertical distance from its geometric center point to the preset weld trajectory, and use it as the first minimum distance; Step S42: Obtain the contour tangent direction of each of the contour abnormal hot zones at the geometric center point, and calculate the absolute value of the angle between the contour tangent direction and the tangent direction of the preset weld trajectory at the nearest projection point, as the trajectory direction angle. Step S43: Determine the contour abnormal hot zone where the first minimum distance is less than the preset first minimum distance or the trajectory direction angle is greater than the preset angle as the welding complex area.
8. The welding method for a ball valve assembly based on image recognition according to claim 7, characterized in that, In step S42, the absolute value of the angle between the contour tangent direction and the tangent direction of the preset weld trajectory at the nearest projection point is calculated as the trajectory direction angle, including: Step S421: Project the geometric center point of the abnormal hot zone of the contour vertically onto the preset weld trajectory to obtain the nearest projection point; Step S422: At the geometric center point, obtain the contour tangent direction vector at the nearest projection point based on the contour feature data; Step S423: At the nearest projection point, based on the discrete point sequence of the preset weld trajectory, calculate the tangent direction vector of the weld trajectory at the nearest projection point. Step S424: Based on the dot product of the contour tangent direction vector and the weld trajectory tangent direction vector, calculate the angle between the two vectors using inverse trigonometric functions, and take the absolute value of the angle as the trajectory direction angle.
9. The welding method for a ball valve assembly based on image recognition according to claim 1, characterized in that, In step S5, based on the local average curvature of each complex weld region and the second minimum distance from each complex weld region to the critical sealing surface, the position sensitivity coefficient of each complex weld region is determined, including: Step S511: For each complex welding area, determine the average value of the absolute curvature of all points on its contour line as the local average curvature. Step S512: Determine the vertical distance from the geometric center point of each complex welding area to the critical sealing surface, as the second minimum distance; Step S513: Normalize the local average curvature and the second minimum distance respectively to obtain the corresponding normalized curvature value and normalized distance value; Step S514: Determine the position sensitivity coefficient based on the normalized curvature value and the normalized distance value.
Citation Information
Patent Citations
Welding method of ball valve assembly
CN117206674A
Industrial robot welding track real-time optimization method and system based on deep learning
CN120347765A
Method for automatically generating welding track of robot
CN121235969A