Method for detecting production quality of magnetic material based on image detection

By constructing a multi-level gray-scale gradient field and spatiotemporal consistency verification, combined with local binary mode decomposition, the problems of background interference and dynamic defect identification in magnetic material production are solved, achieving efficient quality inspection and early warning.

CN122115367APending Publication Date: 2026-05-29DONGGUAN WANLI NEW MATERIALS CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DONGGUAN WANLI NEW MATERIALS CO LTD
Filing Date
2026-02-10
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively distinguish between processing textures and process-related color differences and actual defects in the quality inspection of magnetic material production. Furthermore, they lack analysis of the dynamic attributes of defects, resulting in a high false alarm rate and insensitivity to early defects.

Method used

By constructing a multi-level gray-level gradient field, identifying and tracking gray-level anomaly convergence points, forming candidate defect trajectory clusters, and performing spatiotemporal consistency verification, dynamic texture divergence and structural entropy are calculated. Combined with local binary pattern histogram decomposition, a comprehensive quality evaluation value is generated.

Benefits of technology

It enables quantitative analysis of the dynamic evolution process of defects in magnetic materials, reduces background interference, improves the specificity and accuracy of defect identification, and enhances the early warning capability for potential quality risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115367A_ABST
    Figure CN122115367A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, and discloses a production quality detection method of a magnetic material based on image detection. The method obtains a surface scanning image of the magnetic material, constructs a multi-level gray gradient field, identifies and tracks a gray abnormal convergence point to form a candidate defect track cluster, and selects an effective track cluster through space-time consistency verification. The dynamic texture divergence of the effective defect track cluster is calculated, the structural entropy of the multi-level gray gradient field is combined, and an image structure instability index is obtained. A local binary pattern histogram of the surface scanning image is extracted, is decomposed into a base mode component and a residual mode component, and a mode separation degree is calculated according to a distribution offset. According to the image structure instability index and the mode separation degree, a comprehensive quality evaluation value is generated, compared with a preset threshold, and the quality grade is determined. The application can distinguish real defects from material inherent textures and color difference interference, and improves detection accuracy and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, specifically to a production quality inspection method for magnetic materials based on image detection. Background Technology

[0002] In the field of quality inspection in magnetic material production, surface defect detection based on machine vision is a core technology. Existing technologies generally employ static image analysis, such as extracting suspicious regions through single threshold segmentation or edge detection operators, and treating defects as isolated, static anomalous features. However, the processing textures and color differences inherent in the magnetic material surface create complex background interference in images. These inherent normal features are difficult to effectively distinguish from real defects in static analysis, leading to a high false alarm rate for traditional methods. The limitation lies in the lack of a dedicated mechanism to remove background interference from image features.

[0003] Traditional methods lack analysis of the dynamic properties of defects. During the generation and development of defects, their morphology and texture continuously change. Judging defects based solely on static snapshots of single images cannot characterize the evolution process, leading to insensitivity to early or subtle defects. Furthermore, conventional texture feature analysis typically uses the overall feature vector directly for comparison, failing to deconstruct the intrinsic texture primitives and anomalous perturbation components, making the detection model susceptible to background texture fluctuations. A detection method is needed that can simultaneously address the quantification of dynamic defect evolution and the analysis of complex background textures. Summary of the Invention

[0004] The purpose of this invention is to provide a production quality inspection method for magnetic materials based on image detection, so as to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides a production quality inspection method for magnetic materials based on image detection, the method comprising:

[0006] Acquire surface scan images of magnetic materials on the production line; A multi-level grayscale gradient field is constructed based on the surface scan image; In the multi-level gray-level gradient field, gray-level anomaly convergence points are identified and tracked to form candidate defect trajectory clusters; The candidate defect trajectory clusters are subjected to spatiotemporal consistency verification to select valid defect trajectory clusters; Calculate the dynamic texture divergence of the effective defect trajectory cluster; By combining the dynamic texture divergence with the structural entropy of the multi-level gray-level gradient field, the image structure instability index is calculated. The local binary mode histogram of the surface scan image is extracted and decomposed into base mode components and residual mode components; The mode separation degree is calculated based on the distribution offset between the base mode components and the residual mode components. A comprehensive quality evaluation value is generated based on the image structure instability index and the pattern separation degree. The comprehensive quality evaluation value is compared with a preset threshold to determine the production quality level of the magnetic material.

[0007] Preferably, the method for constructing a multi-level gray-scale gradient field includes: The surface scan image is downsampled using a Gaussian pyramid to generate image sub-layers of multiple scales; In each of the image sub-layers, the gray-level gradient vector of each pixel in multiple directions is calculated; The gray-level gradient vectors of each pixel at the corresponding positions in all the image sub-layers are concatenated to generate the gradient descriptor of the pixel; The multi-level grayscale gradient field is constructed from the gradient descriptors of all pixels in the surface scan image.

[0008] Preferably, the method for forming a cluster of candidate defect trajectories includes: In the multi-level gray-scale gradient field, pixels whose gradient magnitude exceeds the adaptive threshold are detected and marked as initial abnormal points; Using each initial outlier as the core, search for pixels with continuously abrupt changes in gradient direction in its neighborhood and perform region growing. The connected regions that have completed region growth are defined as potential defect patches; In a series of consecutive surface scan images, the potential defect patches at the same physical location are correlated and matched; Multiple successfully matched potential defect patches are connected in chronological order to form the candidate defect trajectory cluster.

[0009] Preferably, the method for spatiotemporal consistency verification includes: Obtain the centroid coordinates and occurrence time of each potential defect patch in the candidate defect trajectory cluster; Calculate the displacement vector between the centroids of potential defect patches at adjacent time points in the candidate defect trajectory cluster; Statistically analyze the variance of directional consistency and the magnitude fluctuation coefficient of all displacement vectors; Based on the directional consistency variance and the modulus fluctuation coefficient, the motion coherence score of the candidate defect trajectory cluster is calculated; Simultaneously, the mean gray-level co-occurrence matrix contrast of all potential defect patches within the candidate defect trajectory cluster is calculated; The consistency check score is obtained by weighted and fused with the mean contrast of the gray-level co-occurrence matrix; If the consistency verification score is higher than the acceptance threshold, the candidate defect trajectory cluster is determined to be a valid defect trajectory cluster.

[0010] Preferably, the method for calculating the dynamic texture divergence of the effective defect trajectory cluster includes: For the effective defect trajectory cluster, the image region it covers is extracted as the region to be analyzed; The region to be analyzed is divided into multiple analysis units of equal size; Calculate the gradient direction histogram for each analysis unit; By comparing the gradient direction histograms of the same analysis unit at different times within the effective defect trajectory cluster, the change in the direction distribution of the analysis unit is obtained; The summation and normalization of the directional distribution changes of all analysis units yields the dynamic texture divergence of the effective defect trajectory cluster.

[0011] Preferably, the method for calculating the image structure instability index includes: Calculate the information entropy of the gradient descriptor of each pixel in the multi-level gray-scale gradient field; The structural entropy of the multi-level gray-scale gradient field is obtained by statistically analyzing the information entropy of all pixels. The dynamic texture divergence of the effective defect trajectory cluster is nonlinearly fused with the structural entropy of the multi-level gray-level gradient field; The result of the nonlinear fusion is the image structure instability index.

[0012] Preferably, the method for calculating the pattern separation degree includes: From the local binary pattern histogram, the most frequently occurring patterns are separated as base pattern components; The remaining patterns in the local binary pattern histogram constitute the residual pattern components; Calculate the cumulative distribution functions of the basic mode components and the residual components respectively; Calculate the maximum vertical distance between the two cumulative distribution functions, which is the distribution offset between the base mode component and the residual component; The product of the distribution offset and the entropy of the residual component is defined as the mode separation degree.

[0013] Preferably, the method for generating the comprehensive quality evaluation value includes: The image structure instability index is standardized to obtain a standardized structure instability value; The pattern separation degree is standardized to obtain a standardized pattern separation value; The standardized structural instability value and the standardized pattern separation value are input into a pre-trained multilayer perceptron model; The output of the multilayer perceptron model is the comprehensive quality evaluation value.

[0014] Preferably, the method for determining the production quality grade of the magnetic material includes: Multiple quality level thresholds are set to divide the continuous quality space into the superior product range, the qualified product range, and the unqualified product range; Map the comprehensive quality evaluation value to the continuous quality space; The production quality grade of the magnetic material is determined based on the range in which the comprehensive quality evaluation value falls.

[0015] Preferably, the method for calculating the information entropy of the gradient descriptor of each pixel in the multi-level grayscale gradient field includes: The gradient descriptor of the pixel is deconstructed and restored to gray-level gradient vector components corresponding to multiple image sub-layers; For each of the gray-level gradient vector components, the values ​​of its vector elements are normalized. Based on the normalized vector element values, calculate the distribution histogram of the element values ​​within the vector of the gray-level gradient vector component; Based on the distribution histogram, calculate the sub-layer information entropy corresponding to the gray-level gradient vector component; The gradient descriptor information entropy of the pixel is obtained by weighting and summing all the sub-layer information entropies corresponding to the pixel according to the scale of the sub-layer of the image.

[0016] Compared with the prior art, the beneficial effects of the present invention are: By constructing a multi-level gray-level gradient field and tracking its gray-level anomaly convergence points, a cluster of valid defect trajectories with spatiotemporal consistency verification is formed, and then its dynamic texture divergence is calculated. This divergence is combined with the structural entropy of the gradient field itself to generate an image structure instability index. This quantifies the dynamic evolution process of defect regions and the degree of disruption to the overall structural order of the image. This transforms the analysis of defects from isolated static features to continuous dynamic behavior, enabling the detection system to sensitively capture the initiation and early expansion trends of defects, thus improving the early warning capability for potential quality risks.

[0017] The local binary pattern histogram of a surface scan image is decomposed into a base pattern component and a residual pattern component. The base pattern component represents the inherent, normal texture statistics of the material surface, while the residual pattern component reflects anomalous pattern information deviating from the normal substrate. The pattern separation degree is obtained by calculating the distribution offset between the two. This scheme achieves the parsing and stripping of image texture features, effectively separating information representing the material's underlying texture from anomalous information representing defects. This reduces background interference caused by inherent material processing textures and uniform color differences, making feature representation more focused on the true defect signal, thereby improving the specificity and accuracy of defect identification under complex background conditions. Attached Figure Description

[0018] Figure 1 This is a schematic diagram illustrating the working principle of the image detection-based production quality inspection method for magnetic materials according to the present invention. Figure 2 A flowchart for constructing a multi-level grayscale gradient field; Figure 3 A flowchart for forming a cluster of candidate defect trajectories; Figure 4 Frequency distribution histogram for LBP mode encoding; Figure 5 A radar chart showing the quality grades of magnetic materials. Detailed Implementation

[0019] 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. 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.

[0020] Please see Figure 1This invention provides a production quality inspection method for magnetic materials based on image detection. The method includes: acquiring surface scan images of the magnetic material on a production line, wherein the images are acquired online using an industrial camera to ensure full coverage of the magnetic material surface; constructing a multi-level gray-level gradient field based on the surface scan images, which characterizes the gray-level variation features of the image at different scales; identifying and tracking gray-level anomalous convergence points in the multi-level gray-level gradient field, which correspond to gray-level abrupt change regions in the image, and forming candidate defect trajectory clusters by tracking; performing spatiotemporal consistency verification on the candidate defect trajectory clusters, eliminating false trajectories generated by noise or temporary interference, and selecting valid defect trajectory clusters; calculating the dynamic texture divergence of the valid defect trajectory clusters, which reflects the severity of texture changes in the defect area over time; combining the dynamic texture divergence with the structural entropy of the multi-level gray-level gradient field, where structural entropy describes the overall disorder of the gradient field, and calculating the image structural instability index by fusion; extracting the local binary mode histogram of the surface scan images, which captures the local texture patterns of the image and decomposes them into base mode components and residual mode components. The mode separation degree is calculated based on the distribution offset between the fundamental mode components and the residual components. This separation degree measures the degree of abnormal deviation of the texture mode. A comprehensive quality evaluation value is generated based on the image structure instability index and the mode separation degree. This evaluation value integrates information on structure instability and texture anomalies. The comprehensive quality evaluation value is compared with a preset threshold, which is set based on historical quality data, to determine the production quality grade of the magnetic material. The grades include superior, qualified, and unqualified products.

[0021] In one embodiment of the present invention, see [reference] Figure 2 This method captures the grayscale variation characteristics of magnetic material surface images at different spatial scales by constructing a multi-level grayscale gradient field. This construction process begins with Gaussian pyramid downsampling of the acquired surface scan image. For example, for an original surface scan image with a resolution of 2000 pixels × 2000 pixels, the pyramid is set to 4 layers with a downsampling coefficient of 2. Gaussian pyramid downsampling generates multiple image sub-layers at various scales. The first sub-layer is the original surface scan image itself; the second sub-layer is a 1000 pixel × 1000 pixel image obtained by Gaussian blurring and interleaved downsampling of the original surface scan image; the third and fourth sub-layers are generated in a similar manner. The recursive formula for Gaussian pyramid downsampling is:

[0022] in: Representing the The pixel matrix of the sub-layer of the image. This represents a downsampling operator that incorporates Gaussian smoothing and staggered sampling. This series of image sublayers collectively forms the multi-scale basis of the analysis.

[0023] In practical implementation, after constructing the Gaussian pyramid, the gray-level gradient vector of each pixel needs to be calculated independently in each image sub-layer. For any pixel in an image sub-layer, a 3-pixel × 3-pixel local neighborhood window is defined centered on it. Within this window, the approximate values ​​of the first derivatives in the horizontal and vertical directions are calculated separately, obtained by convolving the kernel with the gray-level values ​​of the pixels within the window. Based on the horizontal and vertical gradient values, the gradient magnitude of the pixel can be calculated. To obtain directional information, the 360-degree directional range is evenly divided into 8 directional intervals, such as 0-45 degrees, 45-90 degrees, etc. The gradient direction angle of the pixel is calculated, and according to the interval to which the direction angle belongs, the gradient magnitude is accumulated onto the corresponding directional interval, ultimately forming a gray-level gradient vector containing 8 components. Each component in the vector represents the cumulative gradient intensity of the pixel in the corresponding directional interval.

[0024] In practice, generating the gradient descriptor for each pixel requires integrating information from all image sub-layers. For a given pixel with coordinates in the original surface scan image... For each pixel, its corresponding position in each image sub-layer needs to be located. Since the image sub-layers are downsampled layer by layer, the coordinates of the pixel in the second image sub-layer are approximately... The corresponding coordinates in the third image sub-layer are approximately Extract the gray-level gradient vector of the corresponding position of the pixel in each image sub-layer. If the calculated coordinates are not integers, estimate the vector value at that position from the gray-level gradient vectors of neighboring pixels using bilinear interpolation. Concatenate the gray-level gradient vectors from the first, second, and last image sub-layers sequentially. Assuming there are four image sub-layers, each with an 8-dimensional gray-level gradient vector, the concatenated gradient descriptor is a 32-dimensional feature vector. This gradient descriptor comprehensively represents the directional gradient distribution of the pixel at multiple scales.

[0025] In some embodiments, the concatenation order of gradient descriptors follows a principle from fine-scale to coarse-scale. That is, the gray-level gradient vectors of the first image sub-layer (original scale) are placed first, followed by the gray-level gradient vectors of the second image sub-layer, and finally the gray-level gradient vectors of the fourth image sub-layer. This sequential arrangement preserves the inherent logic of scale information. In some embodiments, for pixels at image boundaries, their local neighborhood windows may extend beyond the image area. In this case, image boundaries need to be filled using a mirror filling method to ensure that a complete gray-level gradient vector can be calculated for each pixel. After calculating the gradient descriptors for all pixels in the image, these descriptors together constitute the multi-level gray-level gradient field. The multi-level gray-level gradient field is a three-dimensional data structure, where the first two dimensions correspond to the spatial coordinates of the original surface scan image, and the third dimension is the high-dimensional feature space of the gradient descriptors.

[0026] In one embodiment of the present invention, see [reference] Figure 3 Starting from the constructed multi-level gray-level gradient field, gray-level anomaly convergence points are identified and tracked to form candidate defect trajectory clusters. In the multi-level gray-level gradient field, the overall magnitude of the gradient descriptor for each pixel is calculated, obtained by taking the square root of the sum of the squares of all dimensions of the gradient descriptor. The overall magnitude of all pixels in the entire image is statistically analyzed, and the mean and standard deviation of the overall magnitude are calculated. An adaptive threshold is set to the mean plus three times the standard deviation. Pixels with an overall magnitude exceeding the adaptive threshold are detected and marked as initial anomalies. Using an initial anomaly as the core, its eight-neighborhood is defined as the search range. Within the search range, the gradient direction distribution of adjacent pixels is examined, extracted from the gradient descriptor of that pixel. If the gradient direction distribution of an adjacent pixel in at least one directional interval has a continuous abrupt change exceeding a preset angle compared to the gradient direction distribution of the core initial anomaly, then this adjacent pixel is included in the growth region. The same neighborhood search and judgment are recursively performed on newly included pixels in the growth region until no more pixels meeting the conditions are added, at which point the region growth process terminates. The set of connected pixels formed after the region growing is completed is defined as a potential defect patch, which records the coordinates of all member pixels.

[0027] In practice, potential defect patches at the same physical location are correlated and matched across multiple consecutive surface scan images. A potential defect patch in the current frame of the surface scan image is acquired, and its centroid coordinates are calculated using the arithmetic mean of all pixel coordinates within the patch. Potential defect patches are then searched for within the corresponding spatial region of the next frame of the surface scan image. This corresponding spatial region is a square area centered at the current centroid coordinates with sides of 50 pixels. The texture similarity between the current potential defect patch and each potential defect patch within the search region of the next frame is calculated. Texture similarity is evaluated by comparing the cosine distance between the average gray-level gradient vectors of the two patches on the same image sublayer. The potential defect patch with the smallest cosine distance is marked as a matching object; the matching object must satisfy a minimum cosine distance of less than a threshold of 0.15. Multiple successfully matched potential defect patches are connected chronologically to form a candidate defect trajectory cluster, which is a sequence containing timestamps and corresponding patch data.

[0028] In practical implementation, spatiotemporal consistency verification is performed on the formed candidate defect trajectory clusters. The centroid coordinates and occurrence time of each potential defect patch in the candidate defect trajectory cluster are obtained, with centroid coordinates in pixels and occurrence time in milliseconds. The displacement vector between the centroids of potential defect patches at adjacent times in the candidate defect trajectory cluster is calculated; the displacement vector is obtained by subtracting the centroid coordinates of the previous time from the centroid coordinates of the later time. All displacement vectors within the candidate defect trajectory cluster are statistically analyzed, and the directional consistency variance and magnitude fluctuation coefficient of these displacement vectors are calculated. The directional consistency variance reflects the variance of the displacement vector's direction angle, and the magnitude fluctuation coefficient is the standard deviation of the displacement vector's magnitude divided by its mean. Based on the directional consistency variance and magnitude fluctuation coefficient, the motion coherence score of the candidate defect trajectory cluster is calculated. From the formula:

[0029] in: The score represents the continuity of movement. The variance representing directional consistency. Represents the modulus fluctuation coefficient. and It is a weighting factor used to balance the effects of two factors. Set to 0.7, weighting factor Set to 0.3.

[0030] In some embodiments, the mean gray-level co-occurrence matrix contrast of all potential defect patches within a candidate defect trajectory cluster is calculated simultaneously. For each potential defect patch, a gray-level co-occurrence matrix in the 0-degree direction is calculated based on gray values ​​within the original surface scan image region it occupies. Contrast feature values ​​are extracted from the gray-level co-occurrence matrix, reflecting the clarity of the texture. The arithmetic mean of the contrast feature values ​​of all potential defect patches within the candidate defect trajectory cluster is calculated to obtain the mean gray-level co-occurrence matrix contrast. In some embodiments, the motion coherence score and the mean gray-level co-occurrence matrix contrast are weighted and fused to obtain a consistency check score. The fusion weight of the motion coherence score is set to 0.6, and the fusion weight of the mean gray-level co-occurrence matrix contrast is set to 0.4. The weighted fusion is achieved by multiplying the motion coherence score by a weight of 0.6 and adding the mean gray-level co-occurrence matrix contrast by a weight of 0.4. If the consistency check score is higher than the acceptance threshold, which is set to 0.65, the candidate defect trajectory cluster is determined to be a valid defect trajectory cluster.

[0031] It is understandable that a higher motion coherence score indicates a more regular movement of potential defect patches across consecutive images, consistent with the expected physical movement of real defects. Similarly, a higher mean gray-level co-occurrence matrix contrast indicates a more pronounced difference between the texture and background of the potential defect patch region, consistent with the visual characteristics of real defects. If the consistency check score is not higher than the acceptance threshold, the candidate defect trajectory cluster is discarded, considered to be generated by noise or artifacts. Valid defect trajectory clusters selected through spatiotemporal consistency checks will be used in subsequent dynamic texture analysis steps. Optionally, the adaptive threshold calculation can also be based on layered settings for image sub-layers, calculating the mean and standard deviation of pixel gradient magnitudes for each sub-layer and setting independent inter-layer adaptive thresholds. Optionally, the condition for judging continuous abrupt changes in gradient direction during region growing can be adjusted to check for changes in the principal gradient direction, defined as the direction represented by the interval with the largest value in the gradient descriptor.

[0032] In one embodiment of the present invention, dynamic texture divergence is calculated for a selected cluster of valid defect trajectories, which contains multiple potential defect patches arranged in chronological order. For each cluster of valid defect trajectories, the image region it covers is extracted as the region to be analyzed. The bounding box of the region to be analyzed is determined by the union of the bounding rectangles of all potential defect patches of the cluster at all times. The region to be analyzed is divided into multiple analysis units of equal size, with each analysis unit being a 16-pixel × 16-pixel square grid. The grid is divided from the upper left corner of the region to the right and downwards with a fixed step size. The gradient direction histogram of each analysis unit is calculated. The gray-level gradient vector components of the corresponding original scale image sublayer are extracted from the gradient descriptors of all pixels within the analysis unit. The component values ​​of the eight directional intervals are summed and normalized to form the gradient direction histogram of the analysis unit. ,in This represents a vector containing eight probability values. The gradient direction histograms of the same analysis unit at different times within the effective defect trajectory cluster are compared to obtain the change in the direction distribution of the analysis unit. This change in direction distribution is obtained by calculating the Bach distance between the two gradient direction histograms. The change in direction distribution of all analysis units is summed, and the sum is divided by the total number of times included in the effective defect trajectory cluster minus one, and then divided by the total number of analysis units in the region to be analyzed to achieve normalization. The result of the normalization is the dynamic texture divergence of the effective defect trajectory cluster. ,in Represents dynamic texture divergence.

[0033] In practical implementation, calculating the image structure instability index requires combining dynamic texture divergence with the structural entropy of a multi-level gray-level gradient field. The information entropy of the gradient descriptor for each pixel in the multi-level gray-level gradient field is calculated. For a single pixel's gradient descriptor, it is deconstructed into gray-level gradient vector components corresponding to multiple image sub-layers, each of which is an eight-dimensional vector. For each gray-level gradient vector component, its eight vector elements are normalized so that the sum of the eight elements is 1. Based on the normalized vector element values, a histogram of the distribution of the vector elements corresponding to the gray-level gradient vector component is calculated. This histogram is directly constructed using the eight normalized probability values. Based on the distribution histogram, the sub-layer information entropy corresponding to the gray-level gradient vector component is calculated. Sub-layer information entropy The calculation formula is:

[0034] in: Represents the entropy of sub-layer information. The first in the distribution histogram Normalized probability values ​​for each directional interval. This is the index of the direction interval. The entropy of all sub-layers corresponding to a pixel is weighted and summed according to the scale of its respective image sub-layer. The weighting coefficient is inversely proportional to the downsampling scale of the image sub-layer. The first image sub-layer (original scale) is assigned a weight of 1.0, the second image sub-layer is assigned a weight of 0.5, and the third image sub-layer is assigned a weight of 0.25. The summation result is the gradient descriptor entropy of that pixel.

[0035] In practice, after calculating the gradient descriptor entropy of all pixels, the arithmetic mean of the gradient descriptor entropy of all pixels is taken to obtain the structural entropy of the multi-level grayscale gradient field. ,in Represents structural entropy. The dynamic texture divergence of the effective defect trajectory cluster. Structural entropy of multi-level gray-scale gradient fields Nonlinear fusion is performed, using the square root of the product, to determine the image structure instability index. From the formula The calculation shows that, among which This represents an index of image structural instability. Image structural instability index As a comprehensive metric, it quantifies the correlation between local texture dynamics caused by defects and global gradient field disorder.

[0036] In one embodiment of the present invention, the anomalous distribution of texture patterns in a surface scan image is quantified by calculating pattern separation. The calculation of pattern separation begins with extracting the local binary pattern histogram of the image. For a surface scan image of a magnetic material, a circular neighborhood with a radius of 1 pixel and containing 8 neighboring points is defined centered on each pixel. The gray values ​​of the neighboring pixels are compared with the gray value of the center pixel. If the gray value of the neighboring pixel is greater than or equal to the gray value of the center pixel, it is marked as 1; otherwise, it is marked as 0. These 8 binary bits are concatenated in a fixed order to form an 8-bit local binary pattern code. The value range of the local binary pattern code is 0 to 255. The occurrence frequency of the local binary pattern codes generated by all pixels in the entire surface scan image is counted and normalized to a frequency, thereby obtaining a 256-dimensional local binary pattern histogram. Each dimension of the local binary pattern histogram corresponds to the frequency value of a local binary pattern code.

[0037] In practice, the most frequently occurring patterns are separated from the local binary pattern histogram and selected as base pattern components. The frequency values ​​of all 256 patterns in the local binary pattern histogram are sorted in descending order, and the top 5 patterns are selected as base pattern components. Each base pattern component is a set containing 5 pattern codes and their corresponding frequency values. The remaining patterns in the local binary pattern histogram constitute residual pattern components, which are sets containing 251 pattern codes and their corresponding frequency values. Table 1 shows an example of the top 10 patterns and their frequency distribution in a local binary pattern histogram calculated from a surface scan image. In this example, the base pattern components contain pattern codes 0, 1, 3, 5, and 7. (Refer to Table 1.)

[0038] Table 1: Partial Mode Frequency Table of Local Binary Mode Histogram

[0039] In practice, the cumulative distribution functions of the base mode components and residual mode components are calculated separately. For the base mode components, the five modes they contain are rearranged in ascending order of their mode codes, and the cumulative sum of their frequency values ​​is calculated, resulting in a cumulative sum sequence. Divide each value by the sum of the total frequencies of the base mode components and normalize to obtain the cumulative distribution function of the base mode components. For the residual mode components, the 251 modes they contain are arranged in ascending order of their mode codes, and the cumulative sum of their frequency values ​​is calculated, resulting in a cumulative sum sequence. Divide each value by the sum of the total frequencies of the residual mode components and normalize to obtain the cumulative distribution function of the residual mode components. Calculate the two cumulative distribution functions. and At the same pattern coding point The absolute value of the difference is used to iterate through all possible pattern coding points. Find the maximum absolute value of the difference; this maximum value is the distribution offset between the base mode component and the residual mode component. ,in This represents the distribution offset.

[0040] In some embodiments, the entropy value of the residual mode component The Shannon entropy formula is used for calculation; the formula is as follows:

[0041] in: The entropy value represents the residual mode component. Represents the set of all mode codes in the residual mode components. Represents the mode coding in the residual mode components Normalized frequency values. Distribution offset. Entropy value of residual mode components Multiply, and the product is defined as the pattern separation degree. ,Right now ,in Represents the separation degree of the model.

[0042] See Figure 4 This is a frequency distribution bar chart of LBP mode encoding, a visualization result from the "Local Binary Pattern (LBP) Analysis" step in magnetic material quality inspection. The frequency distribution of LBP modes is one of the core indicators for quantifying material surface texture. The concentration of the base mode components reflects the "normal characteristics" of the material surface texture. Subsequently, by comparing the distribution differences between the base mode and the residual mode, it can be determined whether there are abnormal textures (i.e., potential defects) on the material surface. This type of chart is commonly used in the "texture feature analysis" step of industrial quality inspection to help engineers quickly identify abnormal distributions of surface textures, and is one of the basic data visualization forms for subsequent defect determination.

[0043] In one embodiment of the present invention, a comprehensive quality evaluation value for the magnetic material is generated based on the image structure instability index and mode separation degree, wherein the image structure instability index and mode separation degree are calculated by the aforementioned steps. The image structure instability index is standardized, and the image structure instability index values ​​of normal products in historical production batches are collected to calculate the average of the historical values. with standard deviation mean with standard deviation Retrieved from historical databases. Image structural instability indices for the magnetic material samples to be evaluated. Its standardized structural instability value Through the formula:

[0044] in: Represents the standardized structural instability value. This represents an index of image structural instability. This represents the average value of historical image structural instability indicators. This represents the standard deviation of the historical image structure instability index. The pattern separation score is standardized, and pattern separation score values ​​of normal products from historical production batches are collected, with the mean of the historical values ​​calculated. with standard deviation For the mode separation of the magnetic material samples to be evaluated Its standardized model separation value pass The calculation yielded the result.

[0045] In practical implementation, the standardized structural instability value will be... Value separated from standardized model The input is fed into a pre-trained multilayer perceptron model. The input layer of the multilayer perceptron model contains two neurons, which receive signals respectively. and Two scalar values. The multilayer perceptron model contains one hidden layer with five neurons, and the activation function of the hidden layer neurons is the ReLU function. The output layer of the multilayer perceptron model contains one neuron. The multilayer perceptron model is trained using historical sample data, which includes the standardized structural instability values, standardized pattern separation values, and corresponding known quality labels of the historical samples. The output of the multilayer perceptron model is the comprehensive quality evaluation value. Comprehensive quality evaluation value It is a continuous value between 0 and 1.

[0046] In some embodiments, multiple quality grade thresholds are set to divide the continuous quality space into a superior grade range, a qualified grade range, and a non-qualified grade range. The lower limit of the threshold for the superior grade range is... Set to 0.85, the lower limit of the threshold for the qualified product range. Setting it to 0.60, the upper limit of the threshold for the non-conforming product range is... The comprehensive quality evaluation value Mapping to a continuous mass space, the mapping process is a direct comparison. With threshold and The numerical value. Based on the comprehensive quality evaluation value. The interval in which the magnetic material is located determines the production quality grade. Then the production quality grade is determined to be superior. Then the production quality grade is determined to be qualified. If so, the product is determined to be of substandard quality.

[0047] See Figure 5 This is a radar chart of magnetic material quality grades, used to compare the performance of different quality grades across multiple testing indicators. The values ​​of each indicator are positively correlated with the quality grade, with superior grade materials performing best across all indicators, followed by qualified materials, and unqualified materials performing worst. This type of radar chart is a multi-indicator comparison tool in industrial quality inspection, which can intuitively distinguish the differences between materials of different quality grades in core testing dimensions, helping engineers quickly determine material quality and also optimize testing thresholds. It clearly shows the correlation logic between the five core indicator quality grades; the performance of all indicators decreases synchronously with the decrease in quality grade, verifying the rationality of "multi-indicator fusion for quality judgment" and also helping to identify whether there are any anomalies in a single indicator.

[0048] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0049] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A production quality inspection method for magnetic materials based on image detection, characterized in that, include: Acquire surface scan images of magnetic materials on the production line; A multi-level grayscale gradient field is constructed based on the surface scan image; In the multi-level gray-level gradient field, gray-level anomaly convergence points are identified and tracked to form candidate defect trajectory clusters; The candidate defect trajectory clusters are subjected to spatiotemporal consistency verification to select valid defect trajectory clusters; Calculate the dynamic texture divergence of the effective defect trajectory cluster; By combining the dynamic texture divergence with the structural entropy of the multi-level gray-level gradient field, the image structure instability index is calculated. The local binary mode histogram of the surface scan image is extracted and decomposed into base mode components and residual mode components; The mode separation degree is calculated based on the distribution offset between the base mode components and the residual mode components. A comprehensive quality evaluation value is generated based on the image structure instability index and the pattern separation degree. The comprehensive quality evaluation value is compared with a preset threshold to determine the production quality level of the magnetic material.

2. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for constructing a multi-level gray-level gradient field includes: The surface scan image is downsampled using a Gaussian pyramid to generate image sub-layers of multiple scales; In each of the image sub-layers, the gray-level gradient vector of each pixel in multiple directions is calculated; The gray-level gradient vectors of each pixel at the corresponding positions in all the image sub-layers are concatenated to generate the gradient descriptor of the pixel; The multi-level grayscale gradient field is constructed from the gradient descriptors of all pixels in the surface scan image.

3. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for forming candidate defect trajectory clusters includes: In the multi-level gray-scale gradient field, pixels whose gradient magnitude exceeds the adaptive threshold are detected and marked as initial abnormal points; Using each initial outlier as the core, search for pixels with continuously abrupt changes in gradient direction in its neighborhood and perform region growing. The connected regions that have completed region growth are defined as potential defect patches; In a series of consecutive surface scan images, the potential defect patches at the same physical location are correlated and matched; Multiple successfully matched potential defect patches are connected in chronological order to form the candidate defect trajectory cluster.

4. The production quality inspection method for magnetic materials based on image detection as described in claim 3, characterized in that, The method for spatiotemporal consistency verification includes: Obtain the centroid coordinates and occurrence time of each potential defect patch in the candidate defect trajectory cluster; Calculate the displacement vector between the centroids of potential defect patches at adjacent time points in the candidate defect trajectory cluster; Statistically analyze the variance of directional consistency and the magnitude fluctuation coefficient of all displacement vectors; Based on the directional consistency variance and the modulus fluctuation coefficient, the motion coherence score of the candidate defect trajectory cluster is calculated; Simultaneously, the mean gray-level co-occurrence matrix contrast of all potential defect patches within the candidate defect trajectory cluster is calculated; The consistency check score is obtained by weighted and fused with the mean contrast of the gray-level co-occurrence matrix; If the consistency verification score is higher than the acceptance threshold, the candidate defect trajectory cluster is determined to be a valid defect trajectory cluster.

5. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for calculating the dynamic texture divergence of the effective defect trajectory cluster includes: For the effective defect trajectory cluster, the image region it covers is extracted as the region to be analyzed; The region to be analyzed is divided into multiple analysis units of equal size; Calculate the gradient direction histogram for each analysis unit; By comparing the gradient direction histograms of the same analysis unit at different times within the effective defect trajectory cluster, the change in the direction distribution of the analysis unit is obtained; The summation and normalization of the directional distribution changes of all analysis units yields the dynamic texture divergence of the effective defect trajectory cluster.

6. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for calculating the image structure instability index includes: Calculate the information entropy of the gradient descriptor of each pixel in the multi-level gray-scale gradient field; The structural entropy of the multi-level gray-scale gradient field is obtained by statistically analyzing the information entropy of all pixels. The dynamic texture divergence of the effective defect trajectory cluster is nonlinearly fused with the structural entropy of the multi-level gray-level gradient field; The result of the nonlinear fusion is the image structure instability index.

7. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for calculating the pattern separation degree includes: From the local binary pattern histogram, the most frequently occurring patterns are separated as base pattern components; The remaining patterns in the local binary pattern histogram constitute the residual pattern components; Calculate the cumulative distribution functions of the basic mode components and the residual components respectively; Calculate the maximum vertical distance between the two cumulative distribution functions, which is the distribution offset between the base mode component and the residual component; The product of the distribution offset and the entropy of the residual component is defined as the mode separation degree.

8. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for generating the comprehensive quality evaluation value includes: The image structure instability index is standardized to obtain a standardized structure instability value; The pattern separation degree is standardized to obtain a standardized pattern separation value; The standardized structural instability value and the standardized pattern separation value are input into a pre-trained multilayer perceptron model; The output of the multilayer perceptron model is the comprehensive quality evaluation value.

9. The production quality inspection method for magnetic materials based on image detection as described in claim 1, characterized in that, The method for determining the production quality grade of magnetic materials includes: Multiple quality level thresholds are set to divide the continuous quality space into the superior product range, the qualified product range, and the unqualified product range; Map the comprehensive quality evaluation value to the continuous quality space; The production quality grade of the magnetic material is determined based on the range in which the comprehensive quality evaluation value falls.

10. The production quality inspection method for magnetic materials based on image detection as described in claim 6, characterized in that, The method for calculating the information entropy of the gradient descriptor of each pixel in the multi-level gray-level gradient field includes: The gradient descriptor of the pixel is deconstructed and restored to gray-level gradient vector components corresponding to multiple image sub-layers; For each of the gray-level gradient vector components, the values ​​of its vector elements are normalized. Based on the normalized vector element values, calculate the distribution histogram of the element values ​​within the vector of the gray-level gradient vector component; Based on the distribution histogram, calculate the sub-layer information entropy corresponding to the gray-level gradient vector component; The gradient descriptor information entropy of the pixel is obtained by weighting and summing all the sub-layer information entropies corresponding to the pixel according to the scale of the sub-layer of the image.