A method for on-line visual detection of surface defects of a magnetic ring

CN122948870APending Publication Date: 2026-10-20SICHUAN VOCATIONAL & TECHN COLLEGE OF COMM +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611417966.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-14
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0004]有鉴于此,本发明提供了一种磁环表面缺陷在线视觉检测方法,以解决现有技术中二维纹理信息与三维形貌信息的融合方式多为简单的结果叠加,未能充分利用两种模态数据在特征层面的互补性,对曲面区域的检测精度提升有限的问题

Benefits of technology

[0021]1.本发明中,通过多光谱图像与多线结构光点云的多模态时空同步融合,将二维纹理与三维形貌在特征层面互补匹配,有效降低了磁环曲面表面材质纹理伪影造成的误检率;采用嵌入通道自适应降噪门控机制的跨尺度特征交互网络,通过多分支膨胀卷积与交叉注意力交互自动筛选缺陷相关纹理异常通道,抑制了磁环固有纹理和弧面反光的干扰;在缺陷形态分析中对延伸路径进行曲率补偿与各向异性畸变矫正,消除了磁环曲面曲率造成的几何测量畸变以及缺陷方向性宽度变化引起的形态失真,提高了缺陷形态描述的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention proposes an online visual detection method for surface defects on magnetic rings, comprising: acquiring multispectral image sequences and multi-line structured light scanning point clouds of the magnetic ring surface; constructing a multispectral gradient response map and a three-dimensional surface topography point cloud set after multimodal spatiotemporal synchronization and distortion correction; extracting texture anomaly feature maps through a cross-scale feature interaction network with an embedded channel adaptive noise reduction gating mechanism; performing texture difference between the texture anomaly feature maps and a standard sample template, and performing topography difference between the surface three-dimensional topography point cloud set and the standard sample three-dimensional point cloud model, and fusing them to obtain candidate defect regions; extracting the skeleton of the candidate regions and tracing the extension path, and generating morphological descriptors; performing secondary verification of the crack candidate regions by hierarchical eddy current pulse thermal imaging according to defect confidence, eliminating false detections to obtain the final result; and generating a parameter tuning scheme through defect spatial clustering and source tracing. This method improves the detection accuracy of magnetic ring surface defects through multimodal fusion and hierarchical verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of industrial visual inspection technology, and specifically relates to an online visual inspection method for defects on the surface of magnetic rings. Background Technology

[0002] Magnetic rings, as core magnetic components in power electronic devices, are widely used in transformers, inductors, and electromagnetic compatibility devices. Magnetic rings are typically made from ferrite or nanocrystalline materials through processes such as pressing, high-temperature sintering, and surface grinding. Surface quality directly affects the insulation performance and magnetic circuit characteristics of the device. However, the annular curved surface structure of magnetic rings, along with the inherent porosity and uneven surface reflectivity of the material, makes it difficult for traditional visual inspection methods to accurately distinguish between genuine defects and material texture artifacts.

[0003] Currently, most industrial methods for detecting surface defects in magnetic rings rely on two-dimensional vision systems operating under a single visible light band. These systems locate defect areas through grayscale thresholding or edge detection. However, these methods are prone to misidentifying natural surface textures as cracks or missing micro-cracks as normal textures when faced with surface reflections and material texture interference. It is difficult to simultaneously control both false positive and false negative rates within acceptable limits. Some improved solutions introduce structured light 3D reconstruction technology to assist in defect identification by acquiring surface height information. However, the fusion of 2D texture and 3D shape information is often a simple superposition of results, failing to fully utilize the complementarity of the two modalities at the feature level, resulting in limited improvement in detection accuracy for curved areas. Furthermore, for the most common crack-type defects on magnetic ring surfaces, visual information alone is insufficient to distinguish between real cracks and dark-textured scratches, especially when the crack width approaches the imaging resolution limit, where the separability of visual features significantly decreases. Summary of the Invention

[0004] In view of this, the present invention provides an online visual inspection method for defects on the surface of magnetic rings, in order to solve the problem that the fusion of two-dimensional texture information and three-dimensional shape information in the prior art is mostly a simple superposition of results, which fails to make full use of the complementarity of the two modal data at the feature level and has limited improvement in the detection accuracy of curved areas.

[0005] The technical solution adopted in this invention is as follows: an online visual inspection method for defects on the surface of a magnetic ring, comprising:

[0006] Step 1: Collect multispectral image sequences of the magnetic ring surface under multiple illumination angles, simultaneously acquire multi-line structured light scanning point clouds, perform multimodal spatiotemporal synchronization and distortion correction on the multispectral image sequences and multi-line structured light scanning point clouds, and construct a set of multispectral gradient response maps and surface three-dimensional topography point clouds.

[0007] The multimodal spatiotemporal synchronization includes: aligning the acquisition time of each band image in the multispectral image sequence with the acquisition time of the stripe image in the multi-line structured light scanning point cloud using timestamps; calculating the spatial transformation matrix between the multispectral camera and the binocular camera; and unifying the multispectral image and the three-dimensional topography point cloud into the same spatial coordinate system.

[0008] Step 2: Based on the multispectral gradient response map, extract texture anomaly features through a cross-scale feature interaction network with an embedded channel adaptive noise reduction gating mechanism to generate a texture anomaly feature map.

[0009] Preferably, the multispectral gradient response map is input into a cross-scale feature interaction network, which comprises three parallel encoding branches. These branches employ dilated convolutional kernels with different dilation rates to extract fine-grained texture features, mesoscale structural features, and coarse-scale contour features, respectively. Specifically, the first branch has a dilation rate of 1, the second branch has a dilation rate of 3, and the third branch has a dilation rate of 6. A cross-attention module is introduced between the three encoding branches to perform bidirectional attention interactions between fine-grained texture features and mesoscale structural features, between mesoscale structural features and coarse-scale contour features, and between coarse-scale contour features and fine-grained texture features, forming a cross-scale feature flow. During this cross-scale feature flow, a channel-adaptive noise reduction gating mechanism is embedded. An importance score is calculated for the feature map of each channel, and an important channel is selected and retained while noise channels are suppressed using a learnable gating threshold. The selected features from the three branches are fused and then upsampled by a decoder to restore the same spatial resolution as the multispectral gradient response map, outputting the texture anomaly feature map. The gating threshold of the channel-adaptive noise reduction gating mechanism is automatically learned through network training.

[0010] Step 3: Perform texture difference between the texture anomaly feature map and the standard sample template, and perform morphology difference between the surface three-dimensional topography point cloud set and the standard sample three-dimensional point cloud model. Fuse the texture difference results and morphology difference results to separate the candidate boundaries of the surface anomaly region and obtain the defect candidate region set.

[0011] Preferably, the multispectral gradient response map of a standard sample corresponding to the currently detected magnetic ring model is retrieved from the magnetic ring standard sample database. This map is then forward-inferred through the cross-scale feature interaction network to obtain a template texture feature map, which serves as the standard sample template. The texture anomaly feature map is subtracted pixel-by-pixel from the template texture feature map to obtain a texture difference map, which is then adaptively thresholded to generate a texture anomaly mask. A 3D point cloud model of the standard sample is retrieved from the magnetic ring standard sample database. The surface 3D topography point cloud set is spatially registered with the standard sample 3D point cloud model. The normal distance from each point in the point cloud set to the model surface is calculated. Points exceeding a preset height threshold are marked as topography anomaly points, forming a topography anomaly mask. The texture anomaly mask and the topography anomaly mask are projected onto the same coordinate system and fused using a position-by-position logical OR operation. Connectivity analysis is performed on the fused mask, and the bounding rectangle of each connected component is extracted as a candidate boundary, forming the defect candidate region set.

[0012] Step 4: Extract the morphological skeleton of each candidate region in the defect candidate region set and trace the extension path. Introduce curvature compensation and anisotropic distortion correction to double-correct the extension path and generate a high-dimensional defect morphological descriptor.

[0013] Preferably, each candidate region is binarized and segmented. The ZhangSuen thinning algorithm is used to extract the morphological skeleton, resulting in a skeleton curve with a single pixel width. Starting from the endpoint of the skeleton curve, the system traces pixel-by-pixel along the eight-neighbor direction, recording the coordinates, tangent direction, and local width of each pixel to form an extension path sequence. The local radius of curvature of the surface is calculated based on the position of the candidate region on the three-dimensional geometric model of the magnetic ring. The Euclidean distance between adjacent pixels in the extension path sequence is corrected by arc length adjustment to achieve curvature compensation. For the curvature-compensated extension path sequence, the width ratio of each pixel along the circumferential and axial directions of the magnetic ring is calculated. When the ratio is greater than a preset threshold, the circumferential coordinates are compressed; when the ratio is less than a preset threshold, the axial coordinates are stretched to complete anisotropic distortion correction. The total arc length, average curvature, mean width, and variance of the double-corrected extension path, as well as the straight-line distance between the beginning and end points of the path, are extracted to constitute the high-dimensional defect morphological descriptor.

[0014] Step 5: Determine the defect type based on the high-dimensional defect morphology descriptor, perform secondary verification of the crack candidate region by graded eddy current pulse thermal imaging according to the defect confidence level, and obtain the final defect detection result after eliminating false detections.

[0015] Preferably, the high-dimensional defect morphology descriptor is input into a gradient boosting tree defect classifier, which outputs probability scores for cracks, scratches, porosity, peeling, and inclusions. The highest-scoring type is taken as the preliminary judgment result, and the highest score is recorded as the defect confidence level. Based on the defect confidence level, candidate regions initially judged as cracks are divided into three levels: high-confidence interval, medium-confidence interval, and low-confidence interval. For high-confidence crack regions, high-frequency electromagnetic pulse excitation is used, and temperature decay curves are collected and input into a one-dimensional convolutional neural network for verification. For medium-confidence crack regions, medium-frequency electromagnetic pulse excitation is used, and the acquisition time is extended. The decay time constant, maximum temperature difference, and cooling rate features of the temperature decay curve are extracted and input into a support vector machine for verification. For low-confidence crack regions, low-frequency electromagnetic pulse excitation is used, and the average temperature decay curve is repeatedly acquired and verified through statistical analysis. Candidate regions verified as false detections are eliminated, and the confirmed defect regions and types are summarized to obtain the final defect detection result.

[0016] Preferably, the one-dimensional convolutional neural network includes a first convolutional layer, a first pooling layer, a second convolutional layer, a third convolutional layer, a global average pooling layer, a first fully connected layer, and a second fully connected layer connected in sequence. The first convolutional layer uses a convolutional kernel of size 5 to extract local trend features of the temperature decay curve; the second convolutional layer uses a convolutional kernel of size 3 to extract detailed fluctuation features of the temperature decay curve; the third convolutional layer uses a convolutional kernel of size 3 to extract high-level temporal features of the temperature decay curve; the global average pooling layer compresses the high-level temporal features into a fixed-length vector; the first fully connected layer maps the fixed-length vector to a low-dimensional feature space; and the second fully connected layer outputs a binary classification result for the authenticity of cracks.

[0017] Step 6: Statistically analyze the final defect detection results by type and location, map the defect spatial clustering to process parameters, generate a defect distribution report and a quantitative parameter adjustment scheme, and feed them back to the preceding process steps.

[0018] Preferably, the quantity, size, and spatial distribution of each type of defect in the final inspection results are statistically analyzed according to defect type; density clustering is performed on the spatial locations of similar defects to identify defect clustering areas; based on the location of the clustering areas, the corresponding preceding production process steps are traced back to establish a mapping relationship between the clustering areas and process parameters; the statistical results are overlaid as a defect distribution heatmap on the surface development diagram of the magnetic ring to generate a defect distribution report, and a quantitative parameter adjustment scheme is generated based on the mapping relationship; the defect distribution report and the quantitative parameter adjustment scheme are fed back to the corresponding preceding process steps to complete parameter adjustment.

[0019] This invention also provides an online visual inspection system for magnetic ring surface defects, used to implement the above method, comprising: a multimodal data acquisition module, a texture anomaly feature extraction module, a multimodal differential fusion module, a defect morphology analysis module, a defect classification and grading verification module, and a result statistics and feedback module. The functions of each module correspond to the aforementioned method steps, and will not be repeated here.

[0020] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0021] 1. In this invention, multimodal spatiotemporal synchronous fusion of multispectral images and multi-line structured light point clouds is used to complementarily match two-dimensional textures and three-dimensional morphologies at the feature level, effectively reducing the false detection rate caused by material texture artifacts on the surface of the magnetic ring. A cross-scale feature interaction network with an embedded channel adaptive noise reduction gating mechanism is adopted to automatically filter defect-related texture abnormal channels through multi-branch dilated convolution and cross-attention interaction, suppressing the interference of inherent textures of the magnetic ring and reflections from the curved surface. In defect morphology analysis, curvature compensation and anisotropic distortion correction are performed on the extension path to eliminate geometric measurement distortion caused by the curvature of the magnetic ring surface and morphological distortion caused by changes in the directional width of the defect, thereby improving the accuracy of defect morphology description.

[0022] 2. In this invention, the candidate crack region is subjected to secondary verification by graded eddy current pulse thermal imaging according to the defect confidence level. Different excitation and discrimination strategies are adopted for different confidence levels to achieve a balance between detection efficiency and verification accuracy, which makes up for the deficiency of single visual inspection in distinguishing between micro-cracks and dark scratches. Through defect spatial clustering and process parameter mapping mechanism, the detection results are automatically associated with the previous process and a quantitative parameter adjustment scheme is generated, realizing a closed-loop feedback from defect detection to process optimization. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0024] Figure 1 This is an overall flowchart of the online visual inspection method for magnetic ring surface defects of the present invention;

[0025] Figure 2 This is a flowchart of defect morphology analysis and high-dimensional descriptor generation;

[0026] Figure 3 This is a visualization of the texture anomaly feature map output by the cross-scale feature interaction network in Example 2;

[0027] Figure 4 This is a comparison chart of the temperature decay curve of graded eddy current pulse thermal imaging and the verification in Example 3. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0029] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0030] It should be noted that, unless otherwise specified, the embodiments and features described in this invention can be combined with each other.

[0031] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0032] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0033] It should be noted that, unless otherwise specified, the embodiments and features described in this invention can be combined with each other.

[0034] Example 1

[0035] refer to Figure 1This embodiment discloses an online visual inspection method for defects on the surface of a magnetic ring. Step 1, multimodal data acquisition and spatiotemporal synchronous processing, is achieved through the following method: A multispectral camera and a binocular structured light camera are arranged above the magnetic ring inspection station. The multispectral camera employs a filter wheel imaging system covering the visible to near-infrared range. In this specific implementation, four acquisition bands are set, with center wavelengths of 450 nm, 520 nm, 650 nm, and 850 nm, respectively. These four bands correspond to blue, green, red, and near-infrared light, enabling the capture of differences in the reflectivity of the magnetic ring surface from different spectral angles. The magnetic ring is driven by a rotating fixture to rotate uniformly around its central axis. During one rotation, the multispectral camera sequentially switches between the four bands for exposure at each angular position, forming a multispectral image sequence corresponding to that angular position. Simultaneously, the binocular structured light camera projects multi-line structured light stripes onto the magnetic ring surface and synchronously acquires stripe images. The three-dimensional point cloud of the magnetic ring surface is reconstructed frame by frame using the triangulation principle. The multispectral image sequence and the structured light scanning point cloud were acquired within the same rotation cycle, ensuring their correspondence in the time dimension.

[0036] Since multispectral cameras and binocular structured light cameras are different imaging devices, they differ in acquisition time and spatial coordinate system, thus requiring multimodal spatiotemporal synchronization and distortion correction. The first step in spatiotemporal synchronization is timestamp alignment. Both the multispectral camera controller and the binocular structured light camera controller are connected to the same synchronization trigger source. At the start of each exposure or scan, the synchronization trigger source generates a pulse signal and assigns a timestamp to the corresponding image or point cloud frame. During timestamp alignment, the acquisition time of each band image in the multispectral image sequence is matched with the acquisition time of the stripe image in the multi-line structured light scan point cloud, and the nearest frame with a time difference less than a preset threshold is taken as the synchronization pair. In the specific implementation, the preset threshold is set to 1 millisecond, which is much smaller than the time required for the magnetic ring to rotate once, ensuring the consistency of the synchronization pair in spatial angle.

[0037] The second step in spatiotemporal synchronization is spatial coordinate system one. During the equipment installation phase, a calibration board is used to simultaneously calibrate the multispectral camera and the binocular structured light camera, obtaining the intrinsic parameter matrices and distortion coefficients of each camera. Subsequently, the calibration board is placed in multiple orientations within the magnetic ring detection area, and images of the calibration board are acquired using both the multispectral camera and the binocular structured light camera. The pixel coordinates of the calibration board's corner points in the images from both cameras are extracted. Using these corner point correspondences, the least squares method is employed to solve for the spatial transformation matrix between the multispectral camera and the binocular camera. The spatial transformation matrix contains a... rotation matrix and Translation vector This transformation matrix is ​​used to map 3D points from two camera coordinate systems to the same spatial coordinate system. By mapping pixel positions in a multispectral image to the same spatial coordinate system of the 3D topographic point cloud, it achieves spatial alignment between the two modal data.

[0038] Distortion correction comprises two parts: lens distortion correction and surface projection distortion compensation. Lens distortion correction uses calibrated distortion coefficients to correct radial and tangential distortion in multispectral and structured light fringe images, respectively, ensuring that straight lines in the image remain straight in the actual scene. Surface projection distortion compensation addresses the characteristics of the magnetic ring's annular surface. The magnetic ring surface is cylindrical or approximately cylindrical, and the pixel scale of the curved area varies in the image when captured by the multispectral camera from different angles. To address this, based on the 3D point cloud reconstructed by binocular structured light, the angle between the local normal vector of each point on the magnetic ring surface and the camera's optical axis is calculated. The pixel scale is then normalized according to the angle, ensuring that the same physical size corresponds to approximately the same number of pixels in the image. After distortion correction, the multispectral image sequence is synthesized into a multispectral gradient response map covering the entire circumference of the magnetic ring surface. The multispectral gradient response map is obtained by calculating the gradient amplitude of each band image and then weighted and fused, highlighting changes in surface texture and defect edges. The surface 3D topography point cloud set contains the 3D coordinates of all reconstructed points on the magnetic ring surface, constituting the complete 3D topography of the magnetic ring. The acquisition and fusion effects of multimodal data can be found in the documentation. The standard expressions for gradient response maps and spatial transformations are as follows:

[0039]

[0040]

[0041] In the formula, Indicates the magnetic ring surface at pixel coordinates gradient magnitude at that point This represents the grayscale value of the multispectral gradient response map at this coordinate. and These are the partial derivatives of the grayscale value in the horizontal and vertical directions, respectively. The square root of the sum of their squares is the gradient intensity at that point, used to highlight surface texture and defect edges. The second equation represents the mapping relationship between the multispectral camera coordinate system and the unified spatial coordinate system. The left side of the equation... For a 3D point in the multispectral camera coordinate system, the right side of the equals sign... To unify the three-dimensional points of the same name in a spatial coordinate system, for Rotation matrix, for The translation vectors, both obtained through least squares solution during the equipment calibration stage, accurately align the multispectral image pixels to the unified coordinate system of the 3D topographic point cloud.

[0042] Step 2 involves inputting the multispectral gradient response map into a cross-scale feature interaction network. This network comprises three parallel encoding branches, referred to as the first, second, and third branches. The first branch uses a dilated convolutional kernel with a dilation rate of 1, i.e., a standard convolutional kernel, with a small receptive field, to extract fine-grained texture features, such as small defects like minute cracks and scratches on the surface of a magnetic ring. The second branch uses a dilated convolutional kernel with a dilation rate of 3, expanding the receptive field without increasing the number of kernel parameters, to extract medium-scale structural features, such as local texture blocks and shallow pores. The third branch uses a dilated convolutional kernel with a dilation rate of 6, with a larger receptive field, to extract coarse-scale contour features, such as the overall direction of long cracks and the approximate outline of peeling areas, providing macroscopic morphological information.

[0043] Each of the three branches performs multi-layer convolutional downsampling on the multispectral gradient response map, generating feature maps with different spatial resolutions. A cross-attention module is introduced between adjacent convolutional layers and the three branches to achieve cross-scale feature interaction. The cross-attention module works as follows: taking the bidirectional attention interaction between fine-grained texture features and mid-scale structural features as an example, the fine-grained texture feature map output by the first branch is first flattened into a query vector. The mesoscale structural feature map output from the second branch is flattened into a key vector. Sum value vector ,calculate and dot product and through Normalization yields attention weights, which are then used to... Weighted summation is performed to obtain the updated features after fusing fine-grained features with mesoscale features. Similarly, mesoscale structural features are used as... Fine-grained texture features as and This allows us to obtain updated features resulting from the fusion of mesoscale features and fine-grained features. In this way, fine-grained texture features can suppress isolated noise with the help of mesoscale structural features, while mesoscale structural features can enhance edge details with the help of fine-grained texture features. Similar bidirectional attention interactions are also performed on mesoscale structural features and coarse-scale contour features, as well as coarse-scale contour features and fine-grained texture features, thereby forming a closed-loop cross-scale feature flow between the three branches.

[0044] An adaptive channel-based noise reduction gating mechanism is embedded during cross-scale feature flow. This mechanism calculates an importance score for the feature map of each channel. The calculation of the importance score employs a combination of global average pooling and global max pooling: first, the global average and global maximum values ​​of all pixels in the feature map are calculated separately; then, these two values ​​are concatenated and input into a two-layer fully connected network, which outputs the importance score for that channel. Gating threshold These are the parameters automatically learned during network training. For each channel, when Greater than The channel is reserved when Less than or equal to The channel is then set to zero. In this way, channels highly correlated with defect textures are preserved, while channels related to background textures, curved surface reflections, and other noise are suppressed. The three filtered branch features are then concatenated along the channel dimension, and the spatial resolution is gradually restored by an upsampling decoder, ultimately outputting a texture anomaly feature map with the same spatial resolution as the multispectral gradient response map.

[0045] Step 3 involves performing texture difference between the texture anomaly feature map and the standard sample template, and simultaneously performing shape difference between the surface 3D topography point cloud set and the standard sample 3D point cloud model. Specifically, the magnetic ring standard sample database stores standard data for various types of magnetic rings in a defect-free state. When inspecting a certain type of magnetic ring, the multispectral gradient response map of the corresponding standard sample is retrieved from the database and input into the pre-trained cross-scale feature interaction network for forward inference to obtain the template texture feature map, which serves as the standard sample template. The texture anomaly feature map obtained from the current detection is subtracted pixel by pixel from the template texture feature map to obtain the texture difference map. The value of each pixel in the texture difference map represents the degree of difference between the current magnetic ring surface texture and the standard sample texture. Adaptive threshold binarization is performed on the texture difference map to obtain the texture anomaly mask. The specific calculation method of the adaptive threshold is as follows: a local window is taken with each pixel as the center, and the mean value of the difference value within the window is calculated. and standard deviation When the difference value of the pixel is greater than Plus times The time is marked as an exception, where This is the sensitivity coefficient, which is set to 2.5 in the specific implementation. The larger the value, the higher the threshold, and the greater the tolerance for small differences; The smaller the value, the lower the threshold, and the easier it is to detect subtle anomalies. The calculation of the texture difference map and the adaptive binarization threshold are expressed by the following formulas:

[0046]

[0047]

[0048] In the formula, Represents the texture difference map at pixel coordinates The value at this location reflects the degree of difference between the current magnetic ring surface texture and the standard sample; The texture anomaly feature map of the currently detected magnetic ring is in coordinates The value at that location, The texture difference is obtained by subtracting the values ​​of the standard sample template texture feature map at the same position pixel by pixel. Let be the row and column coordinates of the image pixels. In the second equation, For pixels Adaptive binarization threshold at the location, and These are the mean and standard deviation of the difference values ​​within a local window centered on that pixel, respectively. This is the sensitivity coefficient, which is set to 2.5 in practice. It is used to control the sensitivity of the threshold to local statistical fluctuations. If the difference is greater than this threshold, it is judged as a texture anomaly.

[0049] The implementation method of topography difference is as follows: A 3D point cloud model of a standard sample of the same model is retrieved from the magnetic ring standard sample database. This model is a reference surface obtained by reconstructing the standard sample under defect-free conditions using multi-line structured light scanning and then smoothing it. The currently detected 3D topography point cloud set is spatially registered with the 3D point cloud model of the standard sample. Spatial registration uses an iterative nearest-point algorithm, which solves the rigid transformation from the current point cloud to the standard model by minimizing the distance between the corresponding points in the current point cloud and the standard model. After registration, for each point in the current point cloud, its nearest point is found on the standard model, and the normal distance between this point and the tangent plane containing the nearest point is calculated. The normal distance represents the height deviation of the current magnetic ring surface relative to the standard surface. Points whose normal distance exceeds a preset height threshold are marked as topography anomaly points, forming a topography anomaly mask. The preset height threshold is set to 0.05 mm in the specific implementation, which takes into account both the small undulations allowed in the grinding process and the height abrupt changes caused by actual defects. The normal distance of any sampling point in the point cloud relative to the surface of the standard model is calculated by the following formula:

[0050] In the formula, Indicates the current midpoint of the point cloud. Relative to the normal distance of the standard model surface, For any sampling point in the current point cloud, For the standard model and points The nearest corresponding point For the standard model at points The unit normal vector at the point; With point The difference in the normal vector The absolute value of the projection in the direction is the height deviation at that point. When When the height exceeds the preset threshold by 0.05 mm, the judgment point is... These are points with abnormal morphology.

[0051] Texture anomaly masks and shape anomaly masks are projected onto the same coordinate system and fused using a position-by-position logical OR operation. The logical OR operation means that if a location is marked as an anomaly in either the texture or shape anomaly mask, the corresponding location in the fused mask is marked as an anomaly candidate. Connectivity analysis is performed on the fused mask, and adjacent anomaly pixels are grouped into a single connected region using an 8-neighborhood connectivity rule. The bounding rectangle of each connected region is calculated, and the coordinates of its four vertices serve as the candidate boundaries for that region. All candidate boundaries constitute the set of candidate defect regions. By fusing texture and shape differences, both shallow scratches that cause only texture changes with minimal height variations and indentations or peeling that exhibit significant height changes but weak texture variations can be captured, thus improving the completeness of defect detection.

[0052] Step 4 involves performing defect morphology analysis on each candidate region in the defect candidate region set. (See also...) Figure 2 First, each candidate region is binarized and segmented to obtain a binary image containing only the abnormal pixels of that region. The ZhangSuen thinning algorithm is then used to extract the morphological skeleton from the binary image, resulting in a skeleton curve with a single pixel width. The ZhangSuen thinning algorithm iteratively traverses the foreground pixels in the image, gradually stripping away boundary pixels according to preset deletion conditions while maintaining the connectivity and topological structure of the skeleton. The resulting skeleton curve reflects the direction of the centerline of the defect region.

[0053] Starting from the endpoint of the skeleton curve, the system traces pixel-by-pixel along its eight-neighborhood direction, recording the coordinates, tangent direction, and local width of each pixel to form an extension path sequence. The eight-neighborhood direction includes eight adjacent positions: directly above, above right, directly right, below right, directly below, below left, directly left, and above left. During tracing, starting from the endpoint pixel, the system searches for the next skeleton pixel in its eight-neighborhood and adds it to the path sequence, while marking visited pixels to avoid repeated visits. Tracing stops when it reaches another endpoint or forms a closed loop. The local width is calculated as follows: at each skeleton pixel, the system extends to both sides along the perpendicular direction of the tangent direction until it encounters a background pixel; the sum of the two extended distances is the local width of that point. The tangent direction is obtained by differentiating and normalizing the coordinates of adjacent pixels in the path sequence.

[0054] Since the surface of the magnetic ring is a toroidal curved surface, the pixel distance of the skeleton curve in the two-dimensional image cannot directly reflect the actual arc length; therefore, curvature compensation is required. Based on the position of the candidate region on the three-dimensional geometric model of the magnetic ring, the local radius of curvature of the surface at that position is calculated. The radius of curvature is calculated using a quadratic surface fitting method: a set of 3D point clouds near the center point of the candidate region is used as samples to fit a local quadratic surface. The principal curvatures are calculated based on the first and second fundamental forms of the surface, and the reciprocal of the average of the two principal curvatures is taken as the local radius of curvature. For two adjacent pixels in the extended path sequence, their Euclidean distance in the 2D image is... , corresponding to the radius of curvature is The actual arc length on the curved surface Calculated using the following formula: In the formula, Indicates the first in the extended path The adjacent pixels in a segment correspond to the actual arc length on the magnetic ring surface. This is the Euclidean distance between the adjacent pixels in the two-dimensional image. Let be the local radius of curvature at the location of the candidate region. It is the arcsine function. When Much larger hour, Approximately equal to ;when When the surface is small and the curvature is obvious, this formula can accurately restore the planar pixel distance to the true arc length of the surface through arcsine correction, thereby eliminating the geometric measurement distortion caused by the curvature of the magnetic ring torus.

[0055] After curvature compensation, anisotropic distortion correction is further performed. The imaging width of defects on the magnetic ring surface may vary in different directions due to curvature projection and camera angle. For example, defects extending circumferentially along the magnetic ring may be compressed in the image, while defects extending axially may be stretched. Therefore, the ratio of the width of each pixel along the circumferential direction to the axial direction of the magnetic ring is calculated. Width ratio It equals the circumferential local width divided by the axial local width. When When the value exceeds a preset threshold of 1.5, it indicates that the circumferential width of that point is relatively too large, and the circumferential coordinates need to be compressed; when When the value is less than the preset threshold of 0.67, it indicates that the axial width of that point is relatively too large, and the axial coordinate needs to be stretched. The compression and stretching coefficients are set to 0.85 and 1.18 respectively in the specific implementation. These coefficients are obtained based on a large number of samples and can make the morphological description of defects in different directions more consistent. After anisotropic distortion correction, the geometric relationship of the extended path sequence in the planar image coordinate system is closer to the true geometric relationship of the magnetic ring surface.

[0056] The morphological parameters of the extended path after double correction are extracted to construct a high-dimensional defect morphological descriptor. The morphological parameters include: total arc length of the path. That is, the sum of the corrected arc lengths between all adjacent pixels on the path; mean curvature That is, the average rate of change of the tangent direction at each point on the path along the arc length; mean width. With width variance This reflects the consistency and degree of variation in defect width; the straight-line distance between the beginning and end points of the path. This refers to the straight-line length between the starting and ending points of the path. These parameters form a five-dimensional vector, which serves as a high-dimensional defect morphology descriptor for subsequent defect type determination.

[0057] Step 5 determines the defect type based on the high-dimensional defect morphology descriptor and performs secondary verification of the crack candidate region using graded eddy current pulse thermography according to the defect confidence level. In specific implementation, the high-dimensional defect morphology descriptor is input into a gradient boosting tree defect classifier. The gradient boosting tree is composed of multiple decision trees serially integrated. Each decision tree is fitted based on the residual of the previous decision tree, and the outputs of all decision trees are finally summarized to obtain the classification probability. The output of the classifier is the probability score of the candidate region belonging to one of five types: crack, scratch, porosity, peeling, and inclusion. The type with the highest probability score is taken as the preliminary judgment result, and this highest score is recorded as the defect confidence level.

[0058] Crack-like defects are visually similar to dark scratches, making them prone to misjudgment. Therefore, secondary verification is required for candidate areas initially identified as cracks. Based on defect confidence levels, candidate crack areas are divided into three levels: high confidence interval (areas with a confidence level greater than 0.85), medium confidence interval (areas with a confidence level between 0.6 and 0.85), and low confidence interval (areas with a confidence level between 0.45 and 0.6). Areas with a confidence level below 0.45 are usually directly classified as scratches or other non-crack types and do not require secondary verification.

[0059] For high-confidence crack regions, high-frequency electromagnetic pulse excitation is employed. In this implementation, the excitation frequency of the high-frequency electromagnetic pulse is set to 500 kHz, resulting in a short excitation time and concentrated energy, which generates a strong eddy current concentration effect at the crack tip and surface, causing rapid localized heating. After excitation, an infrared thermal imager is used to acquire temperature decay curves at a frequency of 100 frames per second, recording the temperature decrease in the crack region over time. The temperature decay curves are then input into a one-dimensional convolutional neural network for verification. Real cracks, due to their higher thermal resistance between crack walls, dissipate heat more slowly, resulting in a noticeably slow decreasing trend in the temperature decay curve. In contrast, spurious defects such as scratches lack closed structures, resulting in rapid heat dissipation and a rapid decrease in the temperature decay curve. The one-dimensional convolutional neural network learns from a large number of temperature decay curve samples of real cracks and spurious defects, outputting a binary classification result for crack authenticity.

[0060] For the medium-confidence crack region, a medium-frequency electromagnetic pulse excitation was used, with the excitation frequency set to 100 kHz in the specific implementation, and the acquisition time appropriately extended to 2 seconds. Three features were extracted from the temperature decay curve: decay time constant, maximum temperature difference, and cooling rate. The decay time constant reflects the rate of heat dissipation; the decay time constant of a true crack is relatively large. The maximum temperature difference reflects the temperature rise caused by the excitation and is related to the defect depth and closure degree. The cooling rate reflects the speed of temperature decrease. These three features were input into a support vector machine for verification. The support vector machine separates true crack samples from false defect samples by finding an optimal classification hyperplane.

[0061] For low-confidence crack regions, low-frequency electromagnetic pulse excitation is used, with the excitation frequency set to 20 kHz in the specific implementation. The temperature decay curve is repeatedly acquired and averaged. Low-frequency excitation has a large penetration depth, capable of exciting the thermal response of cracks deep within the magnetic ring. Repeated acquisition and averaging reduce random noise interference in single measurements. Statistical analysis is performed on the average temperature decay curve, calculating the mean, variance, skewness, and kurtosis, and comparing them with a preset crack statistical distribution interval. If the statistical values ​​fall within the actual crack distribution interval, it is determined to be a real crack; otherwise, it is considered a false detection.

[0062] After removing all candidate regions that were verified as false positives, the remaining confirmed defect regions and their types are summarized to obtain the final defect detection results. The final detection results include quantitative information such as the location coordinates, type, confidence level, length, and width of each defect.

[0063] Step 6 involves statistically analyzing the final defect detection results by type and location, and mapping these results to process parameters through spatial clustering. In practice, the quantity, size, and spatial distribution of each defect type are first analyzed. For example, the total number, average length, and maximum length of crack defects, as well as the number of cracks distributed in each quadrant of the magnetic ring surface, are calculated. Density clustering is then performed on the spatial locations of similar defects, using a density-based spatial clustering algorithm to identify defect clustering regions. During clustering, the coordinates of each defect are used as data points, Euclidean distance is used as the similarity metric, and a neighborhood radius and minimum sample size are set. In this implementation, the neighborhood radius is set to 5% of the magnetic ring circumference, and the minimum sample size is set to 5. When the number of similar defects in a region exceeds the minimum sample size and all are within the neighborhood radius, that region is identified as a defect clustering region.

[0064] The manufacturing process of magnetic rings involves tracing back to the preceding production steps based on the location of the defect cluster. The manufacturing process includes three main steps: pressing, sintering, and surface grinding. Defects from different steps often appear in specific areas or morphologies on the surface of the magnetic ring. For example, mold wear or uneven pressure during the pressing process may cause pores or peeling near the end face of the magnetic ring; uneven temperature gradients during the sintering process may cause cracks on the surface; and improper grinding wheel parameters during the grinding process may lead to concentrated circumferential scratches. To establish the mapping relationship between the clustered areas and process parameters, the most likely preceding steps and corresponding process parameters are searched in the process knowledge base based on the spatial location, defect type, and morphological characteristics of the clustered areas. Process parameters include pressing pressure, sintering temperature profile, grinding speed, and feed rate.

[0065] The statistical results are overlaid as a defect distribution heatmap on the surface development diagram of the magnetic ring to generate a defect distribution report. The surface development diagram of the magnetic ring cuts the annular curved surface axially and flattens it into a rectangular plane. The horizontal axis represents the circumferential angle of the magnetic ring, and the vertical axis represents the axial position of the magnetic ring. The defect distribution heatmap uses color depth to represent the density of defects per unit area; the higher the density, the darker the color, making it easier to visually identify defect clusters. Simultaneously, a quantitative parameter adjustment scheme is generated based on the mapping relationship. For example, when a large number of pores are detected in a certain area and traced back to the pressing process, the quantitative parameter adjustment scheme might suggest increasing the pressing pressure by 5% to 10%, or controlling the powder filling uniformity within ±2%. The defect distribution report and the quantitative parameter adjustment scheme are fed back to the corresponding upstream process stage via network interface or file. The process control system automatically or manually confirms and adjusts the parameters, forming a closed-loop feedback from defect detection to process optimization.

[0066] Example 2

[0067] See Figure 3This embodiment further explains the internal structure and output characteristics of the cross-scale feature interaction network. In this implementation, the input size of the multispectral gradient response map is set to 1024 pixels by 1024 pixels, with 4 channels corresponding to the four acquisition bands. The first, second, and third branches all adopt an encoder-decoder structure. The encoder part contains four downsampling blocks, each consisting of a dilated convolutional layer, a batch normalization layer, and a ReLU activation function. The dilation rate sequence of the first branch is 1, 1, 1, 1; the dilation rate sequence of the second branch is 3, 3, 3, 3; and the dilation rate sequence of the third branch is 6, 6, 6, 6. As the network depth increases, the spatial resolution of the feature map gradually decreases, while the number of channels gradually increases, thereby capturing more abstract texture features over a larger receptive field.

[0068] The cross-attention module is positioned between every two downsampling blocks. Taking the cross-attention between the first and second downsampling blocks as an example, the feature map output by the first branch is 512 pixels by 512 pixels with 64 channels; the feature map output by the second branch is also 512 pixels by 512 pixels with 64 channels. The two feature maps are flattened into vectors of length 262144, and then... Convolution maps the number of channels to three subspaces: query, key, and value. The attention matrix is ​​then calculated and weighted summed. To reduce computation, spatial downsampling attention is used in the implementation, i.e., per... A representative point from the spatial block is selected for attention calculation, and the attention result is then upsampled back to the original resolution using bilinear interpolation. The output of the cross-attention module is residually connected to the original feature map to avoid gradient vanishing and preserve original information.

[0069] The channel-adaptive noise reduction gating mechanism is embedded after the cross-attention output. For each channel's feature map, its channel importance score is first calculated, and then a decision is made to retain or zero out the channel based on a learnable gating threshold. (Channel importance score) With gated decision Calculated using the following formula:

[0070]

[0071]

[0072] In the formula, Indicates the first The importance score of each channel for The activation function normalizes the score to between 0 and 1. To correct the linear unit; , Here is the weight matrix of a two-layer fully connected network. For the first Feature map of each channel and These are global average pooling and global max pooling, respectively. This means concatenating the results of the two along the channel dimension, so that the vector simultaneously contains the global mean of the channels and the most significant response information; The learnable gating threshold. For the first The gating decision value of each channel, when Greater than hour Take 1, reserve this channel, when Less than or equal to hour Setting the channel feature to 0 suppresses low-importance channels that are associated with noise.

[0073] See Figure 3 The figure shows, from left to right, the visualization results of the input and three-level output features of the cross-scale feature interaction network in Example 2. The first column is the multispectral gradient response map of the input, presenting the basic texture and grayscale distribution of the magnetic ring surface; the second to fourth columns are the texture anomaly feature maps output by the first, second, and third branches, respectively. It can be seen that as the expansion rate increases from 1 to 6, the spatial details of the feature map gradually become smoother, and the macroscopic contour features become more prominent; the fifth column is the fused texture anomaly feature map, in which the dark highlighted areas correspond to the defect locations.

[0074] As can be seen from the figure, all three branch feature maps show obvious responses in the defect area. After the noise channel is suppressed by the channel adaptive noise reduction gating mechanism, the background area in the fused feature map is relatively clean and the defect area is prominent. This intuitively demonstrates the effect of multi-branch dilated convolution in extracting texture anomaly features at different scales.

[0075] Example 3

[0076] This embodiment further illustrates the secondary verification process of graded eddy current pulse thermal imaging. The eddy current pulse thermal imaging detection unit is positioned downstream of the visual inspection station. After the magnetic ring is initially identified as having a candidate crack region by visual inspection, a rotating fixture sends the magnetic ring into the eddy current pulse thermal imaging detection area. The detection area includes an electromagnetic excitation coil, an infrared thermal imager, and a synchronization controller. The electromagnetic excitation coil generates short-duration high-frequency electromagnetic pulses, inducing eddy currents on the surface of the magnetic ring; the infrared thermal imager records the temperature distribution changes on the surface of the magnetic ring in real time; the synchronization controller coordinates the excitation timing and image acquisition timing to ensure that the temperature decay curve begins recording from the moment the excitation ends.

[0077] For high-confidence crack regions, the frequency of the high-frequency electromagnetic pulse excitation was set to 500 kHz, the pulse width to 50 milliseconds, and the peak excitation current to 200 amperes. After excitation, an infrared thermal imager continuously acquired 300 frames at a frame rate of 100 Hz, corresponding to a 3-second temperature decay process. The temperature values ​​of the center points of the crack candidate regions were extracted from the image sequence, forming a temperature decay curve of length 300. The temperature decay curve was normalized to the 0-1 interval and then input into a one-dimensional convolutional neural network. The first convolutional layer of the one-dimensional convolutional neural network uses a kernel of size 5 and 16 output channels to extract local trend features of the temperature decay curve; the first pooling layer uses max pooling of size 2 to reduce the feature dimension; the second convolutional layer uses a kernel of size 3 and 32 output channels to extract detailed fluctuation features; the second pooling layer also uses max pooling of size 2; the third convolutional layer uses a kernel of size 3 and 64 output channels to extract high-level temporal features; the global average pooling layer compresses the high-level temporal features into a 64-dimensional fixed-length vector; the first fully connected layer maps the 64-dimensional vector to a 16-dimensional low-dimensional feature space; the second fully connected layer outputs a scalar, which is then processed... The crack probability is obtained after the function. If the crack probability is greater than 0.5, it is judged as a real crack; otherwise, it is judged as a false detection.

[0078] For the medium-confidence crack region, the frequency of the intermediate-frequency electromagnetic pulse excitation was set to 100 kHz, the pulse width to 100 milliseconds, and the peak excitation current to 150 amperes. The acquisition time was extended to 2 seconds, and a total of 200 frames were acquired. The decay time constant of the temperature decay curve was extracted. Maximum temperature difference and cooling rate Decay time constant The temperature decay curve is obtained by exponential fitting, and the temperature decay curve is fitted by the following formula: In the formula, Indicates the end of the incentive. Normalized temperature of the crack region at any given moment. For the time variable after the stimulus ends, The base of the natural constant is... The temperature decay time constant characterizes the rate of heat loss. This represents the maximum temperature difference in the temperature decay curve, i.e., the difference between the highest temperature and the ambient temperature. Ambient temperature. Maximum temperature difference. Reflects the temperature rise and cooling rate caused by the excitation. This is the reciprocal of the time required for the temperature to drop from the highest temperature to half of its maximum temperature. These three features are input into a support vector machine (SVM), which uses a radial basis function kernel and a penalty coefficient. Set to 1.0, kernel function parameters Set to 0.1. The support vector machine outputs a binary classification result, where 1 represents a true crack and 0 represents a false detection.

[0079] For the low-confidence crack region, the frequency of the low-frequency electromagnetic pulse excitation was set to 20 kHz, the pulse width to 200 ms, and the peak excitation current to 100 amperes. Temperature decay curves were repeatedly acquired 10 times, each acquisition lasting 2 seconds, for a total of 2000 temperature sampling points. The arithmetic mean of the 10 curves was calculated to obtain the average temperature decay curve. The mean of the average temperature decay curve was then calculated. Standard deviation skewness and kurtosis Four statistical measures are used. Skewness reflects the asymmetry of the temperature decay curve; in real cracks, due to heat accumulation within the crack, the decay process typically exhibits a long tail, resulting in a positive skewness value. Kurtosis reflects the sharpness of the temperature decay curve and is related to the degree of crack closure. These four statistical measures are compared with a pre-defined crack statistical distribution interval. The pre-defined crack statistical distribution interval is obtained based on statistics from 1000 labeled real crack samples, such as the mean. The range is 0.35 to 0.65, with a standard deviation of [missing value]. The range is 0.12 to 0.28, skewness. Greater than 0.15, kurtosis Greater than 2.8. A crack is considered a true crack when all four statistics fall within their respective intervals; otherwise, it is considered a false detection.

[0080] See Figure 4 In the figure, the horizontal axis represents time in milliseconds, and the vertical axis represents normalized temperature. The three curves correspond to the temperature decay curves of the high-confidence true crack region, the medium-confidence true crack region, and the false detection region, respectively. The temperature decay curve of the high-confidence true crack region has the highest initial temperature and the slowest decline, maintaining a normalized temperature of approximately 0.35 at 3000 milliseconds, indicating that the crack structure effectively hinders heat loss. The initial temperature of the medium-confidence true crack region is slightly lower, and its decline trend is between that of the high-confidence true crack region and the false detection region, with a normalized temperature of approximately 0.20 at 3000 milliseconds. The temperature decay curve of the false detection region has the lowest initial temperature and declines rapidly, approaching the ambient temperature within 1000 milliseconds, indicating that there is no closed crack structure in this region, and heat diffuses rapidly to the surrounding matrix.

[0081] The curve comparison reveals a significant difference in temperature decay characteristics between real cracks and false detection areas. High-confidence crack regions, achieved through high-frequency excitation, exhibit strong temperature responses, making them suitable for rapid verification. Medium-confidence crack regions, employing medium-frequency excitation and extracting multiple features, achieve a balance between response intensity and discrimination accuracy. Low-confidence crack regions, through repeated acquisition and statistical analysis, reduce the impact of individual measurement fluctuations and improve the ability to identify weak cracks.

[0082] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. An online visual inspection method for defects on the surface of a magnetic ring, characterized in that, include: Step 1: Acquire multispectral image sequences of the magnetic ring surface, obtain multi-line structured light scanning point clouds, and construct a multispectral gradient response map and a three-dimensional surface topography point cloud set based on the spectral image sequences and multi-line structured light scanning point clouds; Step 2: Extract texture anomaly features based on the multispectral gradient response map to generate a texture anomaly feature map; Step 3: Perform texture difference between the texture anomaly feature map and the standard sample template, perform morphology difference between the surface 3D topography point cloud set and the standard sample 3D point cloud model, fuse the texture difference results and morphology difference results, separate the candidate boundaries of the surface anomaly region, and obtain the defect candidate region set. Step 4: Extract the morphological skeleton of each candidate region in the defect candidate region set and trace the extension path. Introduce curvature compensation and anisotropic distortion correction to double-correct the extension path and generate a high-dimensional defect morphological descriptor. Step 5: Determine the defect type based on the high-dimensional defect morphology descriptor, perform secondary verification of the crack candidate region by graded eddy current pulse thermal imaging according to the defect confidence level, and obtain the final defect detection result after eliminating false detections. Step 6: Statistically analyze the final defect detection results by type and location, map the defect spatial clustering to process parameters, generate a defect distribution report and a quantitative parameter adjustment scheme, and feed them back to the preceding process steps.

2. The online visual inspection method for surface defects of a magnetic ring according to claim 1, characterized in that, Step 1 also includes: aligning the acquisition times of each band image in the multispectral image sequence with the acquisition times of the stripe images in the multi-line structured light scanning point cloud using timestamps; calculating the spatial transformation matrix between the multispectral camera and the binocular camera; and unifying the multispectral images and the three-dimensional topography point cloud into the same spatial coordinate system.

3. The online visual inspection method for surface defects of a magnetic ring according to claim 1, characterized in that, Step 2 specifically includes: The multispectral gradient response map is input into the cross-scale feature interaction network, which contains three parallel encoding branches that use dilated convolution kernels with different dilation rates to extract fine-grained texture features, mesoscale structural features, and coarse-scale contour features, respectively. A cross-attention module is introduced between the three coding branches to perform bidirectional attention interaction between fine-grained texture features and mesoscale structural features, bidirectional attention interaction between mesoscale structural features and coarse-scale contour features, and bidirectional attention interaction between coarse-scale contour features and fine-grained texture features, forming a cross-scale feature flow. During the cross-scale feature flow, a channel adaptive noise reduction gating mechanism is embedded to calculate the importance score of the feature map of each channel. Important channels are retained and noise channels are suppressed by a learnable gating threshold. The three filtered branch features are fused and then upsampled and decoded to restore the same spatial resolution as the multispectral gradient response map, and the texture anomaly feature map is output.

4. The online visual inspection method for surface defects of a magnetic ring according to claim 3, characterized in that, Of the three coding branches, the expansion rate of the first branch is 1, the expansion rate of the second branch is 3, and the expansion rate of the third branch is 6; the gating threshold of the channel adaptive noise reduction gating mechanism is automatically learned through network training.

5. The online visual inspection method for surface defects of a magnetic ring according to claim 1, characterized in that, The set of candidate defect regions is obtained using the following method: The multispectral gradient response map of the standard sample corresponding to the current magnetic ring model is retrieved from the magnetic ring standard sample database. The template texture feature map is obtained through forward inference of the cross-scale feature interaction network and used as the standard sample template. The texture anomaly feature map is subtracted pixel by pixel from the template texture feature map to obtain a texture difference map, which is then generated by adaptive threshold binarization to produce a texture anomaly mask. The three-dimensional point cloud model of the standard sample is retrieved from the magnetic ring standard sample database. The three-dimensional surface topography point cloud set is spatially registered with the three-dimensional point cloud model of the standard sample. The normal distance from each point in the point cloud set to the model surface is calculated. Points that exceed the preset height threshold are marked as topography anomaly points to form a topography anomaly mask. The texture anomaly mask and the shape anomaly mask are projected onto the same coordinate system and fused by a position-by-position logical OR operation. Connectivity analysis is performed on the fused mask, and the bounding rectangle of each connected region is extracted as a candidate boundary to form the set of defect candidate regions.

6. The online visual inspection method for surface defects of a magnetic ring according to claim 1, characterized in that, The generation of high-dimensional defect morphology descriptors includes: Each candidate region is binarized and segmented, and the ZhangSuen thinning algorithm is used to extract the morphological skeleton to obtain a skeleton curve with a single pixel width. Starting from the endpoint of the skeleton curve, trace pixel by pixel along the eight-neighbor direction, record the coordinates, tangent direction and local width of each pixel, and form an extended path sequence; The local curvature radius of the surface is calculated based on the position of the candidate region on the three-dimensional geometric model of the magnetic ring. The Euclidean distance between adjacent pixels in the extended path sequence is corrected by arc length correction to complete the curvature compensation. For the extended path sequence after curvature compensation, calculate the width ratio of each pixel along the circumferential and axial directions of the magnetic ring. When the ratio is greater than a preset threshold, compress the circumferential coordinates; when the ratio is less than a preset threshold, stretch the axial coordinates to complete the anisotropic distortion correction. The total arc length, average curvature, mean width and variance of the extended path after double correction, as well as the straight-line distance between the first and last points of the path, are extracted to form the high-dimensional defect morphology descriptor.

7. The online visual inspection method for surface defects of a magnetic ring according to claim 1, characterized in that, Step 5 specifically includes: The high-dimensional defect morphology descriptor is input into the gradient boosting tree defect classifier, which outputs the probability scores of cracks, scratches, pores, peeling and inclusions. The highest score type is taken as the preliminary judgment result, and the highest score is recorded as the defect confidence level. Based on the defect confidence level, the candidate regions initially identified as cracks are divided into three levels: high confidence interval, medium confidence interval, and low confidence interval. For high-confidence crack regions, high-frequency electromagnetic pulse excitation was used, and the temperature decay curve was collected and input into a one-dimensional convolutional neural network for authenticity verification. For medium-confidence crack regions, medium-frequency electromagnetic pulse excitation was used, and the acquisition time was extended. The decay time constant, maximum temperature difference, and cooling rate features of the temperature decay curve were extracted and input into a support vector machine for authenticity verification. For low-confidence crack regions, low-frequency electromagnetic pulse excitation was used, and the average temperature decay curve was repeatedly acquired and the authenticity was verified through statistical analysis. Candidate regions that are verified as false positives are removed, and the confirmed defect regions and types are summarized to obtain the final defect detection results.

8. The online visual inspection method for surface defects of a magnetic ring according to claim 7, characterized in that, The one-dimensional convolutional neural network includes a first convolutional layer, a first pooling layer, a second convolutional layer, a second pooling layer, a third convolutional layer, a global average pooling layer, a first fully connected layer, and a second fully connected layer connected in sequence. The first convolutional layer uses a convolutional kernel of size 5 to extract the local trend features of the temperature decay curve; The second convolutional layer uses a convolutional kernel of size 3 to extract the detailed fluctuation features of the temperature decay curve; The third convolutional layer uses a convolutional kernel of size 3 to extract high-level temporal features of the temperature decay curve; Global average pooling layers compress high-level temporal features into fixed-length vectors; The first fully connected layer maps a fixed-length vector to a low-dimensional feature space; The second fully connected layer outputs a binary classification result for the authenticity of cracks.

9. The online visual inspection method for surface defects of a magnetic ring according to claim 1, characterized in that, In step 6, the type and location include: the number, size and spatial distribution of each type of defect.

10. An online visual inspection system for surface defects of a magnetic ring, used to implement the online visual inspection method for surface defects of a magnetic ring as described in any one of claims 1-9, characterized in that, include: The multimodal data acquisition module acquires multispectral image sequences of the magnetic ring surface under multiple angle illumination conditions, simultaneously acquires multi-line structured light scanning point clouds, performs multimodal spatiotemporal synchronization and distortion correction on the multispectral image sequences and multi-line structured light scanning point clouds, and constructs a set of multispectral gradient response maps and surface three-dimensional topography point clouds. The texture anomaly feature extraction module extracts texture anomaly features through a cross-scale feature interaction network with an embedded channel adaptive noise reduction gating mechanism, and generates a texture anomaly feature map. The multimodal differential fusion module performs texture difference between the texture anomaly feature map and the standard sample template, and performs morphological difference between the surface three-dimensional topography point cloud set and the standard sample three-dimensional point cloud model. The texture difference result and the morphological difference result are fused to separate the candidate boundaries of the surface anomaly region and obtain the defect candidate region set. The defect morphology analysis module extracts the morphological skeleton of each candidate region in the defect candidate region set and tracks the extension path. Curvature compensation and anisotropic distortion correction are introduced to make dual corrections to the extension path, generating a high-dimensional defect morphology descriptor. The defect classification and grading verification module determines the defect type based on the high-dimensional defect morphology descriptor, performs graded eddy current pulse thermal imaging secondary verification on the crack candidate region according to the defect confidence level, and obtains the final defect detection result after eliminating false detections. The results statistics and feedback module statistically analyzes the final defect detection results by type and location, maps the defect spatial clustering to process parameters, generates a defect distribution report and a quantitative parameter adjustment scheme, and feeds it back to the preceding process steps.