A method and system for detecting deformation of a heat-treated forging
By extracting multimodal features from forging images and reconstructing the energy function of the active contour model, the problem of feature confusion caused by thermal radiation halo and thermal haze interference is solved, thus achieving accuracy and robustness in forging deformation detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-04-07
AI Technical Summary
Traditional active contour models are subject to interference from thermal radiation halos and dynamic thermal haze during the heat treatment of forgings, leading to feature confusion and making it impossible to accurately identify the true contour, thus affecting the accuracy of deformation detection.
通过获取锻件图像的多模态特征,包括梯度向量、灰度饱和度和局部熵,构建局部可信向量场,并通过张量扩散生成引导向量场,重构主动轮廓模型的能量函数,利用各向异性刚度张量约束内部能量项,抑制光晕和热霾干扰。
It improves the accuracy and robustness of contour detection under high temperature and strong interference environment, and ensures the accuracy of deformation detection.
Smart Images

Figure CN121304664B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology. Specifically, it relates to a method and system for detecting deformation during heat treatment of forgings. Background Technology
[0002] In modern high-end equipment manufacturing, heat treatment of precision forgings is a key process. Real-time monitoring of the geometric deformation of forgings is an indispensable technical means to achieve dynamic optimization of process parameters, ensure product quality consistency, and prevent potential defects.
[0003] Currently, machine vision-based detection technology has become the mainstream solution in this field due to its advantages of being non-contact and highly efficient. Among numerous visual detection algorithms, active contour models are a classic method widely used for target contour extraction and dynamic tracking. Its core idea is to iteratively evolve an initial contour curve and minimize a predefined energy function, eventually converging to the edge of the target object. This energy function typically consists of two parts: an internal energy term, used to constrain the curve's smoothness, continuity, and other geometric properties to prevent contour breaks or sharp points; and an external energy term, which establishes the coupling relationship between image data and the contour curve. It usually utilizes the gradient magnitude information of pixels in the image as a driving force to pull the contour towards the region of most dramatic grayscale changes in the image, i.e., the target edge.
[0004] However, during the high-temperature heat treatment of forgings, traditional active contour models, when identifying contours based on forging images for deformation detection, encounter at least two strong interference sources in addition to the clear, real physical contours of the forgings: one is the halo saturation zone formed by the high-temperature thermal radiation of the forgings themselves and their surrounding environment, which has high edge brightness and strong gradient; the other is the dynamic thermal haze interference zone caused by the convection and turbulence of protective or reactive gases in the furnace due to high temperature, which forms flowing artifacts with blurred edges but equally significant gradients on the image.
[0005] Traditional active contour models typically rely solely on a single, undifferentiated image gradient as their external energy term. This design makes them incapable of effectively identifying and distinguishing gradient features generated by different physical sources (real contours, thermal radiation, thermal haze) in complex scenes. Whether it's the true edge of the forging or the pseudo-edges formed by halos and thermal haze, these are all high-gradient regions worthy of convergence in this model, leading to feature confusion. This confusion causes the model to be easily captured by strong interfering edges generated by halos or thermal haze during evolution, getting trapped in local optima and ultimately failing to accurately converge to the true contour of the forging. This affects the accuracy of deformation detection results and makes it difficult to meet the stringent process control requirements of precision manufacturing. Summary of the Invention
[0006] To address the problem that traditional active contour models suffer from false edges caused by interference sources such as thermal radiation halos and dynamic heat haze when detecting deformation of forgings, leading to feature confusion, easy getting trapped in local optima, inability to accurately identify the true contour of the forging, and affecting the accuracy of subsequent deformation detection, this invention proposes a method and system for detecting deformation of forgings after heat treatment.
[0007] In a first aspect, the present invention provides a method for detecting deformation after heat treatment of forgings, comprising:
[0008] Acquire grayscale images of forgings in the furnace, calculate the gradient vector, grayscale saturation, and local entropy of pixels in the grayscale image, and determine the gradient confidence of pixels based on grayscale saturation and local entropy; use gradient confidence as weight to weight the gradient vector to obtain the local confidence vector of pixels, and perform tensor diffusion processing on the local confidence vectors of all pixels to form a guiding vector field;
[0009] The active contour model is initialized based on the preset cold contour to obtain all contour points in the grayscale image. The position of each contour point is updated iteratively until the active contour model converges to the hot contour. After the active contour model converges, deformation analysis is performed on the hot contour to determine the deformation state of the forging and realize online detection of heat treatment deformation of the forging.
[0010] During each iteration update, for each contour point in the current iteration process, the following operations are performed: obtain the guiding vector corresponding to the contour point in the guiding vector field, and query the gradient vector and local entropy of the contour point in the grayscale image; calculate the anisotropic stiffness tensor of the contour point based on the gradient vector and local entropy; reconstruct the local definition of the energy function of the active contour model at the contour point, including: driving the external energy term of the energy function through the guiding vector of the contour point, and constraining the internal energy term of the energy function through the anisotropic stiffness tensor of the contour point.
[0011] This technical solution first extracts multimodal features from the forging image, decomposing the chaotic furnace scene into three physical indicators: gradient and grayscale saturation (physical features of high-temperature halo) and local entropy (physical features of dynamic thermal haze). Then, it uses the latter two as quantification indicators of interference sources to suppress the former's response in the interfered area, generating a locally reliable vector field containing only true contour information. Through tensor diffusion processing, the reliable vector information is smoothly propagated throughout the entire space, thus constructing a long-range, smooth, and uniquely pointing global guiding vector field pointing to the true edge of the forging. Then, in the process of extracting the forging contour using the active contour model, the active contour model is reconstructed, including: in terms of external energy, it replaces the traditionally easily disturbed original gradient with a pure guiding vector, solving the problem of contour being captured by halo artifacts; in terms of internal energy, it no longer uses fixed stiffness, but dynamically calculates the anisotropic stiffness tensor based on gradient and local entropy. This means that when the contour points are in the blurred region caused by thermal haze, the model adaptively and significantly enhances its tangential stiffness, strongly resisting contour drift and jitter caused by gas turbulence. Ultimately, by simultaneously correcting the external driving force to suppress halo and the internal constraint force to resist thermal haze, the model is ensured to accurately converge to the true thermal contour under high temperature and strong disturbance, thereby improving the accuracy of subsequent deformation analysis results.
[0012] Optionally, the gradient confidence of a pixel is determined based on the following method:
[0013]
[0014] in, For the grayscale image Gradient confidence of each pixel For the first grayscale saturation of each pixel For the first Local entropy of each pixel The average local entropy of all pixels. Natural exponential function, To prevent parameters with a denominator of 0.
[0015] This technical solution constructs a nonlinear suppression function that integrates grayscale saturation and local entropy, providing a credibility assessment method for the gradient vector of each pixel based on the cause of physical interference. It can simultaneously suppress pseudo-edge gradients generated by halo saturation areas and thermal haze interference areas, thus achieving suppression of interference from different physical sources.
[0016] Optionally, the guiding vector field is generated by iteratively solving the following vector diffusion equation for all pixels to diffuse the local reliable vectors into guiding vectors;
[0017] , and The first The pixel at the th point sequence The guiding vector during the next iteration. The preset diffusion coefficient, For the Laplace operator, For the first Local confidence vector of each pixel To determine the modulus sign, in each iteration, the average difference between the guiding vector of all pixels in the current iteration and the guiding vector in the previous iteration is calculated. When the average difference is less than a preset average difference threshold in a certain iteration, the iteration ends, and the guiding vectors of all pixels in that iteration are used to form a guiding vector field.
[0018] This technical solution provides a way to implement vector diffusion operation through a stable solvable vector diffusion equation. By iteratively solving until the equation converges, the final guiding vector field is obtained. This ensures that the construction process of the global guiding vector is anchored to the reduced local reliable vector field, thus ensuring that the vector diffusion process is not contaminated by interference information. The generated guiding vector field has both long-range capture capability and reduces interference from the source.
[0019] Optionally, the anisotropic stiffness tensor of the contour point is determined as follows: Based on the magnitude and local entropy of the contour point's gradient vector, the local signal-to-noise ratio of the contour point is calculated; the normalized result of the local signal-to-noise ratio is then subjected to a positively correlated nonlinear mapping to obtain the basic isotropic stiffness of the contour point; the structural tensor of the contour point is calculated based on its gradient vector; the structural tensor is then subjected to eigenvalue decomposition to obtain a first eigenvector and a second eigenvector, as well as a first eigenvalue and a second eigenvalue; the basic isotropic stiffness is set as a first stiffness component along the direction of the first eigenvector; based on the ratio of the first eigenvalue and the second eigenvalue, and the basic isotropic stiffness, a second stiffness component along the direction of the second eigenvector is determined; and by combining the first stiffness component, the second stiffness component, the first eigenvector, and the second eigenvector, the anisotropic stiffness tensor of the contour point is determined.
[0020] This technical solution uses a data-driven anisotropic stiffness constraint to intelligently diagnose the local image environment in which contour points are located. It first calculates the local signal-to-noise ratio using the magnitude of the gradient vector and the local entropy to determine a basic isotropic stiffness. It then uses the eigenvalue decomposition of the structural tensor to evaluate the determinism of the gradient direction. When a contour point is detected to be in a region where the gradient direction is uncertain, it adaptively increases the tangential stiffness of the point based on the ratio of eigenvalues. This directional constraint in the interference region can effectively resist contour drift caused by noise, thereby improving the accuracy and stability of contour convergence under high temperature and strong interference environments.
[0021] Optionally, the second stiffness component is determined as follows: the ratio of the first eigenvalue and the second eigenvalue is determined as the anisotropy enhancement factor, the isotropic stiffness of the base is multiplied by the anisotropic enhancement factor to enhance the isotropic stiffness of the base, and the enhanced isotropic stiffness of the base is taken as the second stiffness component along the direction of the second eigenvector.
[0022] This technical solution defines the ratio of structural tensor eigenvalues as an anisotropy enhancement factor and multiplies it by the basic stiffness to evaluate the directional determinism of the local gradient. This factor is then used to enhance the tangential stiffness. As a result, the tangential stiffness is greatly enhanced at edges where the gradient direction is clear, while in regions where the gradient direction is ambiguous, the stiffness degenerates into isotropy, thus achieving refined and directional adjustment of the contour constraints.
[0023] Optionally, the anisotropic stiffness tensor is constructed using the following formula:
[0024]
[0025] in, For the first Anisotropic stiffness tensor of each contour point For the first The first stiffness component of each contour point For the first The second stiffness component of each profile point and The first The first and second eigenvectors are obtained by eigenvalue decomposition of the structure tensor of each contour point. For transpose operation, for The transpose of , for The transpose of .
[0026] This technical solution combines two independent scalar stiffness components with their respective directions. By weighted summation of the outer product of the eigenvectors, a stiffness matrix is constructed. This matrix is no longer a fixed stiffness coefficient in the traditional model, but a complete mathematical entity that reflects the different stiffnesses in the two principal directions of each contour point. This provides an adaptive constraint for the internal energy function of the active contour model to resist directional disturbances (thermal haze drift).
[0027] Optionally, the method of driving the external energy term of the energy function through the guiding vector of the contour point is to optimize the magnitude of the gradient vector of the contour point in the external energy term, which is determined in the grayscale image, into the magnitude of the guiding vector of the contour point.
[0028] Optionally, the method of constraining the internal energy term of the energy function through the anisotropic stiffness tensor of the contour point is to optimize the stiffness coefficients related to the contour point in the internal energy term into the anisotropic stiffness tensor of the contour point.
[0029] Optionally, the method for performing deformation analysis on the acquired hot profile is as follows: calculate the degree of curvature used to characterize profile warping and ellipticization, and the degree of torsion used to characterize profile twisting, and synthesize the degree of curvature and the degree of torsion into a multidimensional deformation vector; match the multidimensional deformation vector with the feature library of pre-acquired multidimensional deformation vectors to determine the deformation state of the forging.
[0030] In this way, through multi-dimensional deformation analysis, the deformation state of forgings can be comprehensively and accurately evaluated, providing a reliable basis for process adjustment decisions.
[0031] Secondly, the present invention also provides a deformation detection system for heat treatment of forgings, the deformation detection system including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of any of the deformation detection methods described above.
[0032] The present invention has the following effects:
[0033] This invention analyzes images of forgings to extract multimodal features for environmental perception, systematically corrects the internal and external energy terms of traditional models, suppresses halo and heat haze interference, solves feature confusion problems, improves the accuracy and robustness of contour detection under high temperature and strong interference environments, and thus improves the accuracy of deformation detection. Attached Figure Description
[0034] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0035] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0036] Reference Figure 1 A deformation detection method based on image processing specifically includes the following steps:
[0037] S1: Acquire real-time grayscale images of forgings inside the furnace and extract multimodal features from the images.
[0038] This step extracts multiple physical features from the original furnace images in parallel, which can respectively characterize edge intensity, halo interference, and thermal haze interference.
[0039] In one embodiment, the current moment of deformation detection is taken as the current moment, and a grayscale image of the forging in the furnace at the current moment is obtained. Three indicators with distinct physical characteristics are calculated in parallel on this grayscale image:
[0040] The first is the gradient vector of the pixel: Gaussian smoothing is applied to the input grayscale image. A Gaussian kernel is used to suppress high-frequency noise, and then the Sobel or Scharr operator is used to calculate the gradient vector of each pixel. The magnitude of the gradient vector reflects the magnitude of the gradient, and the direction of the gradient vector reflects the direction of the gradient.
[0041] The second is pixel saturation: The grayscale values of all pixels in the grayscale image are normalized (using the minimum-maximum normalization method), mapping all pixel grayscale values to the range [0,1], resulting in normalized grayscale values for all pixels. The grayscale saturation of each pixel is then determined by performing a high-order power operation on the normalized grayscale value. ,in, For the first grayscale saturation of each pixel It is the first The grayscale value of each pixel It is an index that controls the sensitivity of saturation response, and its value needs to be determined by a trade-off between suppressing halo and preserving the details of the forging body. If it is too small, it will cause the normal highlight area of the forging body to be incorrectly suppressed; if If the value is too large, the calculation accuracy may be affected. This was determined by testing typical furnace images and setting... It ensures that only pixels with grayscale values close to full saturation produce a high response, thereby accurately locating the core area of the halo without mistakenly suppressing the forging body.
[0042] The third is the local entropy of a pixel: the local entropy of each pixel. Within a neighborhood window, calculate the probability distribution of grayscale values for all pixels within that window. Then, based on this probability distribution, calculate an information entropy value using the classic information entropy formula. This entropy is used as the local entropy for that pixel. The neighborhood window is used to quantify the texture randomness of heat haze artifacts. The size of this window is also determined based on a trade-off analysis: the window needs to be large enough to capture the texture features of heat haze, but small enough to maintain locality. This is achieved by testing multiple images containing heat haze artifacts. The window size achieves a good balance between the saliency and locality of texture representation.
[0043] In this way, by decomposing the grayscale image into three multimodal feature indicators that respectively contain edge, halo, and heat haze information, a reliable image basis is provided for subsequent targeted correction, avoiding the one-sidedness of a single feature.
[0044] The reason for adopting this approach is that these three physical features have a strong correspondence with the physical phenomena of the grayscale image of the forging. The gradient corresponds to the edge of the object, the saturation corresponds to the halo caused by high temperature thermal radiation, and the local entropy can quantify the texture randomness of the thermal haze artifact caused by gas turbulence. Extracting these decoupled features in parallel provides comprehensive data input for subsequent steps to identify and suppress interference, which is a prerequisite for solving the problem.
[0045] S2: Calculate the gradient confidence level of each pixel to construct a local confidence vector field.
[0046] This step aims to address the feature obfuscation problem. After extracting multimodal physical features, this step utilizes halo features and thermal haze physical features to reduce the amount of information in the original image.
[0047] In one embodiment, the gradient confidence of a pixel is determined based on the following method:
[0048] First, based on the grayscale saturation and local entropy of each pixel, a gradient confidence level is calculated for each pixel using the following formula:
[0049]
[0050] in, For the grayscale image The gradient confidence of each pixel, whose value ranges from [0, 1], is a dimensionless weighting factor. For the first grayscale saturation of each pixel For the first Local entropy of each pixel The average local entropy of all pixels is used as an adaptive normalization factor. It is a natural exponential function. To prevent parameters from having a denominator of 0, they are usually set to a very small positive number. .
[0051] This formula constructs a nonlinear suppression function that integrates multimodal interference features, the first term... The second item is used to suppress halo interference. Used to suppress heat haze interference.
[0052] When a pixel is located in the halo saturation region The larger it is, the closer it is to 1, causing the first term to approach 0, regardless of... Why is it worth it? All values will approach 0; when a pixel is located in a region affected by heat haze interference, Much larger This causes the second term to approach 0, regardless of Why is it worth it? All values will approach 0, only when a pixel simultaneously satisfies... The smaller (less saturated) and Compare The smaller the local entropy, the closer both inhibition terms are to 1, making... The larger it is, the closer it is to 1.
[0053] By multiplying these two terms, it is ensured that any disturbance (high saturation or high local entropy) is sufficient to make the gradient confidence at that point acceptable. A sharp drop occurs only when a pixel simultaneously satisfies the condition that the lower the grayscale saturation, the closer it is to 0, and... Only when both inhibition terms are close to 1 can the condition be met. The larger it is, the closer it is to 1.
[0054] The reason for using this formula is that it can selectively trust the gradient information of pixels based on the unique physical phenomena of the furnace image. For the true contour area of the forging, the saturation is moderate and the local entropy is low, so the calculated gradient confidence is close to 1, preserving effective gradient information. However, in halo or heat haze areas, even if the gradient magnitude is high, the gradient confidence will approach 0, thus effectively filtering out false gradients. In this way, by calculating the gradient confidence weight using this formula, the reliability of each gradient vector can be accurately quantified, laying the foundation for the subsequent generation of a pure guiding vector field.
[0055] Scenario-based example:
[0056] For pixels on the true physical contour of a forging, characterized by low grayscale saturation, clear texture, and small local entropy, the greater the gradient confidence, the more reliable the gradient information of that pixel is. For pixels on the halo edge caused by high-temperature radiation, characterized by high grayscale saturation, the gradient confidence is significantly suppressed, making the gradient information of that pixel less reliable. For pixels on the artifact edge caused by gas turbulence, characterized by high local entropy, the gradient confidence is also significantly suppressed, resulting in very low gradient confidence and less reliable gradient information.
[0057] Subsequently, the gradient vectors of all pixels are multiplied pixel by pixel with their respective gradient confidence weights, that is, the gradient confidence is used as the weight to weight the gradient vectors, and the local confidence vectors of the pixels are obtained. The local confidence vectors of all pixels constitute a local confidence vector field, which constitutes a local confidence vector field that is significantly suppressed in the interference region.
[0058] S3: Perform tensor diffusion on the local believable vector field to generate a global guiding vector field.
[0059] After the local confidence vector field is constructed, the interference has been suppressed. However, since the local confidence vector field forms a large area of information holes with a gradient of 0 in the interference region, and its range of action is still local, the local confidence vector field is local. If the initial position of the contour is too far from the real edge, or if it is located in the information hole, it will not be able to converge. In order to obtain a long-range global driving force that can guide the contour convergence from a distance, further analysis is needed to avoid the problem that the active contour model has a small capture range and is prone to getting trapped in local optima.
[0060] This step uses a tensor diffusion mechanism to propagate the reliable gradient information in the local reliable vector field to the entire image space, forming a smooth, long-range, and interference-resistant global guiding vector field, which serves as the corrected external driving force.
[0061] In one embodiment, the guiding vector field is generated by simultaneously solving the vector diffusion equation multiple times for all pixels. When the vector diffusion equation converges, the resulting vector diffusion is used as the guiding vector field.
[0062] Specifically, for all pixels, the following vector diffusion equation is solved iteratively:
[0063]
[0064] This formula is essentially a partial differential equation. and The first The pixel at the th point sequence The guiding vector during the next iteration. The preset diffusion coefficient, For the Laplace operator, For the first Local confidence vector of each pixel To determine the sign of the modulus. Diffusion coefficient. The value of is a trade-off between diffusion range and detail fidelity. If the size is too large, the diffusion speed is fast and the range is wide, but it may cause the guiding field to be overly smoothed, losing edge details; if While a small image size offers high detail fidelity, it results in slow diffusion and a limited range, failing to address long-range capture challenges. Through testing with typical in-furnace images, [the appropriate method was selected]. It can achieve a balance between convergence speed and result stability.
[0065] This formula balances the vector diffusion mechanism with the data fidelity mechanism. It is a vector diffusion term, responsible for smoothly propagating reliable gradient information from local regions to the entire image space, enabling vector information to smoothly diffuse from strong gradient regions to weak gradient / zero gradient regions. Its function is to fill the resulting information gaps and endow the guiding field with long-range capture capability. It is a data fidelity term, acting as an anchor point. In regions with high gradient confidence, this term generates a strong pull, Pull back to the original reliable gradient This ensures that the diffusion process does not destroy the original, reliable edge information.
[0066] Pixels at the actual edge of the forging Extremely strong The larger the value, the more dominant the data fidelity factor becomes, strongly compelling [the data to be faithful to the original text]. This ensures the accuracy of the guiding field at the edges; for pixels in interference or hole areas, Extremely weak Data fidelity item failed, diffusion item Dominant, allowing vector information from distant real edges to smoothly diffuse and fill the region.
[0067] Iteration stopping condition:
[0068] In each iteration, the average difference between the guiding vector of all pixels in the current iteration and the guiding vector in the previous iteration is calculated. That is, a difference value for a pixel is calculated in each iteration. and The absolute value of the difference (the difference between the two pixels) is used to average the difference values of all pixels to obtain an average difference value.
[0069] When the average difference value is less than a preset average difference threshold during a certain iteration, the iteration ends. The average difference threshold must be set small enough to ensure that the iteration process has fully converged and that the guiding vector field is a stable and accurate result. This is crucial in the field of numerical solutions to partial differential equations. arrive This is a common and reasonable accuracy setting for the average error; therefore, the average difference threshold is set here. When the iteration ends, the vector diffusion has reached a steady state, the equation converges, and the guiding vectors of all pixels in this iteration are used to form a guiding vector field.
[0070] Thus, a vector diffusion operation is performed based on the reduced local reliable vector field to generate a guiding vector field, thereby ensuring that the final generated global guiding vector field has both long-range force and reduces the interference of heat haze and halo at the source. By iteratively solving the equation, a long-range, smooth, and uniquely pointing global guiding vector field pointing to the edge of the real forging is finally obtained. It will serve as the external driving force for the subsequent active contour model, and can guide the contour to converge accurately to the target from a far position.
[0071] S4: Construct an anisotropic stiffness tensor for the contour points obtained from the active contour model.
[0072] The internal energy term of the energy function of the active contour model has a stiffness coefficient that is usually a fixed, artificially pre-defined scalar. It constrains the smoothness of the contour indiscriminately everywhere. However, in hot haze regions, the gradient direction uncertainty is high, and the contour is prone to tangential drift.
[0073] Therefore, this step involves constructing an intelligent stiffness tensor that can sense local signal quality and directional uncertainties and adaptively increase stiffness in specific directions in hot haze regions to resist drift.
[0074] In one embodiment, the anisotropic stiffness tensor of the contour points is determined based on the following:
[0075] First, calculate the local signal-to-noise ratio for each contour point, which is defined as the ratio of the magnitude of the gradient vector of the corresponding pixel in the grayscale image to the local entropy of that pixel.
[0076] Then, a basic isotropic stiffness that is positively correlated with the local signal-to-noise ratio is determined. For example, this can be mapped using an exponential function:
[0077]
[0078] in, It is the first The basic isotropic stiffness of each contour point It is a fundamental stiffness coefficient that can be calibrated based on the average strength of the external guiding vector field to ensure that the internal constraint force and the external driving force are matched in magnitude. It is the average local signal-to-noise ratio of all contour points. For the first The local signal-to-noise ratio of each contour point To prevent parameters from having a denominator of 0, they are usually set to a very small positive number. .
[0079] Next, the structure tensor of each contour point is calculated based on the gradient vector of the neighborhood (pixel) of each contour point, and the structure tensor is decomposed into features to obtain the first feature value and the second feature value, wherein the first feature value is greater than or equal to the second feature value, as well as the corresponding first feature vector (gradient principal direction, i.e. normal) and the second feature vector (edge tangent).
[0080] Then, the isotropic stiffness of the foundation The first stiffness component is defined as the first stiffness component along the direction of the first eigenvector. The normal stiffness is represented by a component denoted by a second stiffness component along the direction of the second eigenvector, based on the ratio of the first and second eigenvalues and the isotropic stiffness of the base. The tangential stiffness is represented by this component, determined by multiplying the base isotropic stiffness by this anisotropy enhancement factor (or its related function) to enhance the base isotropic stiffness.
[0081]
[0082] in, To prevent extremely small positive numbers with a denominator of 0, it is usually set to 0. The reason for adopting this approach is that it deeply couples the stiffness constraint with the directional uncertainty of the local gradient in regions with clear edges and well-defined directions (strong anisotropy). It is the first The first eigenvalue is obtained by performing eigenvalue decomposition on the structure tensor of each contour point. It is the first The second eigenvalue is obtained by performing eigenvalue decomposition on the structure tensor of each contour point. Much larger This results in a large anisotropy enhancement factor, which in turn increases the tangential stiffness. Much greater than normal stiffness This makes the profile very stable at that point, making it difficult to bend in the tangential direction, thus strongly resisting local profile drift caused by noise such as heat haze.
[0083] Finally, the anisotropic stiffness tensor is constructed using the following formula:
[0084]
[0085] In this formula, For the first The anisotropic stiffness tensor of each contour point (one) matrix), and They are the first The first and second stiffness components of the contour points and These are the unit eigenvectors for the normal and tangential directions, respectively. For transpose operation, for The transpose of , for The transpose of .
[0086] In this formula, It is the projection matrix of the normal vector. It is the tangential projection matrix that projects two independent scalar stiffness components. and and their respective directions and By combining the features and performing a weighted summation of the outer product of the feature vectors, a stiffness matrix was constructed. This matrix is no longer a fixed stiffness coefficient in the traditional model, but reflects the different stiffnesses in the two principal directions of each contour point. This provides an adaptive constraint for the internal energy function of the active contour model to resist directional disturbances (such as thermal haze drift).
[0087] In this way, the stiffness constraint and the directional uncertainty of the local gradient are deeply coupled, in regions with clear edges and well-defined directions. Much larger This results in a large anisotropy enhancement factor, which in turn increases the tangential stiffness. Much greater than normal stiffness This makes the contour very stable at that point, making it difficult for it to bend in the tangential direction, thus strongly resisting local contour drift caused by noise such as heat haze. However, in noise regions with blurred textures or isotropic conditions, Approximately equal to With an enhancement factor close to 1, the stiffness degenerates to isotropic, allowing a stronger external field to dominate the evolution of the profile.
[0088] Scenario-based example:
[0089] When the contour points are located at high-quality, sharp edges, the local signal-to-noise ratio is high, the normal stiffness is high, and the gradient direction is clear. Much larger It exhibits strong anisotropy, a large enhancement factor, and tangential stiffness that is much greater than normal stiffness. The profile remains flexible in the normal direction to conform to the edge, but resists jitter along the edge direction in the tangential direction.
[0090] When the contour points are located in a low-quality thermal haze interference region, the local signal-to-noise ratio is low, the normal stiffness is low, and the gradient direction is disordered. and Similar to each other, highly isotropic, with a small enhancement factor, the stiffness degenerates to a lower isotropic stiffness in all directions, allowing a stronger external field to dominate the evolution of the profile.
[0091] The reason for adopting this approach is that it overcomes the defect of fixed stiffness coefficients in traditional active contour models, which results in uniform stiffness of the entire contour and an inability to adapt to changes in local signal quality. The anisotropic stiffness tensor of each contour point obtained in this step is entirely driven by local image feature data, making the stiffness of the contour itself intelligent and able to adaptively adjust its degree in different directions.
[0092] In this way, by introducing anisotropic stiffness tensors, intelligent internal constraints are provided for the fine evolution of the contour, improving the positioning accuracy and morphological stability of the contour under noise interference.
[0093] S5: Adaptively update the energy function of the active contour model based on the global guiding vector and anisotropic stiffness tensor of the contour points to optimize the contour matching process and obtain accurate contour recognition results.
[0094] After completing the construction of the optimal external driving force and the optimal internal constraints in the previous step, this invention has all the core components for modifying the traditional active contour model. In order to obtain accurate contour detection results for subsequent deformation detection, this step will reconstruct the energy function of the traditional active contour model during the process of iteratively obtaining the contour of the forging by the active contour to obtain more accurate contour recognition results.
[0095] To make the technical solution of this application more rigorous and intuitive, we first compare the improvements of the traditional active contour model with those of this step:
[0096] The energy function of a traditional active contour model is the integral of its internal and external energy terms:
[0097]
[0098] In this formula, Let be the total energy of the contour lines generated in any iteration. For the outline, For internal energy terms, The external energy term is used to constrain the geometric properties of the contour itself, such as smoothness and continuity. The external energy term establishes the coupling relationship between the image data and the contour line, acting as a driving force to pull the contour toward the target edge in the image.
[0099] Internal energy term:
[0100]
[0101] In this formula, It is the first one on the outline. One contour point, The internal energy term on the contour line is the first The values at each contour point It is the preset elastic coefficient. These are preset stiffness coefficients, which are fixed scalars in traditional active models. It is the first one on the outline. The tangent vector (first derivative) at the nth contour point represents the nth contour point. The elasticity or tension of a contour point It is the first one on the outline. The curvature vector (second derivative) at the nth contour point represents the... The stiffness of a contour point, || || is used to find the sign of the magnitude. The magnitude of a vector represents the magnitude of the vector. Then, the square value is calculated on the magnitude, which is the conventional way to calculate energy.
[0102] In this formula, This is an elastic / tension constraint term, which is based on the first derivative of the profile. That is, the tangent vector is calculated. In the process of minimizing the energy of the model, it will punish the excessive stretching of the contour, prompting the contour to maintain continuity and tend to contract, thus maintaining tension. This is the stiffness / bending constraint term, which is based on the second derivative of the profile. The curvature vector, calculated by this factor, penalizes excessive curvature of the profile. To minimize this, the profile tends to become straighter and avoid sharp corners, thus ensuring its smoothness. This constraint ensures that the active profile model maintains a continuous and smooth geometry throughout the iterative evolution process of acquiring the true profile of the forging.
[0103] External energy term: In this formula, It is the first external energy term on the contour line. The values at each contour point For the first on the outline One contour point, For the first on the outline The conventional approach to calculating energy is to take the gradient magnitude of each contour point (determined based on the grayscale information of the pixels) and then square the magnitude. The weights are preset to a fixed value. The core function of the external energy term is to establish the coupling relationship between image data and contour lines, acting as a driving force to pull the contour towards the target edge. Its driving force comes from the gradient magnitude of the contour points. In the edge regions of the image, the grayscale of the pixels changes drastically, so the gradient magnitude is large. Since there is a negative sign in the formula, a large gradient magnitude will actually make the energy value very low. The evolution process of the active contour model is to find the minimum total energy. Therefore, the contour lines tend to move to those edge regions with high gradient magnitudes, thus realizing automatic edge detection of the contour.
[0104] This step optimizes two key terms of the traditional energy function:
[0105] The stiffness coefficients related to the contour point in the traditional internal energy term are replaced with the anisotropic stiffness tensor of the contour point. The internal energy term only replaces the stiffness coefficients with anisotropic stiffness tensors without adjusting the elastic coefficients. This is because thermal haze easily causes local drift or jitter in the contour. This jitter is mathematically a high-frequency bending, reflected by curvature, and controlled by curvature vectors in the internal energy term. Therefore, the stiffness coefficients that control high-frequency bending are specifically upgraded to anisotropic stiffness tensors, so that the model can adaptively increase tangential stiffness in the thermal haze region to resist this specific high-frequency bending / jittering. The elastic coefficients, on the other hand, retain their original constraints on the elasticity or tension of the foundation.
[0106] Replacing the magnitude of the gradient vector involving the contour point in the traditional external energy term with the magnitude of the guide vector of the contour point is to solve the feature confusion problem caused by both halo and heat haze. The magnitude of the traditional gradient vector will respond to both the real edge and the artifact, while the guide vector is diffused after reducing the interference of halo and heat haze. Therefore, this replacement mathematically reconstructs the external driving force, making it reduce the interference of artifacts.
[0107] The optimized internal energy term is:
[0108]
[0109] In this formula, It is the optimized internal energy term on the contour line. The values at each contour point It is the preset elastic coefficient. It is the first one on the outline. Tangent vectors at each contour point It is the first one on the outline. Curvature vector at each contour point for The transpose of , For the first The anisotropic stiffness tensor of each contour point, due to It is a scalar, while the anisotropic stiffness tensor of the contour points is a two-dimensional matrix. Therefore, after the replacement, it is necessary to... Perform a transpose operation to enable normal calculations, through We obtain a scalar value to represent the magnitude of energy. Yes The mathematical dimension is increased to meet the requirements of tensor computation, but the core optimization method remains unchanged. It can apply different differentiated penalties to bending or jitter in different directions.
[0110] Thus, the unoptimized internal energy term uses a fixed scalar to penalize high-frequency bending; this constraint is isotropic (the same in all directions). The optimized internal energy term replaces this scalar constraint, replacing the stiffness coefficient with an anisotropic stiffness tensor. This anisotropic stiffness tensor applies different penalties to bending in different directions. The anisotropic stiffness tensor is determined in step S4 based on thermal haze interference (gradient direction uncertainty). / Dynamically constructed, in the hot haze interference zone, the anisotropic stiffness tensor will adaptively increase the tangential stiffness, and the internal energy term will resist tangential drift and jitter while maintaining flexibility in the normal direction (the direction that fits the edge), thereby improving the stability and accuracy of convergence.
[0111] The optimized formula for the external energy term is:
[0112]
[0113] In this formula, For the optimized external energy term on the contour line, the first... The values at each contour point For the first on the outline One contour point, For the first on the outline The conventional approach to calculating energy is to determine the magnitude of the guiding vector at each contour point and then square that magnitude. These are preset fixed weights.
[0114] In this formula, the external energy term before optimization relies entirely on the original image gradient, failing to distinguish between true edges and false edges generated by halos and heat haze, resulting in incorrect contour capture. Here, instead of relying entirely on the original image gradient, the magnitude of the guiding vector is used. In step S2, halo and thermal haze interference has been reduced, and in step S3, a purity index is generated through tensor diffusion. The optimized internal energy term reduces halo and thermal haze interference at the physical source. It has a high amplitude only at true edges and a low amplitude at pseudo edges, avoiding feature confusion and ensuring that the profile converges to the true profile of the forging.
[0115] Based on the above theoretical reconstruction, the specific implementation process of this step is as follows:
[0116] Based on the preset cold profile of the forging, an active profile model is initialized to obtain a series of profile points in the grayscale image of the forging. The position of each profile point is updated iteratively until the model converges. During each iteration, the local definition of each profile point in the energy function is reconstructed: the external energy term of the energy function is driven by the guiding vector of the profile point, that is, the magnitude of the gradient vector of the profile point in the grayscale image is optimized to the magnitude of the guiding vector of the profile point. Furthermore, the internal energy term of the energy function is constrained by the anisotropic stiffness tensor of the profile point, that is, the stiffness coefficient of the profile point in the internal energy term is optimized to the anisotropic stiffness tensor of the profile point. The active profile model iterates under the drive of the reconstructed energy function until it converges to the final hot profile.
[0117] S6: Perform deformation analysis based on accurate contour recognition results.
[0118] In one embodiment, the method for performing deformation analysis on the acquired thermal profile is as follows:
[0119] The degree of curvature used to characterize contour warping and ellipticization, and the degree of twist used to characterize contour torsion, are calculated. For example, the degree of curvature can be quantified by calculating the curvature distribution at points on the contour, and the degree of twist can be quantified by the deviation of the contour principal axis direction from the standard direction obtained by principal component analysis.
[0120] Multiple indicators, such as the degree of bending and the degree of torsion, are combined into a multidimensional deformation vector. The calculated multidimensional deformation vector is then matched with a pre-acquired feature library of multidimensional deformation vectors to determine the deformation state of the forging. This feature library is pre-marked with "qualified area", "area of concern" and "risk area" by analyzing a large number of qualified and unqualified forging samples. By determining which area the deformation vector of the current forging falls into, the deformation state of the forging is finally determined.
[0121] The reason for adopting this approach is that a single deformation index often cannot fully reflect complex geometric changes. By constructing a multidimensional deformation vector and comparing it with a preset spatial feature domain, a comprehensive and robust assessment of the deformation state can be achieved, avoiding misjudgments caused by a single threshold judgment.
[0122] In this way, by conducting multi-dimensional quantitative analysis of the profile, it is possible to accurately determine the deformation state of the forging, providing reliable decision support for quality control and process optimization in the production process.
[0123] The present invention also provides a forging heat treatment deformation detection system, the system comprising: a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement all the steps of the forging heat treatment deformation detection method of the present application.
[0124] The processor can be a central processing unit (CPU), a graphics processing unit (GPU), or a field-programmable gate array (FPGA), and the memory can include volatile memory (such as random access memory RAM) or non-volatile memory (such as read-only memory ROM, flash memory).
[0125] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. 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 method for detecting deformation after heat treatment of forgings, characterized in that, include: Acquire grayscale images of forgings in the furnace, calculate the gradient vector, grayscale saturation, and local entropy of pixels in the grayscale image, and determine the gradient confidence of pixels based on grayscale saturation and local entropy; use gradient confidence as weight to weight the gradient vector to obtain the local confidence vector of pixels, and perform tensor diffusion processing on the local confidence vectors of all pixels to form a guiding vector field; The active contour model is initialized based on the preset cold contour to obtain all contour points in the grayscale image. The position of each contour point is updated iteratively until the active contour model converges to the hot contour. After the active contour model converges, deformation analysis is performed on the hot contour to determine the deformation state of the forging and realize online detection of heat treatment deformation of the forging. During each iteration update, for each contour point in the current iteration process, the following operations are performed: obtain the guiding vector corresponding to the contour point in the guiding vector field, and query the gradient vector and local entropy of the contour point in the grayscale image; calculate the anisotropic stiffness tensor of the contour point based on the gradient vector and local entropy. The local definition of the energy function of the reconstructed active contour model at the contour point includes: the external energy term driven by the guiding vector of the contour point, and the internal energy term constrained by the anisotropic stiffness tensor of the contour point; the internal energy term is: It is the optimized internal energy term on the contour line. The values at each contour point It is the preset elastic coefficient. It is the first one on the outline. Tangent vectors at each contour point It is the first one on the outline. Curvature vector at each contour point for The transpose of , For the first Anisotropic stiffness tensor of each contour point; The formula for the external energy term is: For the optimized external energy term on the contour line, the first... The values at each contour point For the first on the outline One contour point, For the first on the outline The magnitude of the guiding vector of each contour point These are preset fixed weights.
2. The method for detecting deformation after heat treatment of forgings according to claim 1, characterized in that, The gradient confidence level of a pixel is determined based on the following method: ; in, For the grayscale image, the first Gradient confidence of each pixel For the first grayscale saturation of each pixel For the first Local entropy of each pixel The average local entropy of all pixels. Natural exponential function, To prevent parameters with a denominator of 0.
3. The method for detecting deformation after heat treatment of forgings according to claim 1, characterized in that, The guiding vector field is generated by iteratively solving the following vector diffusion equation for all pixels to diffuse the local reliable vectors into guiding vectors; , and The first The pixel at the th point sequence The guiding vector for the next iteration. The preset diffusion coefficient, For the Laplace operator, For the first Local confidence vector of each pixel To determine the modulus sign, in each iteration, the average difference between the guiding vector of all pixels in the current iteration and the guiding vector in the previous iteration is calculated. When the average difference is less than a preset average difference threshold in a certain iteration, the iteration ends, and the guiding vectors of all pixels in that iteration are used to form a guiding vector field.
4. The method for detecting deformation after heat treatment of forgings according to claim 1, characterized in that, The anisotropic stiffness tensor of the contour points is determined as follows: Based on the magnitude of the gradient vector and the local entropy of the contour points, the local signal-to-noise ratio (SNR) of the contour points is calculated. The normalized result of the local SNR is then subjected to a positively correlated nonlinear mapping to obtain the basic isotropic stiffness of the contour points. Based on the gradient vector of the contour points, the structural tensor of the contour points is calculated. The structural tensor is then subjected to eigenvalue decomposition to obtain a first eigenvector and a second eigenvector, as well as a first eigenvalue and a second eigenvalue. The basic isotropic stiffness is set as the first stiffness component along the direction of the first eigenvector. Based on the ratio of the first eigenvalue and the second eigenvalue, and the basic isotropic stiffness, the second stiffness component along the direction of the second eigenvector is determined. By combining the first stiffness component, the second stiffness component, the first eigenvector, and the second eigenvector, the anisotropic stiffness tensor of the contour point is determined.
5. The method for detecting deformation after heat treatment of forgings according to claim 4, characterized in that, The second stiffness component is determined based on the following method: The ratio of the first eigenvalue and the second eigenvalue is determined as the anisotropic enhancement factor. The isotropic stiffness of the foundation is multiplied by the anisotropic enhancement factor to enhance the isotropic stiffness of the foundation. The enhanced isotropic stiffness of the foundation is used as the second stiffness component along the direction of the second eigenvector.
6. The method for detecting deformation after heat treatment of forgings according to claim 4, characterized in that, The anisotropic stiffness tensor is constructed using the following formula: ; in, For the first Anisotropic stiffness tensor of each contour point For the first The first stiffness component of each contour point For the first The second stiffness component of each profile point and The first The first and second eigenvectors are obtained by eigenvalue decomposition of the structure tensor of each contour point. For transpose operation, for The transpose of , for The transpose of .
7. The method for detecting deformation after heat treatment of forgings according to claim 1, characterized in that, The method for performing deformation analysis on the obtained thermal profile is as follows: The degree of curvature used to characterize contour warping and ellipticization, and the degree of torsion used to characterize contour twisting are calculated, and the degree of curvature and torsion are combined into a multidimensional deformation vector. The multidimensional deformation vector is matched with a pre-acquired feature library of multidimensional deformation vectors to determine the deformation state of the forging.
8. A deformation detection system for forgings after heat treatment, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the deformation detection method as described in any one of claims 1-7.
Citation Information
Patent Citations
Off-bed monitoring alarm method and system based on infrared rays
CN119888961A
Pin shaft forging forming quality detection method and system
CN120339278A