Image processing-based complex texture surface defect detection method
By constructing a differentiable physical operation layer with embedded discretized optical scattering partial differential equations, the nonlinear optical interference components on the surface of fiberglass products are decoupled, adaptive negative masks are dynamically generated, and anisotropic covariance matrices are constructed. This solves the decoupling problem between complex texture backgrounds and weak defect features in the production of fiberglass products, improving the accuracy and real-time performance of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LIANYUNGANG NAPURUI NEW MATERIAL CO LTD
- Filing Date
- 2026-07-02
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies struggle to effectively decouple complex textures from subtle defect features during fiberglass product manufacturing, resulting in high false positive and false negative rates in detection systems and making it difficult to meet the real-time online detection requirements of industrial production lines.
By constructing a differentiable physical computation layer with embedded discretized optical scattering partial differential equations, forward tensor operations are used to decouple nonlinear optical interference components, dynamically generating an adaptive negative mask to weaken the main peak energy, and constructing an anisotropic covariance matrix to calculate the directional adaptive Mahalanobis distance to determine defects.
It achieves high-fidelity decoupling between complex textured backgrounds and subtle defects, significantly improving the defect detection rate and generalization ability, reducing the false detection rate, and meeting the real-time online detection needs of industrial sites.
Smart Images

Figure CN122492704A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to a method for detecting defects on complex textured surfaces based on image processing. Background Technology
[0002] In the production process of fiberglass products, due to the complex processes of resin impregnation, fiber weaving, and high-temperature curing, microscopic defects such as tiny pores, fiber breaks, and resin buildup are easily generated on the surface and subsurface. Currently, non-contact non-destructive testing technology based on image processing and machine vision has become the mainstream method for quality control in this field due to its high testing efficiency.
[0003] However, at the optical imaging front end, the smooth, resin-rich layer covering the fiberglass surface is prone to strong specular reflections under conventional machine vision active light sources, leading to localized overexposure of the camera's image sensor. Simultaneously, when light penetrates the translucent resin and enters the interwoven glass fibers, it generates strong subsurface volume scattering. Existing optical inspection methods often only handle single surface reflections, resulting in severe degradation of the underlying image data and complete obliteration of the optical contrast of subtle defects. Secondly, in the feature extraction stage, the surface of fiberglass products exhibits high-density, anisotropic periodic high-frequency woven textures (such as plain weave and twill weave). These dramatic grayscale jumps and high-frequency edges generated by the interweaving of normal fibers are highly coupled with the actual minute defects in terms of geometry and grayscale distribution. Existing technologies typically use frequency domain filtering or traditional edge detection operators to suppress periodic textures. While filtering out background periodic textures, this inevitably smooths out the high-frequency edge features of subtle defects in the same frequency band, leading to extremely high false positive and false negative rates in industrial field inspection systems. Finally, faced with the complex images characterized by extremely low signal-to-noise ratios and high-frequency coupling, existing technologies tend to increase the depth of neural networks or use attention models with a large number of parameters to forcibly fit the background distribution in order to distinguish between complex background textures and subtle defects. This not only consumes enormous computing power, making it difficult to meet the millisecond-level real-time online detection requirements of industrial production lines, but also makes the models extremely prone to overfitting. Once faced with data on new batches or materials with different weave specifications, the model's generalization ability will drop precipitously.
[0004] In summary, under limited computing power, overcoming the masking effect of strong coupling backgrounds from multiple sources on weak defect features and achieving high-fidelity decoupling between complex texture backgrounds and weak defect features is a technical problem that urgently needs to be solved in this field.
[0005] To address this, a method for detecting defects on complex textured surfaces based on image processing is proposed. Summary of the Invention
[0006] The purpose of this invention is to provide a method for detecting defects on complex textured surfaces based on image processing. This invention acquires the original image of the surface to be detected, inputs it into a differentiable physical operation layer embedded with discretized optical scattering partial differential equations, decouples nonlinear optical interference components, and outputs an intrinsic feature map; performs a two-dimensional discrete Fourier transform on it, locates the discrete spatial frequency peaks representing periodic textures, dynamically generates an adaptive negative mask to weaken the main peak energy, and outputs an edge-preserving and noise-reducing feature map after inverse transform; extracts the target feature vector and peak direction vector, uses these as prior constraints to construct an anisotropic covariance matrix, and calculates the adaptive Mahalanobis distance; if the deviation exceeds a threshold, a defect is determined. This invention achieves high-fidelity decoupling between strongly coupled backgrounds and weak defects, significantly improving the accuracy of defect detection.
[0007] To achieve the above objectives, the present invention provides the following technical solution: Image processing-based methods for detecting defects on complex textured surfaces include: The original image of the fiberglass surface to be inspected is acquired and input into a differentiable physical operation layer. The differentiable physical operation layer contains an optical scattering partial differential equation processed by finite difference discretization. The nonlinear optical interference components in the original image are decoupled through forward tensor operation of the differentiable physical operation layer, and the intrinsic feature map is output. A two-dimensional discrete Fourier transform is performed on the intrinsic feature map to locate the discrete spatial frequency peaks that characterize the periodic texture background, and an adaptive negative mask is dynamically generated. The energy of the main peak is weakened by dot multiplication using the adaptive negative mask, and the edge-preserving and noise-reducing feature map is output through inverse discrete Fourier transform. The target feature vector of the edge-preserving and denoising feature map is extracted by the feature encoder, and the direction vector of the discrete spatial frequency peak is extracted. The direction vector is used as a priori constraint to construct the anisotropic covariance matrix that maps the pre-constructed benchmark feature cluster, and the direction adaptive Mahalanobis distance of the target feature vector is calculated. When the direction adaptive Mahalanobis distance exceeds the feature distribution deviation threshold, it is determined to be a defect.
[0008] Preferably, the construction process of the optical scattering partial differential equation through finite difference discretization includes: establishing a bidirectional reflection distribution function term to characterize the specular reflection optical component generated by the resin-rich layer contained in the surface of the fiberglass to be tested; establishing a dipole scattering function term to characterize the volume scattering optical component generated by light penetrating into the interwoven fiber layer contained in the surface of the fiberglass to be tested; transforming the spatial partial derivative term in the optical scattering partial differential equation into a discrete difference weight matrix between adjacent pixels; and using the discrete difference weight matrix to discretize and reconstruct the bidirectional reflection distribution function term and the dipole scattering function term to obtain the discretized optical scattering partial differential equation.
[0009] Preferably, the nonlinear optical interference components in the original image are decoupled through forward tensor operations of the differentiable physical operation layer to output an intrinsic feature map. Specifically, this includes: solidifying the discrete difference weight matrix into untrainable convolution kernel parameters in the differentiable physical operation layer; converting the original image into a multi-channel input tensor, and using the untrainable convolution kernel parameters to perform forward convolution operations on the multi-channel input tensor to calculate the first interference tensor corresponding to the specular reflection optical component; extracting the local low-frequency light intensity distribution of the multi-channel input tensor to generate a spatial heterogeneity prior map, using the spatial heterogeneity prior map to dynamically modulate the untrainable convolution kernel parameters to generate a spatially variable convolution kernel, and using the spatially variable convolution kernel to calculate the second interference tensor corresponding to the volume scattering optical component; subtracting the first interference tensor and the second interference tensor pixel by pixel from the multi-channel input tensor to obtain a reflectivity residual tensor and mapping it to a set physical reflectivity dimension range to generate an intrinsic feature map with physical dimensions.
[0010] Preferably, performing a two-dimensional discrete Fourier transform on the intrinsic feature map to locate the discrete spatial frequency peaks representing the periodic texture background specifically includes: performing a two-dimensional discrete Fourier transform operation on the two-dimensional pixel matrix of the intrinsic feature map, calculating the amplitude spectrum matrix and performing a frequency domain centering translation operation to move the DC component to the geometric center position of the two-dimensional coordinate system; calculating the amplitude gradient vector of the amplitude spectrum matrix, avoiding the reference radius range of the geometric center position; selecting the frequency points whose magnitude of the amplitude gradient vector is zero and whose eigenvalues of the second derivative matrix are negative as local extreme frequency points; extracting the local extreme frequency points whose amplitude values reach the preset background texture energy baseline, and marking the coordinate positions of the local extreme frequency points as the discrete spatial frequency peaks representing the periodic texture background.
[0011] Preferably, an adaptive negative mask is dynamically generated, and the energy of the main peak is weakened by dot-multiplication using the adaptive negative mask. Specifically, this includes: constructing a two-dimensional reciprocal attenuation surface on a two-dimensional frequency domain plane with the frequency coordinates of each discrete spatial frequency peak as the center, wherein the attenuation coefficient of the two-dimensional reciprocal attenuation surface is zero at the center and the attenuation coefficient increases nonlinearly to one along the direction away from the center; combining and splicing all the two-dimensional reciprocal attenuation surfaces to generate an adaptive negative mask matrix; performing element-wise multiplication of the adaptive negative mask matrix with the amplitude spectrum matrix, so that the energy at the discrete spatial frequency peak is reduced point-by-point according to the attenuation coefficient, while keeping the energy values of the non-peak regions in the amplitude spectrum matrix in their initial state, and obtaining an updated amplitude spectrum matrix for use inverse discrete Fourier transform.
[0012] Preferably, the target feature vector of the edge-preserving and denoising feature map is extracted by the feature encoder, specifically including: configuring a fully convolutional neural network containing multi-level residual connection layers and spatial pyramid pooling layers as the backbone information extraction structure of the feature encoder; connecting a contrastive learning projection head at the end of the backbone information extraction structure; inputting the edge-preserving and denoising feature map into the backbone information extraction structure, and extracting multi-scale intermediate layer semantic tensors by sequentially expanding the receptive field layer and semantic aggregation of local pixel regions; using the spatial pyramid pooling layer to perform dimension alignment and spatial dimensionality reduction operations on the multi-scale intermediate layer semantic tensors to obtain a global semantic tensor; and using the contrastive learning projection head to nonlinearly map the global semantic tensor to an implicit metric space, outputting the target feature vector within the implicit metric space.
[0013] Preferably, an anisotropic covariance matrix of the mapping reference feature cluster is constructed using the direction vector as a priori constraint. Specifically, this includes: calculating the direction vector representing the current texture extension direction based on the polar angle distribution values of the discrete spatial frequency peaks in the frequency domain coordinate system, and deriving the orthogonal normal vector perpendicular to the direction vector; establishing a covariance weight allocation mechanism, configuring a principal axis feature space aligned with the direction vector and assigning a first covariance eigenvalue parameter, configuring a secondary axis feature space aligned with the orthogonal normal vector and assigning a second covariance eigenvalue parameter, wherein the value of the first covariance eigenvalue parameter is greater than the value of the second covariance eigenvalue parameter; combining the multidimensional distribution discreteness of the reference feature cluster, the first covariance eigenvalue parameter, and the second covariance eigenvalue parameter, generating an anisotropic covariance matrix through matrix operations, such that the variance weight of the anisotropic covariance matrix in the texture extension direction is greater than its variance weight in the orthogonal normal vector direction.
[0014] Preferably, the method involves calculating the adaptive Mahalanobis distance, where a defect is identified when the adaptive Mahalanobis distance exceeds a feature distribution deviation threshold. Specifically, this includes: calculating the difference vector between the target feature vector and the cluster center of the baseline feature cluster; performing a quadratic operation on the difference vector and the inverse of the anisotropic covariance matrix to obtain the numerical result of the adaptive Mahalanobis distance; acquiring a defect-free verification image set independent of the constructed baseline feature cluster; calculating the corresponding adaptive Mahalanobis distance for each image in the defect-free verification image set and fitting it to generate a distance distribution curve for normal samples; selecting the abscissa value corresponding to a preset cumulative probability area on the distance distribution curve and fixing it as the feature distribution deviation threshold; comparing the numerical result with the feature distribution deviation threshold, and if the numerical result is greater than the feature distribution deviation threshold, outputting a surface defect determination signal.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention constructs a differentiable physical computation layer with embedded discretized partial differential equations for optical scattering, and directly decouples the nonlinear optical interference components of the semi-transparent material surface at the feature extraction front end using forward tensor operations. This structural design, which integrates physical mechanisms with deep learning, effectively filters out optical signal interference introduced by specular reflection and subsurface volume scattering, improves the purity of the underlying image features, and thus enhances the robustness of the detection model under complex lighting conditions.
[0016] 2. This invention utilizes two-dimensional discrete Fourier transform to locate the discrete spatial frequency peaks characterizing periodic textures, and dynamically generates an adaptive negative mask to specifically weaken the energy of the main peak. This frequency-space co-processing mechanism can effectively suppress high-frequency periodic complex background textures while better preserving the high-frequency edge information of weak defects, achieving non-destructive separation of background signals and defect features, and helping to reduce the false detection rate of complex textured surfaces in industrial settings.
[0017] 3. This invention is based on a zero-shot contrastive learning framework, constructing an anisotropic covariance matrix by combining the direction vector of spatial frequency peaks, and calculating the directional adaptive Mahalanobis distance of the target feature vector. This metric mechanism fully considers the tolerance differences in process distribution of normal textures in different physical directions, enabling the system to dynamically establish the feature distribution deviation threshold through normal samples without relying on a large number of defect-annotated samples for training. This effectively improves the model's generalization detection capability for unknown defects and its compatibility with normal process fluctuations. Attached Figure Description
[0018] Figure 1 A flowchart of a method for detecting complex textured surface defects based on image processing provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the decoupling process of forward tensor operations in a differentiable physics computation layer, provided in an embodiment of the present invention. Figure 3 This is a diagram of the feature extraction and orientation-adaptive defect measurement architecture provided in an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Please see Figures 1 to 3 This invention provides a method for detecting surface defects with complex textures based on image processing, the technical solution of which is as follows: Image processing-based methods for detecting defects on complex textured surfaces include: The original image of the fiberglass surface to be inspected is acquired and input into a differentiable physical operation layer. The differentiable physical operation layer contains an optical scattering partial differential equation processed by finite difference discretization. The nonlinear optical interference components in the original image are decoupled through forward tensor operation of the differentiable physical operation layer, and the intrinsic feature map is output. A two-dimensional discrete Fourier transform is performed on the intrinsic feature map to locate the discrete spatial frequency peaks that characterize the periodic texture background, and an adaptive negative mask is dynamically generated. The energy of the main peak is weakened by dot multiplication using the adaptive negative mask, and the edge-preserving and noise-reducing feature map is output through inverse discrete Fourier transform. The target feature vector of the edge-preserving and denoising feature map is extracted by the feature encoder, and the direction vector of the discrete spatial frequency peak is extracted. The direction vector is used as a priori constraint to construct the anisotropic covariance matrix that maps the pre-constructed benchmark feature cluster, and the direction adaptive Mahalanobis distance of the target feature vector is calculated. When the direction adaptive Mahalanobis distance exceeds the feature distribution deviation threshold, it is determined to be a defect.
[0021] Example 1: This embodiment primarily focuses on non-contact online non-destructive testing of surface and subsurface micro-defects (such as micropores, fiber breaks, and resin buildup) in fiberglass products used in industrial production lines. Due to the smooth, resin-rich layer covering the fiberglass surface and the interwoven glass fibers within, conventional machine vision active light sources easily induce strong specular reflections and subsurface volume scattering, significantly degrading the contrast of subtle underlying defects. Simultaneously, the high-frequency periodic woven texture readily couples with actual defects, greatly increasing the system's false positive rate and the risk of missed detections.
[0022] As one embodiment of the present invention, refer to Figure 1 Flowchart of a method for detecting defects on complex textured surfaces based on image processing, refer to Figure 2 The schematic diagram of the decoupling process of forward tensor operations in the differentiable physics computation layer is shown below. Figure 3 Feature extraction and orientation-adaptive defect measurement architecture diagram.
[0023] In this embodiment, the optical scattering partial differential equation is constructed in the following general form: First, for the specular reflection component of the resin-rich layer, a bidirectional reflection distribution function term with incident angle and observation angle as independent variables is selected, which approximates the first-order spatial gradient on the discrete pixel grid using a 3×3 difference template; for the volume scattering component of the interwoven fiber layer, a dipole scattering function term with propagation depth and local density as parameters is selected, which also approximates the second-order spatial derivative on the discrete grid using a 3×3 or 5×5 difference template. For ease of implementation, this embodiment preferably uses a difference weight matrix with a kernel size of 3×3, where the weight of the center pixel is negative, the weight of adjacent pixels is positive, and the sum of the weights in all directions is zero to satisfy the scattering energy conservation constraint. By linearly combining the BRDF term and the dipole scattering function term using the above difference weight matrix, a fixed-structure discretized optical scattering partial differential operator is obtained, and the coefficients of this operator are solidified as non-trainable convolution kernel parameters in the differentiable physical operation layer.
[0024] For the physical dimension mapping of the reflectivity residual tensor, this embodiment adopts a monotonically increasing contrast stretching function. Preferably, the numerical range of the reflectivity residual is mapped to an interval through linear normalization. In the low reflectivity interval, a near-linear response is maintained, and in the high reflectivity interval, a saturation value is set to limit the amplification of extreme outliers. This ensures both the physical interpretability of reflectivity and provides a numerically stable input for subsequent frequency domain processing.
[0025] Furthermore, a bidirectional reflection distribution function term is established to characterize the specular reflection optical component generated by the resin-rich layer contained in the surface of the fiberglass to be tested; a dipole scattering function term is established to characterize the volume scattering optical component generated by light penetrating into the interwoven fiber layer contained in the surface of the fiberglass to be tested; the spatial partial derivative term in the optical scattering partial differential equation is transformed into a discrete difference weight matrix between adjacent pixels, and the bidirectional reflection distribution function term and the dipole scattering function term are discretized and reconstructed using the discrete difference weight matrix to obtain the discretized optical scattering partial differential equation.
[0026] Specifically, in the optical modeling stage for defect detection in semi-transparent materials, instead of directly extracting pixel grayscale features, this approach starts from the physical optical propagation mechanism and first constructs a bidirectional reflection distribution function to accurately quantify the high-reflectance distribution on the resin-rich layer surface. For the complex internal interwoven fiber layer, a dipole scattering function is introduced to simulate the volume scattering diffuse reflection light field formed after multiple photon collisions. To apply continuous partial differential equations to a discrete digital image processing system, this scheme transforms the continuous spatial partial derivatives in the partial differential equations into discrete difference weight matrices of size 3×3 or 5×5. This transformation relies on numerical analysis techniques such as Taylor expansion to perform a high-precision mathematical reconstruction of the complex physical scattering model on a two-dimensional discrete pixel grid, enabling the system to recreate the light propagation and interference process in a purely computational manner under real physical conditions.
[0027] This invention, by establishing and discretizing physical function terms, theoretically overcomes the limitation of traditional machine vision relying solely on the intensity of two-dimensional reflected light for imaging, accurately characterizing the transmission and attenuation laws of complex nonlinear optical signals. This method quantifies the specific components of specular reflection and volume scattering at the source, providing rigorous physical and mathematical support for directly removing optical noise at the feature extraction front end, effectively improving the purity of the underlying image signal and the ability to express true physical features.
[0028] Before performing forward convolution on the multi-channel input tensor using the untrainable convolution kernel parameters to calculate the first interference tensor corresponding to the specular reflection optical component and the second interference tensor corresponding to the volume scattering optical component, the method further includes: extracting the local low-frequency light intensity distribution of the original image to generate a spatial heterogeneity prior map characterizing the local resin thickness and fiber density of the material; extracting the modulation coefficients at the corresponding positions in the spatial heterogeneity prior map based on the pixel-by-pixel coordinates of the multi-channel input tensor; using the modulation coefficients to perform point-by-point multiplication weighting on the untrainable convolution kernel parameters to dynamically generate a corresponding spatially variable convolution kernel for each pixel position; and performing forward convolution on the multi-channel input tensor using the spatially variable convolution kernel to calculate the second interference tensor.
[0029] Specifically, to address the extreme thickness unevenness or severe fiber interweaving and stacking conditions that may occur in industrial settings, this embodiment further introduces a dynamic modulation mechanism based on spatial heterogeneity, building upon the basic untrainable convolution kernel. First, a lightweight mean pooling or low-frequency filter is used to extract the local low-frequency light intensity distribution from the original image. Since low-frequency light intensity directly maps the distribution patterns of the material's macroscopic resin thickness and internal fiber transmittance, a spatial heterogeneity prior map representing the material's local thickness and density is generated. Subsequently, the parameters of the untrainable convolution kernel, representing physical laws, are dynamically modulated by a dot product of the tensor dimension with this spatial heterogeneity prior map. This operation transforms the uniform fixed convolution kernel across the entire image into a spatially variable convolution kernel capable of sensitively sensing changes in local physical boundary conditions. Finally, this spatially variable convolution kernel is used to perform a forward convolution operation, thereby more accurately calculating the second interference tensor of each local region.
[0030] This invention, while adhering to the core structure of partial differential equations and avoiding blind fitting based on massive amounts of data, endows the physical operator with the ability to actively sense and adapt to macroscopic physical boundary conditions (i.e., local thickness and density anomalies). By introducing a priori maps of spatial heterogeneity for dynamic modulation, it effectively prevents "artifact black holes" or "structural residues" caused by over- or under-decoupling of the fixed operator in regions of drastic changes in material thickness. This significantly improves the fidelity of the underlying decoupling and the final detection rate of weak defects under extremely complex process conditions.
[0031] Further, the discrete difference weight matrix is solidified into untrainable convolution kernel parameters in the differentiable physical operation layer; the original image is converted into a multi-channel input tensor, and the untrainable convolution kernel parameters are used to perform forward convolution operation on the multi-channel input tensor to calculate the first interference tensor corresponding to the specular reflection optical component; the local low-frequency light intensity distribution of the multi-channel input tensor is extracted to generate a spatial heterogeneity prior map, and the untrainable convolution kernel parameters are dynamically modulated using the spatial heterogeneity prior map to generate a spatially variable convolution kernel, and the spatially variable convolution kernel is used to calculate the second interference tensor corresponding to the volume scattering optical component; the first interference tensor and the second interference tensor are subtracted pixel by pixel from the multi-channel input tensor to obtain the reflectivity residual tensor and mapped to a set physical reflectivity dimension range to generate an eigenmap with physical dimensions.
[0032] It is important to note that the core theoretical basis for solidifying the discrete difference weight matrix into non-trainable convolution kernel parameters lies in rigorously separating the underlying physical scattering laws from the local spatial states of specific sample data. Those skilled in the art should understand that the partial differential equation for dipole scattering within fiberglass materials describes a universal physical law governing the propagation of photons in a semi-transparent medium. The discretized mathematical operator form of this law is only related to the inherent optical properties of the material itself (such as the overall refractive index and standard scattering coefficient), and belongs to a constant physical law. However, in actual industrial production, the slight fluctuations in resin layer thickness or localized non-uniformity of fiber density caused by coating or weaving processes are essentially local boundary conditions or initial spatial states of this partial differential equation at different spatial locations.
[0033] This spatial heterogeneity in thickness and density is objectively and fully reflected in the local pixel grayscale gradients and distribution characteristics of the original images (i.e., multi-channel input tensors) captured by industrial cameras. Therefore, when this invention uses fixed physical operators (i.e., untrainable convolution kernels) to traverse the input tensors containing local thickness heterogeneity information, it can adaptively decouple physical interference components that conform to their true thickness characteristics in each region based on the local state differences of the tensors themselves. This architectural design explicitly rejects assigning trainable data fitting weights to the physical operators themselves, which not only fundamentally prevents the model from degenerating into a purely data-driven black box and completely eliminates the root cause of overfitting to specific batches of illumination and thickness distribution, but also significantly reduces the memory usage and computational overhead of the front-end decoupling layer.
[0034] Specifically, the discrete difference weight matrix is used as a deterministic parameter and solidified into a non-trainable convolutional kernel in the differentiable physical operation layer. When an industrial camera acquires and inputs a three-channel RGB raw image at a frame rate of 120 frames per second, the image is converted into a multi-channel input tensor and fed into the network. Forward convolution is performed using the aforementioned pre-defined physical convolutional kernel to calculate the first interference tensor representing the specular distribution. Simultaneously, to accommodate the unevenness of local material thickness, the system extracts the local low-frequency light intensity distribution of the multi-channel input tensor to generate a spatial heterogeneity prior map. Based on pixel-by-pixel coordinates, modulation coefficients are extracted and dynamically weighted using the physical convolutional kernel to generate a spatially variable convolutional kernel. This spatially variable convolutional kernel is then used for parallel forward convolution to generate a second interference tensor representing the random walk of internal photons. Subsequently, in the tensor subtraction operation, the two interference components are subtracted point-by-point from the multi-channel input tensor, thereby exposing pure structural features unaffected by the light source angle and material thickness. Finally, the calculated reflectivity residual tensor is strictly mapped to the physical reflectivity dimension range of 0 to 1 through linear normalization, and the output is an intrinsic feature map that excludes nonlinear optical interference and only contains the material's own reflectivity characteristics.
[0035] This invention solidifies complex discretized physical optics equations into a differentiable forward computation structure within a deep learning network, achieving a deep fusion of physical mechanisms and data-driven approaches. This design allows the system to directly and efficiently decouple the nonlinear optical interference components of the semi-transparent material surface at the forefront of feature extraction, effectively avoiding the nonlinear amplification of optical noise in subsequent deep networks. This enhances the robustness and consistency of the detection model under complex and variable lighting conditions in industrial environments.
[0036] As another preferred embodiment of the present invention, the step of subtracting the first interference tensor and the second interference tensor pixel by pixel from the multi-channel input tensor to obtain the reflectivity residual tensor specifically includes: introducing an optical absorption attenuation coefficient tensor characterizing material properties into the differentiable physical operation layer; calculating the optical loss tensor absorbed by the material in combination with a preset light source radiation calibration matrix; simultaneously subtracting the first interference tensor, the second interference tensor, and the optical loss tensor from the multi-channel input tensor, and reconstructing the reflectivity residual tensor by mapping through a nonlinear contrast stretching activation function.
[0037] Specifically, in the forward decoupling process of the differentiable physics operation layer, the physical absorption effect of light energy being converted into heat energy dissipation when light penetrates inhomogeneous media such as translucent resin and glass fiber is further considered. An optical absorption attenuation coefficient tensor characterizing material properties is introduced into the differentiable physics operation layer. This tensor is pre-acquired by the system through offline measurement of the transmittance and absorptivity of a standard defect-free fiberglass sample under the detection light source wavelength, calculated using the Beer-Lambert law, and stored as a priori constant matrix in the system memory. After forward convolution of the first and second interference tensors using a discrete difference weight matrix, the optical loss tensor, which is absorbed by the material and converted into heat energy, is calculated using a pre-measured light source radiation calibration matrix from the industrial site. Subsequently, in the tensor subtraction operation, the first interference tensor representing specular reflection, the second interference tensor representing volume scattering, and the optical loss tensor are simultaneously subtracted pixel-by-pixel from the multi-channel input tensors. Finally, a nonlinear contrast stretching activation function is introduced to map the residual data after subtraction, thereby reconstructing a high-fidelity reflectivity residual tensor that conforms to the real physical light attenuation law without increasing the computing power of complex physical rendering, and outputting it as an intrinsic feature map.
[0038] In this embodiment, by using the pre-calibrated optical absorption attenuation coefficient tensor and the light source radiation matrix, only the energy from the incident light is redistributed and numerically normalized without introducing additional energy terms, thus satisfying the principle of energy conservation overall. The normalization process of the reflectivity residual tensor is merely a numerical mapping of the measurement range and does not change the overall energy balance of the system.
[0039] This invention, based on the decoupling of specular reflection and volume scattering, further compensates for the absorption loss of photons as they are converted into heat energy in a semi-transparent medium. By introducing an optical absorption attenuation coefficient tensor and a nonlinear mapping, it effectively prevents the physical distortion of energy values caused by direct subtraction, reconstructing a high-fidelity eigenvalue map with extremely low computational overhead. This mechanism eliminates the masking effect of complex multi-source optical backgrounds on weak underlying defect features, effectively improving the purity and accuracy of feature extraction.
[0040] Furthermore, a two-dimensional discrete Fourier transform operation is performed on the two-dimensional pixel matrix of the intrinsic feature map to calculate the amplitude spectrum matrix and perform a frequency domain centering translation operation to move the DC component to the geometric center position of the two-dimensional coordinate system; the amplitude gradient vector of the amplitude spectrum matrix is calculated by avoiding the reference radius range of the geometric center position; the coordinates of the frequency points with the magnitude of the amplitude gradient vector being zero and the eigenvalues of the second derivative matrix being negative are selected as local extreme frequency points; the local extreme frequency points whose amplitude values reach the preset background texture energy baseline are extracted, and the coordinate positions of the local extreme frequency points are marked as discrete spatial frequency peaks characterizing the periodic texture background.
[0041] In practical implementation, the reference radius range is related to the spatial resolution of the input image. Preferably, when the size of the input intrinsic feature map is M×N pixels, the reference radius range is set as an annular region at the geometric center with a radius of a fixed ratio of min(M,N), for example, 0.05 to 0.15·min(M,N) as the inner and outer radii, to cover low-frequency luminance components and suppress the influence of large-area background color blocks on gradient calculation. The background texture energy baseline is preferably set according to a fixed ratio based on the global maximum value of the amplitude spectrum matrix, for example, 0.2 to 0.3 times the maximum amplitude value. Ordinary technicians can adjust it within this range according to the actual texture contrast.
[0042] When determining local extreme frequency points, this embodiment adopts a discrete Hessian approximation method based on a 3×3 neighborhood: for each candidate frequency point, calculate its second-order difference in the horizontal and vertical directions, as well as the cross difference, to construct a 2×2 discrete second-order derivative matrix; when the gradient magnitude is close to zero and both eigenvalues of the matrix are negative, the corresponding frequency point is confirmed as a local extreme frequency point.
[0043] Specifically, after processing the optical interference, for the background of the high-frequency interwoven texture, the Fast Fourier Transform (FFT) algorithm is used to perform a two-dimensional Discrete Fourier Transform on the eigenmap, generating the corresponding frequency domain amplitude spectrum matrix. To facilitate subsequent analysis, a low-frequency centering operation is performed, shifting the DC component representing the average brightness of the overall image to the center of the spectrum. Since periodic textures mainly manifest as mid-to-high frequency signals, a baseline radius of 15 to 30 pixels is set to shield against interference from the central low-frequency region. Outside this region, the two-dimensional amplitude gradient vector of the amplitude spectrum matrix is calculated using a differential operator. Through rigorous mathematical conditions—namely, finding points where the magnitude of the amplitude gradient vector is equal to 0 and the eigenvalues of its corresponding second-order derivative Hessian matrix are all less than 0—the absolute local extrema frequency points in the frequency domain are accurately located. To filter out low-energy extrema caused by random small noise, a background texture energy baseline is introduced, for example, set to 20% of the global maximum peak energy. Only the coordinates of local extrema frequency points exceeding this baseline are extracted and precisely marked as discrete spatial frequency peaks characterizing the periodic woven texture of normal fiberglass (such as a plain cross-weave texture).
[0044] This invention, through two-dimensional discrete Fourier transform and rigorous second-order derivative matrix extremum determination logic, accurately captures and locates the discrete spatial frequency peak coordinates representing normal periodic fiber interweaving in an extremely complex frequency domain space. This mechanism transforms complex spatial domain texture interference into intuitive frequency domain energy aggregation points, providing accurate coordinate priors for the subsequent construction of high-precision adaptive filters, and overcoming the problem of traditional edge detection operators blindly suppressing high-frequency details and thus smoothing out defects.
[0045] Before constructing a two-dimensional reciprocal decay surface on a two-dimensional frequency domain plane with the frequency point coordinates of each discrete spatial frequency peak as the center, the process includes: constructing a frequency domain adaptive peak tracking module based on large-scale overlapping blocks; extracting the low-frequency phase difference of the amplitude spectrum of adjacent large-scale blocks and calculating the local deformation field vector characterizing the small deformation of the material; using the local deformation field vector to perform first-order Taylor expansion compensation fine-tuning on the preset discrete spatial frequency peak coordinates to obtain updated frequency point coordinates for constructing the two-dimensional reciprocal decay surface.
[0046] Since small-scale stretching or compression of periodic textures can cause a slight shift in the position of spectral peaks, and this shift has a linearly approximate characteristic in low-frequency phase differences, fine-tuning of frequency coordinates based on first-order Taylor expansion is a reasonable approximation of the actual physical deformation.
[0047] Specifically, considering that uneven stress during the traction process of fiberglass in industrial production lines may cause local stretching or slight deformation of the periodic woven texture, leading to physical drift of the spatial frequency peak, a frequency domain adaptive peak tracking module based on large-scale overlapping blocks is constructed to address this issue before generating the negative mask. The intrinsic feature map is divided into multiple large-scale overlapping image blocks (e.g., using a 256×256 pixel window), and when facing slight material deformation, the low-frequency phase difference of the amplitude spectrum corresponding to adjacent large-scale blocks is extracted. By analyzing this low-frequency phase difference, the local deformation field vector characterizing the current texture stretching direction and scale is calculated. Subsequently, using this deformation field vector, the coordinates of the discrete spatial frequency peaks captured in step four are fine-tuned based on a first-order Taylor expansion to accurately calculate the actual frequency coordinates after drift. The aforementioned two-dimensional reciprocal attenuation surface is then dynamically constructed using these updated coordinates as the center.
[0048] Local deformation field vectors are extracted through large-scale segmentation and low-frequency phase difference, and the frequency coordinates are fine-tuned using a first-order Taylor expansion. This method avoids spectral aliasing caused by extremely small spatial windows, achieving dynamic and accurate tracking of drift frequency peaks with low computational overhead. It ensures that the adaptive negative mask can always accurately align and multiply to weaken the background main peak energy of the deformed area, preventing filter failure and effectively improving the robustness and accuracy of the detection system under complex dynamic traction conditions.
[0049] Furthermore, a two-dimensional reciprocal attenuation surface is constructed on a two-dimensional frequency domain plane, centered on the frequency coordinates of each discrete spatial frequency peak. The attenuation coefficient of this surface is zero at its center and increases non-linearly to one along the direction away from the center. Using this two-dimensional reciprocal attenuation surface as a weighted distribution model, a corresponding local attenuation matrix is generated. All local attenuation matrices are combined and concatenated to generate an adaptive negative mask matrix. The adaptive negative mask matrix is then multiplied element-wise with the amplitude spectrum matrix, resulting in a point-by-point weighted reduction of the energy at the discrete spatial frequency peaks according to the attenuation coefficient, while maintaining the initial energy values in the non-peak regions of the amplitude spectrum matrix. This updated amplitude spectrum matrix is then used for the discrete Fourier inverse transform.
[0050] Preferably, the two-dimensional reciprocal attenuation surface in this embodiment adopts a radial function form centered on the peak frequency coordinates. Its attenuation coefficient exhibits a monotonically increasing relationship with the frequency domain distance, satisfying an attenuation coefficient of 0 at a frequency domain distance of 0, and satisfying an attenuation coefficient close to 1 at a frequency domain distance reaching a set radius. Specifically, an inverse Gaussian function can be used, and its attenuation coefficient is calculated by subtracting an exponential term from the value 1. This exponential term has a base of the natural constant, and its exponent is the square of the ratio of the negative frequency domain distance to the scale parameter. The scale parameter is set according to the peak spacing, for example, it is taken as 0.2 to 0.5 times the Euclidean distance between two adjacent peaks to ensure that the attenuation surface rises rapidly near the peak and asymptotically approaches 1 in regions far from the peak. Through this parameterization method, ordinary technicians can adjust the values of the scale parameter and the set radius according to the specific texture spectrum distribution, while avoiding excessive suppression of adjacent defect frequency components.
[0051] Specifically, after obtaining the spatial frequency coordinates of the periodic texture, a suppression filter is dynamically designed based on these coordinates. Specifically, using the frequency coordinates of each discrete spatial frequency peak as the origin, a two-dimensional reciprocal attenuation surface with an inverse Gaussian or inverse exponential distribution is constructed on the frequency domain plane. The design logic of this surface is as follows: at the peak center point, the attenuation coefficient is strictly set to 0 (i.e., achieving maximum energy suppression); while as the radial distance increases, the attenuation coefficient gradually increases to a maximum value of 1 in a non-linear, smooth manner (i.e., no energy attenuation occurs). The attenuation surfaces constructed for all detected peaks are combined and stitched together to form a global adaptive negative mask matrix with the same size as the amplitude spectrum matrix. During the frequency domain filtering stage, this adaptive negative mask matrix is multiplied element-wise with the amplitude spectrum matrix. This process precisely and directionally reduces the energy of the main peak representing the background texture, while completely preserving the high-frequency edge feature energy distributed in non-peak regions, representing defects such as micropores or cracks. Subsequently, the processed spectrum is reconstructed into an edge-preserving and denoising feature map through inverse discrete Fourier transform.
[0052] The frequency-space collaborative processing mechanism proposed in this invention utilizes dynamically generated attenuation surfaces to construct adaptive negative masks, achieving targeted stripping of high-frequency periodic complex background textures. This scheme deeply weakens the energy of strong background interference while preserving the high-frequency edge information of weak defects, achieving non-destructive separation of background signals and defect features. It provides a practical solution for effectively reducing the false positive and false negative rates in the detection of complex textured surfaces in industrial settings.
[0053] Furthermore, a fully convolutional neural network comprising multi-level residual connection layers and spatial pyramid pooling layers is configured as the backbone information extraction structure of the feature encoder. At the end of the backbone information extraction structure, a contrastive learning projection head is connected. The edge-preserving and denoising feature map is input into the backbone information extraction structure, and after passing through layer-by-layer receptive field expansion and semantic aggregation of local pixel regions, a multi-scale intermediate layer semantic tensor is extracted. The spatial pyramid pooling layer is used to perform dimension alignment and spatial dimensionality reduction operations on the multi-scale intermediate layer semantic tensor to obtain a global semantic tensor. The contrastive learning projection head is used to nonlinearly map the global semantic tensor to an implicit metric space, and the target feature vector within the implicit metric space is output.
[0054] The offline training process of the contrastive learning projector is as follows: a training set is constructed using defect-free normal fiberglass images; data augmentation operations such as random cropping, Gaussian blurring, and frequency domain phase perturbation are performed on the same normal image to generate positive sample pairs; negative sample pairs are generated by randomly selecting normal images from different batches; a contrastive learning projector containing two fully connected layers and a ReLU nonlinear activation function inserted between them is configured; the network parameters are optimized using the InfoNCE contrastive loss function to maximize the cosine similarity of positive sample pairs in the implicit metric space and minimize the cosine similarity of negative sample pairs, and this process is repeated through multiple iterations of backpropagation until the loss function converges and stabilizes.
[0055] The feature encoder employs a fully convolutional network based on the ResNet architecture. The preferred size of the input edge-preserving and denoising feature map is 256×256 pixels, with 1 or 3 channels. The backbone network comprises four residual module groups, each containing 2-3 residual units. Each residual unit consists of a 3×3 convolution + batch normalization + ReLU activation, and short-circuit connections are achieved through identity mapping. Finally, the network uses a spatial pyramid pooling layer to uniformly map feature maps of different scales into fixed-length one-dimensional vectors, and then uses a contrastive learning projection head composed of two fully connected layers to map the features to a 512-dimensional implicit metric space. The contrastive learning training phase uses the InfoNCE loss function with a temperature coefficient of 0.1-0.2 and a batch size set within the range of 64-256. Technical personnel can choose a suitable configuration within this range based on their computing power.
[0056] Specifically, in the target feature vector extraction stage, a fully convolutional neural network optimized for industrial defect detection is configured. This network extensively employs multi-level residual connection layers to ensure that deep networks avoid gradient vanishing during forward propagation and backward gradient updates, thus stably extracting high-order features. It receives the edge-preserving and denoising feature map after frequency domain processing, and through continuous convolution and activation operations, achieves layer-by-layer expansion of the receptive field and local aggregation of pixel semantics, thereby outputting a multi-scale intermediate-layer semantic tensor containing rich edge and structural information. Since the field of view and product size captured by industrial cameras may dynamically change, a spatial pyramid pooling layer is deployed at the network backend. This pooling layer can uniformly map multi-scale intermediate-layer semantic tensors of different spatial dimensions into a fixed-dimensional global semantic tensor, achieving dimensional alignment. Finally, through a contrastive learning projector composed of a multi-layer nonlinear perceptron network, the dimensionality-reduced global semantic tensor is projected onto an implicit metric space dedicated to zero-shot anomaly detection, outputting a 512-dimensional or 1024-dimensional target feature vector. This vector highly condenses the structural distribution characteristics of the current image region.
[0057] This invention introduces a feature encoding architecture comprising residual connection layers and spatial pyramid pooling layers, which not only effectively ensures the depth and stability of multi-scale feature extraction but also significantly improves the adaptive compatibility with different input image sizes. Furthermore, the design of the end-effector contrastive learning projector nonlinearly maps high-dimensional image features to an implicit metric space that facilitates the differentiation of abnormal distributions, effectively improving the linear separability and discriminability of normal background features and potential minor defect features in the metric space.
[0058] Furthermore, based on the polar angle distribution values of the discrete spatial frequency peaks in the frequency domain coordinate system, a direction vector representing the current texture extension direction is calculated, and an orthogonal normal vector perpendicular to the direction vector is derived. A covariance weight allocation mechanism is established, configuring a principal axis feature space aligned with the direction vector and assigning a first covariance eigenvalue parameter, configuring a secondary axis feature space aligned with the orthogonal normal vector and assigning a second covariance eigenvalue parameter, wherein the value of the first covariance eigenvalue parameter is greater than the value of the second covariance eigenvalue parameter. Combining the multidimensional distribution discreteness of the reference feature cluster, the first covariance eigenvalue parameter, and the second covariance eigenvalue parameter, an anisotropic covariance matrix is generated through matrix operations, such that the variance weight of the anisotropic covariance matrix in the texture extension direction is greater than its variance weight in the orthogonal normal vector direction.
[0059] The steps for generating the pre-constructed benchmark feature clusters include: extracting a large number of known qualified defect-free fiberglass images into the feature encoder to obtain a benchmark feature vector set; using the K-Means algorithm to perform unsupervised clustering on the benchmark feature vector set to obtain multiple cluster centers representing normal process fluctuations; and calculating the covariance matrix of the feature vectors within each cluster to characterize the degree of multidimensional distribution dispersion.
[0060] Specifically, considering the inherently large process tolerance of fiberglass fibers in their weaving direction (e.g., plain weave warp and weft or twill weave at a 45-degree angle), and that abrupt changes perpendicular to the texture direction usually indicate breakage or resin buildup, this scheme constructs an anisotropy measurement standard that conforms to the material's physical properties. First, the previously determined discrete spatial frequency peak coordinates are extracted, and their polar angle values in the frequency domain polar coordinate system are calculated. This allows for the accurate calculation of the actual extension direction vector of the current fiberglass weave texture, and the orthogonal normal vector is obtained based on spatial geometric relationships. Subsequently, a covariance weight allocation mechanism is activated: the axis containing the direction vector is assigned a larger first covariance eigenvalue parameter (representing high tolerance) to the principal axis feature space; the axis containing the orthogonal normal vector is assigned a smaller second covariance eigenvalue parameter (representing low tolerance) to the secondary axis feature space. Based on this, combined with the multidimensional distribution covariance data of the benchmark feature clusters generated by offline clustering of a large number of defect-free normal samples, the final anisotropic covariance matrix is reconstructed using matrix operations. This matrix forcibly sets the variance weight along the texture extension direction to be significantly greater than the variance weight in the perpendicular direction.
[0061] This invention ingeniously utilizes the spatial frequency peak direction vector as a physical prior constraint to construct an anisotropic covariance matrix that fits the fiber interweaving characteristics of the material. This metric mechanism fully respects and quantifies the differences in process fluctuations and distribution tolerance of normal textures in different physical directions, eliminating false detections caused by uneven weaving of normal fibers at the algorithm evaluation level, and significantly improving the model's compatibility with normal process fluctuations of good products.
[0062] Further, the difference vector between the target feature vector and the cluster center of the benchmark feature cluster is calculated; the difference vector is subjected to a quadratic operation with the inverse of the anisotropic covariance matrix to obtain the numerical result of the orientation-adaptive Mahalanobis distance; a defect-free verification image set independent of the construction of the benchmark feature cluster is obtained; the orientation-adaptive Mahalanobis distance is calculated for each defect-free verification image set, and a distance distribution curve of normal samples is generated by fitting; the horizontal coordinate value corresponding to the preset cumulative probability area is selected on the distance distribution curve and solidified as the feature distribution deviation threshold; the numerical result is compared with the feature distribution deviation threshold, and if the numerical result is greater than the feature distribution deviation threshold, a surface defect judgment signal is output.
[0063] Specifically, in the real-time online judgment stage of the production line, the target feature vector of the current image to be tested, output by the network, is first extracted, and the multidimensional difference vector between it and the cluster center of the benchmark feature cluster representing standard good products is calculated. Then, the inverse matrix is obtained using the previously generated anisotropic covariance matrix, and a quadratic matrix multiplication operation is performed between the difference vector and this inverse matrix. The result of this operation is the precise value of the direction-adaptive Mahalanobis distance, which fully considers the tolerance of texture direction. To ensure the scientific nature and dynamic adaptability of the judgment threshold, a set of defect-free verification images of the current batch, independent of the training set, is collected during the initial deployment phase. The direction-adaptive Mahalanobis distance is calculated for each of these good product verification images, and a distance distribution curve specific to normal samples is generated using chi-square distribution or Gaussian kernel density estimation methods. Based on the specific tolerance of the false negative and false positive rates in the industrial environment, the horizontal coordinate value corresponding to the preset cumulative probability area (such as a 99.7% three-sigma interval) is selected on the distribution curve and set and solidified as the feature distribution deviation threshold under the current production environment. During detection, the adaptive Mahalanobis distance value calculated in real time is compared with the feature distribution to determine if it deviates from the threshold. Once the value crosses the threshold boundary, the alarm device is immediately triggered and a surface defect judgment signal is output.
[0064] This invention constructs a highly reliable zero-sample anomaly detection system based on directional adaptive Mahalanobis distance. It eliminates the strong reliance on defective samples with high manual annotation costs, dynamically establishing and flexibly adjusting the characteristic distribution deviation threshold to adapt to the current production batch using only normal good-quality samples. This adaptive threshold setting method effectively improves the detection system's ability to generalize and detect unknown and rare morphological defects, meeting the high standards of modern industrial assembly line flexible production and millisecond-level real-time online detection.
[0065] This invention significantly improves the purity and illumination robustness of the underlying image by precisely decoupling specular reflection and volume scattering interference at the front end through a differentiable physical operation layer with embedded discretized optical scattering partial differential equations. Utilizing a frequency-space coordination mechanism of two-dimensional discrete Fourier transform and adaptive negative masking, it effectively suppresses high-frequency periodic complex background textures while fully preserving the high-frequency edge features of weak defects, achieving non-destructive stripping. Furthermore, by constructing an anisotropic covariance matrix using direction vectors and calculating the direction-adaptive Mahalanobis distance, it can be compatible with normal process fluctuations without relying on massive defect samples, greatly improving the accurate detection rate and model generalization ability of weak defects under complex working conditions.
[0066] Example 2: This embodiment will describe in detail the flow and processing steps of each data tensor, focusing on the underlying algorithm execution process of a complex texture surface defect detection method based on image processing. This embodiment emphasizes how to achieve high-fidelity decoupling of the entire process from original pixels to the final defect determination signal through the sequential synergy of physical mechanism constraints, frequency domain signal processing, and high-dimensional feature measurements.
[0067] As one embodiment of the present invention, refer to Figure 1 Flowchart of a method for detecting defects on complex textured surfaces based on image processing, refer to Figure 2 The schematic diagram of the decoupling process of forward tensor operations in the differentiable physics computation layer is shown below. Figure 3 Feature extraction and orientation-adaptive defect measurement architecture diagram.
[0068] During system initialization, the vision acquisition hardware at the front end of the industrial production line acquires the original image of the fiberglass surface to be inspected. This original image is then converted into a multi-channel input tensor and input into a pre-constructed differentiable physical computation layer. Within this computation layer, optical scattering partial differential equations, processed by finite difference discretization, are pre-embedded. Specifically, the construction of these partial differential equations does not rely on black-box fitting but is based on a rigorous optical physics model: first, a bidirectional reflection distribution function term is established to mathematically characterize the specular reflection optical component generated by the resin-rich layer within the fiberglass surface; simultaneously, a dipole scattering function term is established to characterize the nonlinear volume scattering optical component generated by active light penetrating the interwoven fiber layer within the fiberglass surface. To enable efficient computation of the continuous physical equations on a discrete pixel grid, the spatial partial derivative terms in the optical scattering partial differential equations are transformed into discrete difference weight matrices between adjacent pixels. These discrete difference weight matrices are then used to discretize and reconstruct the bidirectional reflection distribution function term and the dipole scattering function term.
[0069] The forward physical interference decoupling step involves directly embedding the derived discrete difference weight matrix into untrainable convolution kernel parameters in the differentiable physical computation layer. Upon receiving the multi-channel input tensor, the computation layer performs forward convolution operations on it using the untrainable convolution kernel parameters to independently calculate the first interference tensor corresponding to the specular reflection optical component. In parallel, to overcome local fiber density heterogeneity, the computation layer extracts low-frequency features from the input tensor to generate a spatial heterogeneity prior map. By extracting the modulation coefficients of the corresponding coordinates, it performs point-by-point multiplication weighting on the untrainable convolution kernel parameters to dynamically construct a spatially variable convolution kernel. This variable convolution kernel is then used to accurately calculate the second interference tensor corresponding to the volume scattering optical component. Subsequently, point-to-point operations are performed in the tensor dimension, synchronously subtracting the first and second interference tensors pixel-by-pixel from the multi-channel input tensor. This removes optical noise interference caused by material properties at its source, yielding the reflectivity residual tensor. To meet the data consistency requirements of subsequent algorithms, the reflectivity residual tensor is linearly or nonlinearly mapped to a defined range of physical reflectivity dimensions, generating an eigenvalue map with physical dimensions. This completes the first stage of decoupling the coupling between illumination and the material background.
[0070] After obtaining the intrinsic feature map, the algorithm enters the frequency domain collaborative denoising stage. The Fast Fourier Transform (FFT) module is invoked to perform a two-dimensional Discrete Fourier Transform (DFT) operation on the two-dimensional pixel matrix of the intrinsic feature map to calculate the amplitude spectrum matrix in the frequency domain. To facilitate subsequent frequency localization, a frequency domain centering translation operation is performed, shifting the DC component representing the overall average brightness of the image to the geometric center position of the two-dimensional coordinate system. Subsequently, peak tracking logic is initiated in the frequency domain space: actively avoiding a certain reference radius range at the geometric center position (to eliminate low-frequency large-area color block interference), and calculating the amplitude gradient vector of the amplitude spectrum matrix. Through rigorous mathematical optimization conditions, frequency points with a magnitude of zero and negative eigenvalues of the second derivative matrix are selected and identified as local extrema frequency points in the frequency domain space. To prevent interference from random high-frequency noise, local extrema frequency points whose amplitude values reach the preset background texture energy baseline are further extracted, and the coordinates of these local extrema frequency points are accurately marked as discrete spatial frequency peaks representing periodic textured backgrounds (such as the plain or diagonal interwoven network of glass fibers).
[0071] After accurately locating the periodic background features, an adaptive negative mask is dynamically generated. Specifically, a two-dimensional reciprocal attenuation surface is constructed on a two-dimensional frequency domain plane, using the frequency coordinates of each discrete spatial frequency peak as the geometric center. The topological characteristics of this surface are: the attenuation coefficient at the center of the two-dimensional reciprocal attenuation surface is strictly zero, and the attenuation coefficient increases non-linearly along the direction away from the center (e.g., radially outward), eventually approaching one. All two-dimensional reciprocal attenuation surfaces generated for individual peaks are combined and stitched together to generate a global adaptive negative mask matrix. Then, this adaptive negative mask matrix is multiplied element-wise with the amplitude spectrum matrix to be processed. This operation step ensures that the energy at the discrete spatial frequency peaks (i.e., the background energy of the periodic woven texture) is weighted and reduced point-by-point according to the extremely low attenuation coefficient, while maintaining the energy values of non-peak regions (i.e., high-frequency edge information of potential minute defects) in the amplitude spectrum matrix completely in their initial state. Finally, the updated amplitude spectrum matrix is obtained and restored to the spatial domain through inverse discrete Fourier transform, outputting a denoising feature map with suppressed background and preserved defect edges. This completes the second stage of high-fidelity decoupling for the periodic texture background.
[0072] As the background noise is gradually stripped away, the semantic feature extraction and dimensionality reduction stage begins. A fully convolutional neural network, comprising multi-level residual connection layers and spatial pyramid pooling layers, is configured as the backbone information extraction structure of the feature encoder. A contrastive learning projection head is connected to the end of this backbone information extraction structure. The edge-preserving and denoising feature map is input into the backbone information extraction structure. As the network depth increases, the image data undergoes layer-by-layer receptive field expansion and semantic aggregation of local pixel regions, thereby extracting multi-scale intermediate layer semantic tensors. To adapt to the different sizes of detection fields in industrial environments, the spatial pyramid pooling layers are used to perform multi-grid dimensionality alignment and spatial dimensionality reduction operations on the multi-scale intermediate layer semantic tensors, resulting in a global semantic tensor of uniform dimension. Finally, the contrastive learning projection head nonlinearly maps the global semantic tensor to a high-dimensional implicit metric space, stably outputting the target feature vector within the implicit metric space.
[0073] Finally, the adaptive feature measurement and defect judgment stage begins. To eliminate misjudgments caused by process fluctuations in specific physical directions of the material, the polar angle distribution values of the discrete spatial frequency peaks extracted in the frequency domain stage are used to calculate the direction vector representing the current texture extension direction. Based on geometric relationships, an orthogonal normal vector perpendicular to the direction vector is derived. Based on this physical prior constraint, a covariance weight allocation mechanism is established: a principal axis feature space aligned with the direction vector is configured and assigned a higher first covariance eigenvalue parameter, while a secondary axis feature space aligned with the orthogonal normal vector is configured and assigned a lower second covariance eigenvalue parameter. Combining the multidimensional distribution dispersion of the baseline feature clusters generated by pre-offline clustering, the first covariance eigenvalue parameter, and the second covariance eigenvalue parameter, an anisotropic covariance matrix is generated through matrix operations. This mechanism forces the variance weight of the anisotropic covariance matrix in the texture extension direction to be greater than its variance weight in the orthogonal normal vector direction.
[0074] In the final measurement calculation, the difference vector between the currently extracted target feature vector and the cluster center of the benchmark feature cluster is calculated. Then, a quadratic operation is performed on the difference vector and the inverse of the anisotropic covariance matrix to calculate the numerical result of the orientation-adaptive Mahalanobis distance. To establish a scientific judgment boundary, a defect-free verification image set independent of the constructed benchmark feature cluster is acquired during deployment. The orientation-adaptive Mahalanobis distance is calculated for each defect-free verification image set, and a distance distribution curve specific to normal samples is generated. The horizontal coordinate value corresponding to the preset cumulative probability area is selected on the distance distribution curve and solidified as the feature distribution deviation threshold under the current operating conditions. During real-time online detection, the calculated numerical result is continuously compared with the absolute value of the feature distribution deviation threshold. If the numerical result is within the threshold range, it is determined to be a normal process fluctuation; if the numerical result exceeds the boundary of the feature distribution deviation threshold, a surface defect judgment signal is immediately output, thus completing a complete high-fidelity detection and judgment process for complex texture surface defects.
[0075] 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 defects on complex textured surfaces based on image processing, characterized in that, include: The original image of the fiberglass surface to be inspected is acquired and input into a differentiable physical operation layer. The differentiable physical operation layer contains an optical scattering partial differential equation processed by finite difference discretization. The nonlinear optical interference components in the original image are decoupled through forward tensor operation of the differentiable physical operation layer, and the intrinsic feature map is output. A two-dimensional discrete Fourier transform is performed on the intrinsic feature map to locate the discrete spatial frequency peaks that characterize the periodic texture background, and an adaptive negative mask is dynamically generated. The energy of the main peak is weakened by dot multiplication using the adaptive negative mask, and the edge-preserving and noise-reducing feature map is output through inverse discrete Fourier transform. The target feature vector of the edge-preserving and denoising feature map is extracted by the feature encoder, and the direction vector of the discrete spatial frequency peak is extracted. The direction vector is used as a priori constraint to construct the anisotropic covariance matrix that maps the pre-constructed benchmark feature cluster, and the direction adaptive Mahalanobis distance of the target feature vector is calculated. When the direction adaptive Mahalanobis distance exceeds the feature distribution deviation threshold, it is determined to be a defect.
2. The method for detecting complex textured surface defects based on image processing according to claim 1, characterized in that, The construction process of the optical scattering partial differential equation through finite difference discretization includes: establishing a bidirectional reflection distribution function term to characterize the specular reflection optical component generated by the resin-rich layer contained in the surface of the fiberglass to be tested; establishing a dipole scattering function term to characterize the volume scattering optical component generated by light penetrating into the interwoven fiber layer contained in the surface of the fiberglass to be tested; transforming the spatial partial derivative term in the optical scattering partial differential equation into a discrete difference weight matrix between adjacent pixels; and using the discrete difference weight matrix to discretize and reconstruct the bidirectional reflection distribution function term and the dipole scattering function term to obtain the discretized optical scattering partial differential equation.
3. The method for detecting complex textured surface defects based on image processing according to claim 2, characterized in that, The process of decoupling the nonlinear optical interference components in the original image through forward tensor operations and outputting an intrinsic feature map includes: solidifying the discrete difference weight matrix into untrainable convolution kernel parameters in a differentiable physical operation layer; converting the original image into a multi-channel input tensor, and using the untrainable convolution kernel parameters to perform forward convolution operations on the multi-channel input tensor to calculate the first interference tensor corresponding to the specular reflection optical component; extracting the local low-frequency light intensity distribution of the multi-channel input tensor to generate a spatial heterogeneity prior map, using the spatial heterogeneity prior map to dynamically modulate the untrainable convolution kernel parameters to generate a spatially variable convolution kernel, and using the spatially variable convolution kernel to calculate the second interference tensor corresponding to the volume scattering optical component; subtracting the first and second interference tensors pixel by pixel from the multi-channel input tensor to obtain a reflectivity residual tensor and mapping it to a set physical reflectivity dimension range to generate an intrinsic feature map with physical dimensions.
4. The method for detecting complex textured surface defects based on image processing according to claim 1, characterized in that, To locate the discrete spatial frequency peaks representing the periodic texture background, a two-dimensional discrete Fourier transform is performed on the intrinsic feature map. Specifically, this includes: performing a two-dimensional discrete Fourier transform operation on the two-dimensional pixel matrix of the intrinsic feature map, calculating the amplitude spectrum matrix and performing a frequency domain centering translation operation to move the DC component to the geometric center position of the two-dimensional coordinate system; calculating the amplitude gradient vector of the amplitude spectrum matrix, avoiding the reference radius range of the geometric center position; selecting the frequency points whose magnitude of the amplitude gradient vector is zero and whose eigenvalues of the second derivative matrix are negative as local extreme frequency points; extracting the local extreme frequency points whose amplitude values reach the preset background texture energy baseline, and marking the coordinate positions of the local extreme frequency points as the discrete spatial frequency peaks representing the periodic texture background.
5. The method for detecting complex textured surface defects based on image processing according to claim 4, characterized in that, An adaptive negative mask is dynamically generated and used to weaken the energy of the main peak through dot product. Specifically, this involves: constructing a two-dimensional reciprocal attenuation surface on a two-dimensional frequency domain plane, centered on the frequency coordinates of each discrete spatial frequency peak. The attenuation coefficient of the two-dimensional reciprocal attenuation surface is zero at the center and increases nonlinearly to one along the direction away from the center; combining and splicing all the two-dimensional reciprocal attenuation surfaces to generate an adaptive negative mask matrix; and performing element-wise multiplication of the adaptive negative mask matrix with the amplitude spectrum matrix, so that the energy at the discrete spatial frequency peak is reduced point-by-point according to the attenuation coefficient, while keeping the energy values in the non-peak regions of the amplitude spectrum matrix in their initial state, resulting in an updated amplitude spectrum matrix used for discrete Fourier inverse transform.
6. The method for detecting complex textured surface defects based on image processing according to claim 1, characterized in that, Extracting the target feature vector from the edge-preserving and denoising feature map using a feature encoder specifically includes: configuring a fully convolutional neural network containing multi-level residual connection layers and spatial pyramid pooling layers as the backbone information extraction structure of the feature encoder; connecting a contrastive learning projection head at the end of the backbone information extraction structure; inputting the edge-preserving and denoising feature map into the backbone information extraction structure, and sequentially performing layer-by-layer receptive field expansion and semantic aggregation of local pixel regions to extract multi-scale intermediate layer semantic tensors; using the spatial pyramid pooling layer to perform dimension alignment and spatial dimensionality reduction operations on the multi-scale intermediate layer semantic tensors to obtain a global semantic tensor; and using the contrastive learning projection head to nonlinearly map the global semantic tensor to an implicit metric space, outputting the target feature vector within the implicit metric space.
7. The method for detecting complex textured surface defects based on image processing according to claim 1, characterized in that, Using the direction vector as a priori constraint, an anisotropic covariance matrix of the mapping reference feature cluster is constructed. Specifically, this includes: calculating the direction vector representing the current texture extension direction based on the polar angle distribution values of the discrete spatial frequency peaks in the frequency domain coordinate system, and deriving the orthogonal normal vector perpendicular to the direction vector; establishing a covariance weight allocation mechanism, configuring the principal axis feature space aligned with the direction vector and assigning it a first covariance eigenvalue parameter, configuring the secondary axis feature space aligned with the orthogonal normal vector and assigning it a second covariance eigenvalue parameter, wherein the value of the first covariance eigenvalue parameter is greater than the value of the second covariance eigenvalue parameter; combining the multidimensional distribution discreteness of the reference feature cluster, the first covariance eigenvalue parameter, and the second covariance eigenvalue parameter, generating an anisotropic covariance matrix through matrix operations, such that the variance weight of the anisotropic covariance matrix in the texture extension direction is greater than its variance weight in the orthogonal normal vector direction.
8. The method for detecting complex textured surface defects based on image processing according to claim 7, characterized in that, The process involves calculating the adaptive Mahalanobis distance, and determining a defect if the adaptive Mahalanobis distance exceeds a feature distribution deviation threshold. Specifically, this includes: calculating the difference vector between the target feature vector and the cluster center of the baseline feature cluster; performing a quadratic operation on the difference vector and the inverse of the anisotropic covariance matrix to obtain the numerical result of the adaptive Mahalanobis distance; acquiring a defect-free verification image set independent of the constructed baseline feature cluster; calculating the corresponding adaptive Mahalanobis distance for each image in the defect-free verification image set and fitting it to generate a distance distribution curve for normal samples; selecting the abscissa value corresponding to a preset cumulative probability area on the distance distribution curve and fixing it as the feature distribution deviation threshold; comparing the numerical result with the feature distribution deviation threshold, and outputting a surface defect determination signal if the numerical result is greater than the feature distribution deviation threshold.