Intelligent detection method for image edge fluctuation features

By combining dynamic wavelet decomposition and a dual-channel CNN model with an attention mechanism, the problems of multi-scale adaptation and feature interference in the edge detection of wooden templates are solved, enabling automatic determination of the defect level of wooden templates and improving the accuracy and efficiency of detection.

CN120976566BActive Publication Date: 2026-02-03四川省建筑机械化工程有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511492390.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2026-02-03
Estimated Expiration
2045-10-20

AI Technical Summary

Technical Problem

Existing wood formwork edge detection technologies suffer from insufficient multi-scale feature adaptability, weak feature interference suppression capabilities, lack of quantitative evaluation systems, and rigid post-processing mechanisms, resulting in high false detection rates and low efficiency, failing to meet the quality control requirements of building construction.

Method used

A gradient entropy-based dynamic wavelet decomposition strategy is adopted, combined with a dual-channel CNN model and attention mechanism. Through reinforcement learning, feature fusion is optimized and edge fluctuation quantification index is calculated to achieve automatic determination of the defect level of wooden templates.

Benefits of technology

It improves the accuracy and efficiency of edge detection for wooden formwork, and can automatically identify minor, moderate and severe defects, reducing the false detection rate and meeting project acceptance standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120976566B_ABST
    Figure CN120976566B_ABST
Patent Text Reader

Abstract

The present application relates to wood template detection technical field, disclose a kind of image edge fluctuation feature intelligent detection method, comprising the following steps: obtaining wood template original image and pre-processing to obtain pre-processing image;Design gradient entropy-based dynamic wavelet decomposition strategy, and pre-processing image is carried out multi-scale wavelet decomposition by dynamic wavelet decomposition strategy to obtain low-frequency sub-band image and high-frequency sub-band image;Extract wavelet high-frequency coefficient of high-frequency sub-band image, obtain high-frequency coefficient feature vector;Construct double-channel CNN model, introduce attention mechanism module, obtain deep feature vector;Based on fusion feature vector, calculate edge fluctuation quantization index, and edge fluctuation quantization index is combined with the profile curvature change rate of low-frequency sub-band image and fusion feature vector is jointly input into trained neural network model to obtain the defect grade of original image.The present application can more accurately reflect wood template edge fluctuation and other key features by double-channel CNN architecture combined with attention mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wood template detection technology, specifically to an intelligent detection method for image edge fluctuation features. Background Technology

[0002] In the construction industry, wooden formwork is a key piece of equipment for concrete pouring and shaping, and its edge quality directly determines the dimensional accuracy and surface flatness of the concrete structure. With the rapid development of industrialized construction, the requirements for the turnover efficiency and reusability of wooden formwork are constantly increasing. However, during repeated use, wooden formwork is susceptible to wear, deformation, and cracking at the edges due to factors such as load impact, changes in environmental humidity, and material fatigue, manifesting as irregular fluctuations in the edge contour. Therefore, accurate detection of the edge fluctuation characteristics of wooden formwork is of significant engineering value for timely selection of qualified formwork and prevention of potential construction quality problems.

[0003] Current edge detection technology for wooden formwork mainly relies on traditional computer vision algorithms and rudimentary deep learning methods, but it faces significant technical bottlenecks in practical applications:

[0004] First, the multi-scale feature adaptability is insufficient. Traditional wavelet decomposition uses fixed basis functions and decomposition levels, which cannot dynamically adjust the feature extraction scale according to the wear degree of the wooden template edge. For slight fluctuations in wear, fixed parameters easily lead to high-frequency features being submerged by noise; for large fluctuations in severe deformation, the global contour information is lost due to insufficient decomposition scale, resulting in an edge detection rate of over 30% under complex working conditions.

[0005] Secondly, the ability to suppress feature interference is weak. The natural texture and patterns on the surface of wooden templates are highly similar to the visual features of actual defect fluctuations, and existing single-modal feature extraction methods are unable to effectively distinguish between the two. Traditional edge detection operators (such as Canny and Sobel) are sensitive to texture interference, while basic CNN models lack targeted feature selection mechanisms, resulting in a defect false detection rate that has remained above 25% for a long time, failing to meet engineering acceptance standards.

[0006] Third, a quantitative assessment system is lacking. Existing technologies mostly remain at the qualitative detection level of edge contours, lacking quantitative indicators to describe fluctuation characteristics, and cannot achieve automatic classification of "minor / moderate / severe" defect levels. Detection results rely on human experience for judgment, which suffers from large subjective biases and low efficiency, making it difficult to meet the quality control needs of large-scale construction.

[0007] Fourth, the post-processing mechanism is rigid. Traditional morphological operations use fixed structural elements and parameters, making it impossible to dynamically adjust the processing strategy based on edge connectivity. Repairing broken edges often relies on simple interpolation methods, which easily leads to edge morphology distortion and affects the reliability of the final detection results.

[0008] In summary, existing timber formwork edge fluctuation detection technologies have significant shortcomings in multi-scale adaptation, feature anti-interference, quantitative evaluation, and post-processing optimization. There is an urgent need to develop a new detection technology with dynamic adaptive capabilities, multi-modal feature fusion, and intelligent decision-making functions to overcome the limitations of existing technologies and improve the level of intelligence in timber formwork quality inspection. Summary of the Invention

[0009] This invention provides an intelligent detection method for image edge fluctuation features to solve the above-mentioned problems.

[0010] This invention is achieved through the following technical solution:

[0011] An intelligent detection method for image edge fluctuation features includes the following steps:

[0012] Obtain the original image of the wooden template and perform preprocessing to obtain the preprocessed image;

[0013] Design a dynamic wavelet decomposition strategy based on gradient entropy, and perform multi-scale wavelet decomposition on the preprocessed image through the dynamic wavelet decomposition strategy to obtain a low-frequency sub-band image that reflects the overall contour of the preprocessed image and a high-frequency sub-band image that contains the edge details of the preprocessed image.

[0014] Extract the wavelet high-frequency coefficients from the high-frequency sub-band image, and map the wavelet high-frequency coefficients to the feature space to obtain the high-frequency coefficient feature vector;

[0015] A dual-channel CNN model consisting of a texture suppression channel and an edge enhancement channel is constructed. Attention mechanism module containing spatial attention weights and channel attention weights is introduced. The joint feature vector of the high-frequency sub-band image is extracted through the dual-channel CNN model, and the joint feature vector is optimized through the attention mechanism module to obtain a depth feature vector.

[0016] A reinforcement learning dynamic optimization method is used to weight and fuse the deep feature vector and the high-frequency coefficient feature vector to obtain a fused feature vector. Then, an edge fluctuation quantization index is calculated based on the fused feature vector. The edge fluctuation quantization index, together with the contour curvature change rate of the low-frequency sub-band image and the fused feature vector, is input into the trained neural network model to obtain the defect level of the original image.

[0017] As an optimization, the specific steps for preprocessing the original image are as follows:

[0018] The original image is uniformly converted into an initial grayscale image using an image format conversion algorithm;

[0019] The initial grayscale image is subjected to adaptive noise suppression processing to obtain a denoised first intermediate grayscale image;

[0020] The first intermediate grayscale image is subjected to contrast enhancement optimization to obtain a second intermediate grayscale image with improved contrast.

[0021] Calculate the image sharpness index and signal-to-noise ratio of the second intermediate grayscale image. If the image sharpness index or signal-to-noise ratio meets the requirements, the second intermediate grayscale image is regarded as the preprocessed image; otherwise, proceed to the next step.

[0022] Determine if the maximum number of iterations has been reached. If not, return to step two and adjust the noise suppression parameters. If yes, treat the second intermediate grayscale image as the preprocessed image.

[0023] As an optimization, the dynamic wavelet decomposition strategy based on gradient entropy is as follows:

[0024] S2.1 Initial selection of wavelet parameters based on the gradient entropy value: Calculate the mean global gradient entropy value of the preprocessed image, and compare the mean global gradient entropy value with the set gradient entropy value threshold, thereby selecting the corresponding wavelet basis function and decomposition level;

[0025] S2.2. Perform multi-scale wavelet decomposition on the preprocessed image according to the wavelet basis function and decomposition level selected in step S2.1 to obtain the initial low-frequency sub-band image;

[0026] S2.3 Calculate the contour irregularity of the initial low-frequency sub-band image, where the contour irregularity D = Σ|Pk-Pk'| / N, Pk is the coordinate of the actual contour sampling point, Pk' is the coordinate of the corresponding point of the standard rectangular contour, the number of sampling points N ≥ min(200, L / 5), and L is the template length (pixels). Compare the contour irregularity with the set contour irregularity threshold to select a new wavelet basis function and decomposition layer.

[0027] S2.4. Perform multi-scale wavelet decomposition on the preprocessed image according to the new wavelet basis function and the number of decomposition levels to obtain the final low-frequency subband image and high-frequency subband image.

[0028] As an optimization, the specific process of S2.1 is as follows:

[0029] S2.1.1 Gradient Entropy Calculation: For the preprocessed image, divide the image into 16×16 pixel local windows and calculate the gradient entropy value of each window. ,in, Let n be the probability distribution of gradient magnitudes within a local window, and n be the quantization series of the gradient magnitudes. The window size optimization satisfies: L is the template length in pixels, which is the probability distribution of the gradient magnitude within the window, and n is the number of possible values ​​of the gradient magnitude. By traversing the entire image through a sliding window, the gradient entropy distribution of all local regions is obtained, thus obtaining the mean global gradient entropy of the preprocessed image.

[0030] S2.1.2 Wavelet basis function type selection: Setting the gradient entropy threshold and ,and When the mean global gradient entropy value of the preprocessed image is less than When the mean of the global gradient entropy is within a certain range, the sym4 wavelet basis function is selected; when the mean of the global gradient entropy is within a certain range... to When the mean of the global gradient entropy is greater than 1, choose the sym6 wavelet basis function; when the mean of the global gradient entropy is greater than 1. When choosing, select the db6 wavelet basis function;

[0031] S2.1.3 Initial Determination of Decomposition Layers: The initial decomposition layers are determined based on the mean of the global gradient entropy values. When the mean is less than... When the initial decomposition level is set to 3, and the mean is within a certain range... to When the mean is between 4 and 5, the initial decomposition level is set to 4-5; when the mean is greater than 100, the initial decomposition level is set to 4-5. At that time, the initial number of decomposition layers was set to 6.

[0032] As an optimization, the specific process of S2.3 is as follows:

[0033] S2.3.1 Calculation of contour irregularity: Extract the actual overall contour of the wooden template from the initial low-frequency sub-band image, compare the actual overall contour with the standard contour, and obtain the contour irregularity D;

[0034] S2.3.2 Decomposition Layer Update Judgment: Set Contour Irregularity Threshold ,like No need to adjust the number of decomposition levels; maintain the initially selected number of decomposition levels. When the initial decomposition level is reached, add one level; if At this time, 2 more layers are added to the initial decomposition layer number, but the maximum decomposition layer number does not exceed 6 layers;

[0035] S2.3.3, Secondary selection of wavelet basis functions: If the number of decomposition levels is updated, the new number of decomposition levels... If the number of new decomposition layers is 6 and the original wavelet basis function is sym4, then the wavelet basis function is adjusted to sym6; if the number of new decomposition layers is 6 and the original wavelet basis function is sym6, then the wavelet basis function is adjusted to db6.

[0036] As an optimization, the high-frequency sub-band image consists of an LH sub-band image containing horizontal low-pass filtering and vertical high-pass filtering, an HL sub-band image containing horizontal high-pass filtering and vertical low-pass filtering, and an HH sub-band image containing two high-pass filters. The specific process of extracting wavelet high-frequency coefficients from the high-frequency sub-band image and mapping the wavelet high-frequency coefficients to the feature space to obtain high-frequency coefficient feature vectors is as follows:

[0037] The LH sub-band image and / or HL sub-band image and / or HH sub-band image are selected as input sub-band images based on the directional attributes of the edge fluctuation features;

[0038] Read the wavelet coefficient matrix of the input sub-band image, use soft thresholding to filter the coefficients in the wavelet coefficient matrix, retain the coefficients whose absolute value is greater than the threshold T, and set the coefficients whose absolute value is not greater than the threshold T to 0, thereby obtaining the denoised high-frequency coefficient matrix;

[0039] The high-frequency coefficient matrix is ​​divided into blocks, and the statistical characteristics within each block are calculated. The statistical characteristics include the mean, variance, and number of maximum points of the coefficients.

[0040] Extract the global features of the high-frequency coefficient matrix, including the proportion of non-zero coefficients and the histogram distribution of the absolute values ​​of the coefficients;

[0041] The statistical features are concatenated with the global features to form a high-frequency coefficient feature vector with fixed dimensions;

[0042] The high-frequency coefficient feature vectors are mapped to a feature space that is homologous to the multimodal attention features through a fully connected layer, and the mapped features are then processed. Standardization is performed so that the modulus of the feature vector is 1, and the high-frequency coefficient feature vector of the high-frequency subband image is finally obtained.

[0043] As an optimization, a dual-channel CNN model consisting of a texture suppression channel and an edge enhancement channel is constructed. Simultaneously, an attention mechanism module containing spatial attention weights and channel attention weights is introduced. The initial depth feature vector of the high-frequency sub-band image is extracted using the dual-channel CNN model, and the initial depth feature vector is then optimized using the attention mechanism module to obtain the final depth feature vector. The specific process is as follows:

[0044] The LH subband graph, HL subband graph and HH subband graph are merged into a three-channel input tensor;

[0045] A dual-channel CNN model is constructed, which includes a texture suppression channel and an edge enhancement channel. The texture suppression channel uses dilated convolution to filter the natural texture of wood, and the edge enhancement channel enhances the fluctuation features through residual connections.

[0046] The three-channel input tensor is input into the texture suppression channel and the edge enhancement channel respectively to obtain the texture suppression feature vector and the edge enhancement feature vector;

[0047] The texture suppression feature vector and the edge enhancement feature vector are concatenated to obtain the joint feature vector;

[0048] The joint feature vector is compressed by global average pooling to reduce the channel dimension, and then processed through two fully connected layers plus sigmoid activation to generate a spatial attention weight map. H is the height, and W is the width;

[0049] The joint feature vector is compressed in terms of spatial dimension through global average pooling, and then processed through two fully connected layers plus sigmoid activation to generate a channel attention weight vector. C represents the dimension;

[0050] Generate deep feature vectors using feature optimization formulas: ,in, This represents matrix multiplication, and F represents the joint eigenvector. This indicates element-wise multiplication.

[0051] As an optimization, the edge fluctuation quantification index includes the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the preprocessed image edge, wherein the fluctuation frequency is the number of fluctuations per unit length of edge, the fluctuation amplitude is the gray difference between the peak and valley values ​​of the vertical distance from the sampling point on the edge contour to the baseline, and the fluctuation continuity is the proportion of continuous fluctuation segments.

[0052] As an optimization, a reinforcement learning dynamic optimization method is used to determine the weights of the deep feature vector and the high-frequency coefficient feature vector. These two are then weighted and fused to obtain a fused feature vector. Based on this fused feature vector, an edge fluctuation quantization index is calculated. This edge fluctuation quantization index, combined with the contour curvature change rate of the low-frequency sub-band image and the fused feature vector, is then input into a trained neural network model to obtain the defect level of the original image. The specific process is as follows:

[0053] The deep feature vector and the high-frequency coefficient feature vector are initially weighted and fused to obtain a fused feature vector, wherein the weights of the deep feature vector and the high-frequency coefficient feature vector are obtained through a reinforcement learning dynamic optimization method;

[0054] Based on the fused feature vector, calculate the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the edge graph corresponding to the fused feature vector;

[0055] The fused feature vector, contour curvature change rate, fluctuation frequency, fluctuation amplitude, and fluctuation continuity are input into the trained neural network model to obtain the defect level of the original image.

[0056] As an optimization, the specific calculation process for calculating the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the preprocessed image edges based on the fusion features is as follows:

[0057] Fluctuation frequency:

[0058] Calculate the direction angle of the line connecting adjacent sampling points The direction angle sequence is obtained. M represents the number of sampling points for the edge contours of the preprocessed image. This represents the coordinates of the i-th sampling point of the edge contour;

[0059] Set the direction angle abrupt change threshold ,when At that time, the judgment This is the inflection point of the fluctuation;

[0060] Total length of the statistical edge Simultaneously, count the total number K of fluctuation inflection points, then the fluctuation frequency... Where L is the total length of the preprocessed image edge, and K represents the total number of fluctuation inflection points;

[0061] Fluctuation range:

[0062] The baseline line function B(x) is obtained by fitting a reference line to the edge contour points P of the preprocessed image using the least squares method.

[0063] Calculate each sampling point vertical distance to the baseline ;

[0064] Filter the maximum value among all sampled points Minimum value ;

[0065] Fluctuation range Through the grayscale mapping formula Converted to grayscale difference, where, , These represent the maximum and minimum grayscale values ​​of the edge region, respectively. The maximum edge length;

[0066] Fluctuation continuity:

[0067] Set the maximum allowable distance between adjacent contour points ,when When the edge breaks at this point, the break location is recorded.

[0068] A continuous, unbroken edge segment is defined as an effective fluctuation segment, and the total length of all effective segments is calculated. ;

[0069] Calculating the continuity of fluctuations .

[0070] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0071] This invention effectively improves the quality of the original image of the wooden template through preprocessing steps such as image format conversion, adaptive noise suppression, and contrast enhancement optimization. It removes noise interference and enhances image contrast, providing clearer and more reliable image data for subsequent feature detection. For example, adaptive noise suppression can specifically address salt-and-pepper noise and Gaussian noise, making image details more prominent; contrast enhancement optimization can reasonably improve contrast based on the image histogram distribution, making features such as edges easier to identify.

[0072] This invention presents a dynamic wavelet decomposition strategy based on gradient entropy, which adaptively selects the wavelet basis function type and the number of decomposition layers according to the edge complexity of the preprocessed image. This allows for more accurate acquisition of low-frequency sub-band images that reflect the overall image contour and high-frequency sub-band images that contain edge details. For example, when edge complexity varies, selecting appropriate wavelet basis functions (such as sym4, sym6, db6, etc.) and the number of decomposition layers can better preserve image contour and edge detail information, laying the foundation for subsequent feature extraction.

[0073] This invention extracts effective high-frequency coefficient feature vectors from high-frequency subband images through operations such as coefficient filtering, block processing, feature concatenation, and mapping standardization. Simultaneously, a dual-channel CNN model is constructed to extract depth feature vectors, and an attention mechanism module is introduced to optimize features, highlighting features in defective regions and suppressing interference from irrelevant textures, making the extracted features more targeted and representative.

[0074] This invention combines a dual-channel CNN architecture with an attention mechanism. The texture suppression channel filters out the natural texture of the wood, the edge enhancement channel strengthens the fluctuation features, and the attention mechanism dynamically focuses on the defect area. The optimized features can more accurately reflect key features such as the edge fluctuation of the wooden template.

[0075] This invention integrates multiple features to calculate auxiliary features such as edge fluctuation quantification indicators (fluctuation frequency, amplitude, and continuity) and contour curvature change rate, enabling a comprehensive characterization of the fluctuation situation at the edge of the wooden template. For example, fluctuation frequency reflects the number of fluctuations per unit length of edge, fluctuation amplitude reflects the degree to which the edge deviates from the baseline, and fluctuation continuity indicates the proportion of effective fluctuation segments at the edge. These indicators describe edge characteristics from different dimensions.

[0076] This invention inputs the fused features into a trained neural network to automatically determine the defect level (minor, moderate, severe) of wooden formwork. By dynamically optimizing the feature fusion weights through reinforcement learning and combining multiple features for judgment, the accuracy and reliability of defect level determination can be improved, effectively identifying different degrees of defects on the edges of wooden formwork, and providing a basis for wooden formwork quality assessment and subsequent processing. Attached Figure Description

[0077] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:

[0078] Figure 1 This is a flowchart of an intelligent detection method for image edge fluctuation features according to the present invention. Detailed Implementation

[0079] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of this invention are only for explaining this invention and are not intended to limit this invention.

[0080] This embodiment 1 provides an intelligent detection method for image edge fluctuation features, such as... Figure 1 As shown, it includes the following steps:

[0081] S1. Obtain the original image of the wooden template and perform preprocessing to obtain the preprocessed image.

[0082] The specific steps of S1 are as follows:

[0083] S1.1 The original image is uniformly converted into an initial grayscale image using an image format conversion algorithm.

[0084] The acquired raw images are typically color images, i.e., RGB images. An image format conversion algorithm converts these RGB images to 8-bit grayscale images, eliminating redundant information in the color channels. The conversion formula is as follows: Where R, G, and B are the pixel values ​​of the red, green, and blue channels, respectively, this ensures that the grayscale value range is normalized to [0, 255], and the output initial grayscale image retains the brightness characteristics of the wooden template edges and textures.

[0085] S1.2. Perform adaptive noise suppression processing on the initial grayscale image to obtain the first intermediate grayscale image after denoising.

[0086] The initial grayscale image may contain salt-and-pepper noise, Gaussian noise, and ambient noise from the shooting environment. Therefore, adaptive noise suppression processing of the initial grayscale image involves the following steps:

[0087] A noise type identification algorithm is used to automatically determine the dominant noise type by calculating the proportion of impulse noise (the proportion of pixels with a jump value of more than 100) and the variance of Gaussian noise in local image regions.

[0088] If the proportion of salt and pepper noise Enable 3×3 or 5×5 adaptive median filtering (window size dynamically adjusts with noise density) to suppress impulse noise by sorting the median values ​​of neighboring pixels;

[0089] If the proportion of salt and pepper noise A 2×2 small-size median filter window is enabled, and isolated noise points are specifically suppressed by sorting the local neighboring pixels and taking the median. Combined with the edge protection mechanism, median filtering is skipped for areas with pixel gradient values ​​>30 (suspected edges), and weighted average filtering is used instead (edge ​​pixels weight 0.7, neighboring pixels weight 0.3) to avoid edge blurring. For local areas with noise density <5% (specifically referring to the proportion of pixels contaminated by salt and pepper noise in the area to the total number of pixels in the area is <5%, such as the smooth area of ​​the wooden template surface), a threshold judgment method is directly used: if the difference between the pixel value and the neighborhood mean is >50, the neighborhood mean is replaced; otherwise, the original pixel value is retained.

[0090] If Gaussian noise variance ,use Gaussian filtering ( The value is linearly adjusted with the noise variance: for every 5 increase in variance, the σ value increases by 0.2), and the noise is smoothed by Gaussian kernel convolution.

[0091] If Gaussian noise variance ,use An adaptive Gaussian filter (σ value is linearly adjusted with noise variance: σ value increases by 0.2 for every 5 increase in variance) is used to smooth noise through small-scale Gaussian kernel convolution. A bilateral filtering enhancement algorithm is introduced, which adds spatial similarity weights (higher weights for closer distances) and gray-level similarity weights (higher weights for smaller gray-level differences) to the Gaussian filter to balance denoising and edge preservation. For texture-dense regions (such as wood ring regions), the filtering window is reduced to 3×3 to reduce texture blurring. For smooth regions (such as template edge transition areas), the window is kept at 5×5 to improve the denoising effect.

[0092] For mixed noise scenarios, a cascaded operation of median filtering and Gaussian filtering is performed. That is, the salt-and-pepper noise removal operation is performed first, followed by the Gaussian noise removal operation.

[0093] S1.3. Perform contrast enhancement optimization on the first intermediate grayscale image to obtain a second intermediate grayscale image with improved contrast.

[0094] The first intermediate grayscale image after denoising may have local brightness unevenness issues (such as blurred edges in shadow areas). Therefore, the following contrast enhancement optimization processing is required for the first intermediate grayscale image:

[0095] S1.3.1 Calculate the image grayscale histogram:

[0096] S1.3.1.1 If the histogram distribution is concentrated (entropy value) Enable the Limit Contrast Adaptive Histogram Equalization (CLAHE) algorithm; set the CLAHE grid size to 8×8 and the contrast limit threshold to 2.0-3.0 (dynamically adjusted according to image brightness) to perform histogram equalization on local areas; for areas with uniform brightness (grayscale standard deviation <15), skip the enhancement process to avoid excessive amplification of noise.

[0097] S1.3.1.2 If the histogram distribution is not concentrated, targeted strategies should be adopted to avoid noise amplification or loss of detail caused by over-enhancement. The specific processing steps are as follows:

[0098] S1.3.1.2.1, Judgment of local regional differences:

[0099] The first intermediate grayscale image is divided into 16×16 local sub-blocks, and the grayscale standard deviation and entropy value of each sub-block are calculated. Regions with an entropy value less than 4.5 and a grayscale standard deviation less than 10 are selected (determined as local low contrast regions, such as the shadow area on the surface of the wooden template). The remaining sub-blocks (high contrast regions) are marked as "no enhancement required".

[0100] S1.3.1.2.2, Local contrast fine-tuning:

[0101] a) For low-contrast sub-blocks, local adaptive gamma correction is adopted. The gamma value γ is dynamically adjusted according to the average brightness of the sub-block: γ=1.2-1.5 is used in areas with high brightness (mean > 180) to suppress highlights, and γ=0.5-0.8 is used in areas with low brightness (mean < 80) to enhance shadows. The correction range is limited to ensure that the gray value change of the sub-block does not exceed 20% of the original range, so as to avoid destroying the overall gray value balance.

[0102] b) For high-contrast sub-blocks, skip the enhancement process and retain the original grayscale distribution; only perform smooth transition processing on the block edges (using 5×5 Gaussian blur weight fusion) to avoid obvious brightness jumps between sub-blocks.

[0103] S1.3.1.2.3, Enhancement effect verification:

[0104] Calculate the global entropy value of the enhanced image to ensure that the entropy value is still greater than 5 (to maintain the richness of grayscale levels); check the improvement of the grayscale standard deviation in low-contrast areas, which should reach 30%-50% of the original standard deviation (to ensure the improvement of local detail visibility); compare the structural similarity index (SSIM) with the original image, and the SSIM should be >0.9 (to ensure overall visual consistency).

[0105] The second intermediate grayscale image is obtained through step S1.3.

[0106] S1.4 Calculate the image sharpness index and signal-to-noise ratio of the second intermediate grayscale image. If the image sharpness index or signal-to-noise ratio meets the requirements, the second intermediate grayscale image is regarded as the preprocessed image; otherwise, proceed to S1.5.

[0107] S1.5 Determine whether the maximum number of iterations has been reached. If not, return to S1.2 and adjust the noise suppression parameters. If yes, then regard the second intermediate grayscale image as the preprocessed image.

[0108] Steps S1.4 and S1.5 are image quality assessment and reprocessing procedures.

[0109] Its input is a contrast-enhanced grayscale image, and the specific process is as follows:

[0110] Calculate image sharpness metrics (such as the response value of the Tenengrad gradient operator) and signal-to-noise ratio (SNR); if the sharpness metric is <50 or the SNR is <20dB, automatically backtrack to the noise suppression step, adjust the filtering parameters and reprocess; repeat the iteration until the image quality meets the standard or the maximum number of iterations (3 times) is reached.

[0111] Finally, a preprocessed image that meets the detection criteria is output as input data for dynamic wavelet decomposition. The preprocessed image is a grayscale image containing original visual information such as the surface texture and edge contours of the wooden template.

[0112] S2. Design a dynamic wavelet decomposition strategy based on gradient entropy, and perform multi-scale wavelet decomposition on the preprocessed image using the dynamic wavelet decomposition strategy to obtain a low-frequency sub-band image that reflects the overall contour of the preprocessed image and a high-frequency sub-band image that contains the edge details of the preprocessed image.

[0113] In some embodiments, the dynamic wavelet decomposition strategy based on gradient entropy is as follows:

[0114] The edge complexity of the preprocessed image is quantified based on the gradient entropy value of the local region of the preprocessed image obtained in real time. The wavelet basis function type and decomposition level are dynamically selected based on the gradient entropy value. Multi-scale wavelet decomposition is then performed on the preprocessed image according to the selected wavelet basis function and decomposition level, thereby obtaining a low-frequency sub-band image reflecting the overall contour of the preprocessed image and a high-frequency sub-band image containing the edge details of the preprocessed image. A secondary verification and adjustment are performed based on the contour irregularity of the obtained low-frequency sub-band image to update the selected decomposition level. The formula for calculating the gradient entropy value is: E represents the gradient entropy value, and n represents the number of value categories. In a grayscale image, n is 256. This represents the probability of the i-th value occurring.

[0115] The more specific process is as follows:

[0116] S2.1 Initial selection of wavelet parameters based on gradient entropy:

[0117] S2.1.1 Gradient Entropy Calculation: For the preprocessed image (i.e., the preprocessed grayscale image of the wooden template), the image is divided into local windows of 16×16 pixels, and the gradient entropy value of each window is calculated. ,in, This represents the probability distribution of gradient magnitudes within the window, i.e. Let n be the probability distribution of gradient magnitudes within a 16×16 local window, where n is the number of possible values ​​for the gradient magnitude, i.e., the quantization level of the gradient magnitude. Of course, the window size can also be optimized to satisfy... L represents the length of the wooden template (in pixels), i.e., the number of pixels on the longer side of the template. By traversing the entire image through a sliding window, the gradient entropy distribution of all local regions is obtained, and the average value of all gradient entropy values ​​is calculated to obtain the average global gradient entropy value of the preprocessed image.

[0118] S2.1.2 Wavelet basis function type selection: Setting the gradient entropy threshold and ,and In this embodiment, , When the mean global gradient entropy value of the preprocessed image is less than When the edge complexity is low, the sym4 wavelet basis function is chosen (good symmetry, suitable for smooth edge processing); when the mean global gradient entropy value is within... to Between (inclusive) and This indicates moderate marginal complexity, so the sym6 wavelet basis function is chosen; when the mean global gradient entropy is greater than... When the edge complexity is high, the db6 wavelet basis function is selected (it has strong tight support and is suitable for capturing complex edge details).

[0119] S2.1.3 Initial Determination of Decomposition Layers: The initial number of decomposition layers is determined based on the mean global gradient entropy value. When the mean is less than... When the initial decomposition level is set to 3, and the mean is within a certain range... to Between (inclusive) and The initial decomposition level is set to 4-5 levels; when the mean is greater than At that time, the initial number of decomposition layers was set to 6.

[0120] S2.2 Multi-scale wavelet decomposition execution:

[0121] Using the wavelet basis function and initial decomposition level selected in step S2.1, multi-scale wavelet decomposition is performed on the preprocessed image to obtain a low-frequency sub-band image (LL) containing the overall contour and a high-frequency sub-band image (LH, HL, HH) containing edge details.

[0122] S2.3, Secondary verification and adjustment based on low-frequency sub-band image contour irregularity:

[0123] S2.3.1 Contour Irregularity Calculation: Extract the overall contour of the wooden template from the low-frequency sub-band image and compare it with the standard contour (set according to the actual size of the wooden template). Calculate the Euclidean distance from each point on the contour to the corresponding point on the standard rectangular contour, and take the average of these distances as the contour irregularity D.

[0124] The contour irregularity D is used to quantify the deviation between the actual contour and the standard rectangular contour in the low-frequency subband image of the wooden template. The contour irregularity D = Σ|Pk-Pk'| / N, where Pk is the coordinate of the actual contour sampling point, Pk' is the coordinate of the corresponding point of the standard rectangular contour, the number of sampling points N≥min(200, L / 5), and L is the template length (pixels). The specific calculation formula is as follows: Where D represents the contour irregularity (unit: pixels), the larger the value, the more significant the deviation between the actual contour and the standard contour; N represents the total number of contour sampling points (points are taken evenly according to the contour length, usually...). To ensure accuracy, the value of N can also be N≥min(200, L / 5), where L is the template length (pixels). This represents the coordinates of the k-th sampling point on the actual contour (extracted from the initial low-frequency sub-band image). This represents the coordinates of the reference point corresponding to the kth sampling point on the quasi-rectangular outline (generated based on the design dimensions of the wooden template).

[0125] Actual contour extraction: The initial low-frequency sub-band image (LL) is binarized (threshold is the gray-level mean). The Canny edge detection algorithm is used to extract the closed contour of the wooden template. The contour is simplified by the Douglas-Peucker algorithm, and N sampling points are uniformly collected and the coordinates are recorded. ;

[0126] Standard contour generation: Based on the nominal dimensions of the wooden template (e.g., length L, width W), generate a standard rectangular contour in the image coordinate system. Take N reference points at the same sampling interval as the actual contour and record their coordinates. ;

[0127] Distance calculation: Calculate the Euclidean distance between the actual sampling point and the corresponding reference point point point by point, and take the average value after summing to obtain the profile irregularity D.

[0128] For example, if the standard size of the wooden template is 1000×500 pixels, the total distance between the actual contour sampling point and the standard contour reference point is 800 pixels, and the number of sampling points N=200, then D=800 / 200=4 pixels, indicating that the average deviation is 4 pixels.

[0129] S2.3.2 Decomposition Layer Update Judgment: Set Contour Irregularity Threshold (Determined according to the quality standards of wooden formwork, for example, 5 pixels). If This indicates that the low-frequency contours are regular, and there is no need to adjust the number of decomposition layers; the initially selected number of decomposition layers should be maintained. This indicates that the low-frequency contours are irregular, requiring an increase in the number of decomposition layers to better capture edge details. The specific update rule is: when... When, add 1 layer to the initial decomposition layer number; when At this time, 2 more layers are added to the initial decomposition layer number, but the maximum decomposition layer number does not exceed 6 layers.

[0130] S2.3.3, Secondary selection of wavelet basis functions: If the number of decomposition levels is updated, the new number of decomposition levels... If the number of decomposition layers is 6 and the original wavelet basis function is sym4, then the wavelet basis function is adjusted to sym6; if the new decomposition layer number is 6 and the original wavelet basis function is sym6, then the wavelet basis function is adjusted to db6 to meet the need for capturing complex edges at higher decomposition layers.

[0131] S2.4 Final Wavelet Decomposition Execution: Based on the wavelet basis function and decomposition level determined after secondary verification and adjustment, the preprocessed image is re-decomposed into multi-scale wavelet decomposition to obtain the final low-frequency sub-band image and high-frequency sub-band image, providing accurate multi-scale feature data for subsequent feature extraction and other steps.

[0132] The gradient entropy-based dynamic wavelet decomposition strategy of this invention for decomposing preprocessed images has the following advantages:

[0133] Improve the accuracy of feature extraction:

[0134] Quantifying edge complexity by using gradient entropy values ​​and matching them with wavelet basis functions allows wavelet decomposition to better reflect the actual features of the wooden template edges. For example, using the tightly supported db6 wavelet for images with complex edges can accurately capture subtle fluctuations; while using the sym4 wavelet for images with simple edges can reduce redundant computation. Furthermore, the initial setting of the decomposition layer number is linked to the edge complexity, avoiding the problems of under-extraction (insufficient layers leading to missed details) or over-extraction (too many layers introducing noise) caused by a fixed number of layers.

[0135] Enhancing the algorithm's adaptability to complex scenarios:

[0136] In practical applications, wooden templates may exhibit complex local edges but regular overall contours, or large overall deformation but simple local edges. Secondary verification introduces low-frequency contour irregularity, which can correct decomposition parameters from a global perspective. For example, when the global gradient entropy value indicates moderate edge complexity (corresponding to 4-layer decomposition), but the low-frequency contour irregularity exceeds the threshold, increasing the decomposition layer to 5-6 layers ensures sufficient extraction of edge features from the overall deformation, avoiding misjudgment of local features from affecting global detection.

[0137] Balancing detection efficiency and accuracy:

[0138] The initial parameter selection is based on the global gradient entropy value, which can quickly determine the approximate decomposition strategy; the secondary verification adjusts the parameters only when necessary (when the contour irregularity exceeds the threshold), avoiding blindly increasing the amount of computation across the entire scene. For example, for wooden templates with regular contours, maintaining the initial 3-layer decomposition is sufficient to meet the requirements, reducing the time consumed by unnecessary multi-layer decomposition; for templates with severe deformation, the accuracy is improved by increasing the number of layers, achieving a dynamic balance of "precision where it should be precise and speed where it should be fast".

[0139] Provides high-quality feature data for subsequent processing:

[0140] The final output low-frequency and high-frequency sub-band images are optimized to retain complete global contour information while highlighting detailed edge undulations. This enables multimodal attention feature extraction to focus on defect areas more efficiently, strengthens feature complementarity during heterogeneous fusion, and thus improves the accuracy of defect level determination, reducing false positives and false negatives caused by insufficient feature quality.

[0141] S3. Extract the wavelet high-frequency coefficients of the high-frequency sub-band image and map the wavelet high-frequency coefficients to the feature space to obtain the high-frequency coefficient feature vector.

[0142] In some embodiments, the specific process of S3 is as follows:

[0143] S3.1. Filter the LH sub-band image and / or HL sub-band image and / or HH sub-band image as input sub-band images based on the directional attributes of the edge fluctuation features.

[0144] The extracted high-frequency subband image specifically refers to the high-frequency detail image containing edge details generated during wavelet decomposition, and does not include the low-frequency subband image.

[0145] In two-dimensional wavelet transform, an image is decomposed into four subbands: LL, LH, HL, and HH. The low-frequency subband LL undergoes two low-pass filtering operations (horizontal and vertical), reflecting the overall appearance of the image at the next scale, including the overall shape of the wooden template, large-area grayscale gradations, and overall structural information, acting like the skeleton of the image. The high-frequency detail subbands—LH (low-pass filtered horizontally, high-pass filtered vertically, containing horizontal edge information and reflecting high-frequency changes in the vertical direction), HL (high-pass filtered horizontally, low-pass filtered vertically, containing vertical edge information and reflecting high-frequency changes in the horizontal direction), and HH (two high-pass filtered, containing high-frequency information along the diagonal, reflecting details and texture)—capture subtle but crucial information such as edges, textures, and local abrupt changes, acting like the texture and detail brushstrokes of the image. In the wooden template edge fluctuation feature detection process, the high-frequency detail subband images output by dynamic wavelet decomposition serve as input to the multimodal attention feature extraction step. Their importance lies in providing detailed features directly related to edge fluctuations for subsequent feature extraction. The edge information in these high-frequency detail images helps the texture suppression channel and edge enhancement channel in the subsequent dual-channel CNN architecture to further process the data. By filtering out the interference of natural wood texture through dilated convolution, strengthening the fluctuation features by utilizing residual connections, and focusing on the defect area by combining the attention mechanism, the precise extraction and analysis of the fluctuation features of the wood template edge can be achieved.

[0146] Step S3.1 is the screening of high-frequency sub-band images. In step S3.1, the input is a set of high-frequency sub-band images after dynamic wavelet decomposition (including multi-scale sub-band images in the three directions of LH, HL, and HH, such as 3-6 level decomposition corresponding to 3-6 groups of high-frequency sub-bands).

[0147] The specific processing procedure is as follows:

[0148] Target subbands are selected based on the directional attributes of edge fluctuation characteristics: HL subband maps (horizontal high-pass filtering) are preferred for horizontal edge fluctuations (such as lateral bending of wooden templates), LH subband maps (vertical high-pass filtering) are preferred for vertical edge fluctuations, and HH subband maps are preferred for diagonal fluctuations; the significance of multi-scale subbands is evaluated, the edge energy (sum of squared gradient magnitudes) of each subband is calculated, the top two scale subbands in terms of energy are retained, and redundant subbands with too low energy (subbands with energy percentage <5%) are removed.

[0149] Output 1-2 sets of high-frequency sub-band images after filtering (such as HL4, LH5, where the number indicates the number of decomposition layers), focusing on high-frequency information that is strongly correlated with edge fluctuations.

[0150] S3.2 Read the wavelet coefficient matrix of the input sub-band image, use soft thresholding to filter the coefficients in the wavelet coefficient matrix, retain the coefficients whose absolute value is not less than the threshold T, and set the coefficients whose absolute value is less than the threshold T to 0, thereby obtaining the denoised high-frequency coefficient matrix.

[0151] Specifically, the wavelet coefficient matrix of the sub-band image is read (each pixel corresponds to a high-frequency coefficient value, reflecting the intensity of edge change at that location), and soft thresholding is used to filter the coefficients. The threshold T is dynamically calculated based on the sub-band noise level. ,in, As a volatility-sensitive factor, , This represents the set of subband coefficients, where median is the median. Then, coefficients with an absolute value greater than T are considered as effective edge fluctuation coefficients, while coefficients with an absolute value less than or equal to T are set to 0 (suppressing noise coefficients). Finally, the denoised high-frequency coefficient matrix is ​​output, highlighting the coefficient information of effective edge fluctuations.

[0152] S3.3. Divide the high-frequency coefficient matrix into blocks (e.g., 8×8 pixel blocks) and calculate the statistical characteristics within each block. The statistical characteristics include the mean of the coefficients (reflecting the average fluctuation intensity), the variance (reflecting the fluctuation stability), and the number of maximum points (reflecting the fluctuation frequency).

[0153] S3.4 Extract the global features of the high-frequency coefficient matrix, including the proportion of non-zero coefficients (reflecting the coverage of the fluctuation area) and the histogram distribution of the absolute values ​​of the coefficients (reflecting the distribution pattern of fluctuation intensity).

[0154] S3.5. The statistical features are concatenated with the global features to form a high-frequency coefficient feature vector with fixed dimensions.

[0155] In this embodiment, the high-frequency coefficient feature vector dimension is fixed at 1212 dimensions, of which the block statistical features are 1200 dimensions (400 blocks × 3 dimensions) and the global features are 12 dimensions; if the matrix size is insufficient, standardization is achieved by padding with zeros at the edges or truncating the first 400 blocks.

[0156] Steps S3.3-S3.5 involve coefficient quantization and feature construction of the high-frequency coefficient matrix, outputting a structured high-frequency coefficient feature vector that can be directly input into the fully connected layer for feature mapping.

[0157] To concatenate the block-based statistical features with the global features into a fixed-dimensional high-frequency coefficient feature vector, three core steps are required: feature dimension standardization, ordered concatenation, and dimension verification. The specific implementation process of S3.5 is as follows:

[0158] S3.5.1 Dimensional Standardization of Block Statistical Features:

[0159] S3.5.1.1, Block parameter setting: For the denoised high-frequency coefficient matrix (assuming size is...) H and W are the number of rows and columns, respectively. The matrix is ​​divided into fixed blocks of 8×8 pixels. If the matrix size is not a multiple of 8, zeros are added to the edges to make it the nearest multiple of 8 (e.g., a 120×160 matrix is ​​divided into 15×20=300 blocks).

[0160] S3.5.1.2 Single Block Feature Extraction: Extract 3 statistical features for each 8×8 block—mean coefficient (1-dimensional), variance (1-dimensional), and number of maximum points (1-dimensional). The feature dimension of a single block is 3-dimensional.

[0161] S3.5.1.3 Unified Block Feature Dimensions: If the image size fluctuates (e.g., different wooden template images have slightly different resolutions), dimension standardization is achieved by fixing the number of blocks. For example, the maximum number of blocks is set to 400 (corresponding to 32×32 blocks, covering the maximum high-frequency coefficient matrix of 256×256 pixels). If the number of blocks is less than 400, zero vectors are used to fill up to 400 blocks; if it exceeds 400 blocks, the first 400 blocks are truncated. At this time, the total dimension of the block statistical features is 400*3=1200 dimensions.

[0162] S3.5.2, The dimensions of global features are fixed:

[0163] S3.5.2.1 Global Feature Extraction: Extract 5 global features from the high-frequency coefficient matrix: proportion of non-zero coefficients (1-dimensional), histogram distribution of absolute coefficient values ​​(divided into 8 intervals, 8-dimensional), maximum coefficient value (1-dimensional), minimum coefficient value (1-dimensional), and sum of coefficients (1-dimensional). The total dimension of the global features is fixed at 1+8+1+1+1=12 dimensions.

[0164] S3.5.2.2 Feature Normalization: Perform min-max normalization on the global features, mapping each feature value to the [0,1] interval to avoid the influence of numerical range differences on the concatenated feature vector.

[0165] S3.5.3, Feature-Ordered Assembly and Dimension Locking:

[0166] S3.5.3.1 Definition of Concatenation Order: A fixed concatenation order of "block statistical features first, global features second" is adopted to ensure the structural consistency of the feature vectors. For example, after concatenating 1200-dimensional block features with 12-dimensional global features, the total dimension is 1200 + 12 = 1212 dimensions.

[0167] S3.5.3.2 Dimension Validation Mechanism: After splicing, if the total dimension is not equal to the preset 1212 dimensions through the feature dimension checking module, the backtracking mechanism is triggered—re-checking whether the number of blocks is 400 and whether the global feature is 12 dimensions, and automatically correcting zero-padding or truncation operations until the dimension meets the requirements.

[0168] S3.5.3.3 Vector Format Conversion: Convert the concatenated feature matrix into a 1×1212 row vector format as the input data format for the fully connected layer.

[0169] Taking a high-frequency coefficient matrix (size 240×320, divided into 30×40=1200 blocks) as an example:

[0170] Block statistical characteristics: 1200 blocks × 3 dimensions = 3600 dimensions. Since it exceeds the maximum number of blocks of 400, the first 400 blocks are truncated, resulting in 400 × 3 = 1200 dimensions.

[0171] Global features: Extract 12 dimensions using a fixed approach;

[0172] The concatenated feature vector is 1200+12=1212 dimensional. After dimension verification, the output ensures that the feature vectors extracted from different high-frequency subband images have completely consistent dimensions, providing standardized input for subsequent fully connected layer mapping and heterogeneous fusion.

[0173] S3.6. The high-frequency coefficient feature vector is mapped to a feature space that is homologous to the multimodal attention features through a fully connected layer, and the mapped features are then processed. Standardization is performed so that the modulus of the feature vector is 1, and the high-frequency coefficient feature vector of the high-frequency subband image is finally obtained.

[0174] This step maps the feature vectors obtained in S3.5 to a feature space homologous to the multimodal attention features using a fully connected layer (with the number of hidden neurons being 1.5 times the dimension of the feature vectors). The mapping function is... W is the weight matrix, b is the bias term, and the mapped features are processed... Standardization makes the feature vector's magnitude 1, eliminating the impact of dimensional differences on subsequent fusion.

[0175] Standardization refers to the standardization of feature vectors. (where d is the feature dimension) is transformed to make the transformed vector Satisfying the Euclidean norm ( The norm is equal to 1, that is:

[0176] ;

[0177] yes The transformed elements, where, ( ).

[0178] Finally, a standardized high-frequency coefficient feature vector is output, which can be directly weighted and fused with multimodal deep features to provide high-frequency detailed basis for defect level determination.

[0179] This step can eliminate the influence of dimensions: in the high-frequency coefficient feature vector after mapping, features of different dimensions may have different numerical ranges (such as "non-zero coefficient percentage" in the range of [0,1], and "total coefficients" may reach thousands). After standardization, all feature values ​​are scaled to the range of [-1,1] to avoid the dominance of a certain dimension value in subsequent fusion calculations.

[0180] At the same time, it can enhance feature comparability: after standardization, the "direction" of the feature vector becomes the core information, while the "length" is unified. For example, two feature vectors describing slight fluctuations and moderate fluctuations respectively can more accurately reflect their differences through the angle between the vectors after standardization, thus improving the rationality of weight allocation when fusing heterogeneous features.

[0181] Furthermore, it can stabilize model training: In subsequent BP neural network training, standardized features can accelerate the convergence speed of gradient descent, reduce model oscillations caused by fluctuations in feature values, and improve the stability of defect level determination.

[0182] S4. Construct a dual-channel CNN model and extract the depth feature vector of the high-frequency sub-band image through the dual-channel CNN model.

[0183] The specific process of S4 is as follows:

[0184] S4.1. Merge the LH subband graph, HL subband graph and HH subband graph into a three-channel input tensor.

[0185] The high-frequency sub-band image (256×256 pixels, pixel value range [0,1], normalized) obtained by the gradient entropy-based dynamic wavelet decomposition strategy contains edge details in the horizontal (HL), vertical (LH), and diagonal (HH) directions. The high-frequency sub-band image has a size of H×W×C (H is height, W is width, and C is the number of channels, such as a 3-channel RGB or a single-channel grayscale image), and includes original features such as wood texture and edge undulations. It covers edge details in the horizontal, vertical, and diagonal directions.

[0186] First, the high-frequency subband image is preprocessed: the high-frequency subband image is channel-stitched, and the high-frequency subband images in the three directions are merged into a 3-channel input tensor (shape 256×256×3), which is used as the common input of the dual-channel CNN.

[0187] S4.2 Construct a dual-channel CNN model, which includes a texture suppression channel and an edge enhancement channel. The texture suppression channel uses dilated convolution to filter the natural texture of the wood, while the edge enhancement channel enhances the fluctuation features through residual connections.

[0188] Specifically, texture suppression channels include:

[0189] First layer: Hollow convolution layer

[0190] 64 3×3 convolution kernels are used, with an inflation rate of 2, a stride of 1, and padding mode of "same" (to keep the output size consistent with the input).

[0191] The activation function chosen is LeakyReLU (slope 0.01) to suppress low-frequency interference signals generated by wood grain.

[0192] The output feature map size is 256×256×64, which initially filters out dense texture information.

[0193] Second layer: Batch normalization and pooling:

[0194] Perform batch normalization on the convolution output (mean 0, variance 1) to stabilize the training process;

[0195] Using 2×2 max pooling (step size 2), the output feature map size is compressed to 128×128×64.

[0196] Third layer: Multi-scale dilated convolution:

[0197] Three sets of convolutional kernels are set in parallel: 3×3 (dilation rate 3), 5×5 (dilation rate 2), and 7×7 (dilation rate 1), with 32 convolutional kernels in each set;

[0198] The three sets of output feature maps are concatenated (32×3=96 channels) and compressed to 64 channels by 1×1 convolution.

[0199] The output feature map size is 128×128×64, which further suppresses texture interference at different scales.

[0200] Fourth layer: Global average pooling:

[0201] Perform global average pooling on the feature map to output a 1×1×64 texture suppression feature vector.

[0202] Edge enhancement channels include:

[0203] First layer: Regular convolutional layer:

[0204] The system uses 64 3×3 convolutional kernels with a stride of 1, padding with "same" characters, and the activation function ReLU.

[0205] The output feature map size is 256×256×64, and the edge primitive features are initially extracted.

[0206] Second layer: Residual module:

[0207] It contains two 3×3 convolutional layers (64 channels each), with batch normalization and ReLU activation added in between;

[0208] By adding the input features to the convolutional output (F(x)+x) through skip connections, edge feature propagation is enhanced;

[0209] The output feature map size is 256×256×64, which alleviates the gradient vanishing problem in deep networks.

[0210] Third layer: Downsampling and residual stacking:

[0211] Using 2×2 max pooling (step size 2), the feature map size is compressed to 128×128×64;

[0212] Stack two residual modules (each containing two convolutional layers) while maintaining 64 output channels;

[0213] The output feature map size is 128×128×64, enhancing the hierarchical features of the edge contour.

[0214] Fourth layer: Global average pooling:

[0215] Perform global average pooling on the feature map to output a 1×1×64 edge enhancement feature vector.

[0216] S4.3. Input the three-channel input tensor into the texture suppression channel and the edge enhancement channel respectively to obtain the texture suppression feature vector and the edge enhancement feature vector.

[0217] S4.4. Concatenate the texture suppression feature vector and the edge enhancement feature vector to obtain the joint feature vector.

[0218] The specific process is as follows:

[0219] Feature concatenation: The 64-dimensional feature vector of the texture suppression channel is concatenated with the 64-dimensional feature vector of the edge enhancement channel to form a 128-dimensional joint feature vector.

[0220] S4.5. For the joint feature vector (e.g., 256×256×64), compress the channel dimension through global average pooling, and then generate a spatial attention weight map through 2 fully connected layers + Sigmoid activation. (Size and Input Features) Figure 1 (e.g., 256×256), where H is the height and W is the width.

[0221] The weight of each pixel reflects the spatial correlation between that location and the defect area (high weight for defect areas and low weight for texture areas).

[0222] S4.6. The joint feature vector is compressed in spatial dimension by global average pooling (to obtain 1×1×C, where C is the number of channels), and then passed through 2 fully connected layers + Sigmoid activation to generate channel attention weight vectors. C represents the dimension (the dimension is the same as the number of channels, such as 64 dimensions).

[0223] The weight of each channel reflects its contribution to the defect features (edge ​​fluctuation channels have high weights, texture channels have low weights).

[0224] S4.7. Generate deep feature vectors using feature optimization formulas: ,in, Representation of matrix multiplication (spatial attention weight graph) Multiplying the joint eigenvector F at each spatial location (highlighting the defect area), F represents the joint eigenvector. This represents element-wise multiplication (channel attention weight vector). Multiply the joint feature vector F channel by channel to highlight the effective channels.

[0225] S5. The weights of the deep feature vector and the high-frequency coefficient feature vector are determined by the reinforcement learning dynamic optimization method, and the deep feature vector and the high-frequency coefficient feature vector are weighted and fused to obtain the fused feature vector. Then, the edge fluctuation quantification index (fluctuation frequency, amplitude, continuity) is calculated based on the fused feature vector, and the edge fluctuation quantification index is combined with the contour curvature change rate of the low-frequency sub-band image and input into the trained neural network model to obtain the defect level of the original image.

[0226] In some embodiments, the specific process of S5 is as follows:

[0227] S5.1. The deep feature vector and the high-frequency coefficient feature vector are initially weighted and fused to obtain a fused feature vector, wherein the weights of the deep feature vector and the high-frequency coefficient feature vector are obtained through a reinforcement learning dynamic optimization method.

[0228] In the initial weighted fusion of deep feature vectors (CNN-extracted, 128-dimensional) and high-frequency coefficient feature vectors (1212-dimensional), the core logic of using reinforcement learning to dynamically optimize the weights is: through trial and error between the agent and the environment, to find the weight parameters that optimize the discriminative ability of the fused features. The specific implementation steps are as follows:

[0229] S5.1.1 Design of Core Elements of Reinforcement Learning:

[0230] S5.1.1.1, State Space:

[0231] Define the state as the feature distribution statistics of the current batch of training data, including:

[0232] Mean of deep feature vectors ,variance (Reflecting the overall distribution of depth features);

[0233] Mean of the eigenvectors of high-frequency coefficients ,variance (The overall distribution reflecting high-frequency characteristics);

[0234] Cosine similarity between two types of features (Measure feature redundancy). , These are the deep feature vector and the high-frequency coefficient feature vector, respectively.

[0235] State vector It has 5 dimensions to ensure that it contains key information about the feature distribution.

[0236] S5.1.1.2, Action Space:

[0237] Action is defined as deep feature weights and high-frequency coefficient feature weights The adjustment amount satisfies and (To avoid feature failure due to excessively low weights).

[0238] The motion space is discretized, The possible values ​​are divided into 9 levels: 0.1, 0.2, ..., 0.9, corresponding to... The values ​​are automatically determined to be 0.9, 0.8, ..., 0.1, for a total of 9 selectable actions.

[0239] S5.1.1.3, Reward Function:

[0240] The core reward is the accuracy of defect level determination based on fusion features, and the formula is:

[0241] ;

[0242] Where acc is the accuracy of the model on the validation set with the current weights (value [0,1]).

[0243] loss is the value of the cross-entropy loss function (values ​​[0,1]).

[0244] This is a penalty term for weight differences to prevent certain features from being overly ignored.

[0245] Hyperparameters , , (Determined through grid search).

[0246] when At that time, an additional penalty r = r - 0.2 is applied to accelerate the elimination of inferior weights.

[0247] S5.1.2, Reinforcement Learning Optimization Process:

[0248] S5.1.2.1, Agent Initialization:

[0249] A deep Q-network (DQN) is used as the agent. The network structure is as follows: input layer (5-dimensional state) → hidden layer 1 (64-dimensional, ReLU) → hidden layer 2 (32-dimensional, ReLU) → output layer (9-dimensional Q-value, corresponding to the value of 9 actions).

[0250] Initialize weight parameters , , as the initial fusion weight.

[0251] S5.1.2.2, Interactive Iteration Process:

[0252] S5.1.2.2.1 State Observation: For the current training batch data, calculate the state vector s and input it into DQN to obtain the Q value estimate for each action.

[0253] S5.1.2.2.2 Action Selection: An ε-greedy strategy is used to select actions: the action with the largest Q value is selected with a probability of ε=0.8, and an action is randomly selected with a probability of 0.2 (balancing exploration and exploitation). and .

[0254] S5.1.2.2.3, Execution of Actions and Calculation of Rewards:

[0255] Fuse feature vectors according to selected weights ( The input is used to train the neural network, and the reward r on the validation set is calculated.

[0256] S5.1.2.2.4, Experience Replay and Network Updates:

[0257] Will( ) are stored in the experience pool (capacity 10000), 32 experiences are randomly sampled, and the loss function is applied. Update DQN parameters, where , which is the discount factor.

[0258] S5.1.2.2.5 Termination Condition: When the reward r fluctuation is less than 0.02 for 10 consecutive iterations, or when the total number of iterations reaches 500, training stops, and the current optimal weights are output. and .

[0259] S5.1.2.3, Dynamic weight adjustment mechanism:

[0260] After each training epoch is completed, a reinforcement learning optimization is triggered, and the weights are updated according to the new state.

[0261] During the testing phase, the optimal weights obtained from training are used consistently to ensure the stability of the inference process.

[0262] This method uses the trial-and-error mechanism of reinforcement learning to dynamically adjust the weight parameters according to the data distribution, which solves the problem that fixed weights are difficult to adapt to multi-sample scenarios and provides better fusion features for subsequent dual-branch neural network inputs.

[0263] S5.2 Calculate the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the edge map corresponding to the fused feature vector based on the fused feature vector (the fluctuation frequency is the number of fluctuations per unit length of edge, the fluctuation amplitude is the gray difference between the peak and valley values ​​of the vertical distance from the sampling point on the edge contour to the baseline, and the fluctuation continuity is the proportion of continuous fluctuation segments).

[0264] In some embodiments, the specific process of S5.2 is as follows:

[0265] S5.2.1 Edge contour extraction and sampling:

[0266] Input: Edge probability map (size 2048×1536, pixel value represents edge probability) generated by mapping the fused feature vector through a fully connected layer.

[0267] Processing procedure:

[0268] An adaptive threshold segmentation method (the threshold is the mean of the probability map plus 1.2 times the standard deviation) is used to obtain a binarized edge image;

[0269] The complete edge contour is extracted by 8-neighbor connected component analysis, and isolated edge segments with a length of less than 50 pixels are removed.

[0270] The preserved edge contours are sampled at equal intervals of 2 pixels to obtain a sequence of contour points. , Here are the pixel coordinates, and M is the total number of sampling points.

[0271] S5.2.2, Calculation of fluctuation frequency:

[0272] Direction angle sequence generation: Calculate the direction angle of the line connecting adjacent sampling points. The direction angle sequence is obtained. (Unit: radians), M represents the number of sampling points for the edge contour of the preprocessed image. This represents the coordinates of the i-th sampling point of the edge contour;

[0273] Fluctuation point identification: Set a threshold for sudden changes in direction angle , (Converted to 0.523 radians), when At that time, the judgment This is the inflection point of the fluctuation;

[0274] Frequency calculation: Statistical edge total length (Unit: pixels), and simultaneously count the total number of fluctuation inflection points K, then the fluctuation frequency. (Unit: times / pixel), which is the number of fluctuations per unit length of edge, where L is the total length of the edge of the preprocessed image and K represents the total number of fluctuation inflection points;

[0275] S5.2.3, Calculation of fluctuation amplitude:

[0276] Baseline fitting: The least squares method is used to fit a baseline line to the edge contour points P of the preprocessed image (fitting a Bezier baseline curve to the curve edge) to obtain the baseline function B(x);

[0277] Deviation calculation: Calculate for each sampling point vertical distance to the baseline (The curved edges use Euclidean distance).

[0278] Amplitude determined:

[0279] Filter the maximum value among all sampled points Minimum value ;

[0280] Fluctuation range Through the grayscale mapping formula Converted to grayscale difference, where, , These represent the maximum and minimum grayscale values ​​of the edge region, respectively. This represents the maximum edge length.

[0281] S5.2.4, Fluctuation Continuity:

[0282] Break detection: Set the maximum allowable distance between adjacent contour points ,For example ,when When the edge breaks at this point, the break location is recorded.

[0283] A continuous, unbroken edge segment is defined as an effective fluctuation segment, and the total length of all effective segments is calculated. ;

[0284] Calculating the continuity of fluctuations (Value range [0,1]).

[0285] S5.2.5, Rate of change of profile curvature:

[0286] For each sampling point (From i=2 to M-1, exclude the first and last points), take the points immediately before and after it. , Construct a local triad;

[0287] Calculate the circumradius of the triangle formed by the three points. The formula is: ,in, The area of ​​the triangle (calculated using the cross product of vectors): );

[0288] Ri

[0289] Contour point curvature (Curvature is inversely proportional to radius, unit: 1 / pixel), if three points are collinear ( ),but Thus, the curvature sequence is obtained. (Length is M-2);

[0290] S5.2.6 Calculation of rate of change:

[0291] Calculate the curvature difference between adjacent points in the curvature sequence: ;

[0292] Calculate the arc distance between adjacent sampling points (Unit: pixels);

[0293] Rate of change of profile curvature (Unit: 1 / ) ), which represents the range of curvature change within a unit arc length.

[0294] S5.3 Input the curve curvature change rate, fluctuation frequency, fluctuation amplitude and fluctuation continuity into the trained neural network model to obtain the defect level of the original image.

[0295] Before inputting the contour curvature change rate, fluctuation frequency, fluctuation amplitude, and fluctuation continuity into the trained neural network model, the contour curvature change rate, fluctuation frequency, fluctuation amplitude, and fluctuation continuity are normalized.

[0296] Normalization of fluctuation frequency, fluctuation amplitude, and fluctuation continuity:

[0297] The calculated fluctuation frequency f and fluctuation amplitude grayscale difference Continuity is mapped to the [0,1] interval through min-max normalization.

[0298] , , ;

[0299] , , , These represent the maximum and minimum values ​​of the fluctuation frequency and the maximum and minimum values ​​of the amplitude grayscale difference, respectively.

[0300] , , The normalized fluctuation frequency, fluctuation amplitude, and continuity are part of the input data that is subsequently fed into the neural network.

[0301] The normalized rate of change of contour curvature is as follows:

[0302] Local extremum extraction: Filtering curvature rate of change sequences Local maxima in (greater than the adjacent points before and after) These extreme points correspond to locations where the curvature changes drastically (such as abrupt changes at the edge).

[0303] Statistical feature generation: Calculate the mean global rate of change of curvature ;

[0304] Count the number of local maxima and maximum value ;

[0305] Generate 3D feature vectors ;

[0306] Standardization: Min-max standardization is used to... Mapped to the [0,1] interval, and input into the neural network along with normalized fluctuation frequency, amplitude, and other indicators.

[0307] In this embodiment, a backpropagation (BP) neural network is used, and the process of training the BP neural network is as follows:

[0308] A large number of original images of wooden template samples labeled with defect levels (minor, moderate, severe) were collected. The fused comprehensive features and corresponding edge fluctuation quantification indicators were extracted as input, and the defect level was used as the output to train a backpropagation (BP) neural network. During training, the weights and biases of the BP neural network were adjusted to make its output as close as possible to the true defect level of the samples. Commonly used loss functions include the mean squared error loss function.

[0309] Using fused feature vectors and edge fluctuation quantization indicators as input data into a BP neural network has the following advantages:

[0310] Fine-grained features can be added: fused features include texture details of edges (such as gray-level gradient changes in undulating regions) and hierarchical features (such as edge morphology at multiple scales), which can provide richer discrimination criteria for neural networks. For example, the edge orientation histogram in the CNN depth features can help the network distinguish between "sawtooth undulations" and "smooth undulations," and these two types of undulations may have similar f and A values.

[0311] Enhancing feature robustness: The comprehensive features, after multimodal fusion and attention weighting, have filtered out interfering information such as wood texture, focusing on defect-related features. By inputting these features in conjunction with quantitative indicators, a complementary structure of "coarse-grained statistics (indicators) + fine-grained details (comprehensive features)" can be formed, reducing the impact of noise interference on individual features. For example, when local blurring in the edge image leads to calculation errors, the high-frequency coefficient distribution in the comprehensive features can provide redundant information to correct these errors.

[0312] Specifically, the input layer of the BP neural network adopts a two-branch input structure, with branch 1 inputting the edge fluctuation quantization index (...). , , ) and the rate of change of contour curvature ( The first branch has 6 quantized features; the second branch inputs a standardized fusion feature vector (e.g., 1212-dimensional high-frequency coefficient features + 128-dimensional CNN deep features, totaling 1340 dimensions).

[0313] During the processing of input data in the BP network, feature interactions occur in the network's hidden layers:

[0314] Branch 1 is mapped to 64 dimensions through a fully connected layer, and branch 2 is compressed to 64 dimensions through dimensionality-reducing convolution (1×1 convolution kernel);

[0315] An attention-gating mechanism is used to weight and fuse the 64-dimensional features of the two branches to generate 128-dimensional joint features.

[0316] The combined features are input into the subsequent fully connected layer to determine the defect level (minor / moderate / severe).

[0317] The comparative experiments showed that the model accuracy of the dual-branch input (92.3%) was significantly higher than that of the single index input (78.5%) and the single comprehensive feature input (85.7%), especially in distinguishing similar defects (such as moderate bending and near-severe bending).

[0318] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An intelligent detection method for image edge fluctuation features, characterized in that, Includes the following steps: Obtain the original image of the wooden template and perform preprocessing to obtain the preprocessed image; Design a dynamic wavelet decomposition strategy based on gradient entropy, and perform multi-scale wavelet decomposition on the preprocessed image through the dynamic wavelet decomposition strategy to obtain a low-frequency sub-band image that reflects the overall contour of the preprocessed image and a high-frequency sub-band image that contains the edge details of the preprocessed image. Extract the wavelet high-frequency coefficients from the high-frequency sub-band image, and map the wavelet high-frequency coefficients to the feature space to obtain the high-frequency coefficient feature vector; A dual-channel CNN model consisting of a texture suppression channel and an edge enhancement channel is constructed. Attention mechanism module containing spatial attention weights and channel attention weights is introduced. The joint feature vector of the high-frequency sub-band image is extracted through the dual-channel CNN model, and the joint feature vector is optimized through the attention mechanism module to obtain a depth feature vector. The weights of the deep feature vector and the high-frequency coefficient feature vector are determined by a reinforcement learning dynamic optimization method. The deep feature vector and the high-frequency coefficient feature vector are then weighted and fused to obtain a fused feature vector. Then, the edge fluctuation quantization index is calculated based on the fused feature vector. The edge fluctuation quantization index, together with the contour curvature change rate of the low-frequency sub-band image and the fused feature vector, is input into the trained neural network model to obtain the defect level of the original image. The dynamic wavelet decomposition strategy based on gradient entropy is as follows: S2.1 Initial selection of wavelet parameters based on the gradient entropy value: Calculate the mean global gradient entropy value of the preprocessed image, and compare the mean global gradient entropy value with the set gradient entropy value threshold, thereby selecting the corresponding wavelet basis function and decomposition level; The expression for the gradient entropy value is: ,in, Let n be the probability distribution of gradient magnitude within the local window, and n be the quantization level of the gradient magnitude. S2.

2. Perform multi-scale wavelet decomposition on the preprocessed image according to the wavelet basis function and decomposition level selected in step S2.1 to obtain the initial low-frequency sub-band image; S2.3 Calculate the contour irregularity of the initial low-frequency sub-band image and compare the contour irregularity with the set contour irregularity threshold to select a new wavelet basis function and decomposition layer. S2.

4. Perform multi-scale wavelet decomposition on the preprocessed image according to the new wavelet basis function and the number of decomposition levels to obtain the final low-frequency subband image and high-frequency subband image.

2. The intelligent detection method for image edge fluctuation features according to claim 1, characterized in that, The specific steps for preprocessing the original image are as follows: The original image is uniformly converted into an initial grayscale image using an image format conversion algorithm; The initial grayscale image is subjected to adaptive noise suppression processing to obtain a denoised first intermediate grayscale image; The first intermediate grayscale image is subjected to contrast enhancement optimization to obtain a second intermediate grayscale image with improved contrast. Calculate the image sharpness index and signal-to-noise ratio of the second intermediate grayscale image. If the image sharpness index or signal-to-noise ratio meets the requirements, the second intermediate grayscale image is regarded as the preprocessed image; otherwise, proceed to the next step. Determine if the maximum number of iterations has been reached. If not, return to step two and adjust the noise suppression parameters. If yes, treat the second intermediate grayscale image as the preprocessed image.

3. The intelligent detection method for image edge fluctuation features according to claim 1, characterized in that, The specific process of S2.1 is as follows: S2.1.1 Gradient Entropy Calculation: For the preprocessed image, divide the image into 16×16 pixel local windows, calculate the gradient entropy value E for each window, and optimize the window size to satisfy: ; Given the template length in pixels, the gradient entropy distribution of all local regions is obtained by traversing the entire image through a sliding window, thus obtaining the mean global gradient entropy value of the preprocessed image. S2.1.2 Wavelet basis function type selection: Setting the gradient entropy threshold and ,and When the mean global gradient entropy value of the preprocessed image is less than When choosing, select the sym4 wavelet basis function; When the mean of the global gradient entropy is to When between these points, choose the sym6 wavelet basis function; When the mean of the global gradient entropy is greater than When choosing, select the db6 wavelet basis function; S2.1.3 Initial Determination of Decomposition Layers: The initial decomposition layers are determined based on the mean of the global gradient entropy values. When the mean is less than... When the initial decomposition level is set to 3, and the mean is within a certain range... to When the mean is between 4 and 5, the initial decomposition level is set to 4-5; when the mean is greater than 100, the initial decomposition level is set to 4-5. At that time, the initial number of decomposition layers was set to 6.

4. The intelligent detection method for image edge fluctuation features according to claim 1, characterized in that, The specific process of S2.3 is as follows: S2.3.1 Calculation of contour irregularity: Extract the actual overall contour of the wooden template from the initial low-frequency sub-band image, compare the actual overall contour with the standard contour, and obtain the contour irregularity D; S2.3.2 Decomposition Layer Update Judgment: Set Contour Irregularity Threshold ,like No need to adjust the number of decomposition levels; maintain the initially selected number of decomposition levels. When the initial decomposition level is reached, add one level; if At this time, 2 more layers are added to the initial decomposition layer number, but the maximum decomposition layer number does not exceed 6 layers; S2.3.3, Secondary selection of wavelet basis functions: If the number of decomposition levels is updated, the new number of decomposition levels... If the number of new decomposition layers is 6 and the original wavelet basis function is sym4, then the wavelet basis function is adjusted to sym6; if the number of new decomposition layers is 6 and the original wavelet basis function is sym6, then the wavelet basis function is adjusted to db6.

5. The intelligent detection method for image edge fluctuation features according to claim 1, characterized in that, The high-frequency subband image consists of an LH subband image containing horizontal low-pass filtering and vertical high-pass filtering, an HL subband image containing horizontal high-pass filtering and vertical low-pass filtering, and an HH subband image containing two high-pass filters. The specific process of extracting wavelet high-frequency coefficients from the high-frequency subband image and mapping the wavelet high-frequency coefficients to the feature space to obtain high-frequency coefficient feature vectors is as follows: The LH sub-band image and / or HL sub-band image and / or HH sub-band image are selected as input sub-band images based on the directional attributes of the edge fluctuation features; Read the wavelet coefficient matrix of the input sub-band image, use soft thresholding to filter the coefficients in the wavelet coefficient matrix, retain the coefficients whose absolute value is greater than the threshold T, and set the coefficients whose absolute value is not greater than the threshold T to 0, thereby obtaining the denoised high-frequency coefficient matrix; The high-frequency coefficient matrix is ​​divided into blocks, and the statistical characteristics within each block are calculated. The statistical characteristics include the mean, variance, and number of maximum points of the coefficients. Extract the global features of the high-frequency coefficient matrix, including the proportion of non-zero coefficients and the histogram distribution of the absolute values ​​of the coefficients; The statistical features are concatenated with the global features to form a high-frequency coefficient feature vector with fixed dimensions; The high-frequency coefficient feature vectors are mapped to a feature space that is homologous to the multimodal attention features through a fully connected layer, and the mapped features are then processed. Standardization is performed so that the modulus of the feature vector is 1, and the high-frequency coefficient feature vector of the high-frequency subband image is finally obtained.

6. The intelligent detection method for image edge fluctuation features according to claim 5, characterized in that, A dual-channel CNN model consisting of a texture suppression channel and an edge enhancement channel is constructed. An attention mechanism module containing spatial attention weights and channel attention weights is introduced. The initial depth feature vector of the high-frequency sub-band image is extracted using the dual-channel CNN model, and the initial depth feature vector is optimized using the attention mechanism module to obtain the final depth feature vector. The specific process is as follows: The LH subband graph, HL subband graph and HH subband graph are merged into a three-channel input tensor; A dual-channel CNN model is constructed, which includes a texture suppression channel and an edge enhancement channel. The texture suppression channel uses dilated convolution to filter the natural texture of wood, and the edge enhancement channel enhances the fluctuation features through residual connections. The three-channel input tensor is input into the texture suppression channel and the edge enhancement channel respectively to obtain the texture suppression feature vector and the edge enhancement feature vector; The texture suppression feature vector and the edge enhancement feature vector are concatenated to obtain the joint feature vector; The joint feature vector is compressed by global average pooling to reduce the channel dimension, and then processed through two fully connected layers plus sigmoid activation to generate a spatial attention weight map. H is the height, and W is the width; The joint feature vector is compressed in terms of spatial dimension through global average pooling, and then processed through two fully connected layers plus sigmoid activation to generate a channel attention weight vector. C represents the dimension; Generate deep feature vectors using feature optimization formulas: ,in, This represents matrix multiplication, and F represents the joint eigenvector. This indicates element-wise multiplication.

7. The intelligent detection method for image edge fluctuation features according to claim 1, characterized in that, The edge fluctuation quantification index includes the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the preprocessed image edge, wherein the fluctuation frequency is the number of fluctuations per unit length of edge, the fluctuation amplitude is the gray difference between the peak and valley values ​​of the vertical distance from the sampling point on the edge contour to the baseline, and the fluctuation continuity is the proportion of continuous fluctuation segments.

8. The intelligent detection method for image edge fluctuation features according to claim 7, characterized in that, The specific process of using a reinforcement learning dynamic optimization method to weight and fuse the weights of the deep feature vector and the high-frequency coefficient feature vector to obtain a fused feature vector, then calculating the edge fluctuation quantization index based on the fused feature vector, and finally inputting the edge fluctuation quantization index, the contour curvature change rate of the low-frequency sub-band image, and the fused feature vector into a trained neural network model to obtain the defect level of the original image is as follows: The deep feature vector and the high-frequency coefficient feature vector are initially weighted and fused to obtain a fused feature vector, wherein the weights of the deep feature vector and the high-frequency coefficient feature vector are obtained through a reinforcement learning dynamic optimization method; Based on the fused feature vector, calculate the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the edge graph corresponding to the fused feature vector; The fused feature vector, contour curvature change rate, fluctuation frequency, fluctuation amplitude, and fluctuation continuity are input into the trained neural network model to obtain the defect level of the original image.

9. The intelligent detection method for image edge fluctuation features according to claim 8, characterized in that, The specific calculation process for calculating the fluctuation frequency, fluctuation amplitude, and fluctuation continuity of the preprocessed image edges based on the fusion features is as follows: Fluctuation frequency: Calculate the direction angle of the line connecting adjacent sampling points The direction angle sequence is obtained. M represents the number of sampling points for the edge contours of the preprocessed image. This represents the coordinates of the i-th sampling point of the edge contour; Set the direction angle abrupt change threshold ,when At that time, the judgment This is the inflection point of the fluctuation; Total length of the statistical edge Simultaneously, count the total number K of fluctuation inflection points, then the fluctuation frequency... ,in, K represents the total length of the edges of the preprocessed image, and K represents the total number of fluctuation inflection points. Fluctuation range: The baseline line function B(x) is obtained by fitting a reference line to the edge contour points P of the preprocessed image using the least squares method. Calculate each sampling point vertical distance to the baseline ; Filter the maximum value among all sampled points Minimum value ; Fluctuation range Through the grayscale mapping formula Converted to grayscale difference, where, , These represent the maximum and minimum grayscale values ​​of the edge region, respectively. The maximum edge length; Fluctuation continuity: Set the maximum allowable distance between adjacent contour points ,when When the edge breaks at this point, the break location is recorded. A continuous, unbroken edge segment is defined as an effective fluctuation segment, and the total length of all effective segments is calculated. ; Calculating the continuity of fluctuations .

Citation Information

Patent Citations

  • Cable identification method and system based on image processing

    CN118628983A

  • Resistor disc defect online detection system and grading method based on machine vision

    CN120765532A