A machine vision-based enamel plate surface defect detection method

CN121708003BActive Publication Date: 2026-09-04HUBEI SANXING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202512013955.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-09-04
Estimated Expiration
2045-12-29

AI Technical Summary

Technical Problem

[0003]由于搪瓷板表面纹理受釉色配方、烧成工艺、冷却条件等多重因素影响,正常纹理本身存在较大固有波动性,而气泡、裂纹、黑点等各类缺陷与正常纹理波动的差异往往局部且细微,现有的搪瓷板表面缺陷检测方案,核心存在的主要缺点是:未能根据特征对缺陷的敏感程度进行差异化权重分配,既无法针对性强化缺陷敏感特征的贡献,也难以有效弱化无关特征及正常纹理波动的干扰,导致难以精准区分正常纹理波动与真实缺陷,易将釉料色差、烧成不均等正常波动误判为缺陷,又难以捕捉细微缺陷与背景纹理的微弱差异,最终影响检测准确性,无法满足复杂工况下对搪瓷板表面缺陷的精细化检测需求

Benefits of technology

(1)、将PaDiM算法引入搪瓷正常纹理建模,通过多元高斯分布对无缺陷搪瓷板的纹理特征进行概率建模,充分适配不同釉色、烧成工艺下的正常纹理波动,该方式能有效过滤釉料自然色差、烧成轻微不均等干扰,避免将正常纹理误判为缺陷,为差异区域初筛建立了精准且通用的参考基准。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121708003B_ABST
    Figure CN121708003B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on machine vision's enamel plate surface defect detection method, it is related to enamel plate surface defect detection technical field.The method steps include: the original image of enamel plate is collected, the original image is fused by point optimal gray fusion method, and real-time reflection suppression image is obtained;Enamel plate's defect-free reflection suppression image is collected, and the difference texture area is obtained and the difference texture area coordinates are recorded by matching analysis to defect-free reflection suppression image and real-time reflection suppression image using improved PaDiM algorithm;In difference texture area, two kinds of image features are respectively extracted and fused by scale attention feature extraction method, and real-time and standard fusion matrix are obtained, and defect detection result is obtained by similarity matching;Defect positioning result is obtained by converting difference area coordinates, defect comprehensive score is calculated based on defect detection result and grade is divided, and enamel plate surface defect detection is completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of enamel plate surface defect detection technology, specifically to a machine vision-based method for enamel plate surface defect detection. Background Technology

[0002] Enameled panels are widely used in various fields such as building decoration and home appliance manufacturing due to their excellent corrosion resistance, heat resistance and aesthetics. However, surface defects not only affect the appearance quality of products, but may also reduce structural stability and cause safety hazards. Therefore, accurate and efficient detection of surface defects in enamel panels is a key link in ensuring product quality and improving production efficiency.

[0003] Because the surface texture of enamel panels is affected by multiple factors such as glaze formulation, firing process, and cooling conditions, the normal texture itself has a large inherent fluctuation. However, the differences between various defects such as bubbles, cracks, and black spots and normal texture fluctuations are often local and subtle. The main drawback of existing enamel panel surface defect detection solutions is that they fail to differentiate the weighting of defect sensitivity based on features. This makes it difficult to specifically enhance the contribution of defect-sensitive features, and also difficult to effectively weaken the interference of irrelevant features and normal texture fluctuations. As a result, it is difficult to accurately distinguish between normal texture fluctuations and real defects. It is easy to misjudge normal fluctuations such as glaze color difference and uneven firing as defects, and it is difficult to capture the subtle differences between minor defects and background textures. Ultimately, this affects the accuracy of detection and cannot meet the needs of refined detection of enamel panel surface defects under complex working conditions.

[0004] Therefore, developing a method for detecting surface defects in enamel panels that can accurately distinguish between normal texture fluctuations and real defects through differentiated feature weight optimization has become a pressing technical challenge in this field. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a machine vision-based method for detecting surface defects in enamel plates, thereby resolving the problems existing in the background technology.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting surface defects in enamel plates based on machine vision, comprising the following steps: Step S1: Acquire the original image of the enamel panel, and fuse the original image using the point-by-point optimal grayscale fusion method to obtain a real-time reflection suppression image; Step S2: Acquire a defect-free reflection suppression image of the enamel panel, and perform matching analysis between the defect-free reflection suppression image and the real-time reflection suppression image using the improved PaDiM algorithm to obtain the differential texture region and record the coordinates of the differential texture region; Step S3: Within the differential texture region, feature extraction and fusion of the real-time reflection suppression image are performed using the scale attention feature extraction method to obtain a real-time fusion matrix. Feature extraction and fusion of the defect-free reflection suppression image are performed using the scale attention feature extraction method to obtain a standard fusion matrix. Similarity matching is performed between the real-time fusion matrix and the standard fusion matrix to obtain the defect detection result. Step S4: Perform coordinate transformation on the coordinates of the differential texture area to obtain the defect location result. Calculate the comprehensive defect score based on the defect detection result. Classify the defect level according to the comprehensive defect score to realize the surface defect detection of the enamel plate.

[0007] Preferably, acquiring the original image of the enamel panel includes the following specific steps: Linearly polarized LED light sources are selected as the light source array. The light source array contains four independently controllable linearly polarized light source units. The polarization direction θ of each light source is set to 0°, 45°, 90°, and 135°, respectively. The light source array is symmetrically arranged on both sides of the conveying mechanism with the enamel plate conveying path as the center. When the enamel plate passes through the light source array, the PLC controller illuminates each light source in sequence according to a preset timing sequence of 0°, 45°, 90°, and 135°. The illumination time of each light source is synchronized with the camera exposure time. The camera is installed directly above the enamel plate, with the lens optical axis perpendicular to the surface of the enamel plate. When the enamel plate enters the detection area through the conveying mechanism, the edge signal of the enamel plate is detected by a photoelectric sensor. When the edge signal of the enamel plate is detected, the original image of the enamel plate is acquired, resulting in an original image sequence. {I1(x,y),I2(x,y),I3(x,y),I4(x,y)} .

[0008] Preferably, the step of fusing the original image using a point-by-point optimal grayscale fusion method to obtain a real-time reflection-suppressed image involves the following steps: Based on the original image sequence {I1(x,y),I2(x,y),I3(x,y),I4(x,y)} Calculate the comprehensive evaluation score for each pixel in sequence. Overall evaluation score The calculation formula is:

[0009] in, and These are the weighting coefficients. The maximum effective contrast value. To evaluate the overall score, For pixels The local variance in the corresponding neighborhood under the o-th working condition For pixels In the The reflection intensity under the group of working conditions, where o is the working condition index; Real-time reflection suppression image The formula for generating it is:

[0010]

[0011] in, The working condition number that yields the highest overall evaluation score. For the optimal working condition of the pixel grayscale value, For real-time reflection suppression images, This indicates taking the maximum value.

[0012] Preferably, the acquisition of the defect-free reflection suppression image of the enamel panel, and the matching analysis of the defect-free reflection suppression image and the real-time reflection suppression image using the improved PaDiM algorithm to obtain the differential texture region and record the coordinates of the differential texture region, includes the following steps: Defect-free enamel plate samples were collected and fused using a point-by-point optimal gray-level fusion method to obtain a defect-free reflection suppression image. A normal enamel texture reference model was constructed, and semantic layer optimization was performed on the WideResNet-50 in the improved PaDiM algorithm, using only layer 2 semantic features to obtain the optimized WideResNet-50. The real-time reflection suppression image was then generated. The region is divided into texture analysis sub-regions. For each texture analysis sub-region, a real-time texture feature vector is extracted using the optimized Wide ResNet-50. Call the corresponding spatial coordinates The reference model for normal enamel texture is used to calculate the weighted Mahalanobis distance value. Weighted Mahalanobis distance value The calculation formula is:

[0013] in, Coordinates in the image to be detected Feature vectors of texture blocks It is a diagonal weight matrix. It is the inverse of the covariance matrix. The weighted Mahalanobis distance value; Calculate the weighted Mahalanobis distance values ​​for the texture analysis sub-regions of defect-free enamel panels and enamel panels with minor defects, and use the 99.5th percentile as the base threshold. Introduce operating condition correction coefficient final threshold ; When the weighted Mahalanobis distance value of the texture analysis sub-region > When the texture analysis sub-region is determined to be a differential texture region, adjacent differential texture sub-regions are merged to form a continuous differential texture region, and the coordinates of the differential texture region are recorded.

[0014] Preferably, the construction of the enamel normal texture reference model includes the following steps: The defect-free reflection suppression image is divided into non-overlapping defect-free reflection suppression image blocks. For each defect-free reflection suppression image block, normal texture feature vectors are extracted using Wide ResNet-50. Where (p,q) represents the index coordinates of the defect-free reflection-suppressed image patch in the sample image, and k represents the dataset index, a reference model for normal enamel texture is constructed. ; The formula for calculating the mean vector is:

[0015] in, The total number of training samples. The mean of the feature dimension corresponding to each element. This is a normal texture feature vector; The formula for calculating the covariance matrix is:

[0016] in, For regularization terms, It is a 64th order identity matrix. Let covariance matrix be the variance matrix. It is the transpose of the deviation between the normal texture feature vector and the mean vector.

[0017] Preferably, within the differential texture region, feature extraction and fusion of the real-time reflection suppression image are performed using the scale attention feature extraction method to obtain a real-time fusion matrix. The construction of a normal enamel texture reference model for the defect-free image using the scale attention feature extraction method includes the following steps: The regions with different textures are divided into small-scale, medium-scale, and large-scale regions based on their area. The formula for calculating the actual physical area of ​​the regions with different textures is as follows:

[0018] in, This represents the total number of pixels in the difference region. and For pixel physical size, The actual physical area of ​​the region of difference; A scale-channel spatial attention module is used to extract features from real-time reflection suppression images to obtain a real-time fusion matrix. Image patches in different regions are processed by four dilated convolution branches of the scale feature extraction module to output multi-scale feature maps. , , , The feature maps of the four branches are concatenated by channel to obtain an aggregated feature map. Channel statistical vectors are generated through global average pooling. After two layers of MLP mapping, channel weight vectors are generated using the sigmoid function. These channel weight vectors are multiplied by the aggregated feature map by channel to obtain a channel-weighted feature map. The channel-weighted feature map is then split by branch, and each branch feature map is compressed into a spatial encoding map through a 1×1 convolution. The spatial encoding maps of each branch are concatenated to obtain an aggregated spatial map. The aggregated spatial map is then used to generate a spatial weight map through a 7×7 convolution, which is multiplied pixel-by-pixel with the split branch feature maps to obtain four branch feature maps. These four branch feature maps are then concatenated by channel and compressed into a fused feature map through a 1×1 convolution. ; From the fused feature map Structural feature parameters are extracted from the data, and then standardized using the following formula:

[0019] in, Here, i represents the original feature parameters, and i represents the index of the core feature parameter. and These are the minimum and maximum values ​​of this feature in the standard defect sample set. These are the standardized eigenvalues; A 2×3 dimensional real-time fusion matrix is ​​constructed by arranging the six standardized feature values ​​in a fixed order. , ; Five types of typical defects in enamel panels were selected as standard samples. For each sample, features were extracted and a fusion matrix was constructed according to the above process to obtain the standard fusion matrix for each type of defect. , Index for defect categories.

[0020] Preferably, the extraction of structural feature parameters from the fused feature map is as follows: The formula for calculating the aspect ratio R is: ,in This is the length of the longest side of the circumscribed rectangle. The length of the shortest side; The formula for calculating edge sharpness E is:

[0021] in: The set of pixels at the edge of the defect. This represents the total number of edge pixels. and Let be the magnitude of the Sobel gradient of pixel (x, y) in the x and y directions. For edge sharpness; Internal grayscale transition smoothness The calculation formula is:

[0022] in, For the set of pixels in the defect area, This represents the total number of pixels in the defect area. For pixels grayscale value, The average gray value of the defect area. For the smoothness of internal grayscale transition; The formula for calculating the contour connectivity C is as follows: ,in The number of connected components in the outline; Grayscale contrast The calculation formula is:

[0023] in, The average gray value of the defect area. The average grayscale value of the normal area 5 pixels wide surrounding the defect. This refers to grayscale contrast.

[0024] Preferably, the step of performing similarity matching between the real-time fusion matrix and the standard fusion matrix to obtain the defect detection result includes the following specific steps: The formula for calculating the cosine similarity between the real-time fusion matrix and the standard fusion matrix is:

[0025] in, For matrix vectorization operations, For real-time fusion matrix, For the first The standard fusion matrix of class-standard defects Represents the vector dot product. The L2 norm of a vector. Cosine similarity between the real-time fusion matrix and the standard fusion matrix; Calculate the real-time fusion matrix Similarity with 5 standard fusion matrices A similarity threshold is set by mixing defective samples. When there is a unique Make ≥ Then the region to be detected is determined to be the first... Class defects; when multiple Make ≥ Then, take the defect type corresponding to the maximum similarity. < If the defect is identified as a suspected defect, the defect detection result is obtained, which includes the defect type and the corresponding structural feature parameters.

[0026] Preferably, the step of performing coordinate transformation on the coordinates of the differential texture region to obtain the defect localization result specifically involves: Construct a four-level coordinate transformation system: image pixel coordinate system - camera coordinate system - world coordinate system - enamel plate physical coordinate system. The origin is the top left corner of the real-time reflection suppression image, the u-axis extends horizontally to the right along the image, and the v-axis extends vertically downwards along the image. Camera coordinate system With the optical center of the industrial camera lens as the origin, the x-axis is parallel to the image u-axis, the y-axis is parallel to the image v-axis, and the z-axis is perpendicular to the lens optical axis forward. World coordinate system With the center point of the enamel plate inlet of the conveyor line inspection station as the origin, the X-axis moves along the direction of the conveyor line, the Y-axis is perpendicular to the conveyor line and moves horizontally to the right, and the Z-axis is perpendicular to the conveyor line and moves upward. Enamel plate physical coordinate system With the top left corner of a single enamel panel as the origin, axis A is along the length of the panel, and axis B is along the width of the panel. The formula for transforming from pixel coordinates to camera coordinates is:

[0027] Where (u,v) are the coordinates of the center point of the defect in the image pixel coordinate system. The inverse of the intrinsic parameter matrix. The fixed working distance from the camera to the enamel plate surface, ( , , () represents the three-dimensional coordinates of the defect in the camera coordinate system; The formula for changing the camera coordinate system to the world coordinate system is:

[0028] in, It is a 3×3 rotation matrix. It is a 3×1 translation matrix, ( , , () represents the three-dimensional coordinates of the defect in the world coordinate system; The final defect location result is obtained, which is the final coordinate of the defect in the physical coordinate system of the enamel plate. The conversion formula from the world coordinate system to the physical coordinate system of the enamel plate is as follows:

[0029] in,( , ) represents the coordinates of the top-left corner vertex of the current enamel panel in the world coordinate system. B) represents the final coordinates of the defect in the physical coordinate system of the enamel plate. Let be the rotation matrix of the enamel plate relative to the world coordinate system.

[0030] Preferably, the step of calculating the comprehensive defect score based on the defect detection results specifically involves: A comprehensive defect score is calculated based on the defect detection results. The calculation formula is:

[0031] in, This is a normalization function for the core parameters of the defect. For the comprehensive score of defects, This is a defect density correction term. For defect type weights, For position weights, This represents the defect density.

[0032] This invention provides a machine vision-based method for detecting surface defects in enamel plates, involving machine learning and deep learning technologies, which has the following beneficial effects: (1) The PaDiM algorithm is introduced into the normal texture modeling of enamel. The texture features of defect-free enamel panels are probabilistically modeled by multivariate Gaussian distribution, which fully adapts to the normal texture fluctuations under different glaze colors and firing processes. This method can effectively filter out interference such as natural color difference of glaze and slight unevenness of firing, and avoid misjudging normal texture as defects. It establishes an accurate and universal reference benchmark for the initial screening of difference areas.

[0033] (2) The improved PaDiM algorithm, which introduces weighted Mahalanobis distance and optimizes semantic layer selection, further strengthens the weight of defect-sensitive features on the basis of texture modeling, filters redundant noise, and simplifies feature dimensions to improve computational efficiency. This improvement not only ensures the accuracy of the initial screening of difference regions, but also adapts to the real-time detection needs of industrial production lines, allowing the advantages of texture modeling to be fully utilized, and significantly improving the practicality and stability of the detection system.

[0034] (3) The defect classification algorithm that integrates multi-scale attention and feature matrix similarity is adapted to the detection scenarios of multiple types and scale defects such as bubbles, cracks and black spots in enamel plates. Through multi-dimensional feature extraction and standardized matching, it breaks through the limitations of single feature recognition, accurately captures the morphology and gray scale differences of different defects, reduces misjudgment under complex background interference, and provides reliable technical support for the refined discrimination of defect types. Attached Figure Description

[0035] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is a flowchart of the steps of a machine vision-based method for detecting surface defects in enamel plates proposed in this invention. Figure 2 This is a step hierarchy diagram of obtaining defect location results in a machine vision-based method for detecting surface defects in enamel plates proposed in this invention. Figure 3 This is a hierarchical diagram of the steps for obtaining a comprehensive defect score in a machine vision-based method for detecting surface defects in enamel plates proposed in this invention. Detailed Implementation

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

[0038] Please see Figures 1-3 The present invention provides a technical solution: a method for detecting surface defects of enamel plates based on machine vision.

[0039] Step S1: Acquire the original image of the enamel panel, and fuse the original image using the point-by-point optimal grayscale fusion method to obtain a real-time reflection suppression image; This step targets the core characteristics of enamel panels, namely high gloss and strong specular reflection. By constructing a controllable multi-polarized light source illumination environment and a precise image fusion strategy, a real-time reflection suppression image is generated. This real-time reflection suppression image can minimize high-brightness interference from ambient light, equipment reflections, etc., so that the enamel panel surface is in a stable visual state close to diffuse reflection. This provides a clear and balanced image foundation for subsequent texture analysis and defect identification, ensuring the visibility and detection stability of minute defects such as bubbles, micro-cracks, and black spots.

[0040] Linearly polarized LED light source is selected as the core component of the array. The linearly polarized light can be controlled by adjusting the polarization direction to specifically filter the specular reflection component on the enamel plate surface. The LED light source has the characteristics of stable brightness, fast response speed (≤1ms) and long service life.

[0041] The light source array contains four independently controllable linearly polarized light source units. The polarization direction θ of each light source is set to 0°, 45°, 90°, and 135°, respectively. The values ​​are based on the fact that, through previous experimental verification, these four polarization directions can cover the specular reflection angles of different orientations on the enamel plate surface, and can capture image information under different reflection states to the maximum extent. Compared with two or three polarization directions, the reflection suppression rate can be improved by more than 30%.

[0042] The illumination angle α of each light source is designed to be adjustable from 30° to 60° with an adjustment accuracy of ±1°. The adaptation logic is as follows: for enamel panels with different glaze colors (glossy glaze, matte glaze) and firing processes, the incident direction of light is changed by adjusting the illumination angle to avoid the problem of local reflections that cannot be suppressed under a fixed angle. For example, for glossy glaze enamel panels, an illumination angle of 30° to 40° is selected to reduce specular reflection; for matte glaze enamel panels, an illumination angle of 45° to 60° is selected to ensure uniform brightness of surface details.

[0043] The light source array is installed symmetrically on both sides of the conveying mechanism with the enamel plate conveying path as the center. The vertical distance between each light source and the surface of the enamel plate is fixed at 200mm, and the horizontal distance can be finely adjusted according to the width of the conveying line (range 50~80mm) to ensure that the light uniformly covers the surface of the enamel plate without any blind spots.

[0044] The enamel plate conveying mechanism adopts a constant-speed through-type structure, with the conveying speed v set at 0.5m / s and speed fluctuation ≤ ±0.02m / s. At this speed, it can ensure that the illumination time of each group of light sources on the same position of the enamel plate is ≥10ms, meeting the requirements of synchronous imaging by the camera. A new high-precision encoder (resolution <0.1mm / pulse) is added to record the displacement of the enamel plate in real time, and the displacement is stored synchronously when each image is acquired. (o=1~4 corresponds to 4 sets of polarization conditions), misalignment is compensated through image registration algorithm to adapt to high-speed production scenarios, coordinate registration formula. ,in, , The registered pixel coordinates of the o-th image group This represents the cumulative displacement during the acquisition of the o-th image group. Using pixel physical dimensions, a lightweight ORB image registration algorithm is adopted to improve real-time performance, and the registration error is controlled to <1 pixel.

[0045] By synchronously linking the light source switching, camera light, and encoder counting through the PLC controller, coordinated control is achieved: when a certain spatial position on the enamel plate passes through the light source array, the PLC triggers each group of light sources to light up in sequence according to the preset timing (0°→45°→90°→135°). The lighting time of each group of light sources is strictly synchronized with the camera exposure time, ensuring that the camera can acquire a complete original image of the same position under different polarization conditions.

[0046] A CMOS industrial camera with a resolution of 2448×2048 pixels, a pixel size of 3.45μm, and a frame rate of ≥30fps was selected. This resolution allows the smallest defect (diameter ≥0.1mm) on the enamel plate surface to correspond to ≥3 pixels, meeting the pixel accuracy requirements for defect identification. The high frame rate characteristics of the CMOS sensor can adapt to the synchronous acquisition requirements of multiple light source switching.

[0047] The camera is installed directly above the enamel panel, with the lens optical axis perpendicular to the enamel panel surface. The lens focal length is f=25mm, and the working distance (distance from the lens to the enamel panel surface) is 300mm. Based on the lens parameters, the camera's field of view is calculated to be 101mm×85mm. Since a single image cannot cover a standard enamel panel (1200mmx600mm), a line-by-line stitching mode is adopted. The camera moves with the conveyor mechanism, and the overlap rate of adjacent frames is set to 10% to ensure that the entire panel surface is captured without omission.

[0048] Images of defect-free enamel plates were acquired using four sets of polarized light sources. The actual light intensity of each light source was measured, and the light intensity ratio was calculated. , ( (Light intensity in the 0° polarization direction), exposure time adjustment formula: ,in The reference exposure time for the 0° polarization direction (initially set to 10ms). To adapt the exposure time for the o-th polarization condition, keep the camera's ISO sensitivity constant at 800 to ensure consistent exposure across all image groups (exposure = 100). Exposure time Light intensity); White balance is set to "Custom". Based on the global grayscale mean calibration of the defect-free enamel panel, 1000 random sample points of the defect-free enamel panel are collected, and the global grayscale mean is calculated. White balance gain = global grayscale mean / average grayscale value of the RGB channels of the sample points. It is adjusted through independent white balance gain of the three RGB channels to ensure the grayscale consistency of enamel panels of different colors and avoid the distortion of reflection intensity calculation caused by color interference; a global shutter mode is adopted to avoid image distortion caused by rolling shutter and ensure that the acquisition coordinates of the same pixel position under different light sources are accurately aligned.

[0049] When the enamel plate enters the detection area via the conveyor mechanism, the PLC detects the edge signal of the enamel plate through a photoelectric sensor, triggering the image acquisition process. The first set of light sources with polarization direction θ=0° is illuminated, the camera is exposed synchronously, and the first raw image is captured. I1(x,y) Where (x, y) are the image pixel coordinates; the first set of light sources is turned off, the second set of light sources with a polarization direction of θ=45° is turned on, the camera is exposed synchronously, and the second original image is acquired. I2(x,y) Following the logic described above, sequentially generate the original images corresponding to light sources with θ=90° and θ=135°. I3(x,y) , I4(x,y) collection; The enamel panel continues to move, and the above steps are repeated until the entire panel surface is captured, ultimately forming a sequence of original images for each spatial location of the enamel panel. {I1(x,y),I2(x,y),I3(x,y),I4(x,y)} Each image in the original image sequence corresponds to a different combination of polarization direction and illumination angle, resulting in significant differences in reflection intensity and highlight area distribution.

[0050] It should be noted that the specific relationship between the irradiation angle and polarization direction is as follows: For glossy glazes, the irradiation angle range is 30°~40°, with the optimal irradiation angle for each polarization direction being: 0° / 90° adjusted to 30°, 45° / 135° adjusted to 35°, and a reflection suppression rate of ≥75% required; For matte glazes, the irradiation angle range is 45°~60°, with the optimal irradiation angle for each polarization direction being: 0° / 90° adjusted to 50°, 45° / 135° adjusted to 55°, and a reflection suppression rate of ≥70% required; For colored glazes, the irradiation angle range is... The optimal illumination angle for each polarization direction is 35° to 55°: 0° / 90° is adjusted to 40°, 45° / 135° is adjusted to 45°, and the reflection suppression rate is required to be greater than or equal to 72%. After adjusting the illumination angle, four sets of polarization images of the defect-free enamel plate are acquired, and the reflection suppression rate of each set of images is calculated (reflection suppression rate = (number of reflective pixels before adjustment - number of reflective pixels after adjustment) / number of reflective pixels before adjustment x 100%). If the reflection suppression rate of a certain polarization direction is lower than the adaptation matrix requirement, the illumination angle is finely adjusted (step size + 1°) until all polarization directions meet the requirements.

[0051] The original image is fused using a point-by-point optimal gray-level fusion method to obtain a real-time reflection-suppressed image. The steps are as follows: For the same pixel position (x, y) in the original image sequence, the gray value with the weakest reflection and the most favorable contrast for defect observation is selected from the gray values ​​corresponding to the four polarization conditions. This gray value is used as the final gray value of the pixel in the real-time reflection suppression image. This method can eliminate the specular reflection component of each pixel in a targeted manner, rather than processing it uniformly worldwide, thus avoiding the loss of local details caused by global processing.

[0052] Before testing, 100 sample points (covering different areas of the board surface) were collected from the current batch of defect-free enamel panels. The minimum gray value under diffuse reflection and the maximum gray value under specular reflection saturation were statistically analyzed. First, the pixel points were defined. In the Reflection intensity under operating conditions The calculation formula is:

[0053] in, For polarization condition group index, For the first Pixel under group working conditions grayscale value, The lowest grayscale value under diffuse reflection state of a defect-free enamel panel. This represents the highest grayscale value when the specular reflection of the enamel panel reaches saturation. For pixels In the The reflection intensity under the working conditions is such that the closer the value is to 0, the weaker the reflection, and the closer the value is to 1, the stronger the reflection.

[0054] It should be noted that the parameter values ​​in the formula are based on the calibration results of the diffuse / specular reflection state of the defect-free enamel plate. Take the minimum gray value of the 100 sample points in the current batch. Take the maximum grayscale value of the 100 sample points in the current batch. If after calculation... <0, take =0; if >1, take =1, ensuring the reflection intensity is within the [0,1] range to avoid distortion. The calibration is repeated before testing each batch of enamel panels. If the glaze color and process remain unchanged within a batch, the calibration value can be checked every 100 panels to ensure stability. This formula converts pixel grayscale values ​​under different working conditions into a unified reflection intensity index, facilitating comparison of pixel reflectivity across working conditions and avoiding grayscale contrast distortion caused by slight differences in light source brightness.

[0055] Preset three-level neighborhoods: a 3×3 neighborhood is adopted for small-scale defects (area S<0.25mm), a 5×5 neighborhood is adopted for medium-scale defects (0.25mm<S≤4mm), and a 7×7 neighborhood is adopted for large-scale defects (S>4mm). The defect area is first estimated by the total number of pixels N in the difference region , then the corresponding neighborhood is automatically matched according to S, and the pixel point local variance within the corresponding neighborhood under the o-th group of working conditions has the calculation formula:

[0056] wherein, is the pixel corresponding neighborhood pixel coordinates, M and N are neighborhood sizes, is the average gray value within the neighborhood of the pixel group of working conditions , is the local variance of the pixel point within the corresponding neighborhood under the o-th group of working conditions, K is the half width of the neighborhood, and are neighborhood pixel indexes.

[0057] This formula is used to quantify the local detail contrast of pixel points, avoid local detail blurring caused by screening only based on reflection intensity, and ensure that the screened gray value has no strong reflection interference and can clearly present surface texture and defect details.

[0058] For each pixel point , the comprehensive evaluation score has the calculation formula:

[0059] wherein, and are weight coefficients, is the reflection suppression contribution term, a larger value indicates a better reflection suppression effect, is the normalized contrast contribution term, a larger value indicates a better contrast, is the maximum effective contrast value, which is 120, is the comprehensive evaluation score, and the gray value corresponding to the working condition with the highest score is the optimal gray value of the pixel.

[0060] It should be noted that the weight coefficients are selected according to the glaze color type of the enamel plate, for bright glaze: = 0.7, = 0.3, for matte glaze: = 0.4, = 0.6, for colored glaze: = 0.5, =0.5, allowing users to adjust the weights within ±0.1 based on actual detection results (such as false detection rate and false negative rate), improving the flexibility of the method and adapting to special process enamel plates.

[0061] Ultimately, real-time reflection suppression image The formula for generating it is:

[0062]

[0063] in, The working condition number that yields the highest overall evaluation score. For the optimal working condition of the pixel grayscale value, This is for real-time reflection suppression images.

[0064] It should be noted that the score difference threshold ΔF = 0.05 is set for multiple working conditions. If the difference is less than ΔF, the average of these grayscale values ​​is calculated as the final grayscale value of the pixel to avoid texture inconsistency caused by selecting a single condition.

[0065] First, read the original image sequence. {I1(x,y),I2(x,y),I3(x,y),I4(x,y)} Calculate for each pixel sequentially The optimal operating condition is selected using the argmax function. Extract the corresponding grayscale value as The pixel values ​​are used to traverse all pixels to obtain a complete real-time reflection suppression image. After point-by-point fusion, the real-time reflection suppression image is smoothed by 3x3 Gaussian (standard deviation = 0.5) to eliminate gray-level abrupt changes between adjacent pixels while preserving defect details. The gray-level variance of the fused image is calculated. If the gray-level variance > 50 (indicating excessive image brightness fluctuation), the weights or neighborhood parameters are readjusted, and the reflection suppression image is regenerated to ensure uniform overall image brightness and provide a stable image foundation for subsequent steps.

[0066] Step S2: Acquire a defect-free reflection suppression image of the enamel panel, and perform matching analysis between the defect-free reflection suppression image and the real-time reflection suppression image using the improved PaDiM algorithm to obtain the differential texture region and record the coordinates of the differential texture region; This step addresses the core issue of the wide range of normal texture variations in enamel panels caused by different glaze colors and firing processes, and the difficulty of traditional detection methods in distinguishing natural texture differences from actual defects. It constructs a reference model of normal enamel texture covering multiple working conditions and optimizes the texture matching mechanism to achieve precise block-by-block matching of the reflection-suppressed image. Its core purpose is to filter out normal texture fluctuations such as natural color differences in the glaze and slight firing unevenness, selecting only texture areas that significantly deviate from the normal texture distribution. This allows for focused targeting in subsequent fine-grained defect identification, reducing false positives and false negatives, and ensuring the adaptability and stability of the detection system under complex working conditions.

[0067] Fifty defect-free enamel plate samples were selected, covering mainstream glaze colors (glossy and matte), firing temperatures (850℃~950℃), and cooling processes (natural and forced cooling) used in industrial production. Each sample measures 1200mm × 600mm (standard industrial specifications). For each sample, a corresponding defect-free reflection suppression image was generated using the multi-polarization light source array and image fusion process in step S1, ensuring that all sample images are in a diffuse reflection state without specular reflection interference.

[0068] The defect-free reflection suppression images were divided into non-overlapping texture image patches of size 100×100 pixels, resulting in a dataset containing 144,000 defect-free reflection suppression image patches, covering typical normal texture features under different working conditions, providing sufficient and comprehensive sample support for model training.

[0069] Wide ResNet-50 was selected as the feature extraction network. By widening the number of channels in the residual module, this network can extract richer mid-to-low-level texture features while maintaining computational efficiency. Compared with networks such as ResNet-18 and VGG-16, it improves the representation ability of fine textures of enamel panels by more than 20%, and is adapted to the complex characteristics of enamel textures.

[0070] Network parameter configuration: Transfer learning is performed using weights pre-trained on the ImageNet dataset. The parameters of the first 10 layers are frozen to retain general feature extraction capabilities, and the parameters of the last 20 layers are fine-tuned to adapt to enamel texture features. The input image patch size is 100×100 pixels, the output feature vector dimension is 64, and the feature extraction step size is set to 1 to ensure that each defect-free reflection-suppressed image patch can obtain complete feature representation.

[0071] For each defect-free reflection suppression image patch in the dataset, Wide ResNet-50 is selected as the feature extraction network. A 100x100 pixel defect-free reflection suppression image patch is input into the network. From the feature map output by its layer 2 stage, the feature map of each channel is compressed into a scalar value through global average pooling, thus obtaining an initial feature vector of 512 dimensions.

[0072] To reduce subsequent computational complexity and model storage overhead, and to avoid the curse of dimensionality, principal component analysis was used to reduce the dimensionality of the initial 512-dimensional feature vector, retaining the 64 most important principal components, ultimately generating a 64-dimensional normal texture feature vector for constructing the texture model. Where (p, q) represents the index coordinates of the texture image patch, p represents the row index (increasing from top to bottom), q represents the column index (increasing from left to right), and k represents the dataset sequence number. For image patches located at the same index position (p, q) in all sample images, their 64-dimensional normal texture feature vectors are extracted. Based on the feature vectors of K defect-free training samples at (p,q), a set containing K 64-dimensional feature vectors is formed, and a normal enamel texture reference model at position (p,q) is constructed. The specific steps are as follows: Mean vector This represents the average level of texture features of all normal samples at position (p, q). The formula for calculating the mean vector is:

[0073] in, The total number of training samples. The mean of the feature dimension corresponding to each element reflects the normal distribution center of that feature dimension.

[0074] covariance matrix The covariance matrix, representing the correlation and dispersion of texture features across all dimensions of all normal samples at position (p,q), is calculated using the following formula:

[0075] in, The deviation between a single feature vector and the mean vector is used to construct the outer product matrix, reflecting the correlation between feature dimensions. For regularization terms, the value is... Its purpose is to avoid singular (non-invertible) covariance matrices. It is a 64th order identity matrix. Let be the covariance matrix.

[0076] To ensure the normal texture model has broad adaptability, this method employs a fusion calculation strategy: when constructing the reference model at position (p, q), the feature vectors of all defect-free samples with different glaze colors and firing processes at that position are treated as a whole for statistical calculation. This strategy enables the model to learn and cover various compliant normal texture fluctuations during the production process (such as natural color differences in glazes and slight uneven firing), thereby avoiding misjudging normal fluctuations as defects.

[0077] For specific application scenarios with special high-precision requirements (such as producing only a single glaze color), a separate calculation strategy can be adopted, that is, to build an independent normal texture model library for each major glaze color type and select it during detection.

[0078] Weighted Mahalanobis distance is used for anomaly measurement. The weight matrix is ​​set based on the contribution of different feature dimensions to the discrimination of defects in enamel panels. This allows for targeted enhancement of the contribution of defect-sensitive features and weakening of interference from irrelevant features or noise when calculating the deviation of the detected features from the normal model. Differentiated weights are assigned to different feature dimensions, and the calculation formula is as follows:

[0079] in, Coordinates in the image to be detected Feature vectors of texture blocks The weights are diagonal, ensuring independent weighting across feature dimensions. This is the inverse of the covariance matrix, used to eliminate the influence of correlation between feature dimensions. The weighted Mahalanobis distance value reflects the degree of deviation between the texture block to be detected and the normal texture model. The larger the value, the more significant the deviation and the more likely it is to be a defect area.

[0080] It should be noted that the weights in the diagonal weight matrix are determined based on experiments conducted using 100 enamel panel samples containing minor defects. The contribution of each feature dimension to defect identification was calculated (measured using information gain). The formula for calculating information gain is as follows: , The initial entropy for defect identification, Let A be the conditional entropy given a feature dimension A, and D be the set of defective / normal sample labels. The larger the value, the stronger the discriminative power of that feature dimension. The data is sorted as follows: the top 30% are high-contribution dimensions (weight 1.8~2.0), the middle 40% are medium-contribution dimensions (weight 1.0~1.5), and the bottom 30% are low-contribution dimensions (weight 0.5~0.8). The specific form of the weight matrix is ​​as follows: ,in The weight of the i-th feature is given by the weight matrix. This formula strengthens the contribution of defect-sensitive features and weakens the interference of irrelevant features, making the distance calculation more suitable for the needs of enamel defect detection.

[0081] The original PaDiM algorithm typically integrates three layers of semantic features: layer 1, layer 2, and layer 3. This results in redundant feature dimensions, with lower-level features (layer 1) containing excessive noise and higher-level features (layer 3) being overly abstract, leading to a loss of detail. To address the characteristic of enamel panel textures being primarily composed of low-to-mid-level features (texture details and local structure), the semantic layer selection is optimized, using only layer 2 semantic features for modeling.

[0082] Layer 2 semantic layer can preserve the key details of enamel texture (such as tiny bumps and fine lines) while filtering out high-frequency noise from layer 1. At the same time, it reduces the feature dimension from the traditional 128 dimensions to 64 dimensions, reducing the model's storage and computational load. Comparative experiments have verified that on 1000 samples, the normal texture coverage of layer 2 features reaches 98.7%, while the coverage of the fused features of layer 1 and laver3 is 99.0%, but the computational load increases by 3 times. Therefore, to balance accuracy and efficiency, only laver2 features are used.

[0083] The real-time reflection suppression image generated in step S1 Following the same rules as training the defect-free reflection suppression image, the image is divided into 100×100 pixel texture analysis sub-regions, with the spatial coordinates of each sub-region as follows: For each sub-region, a 64-dimensional real-time texture feature vector is extracted using the optimized Wide ResNet-50 (extracting only layer 2 features). .

[0084] By matching and analyzing defect-free reflection suppression images and real-time reflection suppression images using an improved PaDiM algorithm, the differential texture regions are obtained and their coordinates are recorded. The steps are as follows: Real-time texture feature vectors for each texture analysis sub-region Call the corresponding spatial coordinates Enamel normal texture reference model This reference model is constructed based on a multivariate Gaussian distribution, where the mean vector... Distribution centers representing normal texture features, covariance matrix The correlation and dispersion of each dimension of the characterization feature together constitute the probability distribution boundary of the defect-free texture, realizing a quantitative description of normal texture fluctuations. The deviation is calculated using the weighted Mahalanobis distance formula. .

[0085] It should be noted that, in order to ensure the compatibility of the matching working conditions, before testing, the corresponding mean vector and covariance matrix should be called from the model library according to the glaze color and firing process information of the enamel plate to be tested. If there is no completely matching model for the working condition to be tested, the nearest working condition model (such as the glossy glaze close working condition) should be used, and the difference should be adapted by fine-tuning the weight matrix (the deviation should not exceed ±0.2). At this time, a low confidence level should be given and manual verification should be recommended.

[0086] Calculate the weighted Mahalanobis distance values ​​for all normal texture sub-regions based on the current batch of defect-free samples, and use the 99.9th percentile as the threshold. At the same time, a working condition correction factor is introduced. Operating condition correction factor Based on the reflective properties of the glaze: Brightness axis =1.0 (strong reflection, threshold needs to be strict), matte finish =0.9 (the weak reflection threshold can be relaxed), colored glaze =1.0, and optimized through cross-validation, the final threshold is... The threshold is determined based on the following criteria: the false positive rate for normal texture areas is ≤0.5%, and the recall rate for slightly defective areas is ≥95%.

[0087] When the deviation of a certain sub-region > When the region is identified as a region with different textures, its spatial coordinates are marked. And pixel-level contours (obtained by mapping the coordinates of sub-region boundaries).

[0088] Adjacent differential texture sub-regions are merged using an 8-neighborhood merging strategy to form continuous differential texture regions, avoiding fragmented markings caused by defects crossing sub-regions. A minimum area threshold of 0.01 square millimeters is set (corresponding to a pixel count greater than or equal to 3 after correction in step S1), and false differential regions with an area smaller than this threshold are removed. After merging, the minimum bounding rectangle and area of ​​each differential texture region are recorded, as well as spatial information such as the coordinates of the differential texture regions. The contour information (polygon vertex coordinates) and grayscale distribution features of the differential regions are supplemented by recording, providing target region data for subsequent defect type identification.

[0089] Step S3: Within the differential texture region, feature extraction and fusion of the real-time reflection suppression image are performed using the scale attention feature extraction method to obtain a real-time fusion matrix. Feature extraction and fusion of the defect-free reflection suppression image are performed using the scale attention feature extraction method to obtain a standard fusion matrix. Similarity matching is performed between the real-time fusion matrix and the standard fusion matrix to obtain the defect detection result. This step targets the differential texture regions identified in step S2, focusing on common defects in enamel panels such as bubbles, cracks, black spots, glaze loss, and exposed substrate. It addresses the core issues of traditional methods—poor adaptability and low classification accuracy for multi-scale and multi-morphological defects—through multi-scale structural feature analysis and cross-dimensional feature fusion classification. Its core objective is to extract multi-scale features that combine global structure and local details from the differential regions, construct a standardized feature representation system, and achieve automated and refined defect type identification through precise similarity matching. This provides clear type criteria for subsequent defect grading and feedback, ensuring the relevance and reliability of the detection results.

[0090] It should be noted that the scale attention feature in step S3 and the 64-dimensional texture feature in step S2, which are progressive correlation features from basic screening to precise classification, are not the same features. The 64-dimensional texture feature in step S2 is extracted based on the defect-free area of ​​the entire board surface, focusing on the global fluctuations of normal texture (such as glaze uniformity and basic roughness). Its core purpose is to screen out the difference areas that deviate significantly from normal texture. The feature has universality and broad coverage. The scale attention feature of step S3 is extracted only from the difference region output by step S2, focusing on the multi-scale structured characteristics specific to defects. It is a local deepening of the general texture features of S2 and a focus on the defect dimension. Its core purpose is to distinguish the defect type.

[0091] The feature extraction in step S3 uses the coordinates, contours, and areas of the difference region output in step S2 as input boundaries. Multi-scale feature extraction is performed only within this local area to avoid redundant calculations caused by full-plane processing. At the same time, it ensures that feature extraction focuses on the core defect region and improves classification accuracy.

[0092] Within the differential texture region, feature extraction and fusion are performed on the real-time reflection suppression image using the scale attention feature extraction method to obtain a real-time fusion matrix. Similarly, feature extraction and fusion are performed on the defect-free reflection suppression image using the scale attention feature extraction method to obtain a standard fusion matrix. The steps are as follows: Based on the industrial inspection needs for enamel panel defects and their common size ranges, areas of differential texture are divided into three scale levels according to their area. The classification standard is based on statistical data from 1000 enamel panels containing defects (defect area). 0.0025mm2~25mm2 ), as detailed below: Small-scale region: area S<0.25mm2 This corresponds to small defects such as black spots and microbubbles (diameter ≤ 0.5mm); Medium-scale areas: 0.25mm2≤S≤4mm2 This corresponds to medium-sized cracks, localized glaze loss, and other defects (0.5~2mm in length); large-scale areas: S>4mm2 This corresponds to defects such as large areas of exposed substrate and long cracks (length > 2mm).

[0093] The structural characteristics of defects at different scales differ significantly (e.g., small-scale defects are mainly characterized by abrupt changes in grayscale, while large-scale defects are mainly characterized by contour morphology). Scale-based analysis can extract features in a targeted manner, avoiding the loss of details or redundant interference caused by single-scale analysis.

[0094] First, the actual physical area of ​​the difference region is obtained through pixel coordinate transformation. The calculation formula is as follows:

[0095] in, The total number of pixels in the difference region is obtained by counting the foreground pixels after binarization. and The pixel physical size is calculated from the camera resolution and the camera's field of view. This represents the actual physical area of ​​the region of difference.

[0096] Feature extraction is performed using a multi-scale channel spatial attention module (MCSAM). This module captures features at different scales through multi-branch dilated convolution and enhances defect features by combining channel-space dual-dimensional attention, thus adapting to the multi-morphological characteristics of enamel defects. The specific parameter configuration of the module is as follows: The input is a reflection suppression image patch of the difference region (adaptively cropped by scale, with small-scale regions cropped to 32×32 pixels, medium-scale regions to 64×64 pixels, and large-scale regions to 128×128 pixels). The Multi-Scale Feature Extraction (MFEM) module contains four parallel dilated convolutional branches with dilation rates of 1, 2, 4, and 8, respectively. The kernel size of each branch is 3×3, and the number of output channels is 64. The dilation rate is determined as follows: dilation rate 1 captures an 11×11 receptive field (suitable for small-scale defects), and dilation rate 8 captures a 25×25 receptive field (suitable for large-scale defects). The four branches can fully cover the scale range of enamel defects. The Group Normalization (GN) module normalizes the output features of each branch by dividing them into 8 groups according to the channel, avoiding statistical bias caused by small batch data and adapting to the small batch characteristics of real-time processing in industrial inspection. The activation function used is the SiLU function, and the formula is as follows: ( The Sigmoid function, compared to the ReLU function, can better preserve the nonlinear expression of features and improve the discriminative power of small-scale defect features.

[0097] The multi-scale feature extraction process is as follows: The image patches representing the differences are processed by four dilated convolution branches of MFEM, which output multi-scale feature maps respectively. , , , (The dimensions are all (H×W×64), where (H and W) are the size of the input image patch). Each branch feature corresponds to the structural information under different receptive fields (e.g., branch 1 focuses on edge details, and branch 4 focuses on the global contour). The feature maps of the four branches are concatenated by channel to obtain an aggregated feature map of (H×W×256). A 256-dimensional channel statistical vector is generated by global average pooling. After mapping through two layers of MLP (128-dimensional hidden layer), a channel weight vector is generated by the Sigmoid function. The channel weight vector is multiplied by the aggregated feature map by channel to obtain a channel-weighted feature map. The weighted feature map strengthens the defect-sensitive channels (e.g., the channel weight corresponding to the crack edge is increased, and the channel weight corresponding to the background texture is suppressed). The channel-weighted feature map is split into branches. Each branch feature map is compressed into a (H×W×1) spatial encoding map by 1×1 convolution. After concatenation, an aggregated spatial map of (H×W×4) is obtained. A spatial weight map is generated by 7×7 convolution and multiplied pixel by pixel with the split branch feature map to highlight the key spatial positions of the defect area (such as the center of the bubble and the end of the crack). The four branch feature maps, after channel-spatial weighting, are concatenated by channel and compressed into a (H×W×128) multi-scale fused feature map through a 1×1 convolution. This feature map combines structural information at different scales with feature enhancement of key regions, providing high-quality input for subsequent feature parsing.

[0098] From the fused feature map Six core structural feature parameters are extracted, covering three dimensions: shape, grayscale, and edge, to meet the needs of distinguishing different types of defects. The calculation methods and significance of each parameter are as follows: The area S reflects the overall size of the defect; the aspect ratio R: the minimum bounding rectangle of the defect is obtained using OpenCV's minAreaRect function, and the ratio of the length to the width of the minimum bounding rectangle is calculated using the following formula: ,in This is the length of the longest side of the circumscribed rectangle. The shortest side length is denoted by R; for crack-type defects, R>5, and for bubble-type defects, R≈1, which are key parameters for morphological differentiation. Edge sharpness E characterizes the degree of grayscale abrupt change between the defect edge and the background, and is calculated using the following formula:

[0099] in: The set of defect edge pixels is extracted using the Canny operator. This represents the total number of edge pixels. and Let be the Sobel gradient values ​​of pixel (x, y) in the x and y directions. The value represents edge sharpness. A larger value indicates a sharper edge (such as cracks or glaze defects), while a smaller value indicates a more blurred edge.

[0100] Internal grayscale transition smoothness The formula reflecting the uniformity of grayscale within a defect is as follows:

[0101] in, For the set of pixels in the defect area, This represents the total number of pixels in the defect area. For pixels grayscale value, The average gray value of the defect area. This refers to the smoothness of the internal grayscale transition. The smaller the value, the more uniform the grayscale (such as bubbles or black spots), while the larger the value, the greater the grayscale fluctuation (such as areas with glaze loss).

[0102] Contour connectivity C: Measured by the number of connected components in the defect contour, calculated using the following formula: ,in The number of connected components in the contour directly reflects the degree of defect dispersion. For crack-type defects, C≈1 (single connected component), and for black dot cluster defects, C>1 (multiple connected component). Grayscale contrast The grayscale difference between the defective area and the surrounding normal area is calculated using the following formula:

[0103] in, The average gray value of the defect area. The average grayscale value of the normal area 5 pixels wide surrounding the defect. For grayscale contrast, defects such as exposed base and glaze loss have a grayscale value of C_g > 0.3 (significant difference in grayscale from the substrate), while defects such as black spots have a grayscale value of C_g < -0.2.

[0104] To eliminate the dimensional differences between different feature dimensions, the six core feature parameters are first standardized using the following formula:

[0105] in, Here, represents the original feature parameters, and 'i' represents the index of the core feature parameter. , The standard deviation of this feature in the standard defect sample set. The standardized feature values ​​ensure that the weights of each feature are balanced.

[0106] A 2×3D real-time fusion matrix is ​​constructed using six standardized feature values ​​in a fixed order (area, aspect ratio, edge sharpness, internal grayscale transition smoothness, contour connectivity, and grayscale contrast). The format is as follows: The first row of the matrix focuses on morphological and edge features, while the second row focuses on grayscale and connectivity features. This ensures both the structured representation of features and facilitates subsequent similarity calculations.

[0107] 100 standard samples of each of the five typical defects in enamel panels (bubbles, cracks, black spots, glaze peeling, and exposed substrate) were selected. Features of each sample were extracted and a fusion matrix was constructed according to the above process to obtain the standard fusion matrix for each type of defect. ( =1~5 correspond to 5 types of defects).

[0108] Cosine similarity is used to measure the degree of matching between the real-time fusion matrix and the standard fusion matrix. The calculation formula is as follows:

[0109] in, This is a matrix vectorization operation that converts a 2×3 matrix into a 6-dimensional column vector. For real-time fusion matrix, For the first The standard fusion matrix of class-standard defects Represents the vector dot product. The L2 norm of a vector. The value is cosine similarity; the closer the value is to 1, the higher the feature matching degree between the area to be detected and the standard defect of this type.

[0110] Calculate the real-time fusion matrix Similarity with 5 standard fusion matrices Set the national value for similarity difference. T=0.05, Mixing threshold =0.65 (Based on ROC curve analysis of 1000 mixed defect samples, the accuracy rate of single defect identification is >94%, and the false negative rate of mixed defects is ≤3%); Defect priorities are set (based on the industry standard "Enamel Plate Quality Grading Specification"): cracks and exposed base directly affect structural strength (weight 1.0), glaze peeling affects corrosion resistance and aesthetics (weight 0.9), bubbles affect appearance (weight 0.8), and black spots only slightly affect appearance (weight 0.5). Calculate the difference between the highest similarity and the second highest similarity. SIM, if SIM> T is then determined to be the single defect type corresponding to the highest similarity. SIM≤ If the similarity score is T, the process proceeds to priority determination. Based on the preset defect type priority, the defect type with the higher priority is selected as the primary classification, and the defect type with the second highest similarity is marked as an "associated defect" and included in the detection results. If the similarity of two or more types of defects is higher than the mixed threshold, the process continues. If the core parameters of the defect area simultaneously meet the typical range of the corresponding defect, it is determined to be a mixed defect. The two defect types and their corresponding core parameters are recorded, and a manual review confirmation is prompted.

[0111] The final defect detection results include the defect type and the corresponding structural feature parameters. The structural feature parameters corresponding to the defect type are: crack length L, bubble diameter D, black spot area S, and glaze loss / exposed base area S.

[0112] Step S4: Perform coordinate transformation on the coordinates of the differential texture area to obtain the defect location result. Calculate the comprehensive defect score based on the defect detection result. Classify the defect level according to the comprehensive defect score to realize the surface defect detection of the enamel plate.

[0113] The coordinates of the differential texture regions are transformed to obtain the defect location results. The steps are as follows: The defect center point pixel coordinates (u, v) are obtained based on the difference texture region information output in step S2, and further pixel-level analysis is performed. Their relationship with the image block index (p, q) is as follows: The output of step S2 is a series of coordinates of differential texture regions, including image patch indices (p, q). Each (p, q) corresponds to a 100x100 pixel image region. For each differential region identified by (p, q), a corresponding image patch is extracted from the original high-resolution image based on the pixel range mapped by (p, q). Within this image patch, an adaptive threshold segmentation algorithm or activation region analysis based on the S2 feature map is used to obtain a precise binary mask of the defect (where the defect pixel value is 1 and the background is 0). The minimum bounding rectangle of the defect mask is calculated, and the pixel coordinates of its center point are (u, v), calculated using the following formula:

[0114] in, , , and These are the boundary coordinates of the smallest bounding rectangle.

[0115] A four-level coordinate transformation system is constructed, consisting of image pixel coordinates, camera coordinates, world coordinates, and enamel plate physical coordinates, to achieve accurate mapping of defects from image pixel positions to their actual physical positions on the plate surface. The coordinate systems are defined as follows: Image pixel coordinate system The origin is the upper left corner of the reflection suppression image generated in step S1. The u-axis extends horizontally to the right along the image, and the v-axis extends vertically downwards along the image. The unit is pixels. Camera coordinate system With the optical center of the industrial camera lens as the origin, the x-axis is parallel to the image u-axis, the y-axis is parallel to the image v-axis, and the z-axis is perpendicular to the lens optical axis forward. The unit is millimeters. World coordinate system The origin is the center point of the enamel plate inlet at the inspection station of the conveyor line. The X-axis is along the direction of the conveyor line, the Y-axis is perpendicular to the conveyor line and moves horizontally to the right, and the Z-axis is perpendicular to the conveyor line and moves upward. The unit is millimeters. Enamel plate physical coordinate system The origin is the top left corner of a single enamel panel. The A-axis runs along the length of the panel (parallel to the X-axis of the world coordinate system), and the B-axis runs along the width of the panel (parallel to the Y-axis of the world coordinate system). The unit is millimeters.

[0116] The transformation from pixel coordinates to camera coordinates eliminates image distortion and converts the image to 3D camera coordinates. The formula is as follows:

[0117] Where (u,v) are the coordinates of the center point of the defect in the image pixel coordinate system. The camera intrinsic parameter matrix was obtained using Zhang Zhengyou's calibration method. This is the inverse of the intrinsic parameter matrix, used to eliminate the effects of camera lens distortion. The fixed working distance from the camera to the enamel plate surface, ( , , ) represents the three-dimensional coordinates of the defect in the camera coordinate system.

[0118] The formula for transforming from camera coordinate system to world coordinate system is:

[0119] in, It is a 3×3 rotation matrix, representing the pose of the camera coordinate system relative to the world coordinate system. The translation matrix is ​​3×1, representing the position of the camera's optical center in the world coordinate system. , , ) represents the three-dimensional coordinates of the defect in the world coordinate system.

[0120] The final defect location result is obtained, which is the final coordinate of the defect in the physical coordinate system of the enamel plate. The conversion formula from the world coordinate system to the physical coordinate system of the enamel plate is as follows:

[0121] in,( , ) represents the coordinates of the top-left corner vertex of the current enamel panel in the world coordinate system. B) represents the final coordinates of the defect in the physical coordinate system of the enamel plate. Let be the rotation matrix of the enamel plate relative to the world coordinate system.

[0122] To address the coordinate offset issue caused by the movement of the enamel plate, a PLC controller is used to synchronously link defect acquisition with conveyor line coding. When the photoelectric sensor detects that the enamel plate has entered the inspection station, it triggers the code counter to start counting and records the initial code value of the plate. When the camera acquires defect images, it simultaneously records the current encoded value. Calculate the displacement of the plate at the time of data acquisition. (Encoding accuracy 1mm / pulse); displacement By incorporating world coordinate system coordinate calculations, the accuracy of defect location mapping under motion conditions is ensured.

[0123] The following steps are taken to calculate a comprehensive defect score based on the defect detection results and classify the defect level according to the comprehensive defect score: A three-dimensional hierarchical index system based on defect type, core parameters, and location weight is constructed. The index selection is based on industrial quality standards and enterprise management needs, as detailed below: Defect type weight : Assign values ​​based on the degree of impact of defects on product performance, bubbles =0.8, crack =1.0 (affects structural strength, highest weight), black dot =0.5, glaze peeling =0.9, Exposed bottom =1.0, the above weight values ​​are set based on industry standards and a large amount of experimental data.

[0124] Core parameter quantization value For different defect types, select key parameters: for cracks, select length L; for bubbles, select diameter D; for black spots, select area S; and for glaze loss / exposed base, select area S.

[0125] Position weight The value is assigned based on the distance between the defect and the edge / hole of the plate. The distance is ≤50mm (edge ​​area, where defects are prone to be magnified). =1.2, distance >50mm and ≤200mm (middle area) =1.0, distance >200mm (center area) =0.8.

[0126] A comprehensive defect score is obtained through weighted calculation. The calculation formula is:

[0127] in, This is a normalization function for the core parameters of the defect, set according to different defect types. For the comprehensive score of defects, This is a defect density correction term. The correction factor is 0.2 when the number of defects is ≥3 and 0 when it is ≤2, to avoid a small number of defects excessively affecting the score. For defect type weights, For positional weights, Defect density.

[0128] It should be noted that, , The maximum allowable parameter value for this type of defect is given by the formula for calculating defect density. , This represents the number of defects. The standard deviation of the defect location. The distribution influence coefficient is set to 0.1.

[0129] Industrial verification using 1000 defective enamel panel samples (covering different defect types, parameters, and locations) was conducted to classify defect levels: Acceptable level: <0.6, the defect has no impact on product performance and requires no action; re-inspection required: 0.6≤ ≤1.2 indicates a potential risk and requires manual review and confirmation; must be removed. >1.2, defects that seriously affect product quality or performance must be removed from the production line.

[0130] For each defect identified in step S3, extract the type weight. Core parameter P, position weight and defect density Substitute into the grading scoring formula to calculate the comprehensive score. The defect classification level is determined based on the relationship between the score and the threshold. When a single board has multiple defects, the highest grade is used as the final quality grade of the board (for example, if a board has one acceptable defect and one defect that must be rejected, the board is classified as defective).

[0131] Furthermore, based on the above method embodiments, the present invention also provides an apparatus, including a memory, a processor, and a computer program stored in the memory, which is adapted to be loaded and executed by the processor to implement the above-described machine vision-based method for detecting defects on the surface of enamel plates.

[0132] It should be noted that, in this document, relational terms such as "first" and "second" are used merely 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 a process, method, article, or apparatus. Without further limitations, the phrase "comprising an element defined as..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0133] 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 method for detecting surface defects in enamel plates based on machine vision, characterized in that: Includes the following steps: Step S1: Acquire the original image of the enamel panel, and fuse the original image using the point-by-point optimal grayscale fusion method to obtain a real-time reflection suppression image. The specific steps are as follows: Based on the original image sequence {I1(x,y),I2(x,y),I3(x,y),I4(x,y)} Calculate the comprehensive evaluation score for each pixel in turn. Overall evaluation score The calculation formula is: ; in, and The weighting coefficient is selected based on the enamel glaze type. The maximum effective contrast value. To evaluate the overall score, For pixels The local variance in the corresponding neighborhood under the o-th working condition For pixels In the The reflection intensity under the group of working conditions, where o is the working condition index; Real-time reflection suppression image The formula for generating it is: ; ; in, The working condition number that yields the highest overall evaluation score. For the optimal working condition of the pixel grayscale value, For real-time reflection suppression images, This indicates taking the maximum value. Step S2: Acquire a defect-free reflection suppression image of the enamel panel. Perform matching analysis between the defect-free reflection suppression image and the real-time reflection suppression image using the improved PaDiM algorithm to obtain the differential texture regions and record their coordinates. This includes the following steps: Defect-free enamel plate samples were collected and fused using a point-by-point optimal gray-level fusion method to obtain a defect-free reflection suppression image. A normal enamel texture reference model was constructed, and semantic layer optimization was performed on the Wide ResNet-50 in the improved PaDiM algorithm, using only layer 2 semantic features to obtain the optimized Wide ResNet-50. The real-time reflection suppression image was then generated. The region is divided into texture analysis sub-regions. For each texture analysis sub-region, a real-time texture feature vector is extracted using the optimized WideResNet-50. Call the corresponding spatial coordinates The reference model for normal enamel texture is used to calculate the weighted Mahalanobis distance value. Weighted Mahalanobis distance value The calculation formula is: ; in, Coordinates in the image to be detected Feature vectors of texture blocks The weight matrix W is a diagonal weight matrix, determined based on the information gain value of each feature dimension for defect identification. It is the inverse of the covariance matrix. The weighted Mahalanobis distance value; Calculate the weighted Mahalanobis distance values ​​for the texture analysis sub-regions of defect-free enamel panels and enamel panels with minor defects, and use the 99.5th percentile as the base threshold. Introduce operating condition correction coefficient final threshold ; When the weighted Mahalanobis distance value of the texture analysis sub-region > When the texture analysis sub-region is determined to be a differential texture region, adjacent differential texture sub-regions are merged to form a continuous differential texture region, and the coordinates of the differential texture region are recorded. Step S3: Within the differential texture region, feature extraction and fusion of the real-time reflection suppression image are performed using the scale attention feature extraction method to obtain a real-time fusion matrix. Feature extraction and fusion of the defect-free reflection suppression image are performed using the scale attention feature extraction method to obtain a standard fusion matrix. Similarity matching is performed between the real-time fusion matrix and the standard fusion matrix to obtain the defect detection result. Step S4: Perform coordinate transformation on the coordinates of the differential texture area to obtain the defect location result. Calculate the comprehensive defect score based on the defect detection result. Classify the defect level according to the comprehensive defect score to realize the surface defect detection of the enamel plate.

2. The method for detecting surface defects of enamel plates based on machine vision according to claim 1, characterized in that: The process of acquiring the original image of the enamel panel includes the following specific steps: Linearly polarized LED light sources are selected as the light source array. The light source array contains four independently controllable linearly polarized light source units. The polarization direction θ of each light source is set to 0°, 45°, 90°, and 135°, respectively. The light source array is symmetrically arranged on both sides of the conveying mechanism with the enamel plate conveying path as the center. When the enamel plate passes through the light source array, the PLC controller illuminates each light source in sequence according to a preset timing sequence of 0°, 45°, 90°, and 135°. The illumination time of each light source is synchronized with the camera exposure time. The camera is installed directly above the enamel plate, with the lens optical axis perpendicular to the surface of the enamel plate. When the enamel plate enters the detection area through the conveying mechanism, the edge signal of the enamel plate is detected by a photoelectric sensor. When the edge signal of the enamel plate is detected, the original image of the enamel plate is acquired, resulting in an original image sequence. {I1(x,y),I2(x,y),I3(x,y),I4(x,y)} .

3. The method for detecting surface defects of enamel plates based on machine vision according to claim 2, characterized in that: The construction of the enamel normal texture reference model includes the following steps: The defect-free reflection suppression image is divided into non-overlapping defect-free reflection suppression image blocks. For each defect-free reflection suppression image block, normal texture feature vectors are extracted using Wide ResNet-50. Where (p,q) represents the index coordinates of the defect-free reflection-suppressed image patch in the sample image, and k represents the dataset index, a reference model for normal enamel texture is constructed. ; The formula for calculating the mean vector is: ; in, The total number of training samples. The mean of the feature dimension corresponding to each element. This is a normal texture feature vector; The formula for calculating the covariance matrix is: ; in, For regularization terms, It is a 64th order identity matrix. Let covariance matrix be the variance matrix. It is the transpose of the deviation between the normal texture feature vector and the mean vector.

4. The method for detecting surface defects of enamel plates based on machine vision according to claim 3, characterized in that: Within the differential texture region, feature extraction and fusion of the real-time reflection suppression image are performed using scale attention feature extraction to obtain a real-time fusion matrix. Then, a normal enamel texture reference model is constructed for the defect-free image using scale attention feature extraction, comprising the following steps: The regions with different textures are divided into small-scale, medium-scale, and large-scale regions based on their area. The formula for calculating the actual physical area of ​​the regions with different textures is as follows: ; in, This represents the total number of pixels in the difference region. and For pixel physical size, The actual physical area of ​​the region of difference; A scale-channel spatial attention module is used to extract features from real-time reflection suppression images to obtain a real-time fusion matrix. Image patches in different regions are processed by four dilated convolution branches of the scale feature extraction module to output multi-scale feature maps. , , , The feature maps of the four branches are concatenated by channel to obtain an aggregated feature map. Channel statistical vectors are generated through global average pooling. After two layers of MLP mapping, channel weight vectors are generated using the sigmoid function. These channel weight vectors are multiplied by the aggregated feature map by channel to obtain a channel-weighted feature map. The channel-weighted feature map is then split by branch, and each branch feature map is compressed into a spatial encoding map through a 1×1 convolution. The spatial encoding maps of each branch are concatenated to obtain an aggregated spatial map. The aggregated spatial map is then used to generate a spatial weight map through a 7×7 convolution, which is multiplied pixel-by-pixel with the split branch feature maps to obtain four branch feature maps. These four branch feature maps are then concatenated by channel and compressed into a fused feature map through a 1×1 convolution. ; From the fused feature map Structural feature parameters are extracted from the data, and then standardized using the following formula: ; in, Here, represents the original feature parameters, and 'i' represents the index of the core feature parameter. and The minimum and maximum values ​​of this feature in the standard defect sample set are given. These are the standardized eigenvalues; A 2×3 dimensional real-time fusion matrix is ​​constructed by arranging the six standardized feature values ​​in a fixed order. , ; Five types of typical defects in enamel panels were selected as standard samples. For each sample, features were extracted and a fusion matrix was constructed according to the above process to obtain the standard fusion matrix for each type of defect. , Index for defect categories.

5. The method for detecting surface defects of enamel plates based on machine vision according to claim 4, characterized in that: The extraction of structural feature parameters from the fused feature map is as follows: The formula for calculating the aspect ratio R is: ,in This is the length of the longest side of the circumscribed rectangle. The length of the shortest side; The formula for calculating edge sharpness E is: ; in: The set of pixels at the edge of the defect. This represents the total number of edge pixels. and Let be the magnitude of the Sobel gradient of pixel (x, y) in the x and y directions. For edge sharpness; Internal grayscale transition smoothness The calculation formula is: ; in, For the set of pixels in the defect area, This represents the total number of pixels in the defect area. For pixels grayscale value, The average gray value of the defect area. For the smoothness of internal grayscale transition; The formula for calculating the contour connectivity C is as follows: ,in The number of connected components in the outline; Grayscale contrast The calculation formula is: ; in, The average gray value of the defect area. The average grayscale value of the normal area 5 pixels wide surrounding the defect. This refers to grayscale contrast.

6. The method for detecting surface defects of enamel plates based on machine vision according to claim 5, characterized in that: The process of performing similarity matching between the real-time fusion matrix and the standard fusion matrix to obtain the defect detection results includes the following specific steps: The formula for calculating the cosine similarity between the real-time fusion matrix and the standard fusion matrix is: ; in, For matrix vectorization operations, For real-time fusion matrix, For the first The standard fusion matrix of class-standard defects Represents the vector dot product. The L2 norm of a vector. Cosine similarity between the real-time fusion matrix and the standard fusion matrix; Calculate the real-time fusion matrix Similarity with 5 standard fusion matrices A similarity threshold is set by mixing defective samples. When there is a unique Make ≥ Then the region to be detected is determined to be the first... Class defects; when multiple Make ≥ Then, take the defect type corresponding to the maximum similarity. < If the defect is identified as a suspected defect, the defect detection result is obtained, which includes the defect type and the corresponding structural feature parameters.

7. The method for detecting surface defects of enamel plates based on machine vision according to claim 6, characterized in that: The coordinate transformation of the differential texture region coordinates to obtain the defect location result is as follows: Construct a four-level coordinate transformation system: image pixel coordinate system - camera coordinate system - world coordinate system - enamel plate physical coordinate system. The origin is the top left corner of the real-time reflection suppression image, the u-axis extends horizontally to the right along the image, and the v-axis extends vertically downwards along the image. Camera coordinate system With the optical center of the industrial camera lens as the origin, the x-axis is parallel to the image u-axis, the y-axis is parallel to the image v-axis, and the z-axis is perpendicular to the lens optical axis forward. World coordinate system With the center point of the enamel plate inlet of the conveyor line inspection station as the origin, the X-axis moves along the direction of the conveyor line, the Y-axis is perpendicular to the conveyor line and moves horizontally to the right, and the Z-axis is perpendicular to the conveyor line and moves upward. Enamel plate physical coordinate system With the top left corner of a single enamel panel as the origin, axis A is along the length of the panel, and axis B is along the width of the panel. The formula for transforming from pixel coordinates to camera coordinates is: ; Where (u,v) are the coordinates of the center point of the defect in the image pixel coordinate system. For the camera intrinsic parameter matrix, The inverse of the intrinsic parameter matrix. The fixed working distance from the camera to the enamel plate surface, ( , , () represents the three-dimensional coordinates of the defect in the camera coordinate system; The formula for changing the camera coordinate system to the world coordinate system is: ; in, It is a 3×3 rotation matrix. It is a 3×1 translation matrix, ( , , () represents the three-dimensional coordinates of the defect in the world coordinate system; The final defect location result is obtained, which is the final coordinate of the defect in the physical coordinate system of the enamel plate. The conversion formula from the world coordinate system to the physical coordinate system of the enamel plate is as follows: ; in,( , () represents the coordinates of the top-left vertex of the current enamel panel in the world coordinate system. B) represents the final coordinates of the defect in the physical coordinate system of the enamel plate. Let be the rotation matrix of the enamel plate relative to the world coordinate system.

8. The method for detecting surface defects of enamel plates based on machine vision according to claim 7, characterized in that: The calculation of the comprehensive defect score based on the defect detection results is as follows: A comprehensive defect score is calculated based on the defect detection results. The calculation formula is: ; in, This is a normalization function for the core parameters of the defect. For the comprehensive score of defects, For defect density correction term, For defect type weights, For positional weights, Defect density.

Citation Information

Patent Citations

  • Mirror reflection-based texture tile surface defect detection method

    CN118115468A

  • Stainless steel tube surface defect detection method and system

    CN121095233A