A defect identification method and system based on multi-scale cooperation

By employing a multi-scale collaborative defect identification method, utilizing multi-scale gradient feature data and phase consistency index of glass tube components, the problems of missed detection of real defects and false alarms of reflection artifacts in the detection of welding defects of glass tube components are solved, and high-precision automated detection is achieved.

CN122244033APending Publication Date: 2026-06-19WUHAN SENSAIRUI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN SENSAIRUI TECH CO LTD
Filing Date
2026-05-20
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing technologies, the detection of welding defects in glass tube components is prone to problems of missed detection of real defects and false alarms of reflection artifacts in complex optical environments, resulting in a low yield rate of automated inspection.

Method used

A multi-scale collaborative defect identification method is adopted. By acquiring two-dimensional grayscale images of glass tube elements, multi-scale gradient feature data is extracted, phase consistency index and reflection dispersion factor are constructed, and gradient reconstruction field is generated for adaptive dual-reference truncation to remove reflection artifacts and retain minute defects.

Benefits of technology

It improves the absolute accuracy and industrial robustness of machine vision in detecting weak defects on complex, highly reflective surfaces, and solves the problem of deep intertwining between missed detection of real defects and false alarms of reflective artifacts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122244033A_ABST
    Figure CN122244033A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of image recognition technology, specifically relating to a defect recognition method and system based on multi-scale collaboration. The method includes: acquiring a two-dimensional grayscale image and extracting spatial gradient feature data; obtaining a phase consistency index based on small-scale gradient phase, large-scale gradient phase, small-scale gradient magnitude, and large-scale gradient magnitude; obtaining a reflection dispersion factor based on local grayscale mean, local grayscale variance, and small-scale gradient magnitude; obtaining a gradient reconstruction field based on the reflection dispersion factor, small-scale gradient magnitude, and phase consistency index; obtaining a truncation boundary based on the gradient reconstruction field, truncating the gradient reconstruction field in conjunction with dark current noise intensity, generating a binary defect image, and outputting the detection result of welding defects in glass tube components. This invention effectively removes reflection artifacts while preserving true defects, significantly improving the detection accuracy and robustness of machine vision systems in complex environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology. More specifically, this invention relates to a defect recognition method and system based on multi-scale collaboration. Background Technology

[0002] In the automated production process of glass tube components, the welding quality directly determines the airtightness and mechanical strength of the final product. In order to ensure the quality of the finished product, machine vision systems are usually deployed on the industrial site to perform non-contact appearance defect detection on the welding area of ​​the glass tube components.

[0003] However, glass tube components are usually made of glass with high light transmittance and smooth surface. Their welding area has complex geometric transitions, drastic changes in surface curvature, and uneven distribution of local internal stress. When an external detection light source shines on this area, it is very easy to generate strong optical interference fringes with interwoven specular reflection and diffuse reflection on the glass surface, forming messy bright reflective halos and reflective ghost images.

[0004] In existing technologies, edge detection methods based on a single scale are typically used for detecting welding defects in glass tube components. This involves first acquiring a grayscale image of the target area and using a Gaussian smoothing filter of a fixed size to eliminate high-frequency noise. Then, the absolute gradient magnitude and gradient direction are calculated, and non-maximum suppression is performed to preserve local gradient extrema. Finally, globally fixed high and low thresholds are set to hard truncate the absolute gradient magnitude to output a binary image of the defect contour.

[0005] This processing method has serious limitations. It uses a single and fixed smoothing scale, which cannot take into account both the broad reflection halo and the fine weld burrs, resulting in the loss of subtle physical boundary features during the smoothing process. At the same time, its globally fixed dual threshold mechanism relies entirely on the absolute amplitude of the gradient. In the reflection halo region, abrupt changes in light intensity will produce dense pseudo-gradient peaks, causing a large number of light spot refraction boundaries to be misjudged as real welding defects. This rigid processing method ignores the underlying physical differences between the defect entity and the reflection artifact in terms of spatial continuity and local energy dispersion. This results in a serious imbalance between missed detection of real defects and false alarms of reflection artifacts in complex optical environments, which severely restricts the yield of automated inspection. Summary of the Invention

[0006] To address the aforementioned technical problem of the intertwined issues of missed detection of real defects and false alarms of reflection artifacts in complex optical environments caused by reliance on single-scale extraction and fixed empirical threshold truncation, this invention provides solutions in the following aspects.

[0007] In a first aspect, the present invention provides a defect identification method based on multi-scale collaboration, comprising: acquiring a two-dimensional grayscale image of a glass tube element and extracting spatial gradient feature data of each pixel in multiple scale dimensions, wherein the spatial gradient feature data includes small-scale gradient magnitude, small-scale gradient phase, large-scale gradient magnitude, and large-scale gradient phase; obtaining a cross-scale normal deflection angle based on the small-scale gradient phase and the large-scale gradient phase, obtaining a cross-scale physical energy retention rate based on the small-scale gradient magnitude and the large-scale gradient magnitude, and obtaining a phase consistency index based on the cross-scale normal deflection angle and the cross-scale physical energy retention rate; and extracting the two-dimensional grayscale image... The system calculates the local gray-level mean and local gray-level variance. Based on the local gray-level mean and small-scale gradient amplitude, it obtains the local physical fundamental energy baseline. Based on the local gray-level variance and local physical fundamental energy baseline, it obtains the reflection dispersion factor. Based on the reflection dispersion factor, it obtains the nonlinear optical damping coefficient. Based on the small-scale gradient amplitude, phase consistency index, and nonlinear optical damping coefficient, it obtains the gradient reconstruction field. Based on the gradient reconstruction field, it obtains the reconstruction mean and reconstruction standard deviation, and constructs a truncation limit. Based on the truncation limit and a preset dark current noise intensity, it truncates the gradient reconstruction field to generate a defect binary image, and outputs the glass tube element welding defect detection result.

[0008] This invention extracts spatial gradient feature data from images across multiple scales and constructs phase consistency indices and reflection dispersion factors. These are then fused to generate a gradient reconstruction field for adaptive dual-benchmark truncation. This effectively solves the technical problem of missed detection of real physical defects and false alarms of reflection halo artifacts caused by the use of a single smooth scale and global absolute gradient dual-threshold truncation in existing technologies. At the bottom-level feature generation stage, this method captures the rigid continuity of real physical steps using the consistency of geometric normals at different scales. Simultaneously, it quantifies the chaotic energy scattering characteristics of reflective regions through local statistical analysis, and then introduces nonlinear optical damping to physically reduce the weight of chaotic reflections. This preserves small weld burrs while removing and dissipating large-area light spot artifacts. Its entire process relies on a truncation mechanism that adapts to the dynamic evolution of physical environment lighting, eliminating the adaptive lag caused by the solidification of empirical parameters. This improves the absolute accuracy and industrial robustness of machine vision for automated detection of weak defects on complex, highly reflective surfaces.

[0009] Preferably, the step of acquiring a two-dimensional grayscale image of the glass tube element and extracting spatial gradient feature data of each pixel in multiple scale dimensions includes: capturing an initial welding image using an up-shot detection module and a down-shot detection module, and performing grayscale conversion processing to obtain a two-dimensional grayscale image; constructing a small-scale Gaussian convolution kernel and a large-scale Gaussian convolution kernel based on a preset microscopic boundary scale and twice its size, respectively; and using the small-scale Gaussian convolution kernel and the large-scale Gaussian convolution kernel to calculate the partial derivatives of the two-dimensional grayscale image to extract the small-scale gradient magnitude, small-scale gradient phase, large-scale gradient magnitude, and large-scale gradient phase.

[0010] Preferably, the phase consistency index satisfies the expression: In the formula, As a phase consistency index, It is a cosine function. For large-scale gradient phase, For small-scale gradient phase, It is a minimum value function. For large-scale gradient magnitude, For small-scale gradient magnitude, It is a function for maximizing the value.

[0011] This invention maps the difference between the gradient phases at large and small scales onto a cosine function with monotonically convergent characteristics. Simultaneously, it locks the degree of energy attenuation by combining the extreme value ratio of the amplitudes at large and small scales. This solidifies the core physical law that the normal direction of real defect entities remains unchanged and the edge energy is stably transferred during smooth cross-scale transformations in the underlying data stream. This operation results in light spot artifacts lacking real structural support receiving extremely low weight penalties due to random normal deflection and rapid energy dissipation, while real rigid boundaries with physical morphological thickness naturally generate high numerical gains, achieving natural targeted isolation of random physical refraction noise in glass.

[0012] Preferably, the step of extracting the local grayscale mean and local grayscale variance of the two-dimensional grayscale image includes: selecting a square local sliding window centered on a pixel in the two-dimensional grayscale image; traversing and extracting the grayscale values ​​of all pixels within the square local sliding window; and calculating the local grayscale mean and local grayscale variance.

[0013] Preferably, the reflection dispersion factor satisfies the expression: In the formula, The reflection dispersion factor, For local grayscale variance, This represents the local grayscale mean. This represents the small-scale gradient magnitude.

[0014] This invention captures the unique physical appearance of the highly reflective region of a glass tube, which is extremely bright and drastically changing but lacks a real three-dimensional step structure, by using the local gray-level variance, which characterizes the violent and disordered jumps of local photons, as a molecular penalty term and dividing it by the local physical baseline energy, which is formed by the superposition of the square of the local gray-level mean representing the overall brightness base and the square of the small-scale gradient amplitude representing the physical edge abrupt change. This division logic causes the internal chaotic but lacking real physical steps of the reflective spot to spontaneously expose extremely high values, while the values ​​of the welding defect region with stable morphology and accompanied by real steps are effectively suppressed, thereby deconstructing the physical divergence index unique to optical medium refraction.

[0015] Preferably, the gradient reconstruction field satisfies the expression: In the formula, To reconstruct the field for gradient, For small-scale gradient magnitude, As a phase consistency index, It is an exponential function with the natural constant as its base. This is the reflection dispersion factor.

[0016] This invention transforms the reflection dispersion factor into a nonlinear optical damping coefficient by substituting it into an exponential function with the natural constant as the base, and then multiplies it with the small-scale gradient magnitude and the phase consistency index representing rigid continuity. In essence, it establishes a multi-condition synchronous gating valve within the algorithm space. This multiplication fusion mechanism fully utilizes the characteristic that the result of exponential decay drops sharply once the independent variable increases, forcing the reflective artifact signal with high dispersion properties to encounter exponential-level physical blocking, while the small real defect signal with good structural coherence and non-reflective properties can be completely reconstructed and amplified, breaking through the physical-level deep masking of the defect signal by the bright reflective halo.

[0017] Preferably, obtaining the reconstruction mean and reconstruction standard deviation based on the gradient reconstruction field and constructing a cutoff boundary includes: extracting all pixels with values ​​greater than zero in the gradient reconstruction field; calculating the reconstruction mean and reconstruction standard deviation of the pixels with values ​​greater than zero; and adding the reconstruction mean and reconstruction standard deviation to generate a cutoff boundary.

[0018] This invention constructs a dynamic cutoff defense line that can evolve synchronously with the material of the current batch of glass tubes and the ambient light of the physical environment by statistically reconstructing the mean and standard deviation of all positive pixels in the effective gradient reconstruction field and adding them together. The dynamic calculation mechanism regards the mean as the unavoidable system background reflection energy of the current physical optical environment and the standard deviation as the effective energy fluctuation amplitude of the real physical anomaly section protruding from the background. It eliminates the problem of physical environment adaptability lag caused by manual intervention and ensures that the cutoff action is always closely aligned with the real physical light conditions of the equipment for adaptive and elastic adjustment.

[0019] Preferably, the gradient reconstruction field is truncated based on the cutoff boundary and a preset dark current noise intensity to generate a defect binary image, and the glass tube element welding defect detection result is output. This includes: traversing the pixels to be judged in the gradient reconstruction field; when the value of the pixel to be judged is greater than the cutoff boundary and greater than the dark current noise intensity, it is determined as a real defect boundary and assigned as a foreground target pixel value; when the value of the pixel to be judged is not greater than the cutoff boundary or not greater than the dark current noise intensity, it is assigned as a background zero value; generating a defect binary image and identifying the continuous region marked in the defect binary image as the glass tube element welding defect detection result.

[0020] Preferably, the dark current noise intensity is obtained by: shielding the physical optical path of the industrial camera and controlling the industrial camera to continuously acquire multiple frames of images at the rated operating temperature of the equipment; extracting the statistical standard deviation of the grayscale values ​​of all pixels in the multiple frames of images and locking the statistical standard deviation as the dark current noise intensity.

[0021] In a second aspect, the present invention provides a defect identification system based on multi-scale collaboration, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the aforementioned defect identification method based on multi-scale collaboration is implemented.

[0022] By adopting the above technical solution, a computer program is generated from the aforementioned multi-scale collaborative defect identification method and stored in a memory for loading and execution by a processor. This allows for the creation of a terminal device based on the memory and processor, facilitating its use.

[0023] The beneficial effects of this invention are as follows:

[0024] This invention extracts spatial gradient feature data from images across multiple scales and constructs phase consistency indices and reflection dispersion factors. These are then fused to generate a gradient reconstruction field for adaptive dual-benchmark truncation. This effectively solves the technical problem of missed detection of real physical defects and false alarms of reflection halo artifacts caused by the use of a single smooth scale and global absolute gradient dual-threshold truncation in existing technologies. At the bottom-level feature generation stage, this method captures the rigid continuity of real physical steps using the consistency of geometric normals at different scales. Simultaneously, it quantifies the chaotic energy scattering characteristics of reflective regions through local statistical analysis, and then introduces nonlinear optical damping to physically reduce the weight of chaotic reflections. This preserves small weld burrs while removing and dissipating large-area light spot artifacts. Its entire process relies on a truncation mechanism that adapts to the dynamic evolution of physical environment lighting, eliminating the adaptive lag caused by the solidification of empirical parameters. This improves the absolute accuracy and industrial robustness of machine vision for automated detection of weak defects on complex, highly reflective surfaces. Attached Figure Description

[0025] Figure 1 This is a flowchart illustrating a multi-scale collaborative defect identification method according to the present invention; Figure 2 This is a schematic diagram illustrating the planar structure of the product conveyor line inspection equipment; Figure 3 This is a schematic diagram illustrating the structural layout of the vision inspection component. Detailed Implementation

[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0028] This invention discloses a defect identification method based on multi-scale collaboration, referring to... Figure 1 This includes steps S1-S5:

[0029] S1: Acquire the initial welding image of the glass tube component and extract the spatial gradient feature data of each pixel in multiple scale dimensions.

[0030] It should be noted that, due to the complex geometric transitions in the welding area of ​​the glass tube element, a single scale cannot fully map the true topological morphology of the physical boundary, resulting in the easy loss of true weak defect boundary features during the smoothing process. Therefore, this invention introduces a cross-scale differentiation mechanism to obtain the local spatial change rate of the image.

[0031] Specifically, refer to Figure 2 A schematic diagram of the planar structure of the product conveyor line inspection equipment and Figure 3The diagram illustrates the structural layout of the vision inspection components. The glass tube elements to be inspected are arranged on a conveyor belt, which drives the material forward. To maintain the positional stability of the material under high-speed movement, elastic pressure rollers located on the upper part of the conveyor belt apply pressure to the glass tube elements to effectively prevent slippage or displacement. The inspection equipment is equipped with two sets of vision inspection modules: an upper-level inspection module located above the conveyor belt and a lower-level inspection module located below the conveyor belt. Each vision inspection module includes a micro-motion servo module and a camera lens assembly. When the material arrival sensor detects that the glass tube element has reached the designated inspection station, it immediately sends the material position information to the camera. The vision computing system synchronously controls the upper and lower camera lens assemblies to perform synchronous capture at a microsecond-level exposure time, comprehensively covering and acquiring the initial welding image from both the upper and lower directions of the material, and then transmitting it to the vision computing system.

[0032] It should be noted that by controlling the upper and lower detection modules to perform simultaneous short-exposure capture from dual perspectives, and by using customized Gaussian kernels in the horizontal and vertical directions to obtain the fundamental differential matrix, the subtle vibration blur that occurs during physical transport is effectively suppressed. Multi-scale partial derivative calculations provide richer underlying physical feature channels for subsequent decoupling of random refraction interference on the glass surface, ensuring that whether it is a wide-span halo gradient edge or an extremely fine weld burr on the cross-section, the initial signal mapping with the highest fidelity can be obtained in the calculation dimension that matches its own physical width.

[0033] Subsequently, the initial welding image is subjected to grayscale conversion processing to obtain a two-dimensional grayscale image. According to the preset microscopic boundary scale We construct small-scale Gaussian convolution kernels and large-scale Gaussian convolution kernels, respectively, using twice their size; and then use these kernels to process two-dimensional grayscale images. Perform partial derivative calculations in the horizontal and vertical directions, and calculate the small-scale gradient magnitude of each pixel based on the partial derivative results. Small-scale gradient phase and large-scale gradient magnitude Large-scale gradient phase .

[0034] Among them, micro boundary scale The result is obtained by directly multiplying the minimum physical cross-sectional size of the weld burr allowed by the production process with the spatial resolution of the industrial camera and then rounding down.

[0035] S2: Construct a phase consistency index based on the spatial gradient feature data of each pixel in multiple scale dimensions.

[0036] It should be noted that, because the boundary of a real welded defect remains constant in its normal direction and its physical edge contrast energy is stably transferred across different smooth scales, the boundary of a virtual light spot formed by random refraction on a glass surface not only experiences directional distortion at different scales, but also exhibits drastic attenuation or abrupt changes in edge energy. Therefore, this invention incorporates the angle between the normals at different scales into a cosine function, allowing real physical boundaries with consistent orientations to naturally generate high values. The minimum and maximum values ​​of the gradient amplitudes at different scales are extracted to construct an energy transfer ratio, which is used to screen stable structures where energy does not drastically attenuate across different scales. Finally, the cosine value is multiplied by the energy transfer ratio to precisely pinpoint the true physical rigidity continuity.

[0037] Specifically, for each pixel, based on the small-scale gradient magnitude obtained above... Small-scale gradient phase Large-scale gradient magnitude Phase with large-scale gradient Calculate the phase consistency index Phase consistency index Satisfying the expression:

[0038]

[0039] In the formula, It is a cosine function. It is a minimum value function. It is a function with maximum value. For large-scale gradient phase, For small-scale gradient phase, For large-scale gradient magnitude, This refers to the small-scale gradient magnitude; Represents the cross-scale normal deflection angle; It represents the physical energy retention rate across scales.

[0040] It should be noted that when both the large-scale gradient magnitude and the small-scale gradient magnitude are equal to 0, there are no physical edges or optical refraction boundaries in physical space. In this case, the phase consistency index... Forced truncation with a value of 0.

[0041] In this study, the physical structure of the reflective artifacts on the glass tube surface rapidly collapses during smooth diffusion. This is directly manifested in the physical appearance as a sharp increase in the cross-scale normal deflection angle and a rapid decay in the cross-scale physical energy retention rate. In contrast, real rigid welding defects can always maintain a stable physical outline. Therefore, this mathematical logic uses the monotonically convergent property of the cosine function to map the cross-scale normal deflection angle and multiplies it with the cross-scale physical energy retention rate. This ensures that only real physical entities with no orientation distortion and no edge energy collapse in physical space can obtain a high numerical mapping, thus achieving natural physical isolation of random refraction artifacts in glass.

[0042] S3: Extract local statistical features from the two-dimensional grayscale image and construct the reflection dispersion factor.

[0043] It should be noted that the actual weld defect area exhibits strong geometric abrupt changes and relatively stable local grayscale, presenting a physical appearance of high gradient amplitude and low variance. In contrast, the highly reflective area of ​​the glass tube, due to multiple random refractions of light within the tube, is not only extremely bright overall but also exhibits fluctuating brightness in certain areas. However, it does not inherently possess a true physical step edge, presenting a physical appearance of high grayscale mean, high grayscale variance, and low actual gradient amplitude. Because these two types of areas have significant overlap and confusion in terms of absolute brightness, the false edges of high-brightness spots are easily misjudged. Therefore, this invention uses the grayscale variance, representing the degree of photon scattering disorder, as a penalty term in the numerator, while simultaneously superimposing the grayscale mean, representing the local overall basic energy, and the small-scale gradient amplitude, representing the sharpness of the true geometric edge, as a protection term in the denominator. This logic causes extremely bright and cluttered light spot regions, which lack real physical step abrupt changes, to spontaneously generate extremely high penalty values, while defect regions with real physical steps and internal stability have extremely low values. This constructs a high-precision reflection dispersion factor to provide targeted data for subsequent reflection removal.

[0044] Specifically, in the two-dimensional grayscale image obtained above Above, a square local sliding window is selected centered on the pixel, and the gray values ​​of all pixels within the local sliding window are extracted and the local gray value is calculated. With local gray variance The size of the square partial sliding window is , , The microscopic boundary scale is preset.

[0045] Furthermore, based on the local grayscale mean Local grayscale variance With small-scale gradient magnitude Calculate the reflection dispersion factor Since there is no random refraction of photons in an absolutely dark field, this invention uses dark current noise intensity. The square of is used as the physical security boundary, when When the area is in a state of absolute darkness or physical stillness, the reflection dispersion factor is directly determined. Forced truncation with a value of 0, when At that time, the reflection dispersion factor Satisfying the expression:

[0046]

[0047] In the formula, For local grayscale variance, This represents the local grayscale mean. This refers to the small-scale gradient magnitude; It represents the local physical baseline energy composed of the brightness base, physical edge abrupt energy, and hardware noise floor.

[0048] It should be noted that regarding the intensity of dark current noise... The value is determined on-site based on the camera's actual hardware boundary conditions. Specifically, during the equipment deployment phase, the physical optical path of the industrial camera is completely blocked, such as by covering it with an opaque lens cap. The camera is then continuously acquiring multiple frames of images at the equipment's rated operating temperature as zero-light boundary samples. Subsequently, the statistical standard deviation of all pixel grayscale values ​​in these images is directly extracted. Since any grayscale fluctuations deviating from absolute zero in an absolutely dark environment originate entirely from thermionic emission within the camera's photosensitive silicon wafer, this statistical standard deviation is directly locked as the dark current noise intensity. The final value of .

[0049] Among them, the bright reflective areas appear physically as violent photon random reflection jumps, that is, the local gray-level variance is extremely large, but they often lack the real physical step structure, that is, the small-scale gradient amplitude in the local physical fundamental energy baseline is extremely low. This mathematical logic divides the local gray-level variance representing the photon scattering jump directly by the local physical fundamental energy baseline, so that the reflective artifact areas that lack real physical steps but have fluctuating light spontaneously expose extremely high penalty values, while the real defect areas with stable physical morphology have extremely low values, thus accurately extracting the unique physical disorder characteristics of optical refraction from the underlying data stream.

[0050] S4: Integrate the phase consistency index and the reflection dispersion factor to construct the gradient reconstruction field.

[0051] It should be noted that, since the initial gradient features extracted in step S1 inevitably mix real weak defect signals with high-intensity reflective interference signals, defects are easily masked. Because the natural exponential decay function exhibits a precipitous drop in its result as the independent variable increases, this invention incorporates the reflection dispersion factor into the natural exponential function, causing the weight of areas with more severe reflection to be directly reduced to zero. Subsequently, utilizing the synchronous gating characteristic of mathematical multiplication, the initial gradient magnitude, exponential decay weights, and the coherence features of the structural phase are strictly multiplied together. This multiplication logic ensures that the initial gradient features can only be preserved and reconstructed when both conditions of non-strong reflection and structural coherence are met, thus isolating reflective artifacts.

[0052] Specifically, based on the small-scale gradient magnitude obtained above Phase consistency index With reflection dispersion factor Calculate the gradient reconstruction field Gradient reconstruction field Satisfying the expression:

[0053]

[0054] In the formula, It is an exponential function with the natural constant as its base. For small-scale gradient magnitude, As a phase consistency index, It is the reflection dispersion factor; This represents the nonlinear optical damping coefficient derived from the reflection dispersion factor.

[0055] Complex optical reflections, after physical superposition, can deeply obscure subtle physical defects, and conventional linear processing cannot decouple this deep coupling. The exponential decay curve of the natural constant has a precipitous drop in mathematical characteristics. This logic directly maps this characteristic to optical damping, causing the nonlinear optical damping coefficient corresponding to the chaotic glass reflection area to rapidly approach absolute zero. When this damping coefficient is multiplied by the underlying gradient magnitude representing the strength of the physical structure and the phase consistency index representing the rigidity continuity, it is equivalent to establishing a synchronous gate valve in physical space, forcing the high-intensity reflection artifacts to dissipate exponentially, while the true defect features are completely reconstructed and preserved.

[0056] S5: Perform feature truncation based on gradient reconstruction field and output the detection results of welding defects in glass tube components.

[0057] It should be noted that the reconstructed mean of the image represents the basic background energy under the current environment, and the reconstruction standard deviation represents the fluctuation range of the target feature protruding from the background. Adding the two together as the cutoff boundary can automatically generate a dynamic shift that increases with the ambient light, solving the problem that fixed empirical values ​​are prone to failure when the light changes, leading to an uncontrollable increase in the false negative rate. At the same time, in a perfectly defect-free image, there will still be weak electrical signal fluctuations in the background caused by the heat generated by the camera sensor. If only the above relative statistical boundary is relied upon, these pure electronic noise fluctuations will inevitably be truncated as significant features, leading to an inevitable false positive paradox. Since the dark current noise intensity represents the inherent hot electron emission limit of the camera's photosensitive silicon wafer at the current physical temperature, it is essentially the physical noise benchmark for all real optical signals. Therefore, this invention uses the dark current noise intensity as an absolute physical interception line, ensuring that the finally extracted features are not only relative extreme values ​​in local statistics, but also real physical optical anomaly signals whose absolute energy exceeds the hardware electrical noise, ensuring correct identification under good product conditions.

[0058] Specifically, the gradient reconstruction field obtained above is calculated. The reconstructed mean of all pixels with values ​​greater than zero With reconstruction standard deviation Set cutoff limits Satisfying the expression:

[0059]

[0060] In the formula, To reconstruct the mean, To reconstruct the standard deviation; combined terms This represents a dynamic cutoff criterion that evolves synchronously with the physical environment and lighting conditions.

[0061] In this context, since the global physical ambient light in industrial sites is usually in a state of weak dynamic fluctuation, fixed empirical values ​​are easily decoupled from the real physical noise floor. This logic regards the reconstructed mean as the basic optical background energy under the current physical environment and the reconstructed standard deviation as the energy fluctuation amplitude of the real physical defects protruding from the background. The dynamic truncation benchmark formed by the sum of the two can accurately map the real reflective background and illumination shift of the current batch of glass tubes, ensuring that the subsequent truncation action always closely follows the real physical environment and makes adaptive adjustments in a rising manner, eliminating the problem of physical environment adaptation lag caused by manual intervention.

[0062] Furthermore, when the overall image's lighting environment shifts, causing the reconstructed mean to... Or reconstruct the standard deviation When fluctuations occur, cut off the boundary. The value will adaptively increase or decrease; the field is reconstructed by traversing the gradient. For each pixel to be judged, if the value of the pixel to be judged is greater than the cutoff limit... And simultaneously greater than the dark current noise intensity If a region is identified as a true defect boundary, it is assigned the value of the foreground target pixel; otherwise, it is identified as a background reflection or normal area and assigned the value of zero background. This process generates a binary image of the defect. The continuous region marked in the binary image represents the identified welding defect in the glass tube component. This logic effectively avoids misjudgments caused by rigid parameters through closed-loop calibration using real experimental data, achieving highly reliable data stream output.

[0063] This invention also discloses a defect identification system based on multi-scale collaboration, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement a defect identification method based on multi-scale collaboration according to the present invention.

[0064] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.

Claims

1. A defect identification method based on multi-scale collaboration, characterized in that, include: A two-dimensional grayscale image of the glass tube element is acquired and spatial gradient feature data of each pixel in multiple scale dimensions is extracted. The spatial gradient feature data includes small-scale gradient magnitude, small-scale gradient phase, large-scale gradient magnitude, and large-scale gradient phase. Based on the small-scale gradient phase and the large-scale gradient phase, the cross-scale normal deflection angle is obtained; based on the small-scale gradient magnitude and the large-scale gradient magnitude, the cross-scale physical energy retention rate is obtained; and based on the cross-scale normal deflection angle and the cross-scale physical energy retention rate, the phase consistency index is obtained. Extract the local grayscale mean and local grayscale variance of the two-dimensional grayscale image, obtain the local physical fundamental energy baseline based on the local grayscale mean and small-scale gradient magnitude, and obtain the reflection dispersion factor based on the local grayscale variance and local physical fundamental energy baseline. The nonlinear optical damping coefficient is obtained based on the reflection dispersion factor, and the gradient reconstruction field is obtained based on the small-scale gradient magnitude, phase consistency index, and nonlinear optical damping coefficient. Based on the gradient reconstruction field, the reconstruction mean and reconstruction standard deviation are obtained, and a cutoff boundary is constructed. Based on the cutoff limit and the preset dark current noise intensity, the gradient reconstruction field is truncated to generate a binary image of the defect, and the detection result of welding defects of the glass tube element is output.

2. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, The process of acquiring a two-dimensional grayscale image of the glass tube element and extracting spatial gradient feature data of each pixel in multiple scale dimensions includes: An initial welding image is captured using an upper-shot detection module and a lower-shot detection module, and then grayscale conversion is performed to obtain a two-dimensional grayscale image. Based on a preset microscopic boundary scale and twice its size, small-scale Gaussian convolution kernels and large-scale Gaussian convolution kernels are constructed respectively. The small-scale Gaussian convolution kernels and large-scale Gaussian convolution kernels are used to calculate the partial derivatives of the two-dimensional grayscale image to extract the small-scale gradient magnitude, small-scale gradient phase, large-scale gradient magnitude, and large-scale gradient phase.

3. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, The phase consistency index satisfies the expression: ; In the formula, As a phase consistency index, It is a cosine function. For large-scale gradient phase, For small-scale gradient phase, It is a minimum value function. For large-scale gradient magnitude, For small-scale gradient magnitude, It is a function for maximizing the value.

4. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, The extraction of the local grayscale mean and local grayscale variance of the two-dimensional grayscale image includes: A square local sliding window is selected on the two-dimensional grayscale image with the pixel as the center; the grayscale values ​​of all pixels within the square local sliding window are extracted; the local grayscale mean and local grayscale variance are calculated.

5. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, The reflection dispersion factor satisfies the expression: ; In the formula, The reflection dispersion factor, For local grayscale variance, This represents the local grayscale mean. This represents the small-scale gradient magnitude.

6. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, The gradient reconstruction field satisfies the expression: ; In the formula, To reconstruct the field for gradient, For small-scale gradient magnitude, As a phase consistency index, It is an exponential function with the natural constant as its base. This is the reflection dispersion factor.

7. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, Based on the gradient reconstruction field, the reconstruction mean and reconstruction standard deviation are obtained, and a cutoff boundary is constructed, including: Extract all pixels with values ​​greater than zero in the gradient reconstruction field; calculate the reconstruction mean and reconstruction standard deviation of the pixels with values ​​greater than zero; add the reconstruction mean and reconstruction standard deviation to generate the cutoff boundary.

8. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, Based on the cutoff boundary and the preset dark current noise intensity, the gradient reconstruction field is truncated to generate a binary image of the defect, and the detection results of welding defects in the glass tube component are output, including: The process iterates through the pixels to be judged in the gradient reconstruction field. When the value of a pixel to be judged is greater than the cutoff limit and greater than the dark current noise intensity, it is determined as a real defect boundary and assigned the value as a foreground target pixel value. When the value of a pixel to be judged is not greater than the cutoff limit or not greater than the dark current noise intensity, it is assigned the value as a background zero value. A defect binary image is generated, and the continuous regions marked in the defect binary image are identified as the detection results of welding defects in glass tube components.

9. The defect identification method based on multi-scale collaboration according to claim 1, characterized in that, The method for obtaining the dark current noise intensity is as follows: The physical optical path of the industrial camera is blocked, and the industrial camera is controlled to continuously acquire multiple frames of images under the rated operating temperature of the equipment; the statistical standard deviation of the gray values ​​of all pixels in the multiple frames of images is extracted, and the statistical standard deviation is locked as the dark current noise intensity.

10. A defect identification system based on multi-scale collaboration, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, implement a multi-scale collaborative defect identification method according to any one of claims 1-9.