Lightweight wood defect segmentation method based on multi-dimensional boundary sensing and guiding

Through the collaborative boundary enhancement of Laplacian operator and Gaussian kernel, dual-stream feature decoupling and cosine similarity loss function optimization, combined with a lightweight network architecture, the accuracy and efficiency problems in wood defect detection are solved, and high-precision real-time detection is achieved.

CN120708224APending Publication Date: 2025-09-26FUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510815811.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Existing wood defect detection technology has problems such as low detection accuracy, blurred boundaries, and insufficient computational efficiency. Especially when faced with low-contrast and complex and diverse wood defects, it is difficult to achieve high-precision real-time detection.

Method used

The Laplacian operator is used to extract the initial boundary, and the Gaussian kernel is used to dynamically smooth the boundary intensity. The boundary prediction is optimized through dual-stream feature decoupling fusion and cosine similarity loss function. The lightweight MiT-B0 backbone network and AdamW optimizer are combined to achieve multi-task collaborative optimization.

Benefits of technology

It significantly improves the boundary perception accuracy and complex defect recognition capabilities of wood defect detection, improves the stability and generalization performance of model training, and meets the real-time processing needs of industrial assembly lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120708224A_ABST
    Figure CN120708224A_ABST
Patent Text Reader

Abstract

The invention provides a lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance, and the method comprises the steps: obtaining an RGB image of a wood surface defect, extracting an initial boundary through a Laplacian operator based on a pixel-level label, and replacing an initial boundary neighborhood value with a Gaussian convolution kernel to generate a Gaussian boundary label; inputting the image into a Segform-based coding-decoding network, and outputting a multi-scale fusion feature map through decoupling features of a space attention flow and a channel attention flow; based on a multi-scale fusion feature map, outputting a defect segmentation map through a segmentation decoding network, and predicting a boundary probability map through a boundary supervision branch; calculating segmentation loss by adopting cross entropy loss and Dice loss, and calculating boundary prediction loss in combination with a Gaussian boundary label and a cosine similarity function; performing model optimization by combining boundary prediction loss, segmentation loss and auxiliary loss, and balancing boundary positioning and segmentation precision through weighted summation; and iteratively executing a boundary prediction and segmentation process, and outputting a defect category segmentation map in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of industrial material surface defect detection, and specifically relates to a lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance. Background Art

[0002] Various defects on the wood surface can significantly impact the quality of wooden products, necessitating rigorous defect detection. During wood processing, tolerance for defects of varying types and sizes varies. To meet the demands of high-quality, refined processing, pixel-level defect segmentation methods are required to accurately determine the location and classification of defect boundaries.

[0003] Wood surface defects exhibit remarkable diversity and complexity. Low contrast blurs the boundaries between defects and normal textures. Defect morphology and texture vary significantly within a class, while defect characteristics between classes are highly similar. These characteristics greatly increase the difficulty of extracting effective features from the model, significantly reducing detection accuracy. Furthermore, the wood industry's pursuit of efficient production lines places strict demands on real-time defect detection. Therefore, improving defect detection accuracy while ensuring a lightweight model to meet the needs of industrial scenarios has become a key challenge that needs to be urgently addressed in the field of wood surface defect detection.

[0004] The Chinese patent application number is CN202411707363.9, and its title is: A method, system, medium, and device for detecting wood surface defects. This method inputs the preprocessed image into the wood defect recognition network, first extracting and aggregating features through the inverse depth separable stem module to obtain the first feature map; then, the rectangular self-calibration module obtains global features to form the second feature map, and the adaptive frequency attention network module extracts key frequency components to obtain the third feature map; the third feature map is processed by the frequency enhancement channel attention module to obtain the fourth feature map; the fourth and first feature maps are fused to generate the fifth feature map, and the segmentation head predicts and outputs the bark defect area, effectively solving the problems of poor feature extraction and low semantic segmentation accuracy caused by bark defects. However, this method does not take into account the ground contrast problem of wood defects, and its generalization performance is limited.

[0005] The Chinese patent application number is: CN202411805150.X, and its name is: Wood surface defect detection system, detection method and training method. The detection system of this method consists of a trunk, a neck, and a feature head module. Among them, the trunk module contains input and output ends; the neck module integrates semantic fusion, feature pyramid network and adaptive structural feature fusion module. A connection path is formed between each module: the output end of the trunk is connected to the semantic fusion module and the feature pyramid network module respectively, and the output of the semantic fusion module is connected to the feature pyramid network module, and its output is then connected to the adaptive structural feature fusion module. Finally, the output of this module is connected to the feature head module. This architecture effectively solves the problem of slow detection speed of existing detection models. However, this method is easily affected by the complexity and diversity of wood defects, resulting in a decrease in detection accuracy. Summary of the Invention

[0006] To address the problems of low defect detection accuracy, blurred boundaries, and insufficient computational efficiency in existing technologies, the present invention provides a lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance, which achieves high-precision real-time detection through the following innovative designs:

[0007] 1. Boundary enhancement mechanism

[0008] The Laplacian operator is used to extract the initial boundary (a 3×3 convolution kernel with a center weight of 8 and an edge weight of -1), and the boundary intensity is dynamically smoothed with a Gaussian kernel (the weight value changes according to an exponential decay law), which significantly improves the boundary recognition of low-contrast defects.

[0009] 2. Dual-stream feature decoupling and fusion

[0010] By collaboratively decoupling features through spatial attention flow (fusing global pooling features to generate a spatial weight map) and channel attention flow (dynamically adjusting channel importance), we can solve the recognition confusion problem caused by large morphological differences within a class and similar features between classes.

[0011] 3. Boundary Perception Guidance

[0012] Innovative use of cosine similarity loss function to optimize boundary prediction:

[0013] Softmax normalization of the boundary probability map

[0014] Calculate the cosine similarity between the normalized result and the Gaussian boundary label

[0015] Effectively suppress training gradient oscillation and improve fuzzy boundary positioning accuracy.

[0016] 4. Multi-task collaborative optimization

[0017] The joint boundary loss (cosine similarity), segmentation loss (cross entropy + Dice loss) and auxiliary loss (binary cross entropy + Dice loss) balance boundary positioning and segmentation accuracy through dynamic weight parameters.

[0018] 5. Lightweight real-time deployment

[0019] Based on the MiT-B0 backbone network (Segformer lightweight architecture), combined with the AdamW optimizer + cosine annealing learning rate adjustment (initial learning rate 0.0001), real-time inference is achieved to meet the efficient detection needs of industrial assembly lines.

[0020] This solution overcomes the three major technical bottlenecks in wood defect detection: blurred low-contrast boundaries, low recognition rate of complex defects, and large model calculation volume. Compared with the existing technology (CN202411707363.9 / CN202411805150.X), the detection accuracy and inference speed are significantly improved.

[0021] The technical solution specifically adopted by the present invention to solve the technical problem is:

[0022] A lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance, including:

[0023] Obtain an RGB image of wood surface defects, extract the initial boundary based on its pixel-level label using the Laplacian operator, and replace the initial boundary neighborhood value with a Gaussian convolution kernel to generate a Gaussian boundary label;

[0024] The image is input into the Segformer-based encoder-decoder network, which decouples features through spatial attention flow and channel attention flow, and outputs a multi-scale fused feature map;

[0025] Based on the multi-scale fusion feature map:

[0026] The segmentation decoding network outputs the defect segmentation map, and the boundary supervision branch predicts the boundary probability map;

[0027] The segmentation loss is calculated using cross entropy loss and Dice loss, and the boundary prediction loss is calculated by combining Gaussian boundary labels and cosine similarity function;

[0028] The model is optimized by combining boundary prediction loss, segmentation loss and auxiliary loss, and the boundary positioning and segmentation accuracy are balanced through weighted summation.

[0029] The boundary prediction and segmentation process is iteratively performed, and the defect category segmentation map is output in real time through the backbone network.

[0030] Furthermore, the generation of the Gaussian boundary label includes:

[0031] A 3×3 Laplacian convolution kernel with a center weight of 8 and an edge weight of -1 is used to extract the initial boundary;

[0032] The convolution kernel weights are generated based on the Gaussian function distribution, so that the weight values ​​change exponentially with the spatial position.

[0033] Furthermore, the spatial attention flow upsamples the deep features, concatenates the global average pooling and maximum pooling features, and generates a spatial weight map through 3×3 convolution;

[0034] Multiply the spatial weight map and its inverse weight map with the shallow features respectively, and generate enhanced features through the channel attention mechanism;

[0035] The two-way enhanced features are spliced ​​and integrated through the dual-stream enhancement module, and the feature integration results are added to the original shallow features at the pixel level to form a residual connection structure.

[0036] Furthermore, the input of the boundary supervision branch includes four feature maps of different scales, including three shallow features enhanced by two streams and one original deep feature;

[0037] Output boundary probability map through decoding network;

[0038] The cosine similarity loss value is calculated by the following steps:

[0039] Perform Softmax normalization on the boundary probability map;

[0040] Calculate the cosine similarity between the normalized result and the Gaussian boundary label.

[0041] Furthermore, it also includes:

[0042] Generate two-category predictions based on the segmentation results: the first channel takes the probability of the defect class, and the second channel takes the maximum probability of the remaining classes;

[0043] Combine the binary cross entropy and Dice loss to calculate the auxiliary loss.

[0044] Furthermore, the backbone network adopts MiT-B0 structure;

[0045] Model training uses:

[0046] AdamW optimizer with cosine annealing learning rate adjustment;

[0047] Dynamically balance boundary loss and segmentation loss through preset weight parameters.

[0048] Furthermore, the dual-stream enhancement module processes deep features and shallow features of adjacent levels in sequence.

[0049] And, a lightweight wood defect segmentation system based on multi-dimensional boundary perception and guidance, including:

[0050] Data acquisition module, used to obtain RGB images of wood surface defects and their pixel-level labels;

[0051] Boundary label generation module, configured as follows:

[0052] Extract the initial boundary through the Laplacian operator;

[0053] Replace the initial boundary neighborhood value with the Gaussian convolution kernel to generate Gaussian boundary labels;

[0054] The feature processing module includes a Segformer-based encoder-decoder network, which decouples features through spatial attention streams and channel attention streams and outputs multi-scale fused feature maps;

[0055] A boundary supervision module is used to output a defect segmentation map through a segmentation decoding network based on the multi-scale fusion feature map, predict a boundary probability map through a boundary supervision branch, calculate the segmentation loss using cross entropy loss and Dice loss, and calculate the boundary prediction loss by combining Gaussian boundary labels and cosine similarity function;

[0056] Segmentation decoding module, used to output defect segmentation map;

[0057] Multi-task optimization module, configured as:

[0058] Combine boundary prediction loss, segmentation loss and auxiliary loss to optimize the model, and balance boundary positioning and segmentation accuracy through weighted summation

[0059] Output module, used to output defect category segmentation map in real time.

[0060] And, an automated wood quality inspection device, comprising:

[0061] An image acquisition unit, used for acquiring an RGB image of the wood surface;

[0062] A processing unit, configured to execute the method described above;

[0063] The defect labeling unit automatically labels defects based on the output defect category segmentation map.

[0064] And, a computer device includes a memory, a processor and a computer program stored in the memory, and the processor implements the above method when executing the computer program.

[0065] A non-transitory computer-readable storage medium stores a computer program, which implements the method described above when executed by a processor.

[0066] Compared with the prior art, the present invention and its preferred embodiments have at least the following beneficial effects:

[0067] 1. Significantly improved boundary perception accuracy

[0068] Through the boundary enhancement mechanism of the Laplacian operator and the Gaussian kernel, the low contrast problem of wood defects is effectively overcome, and the accuracy of fuzzy boundary positioning is greatly improved.

[0069] 2. Enhanced ability to identify complex defects

[0070] The decoupling design of spatial and channel dual-stream features solves the recognition confusion problem caused by large morphological differences within a class and similar features between classes, and significantly improves the ability to distinguish complex defects such as wormholes and cracks.

[0071] 3. Training stability optimization

[0072] The innovative cosine similarity loss is used to replace the traditional classification loss, which effectively suppresses the gradient oscillation phenomenon, speeds up the model convergence and makes the training process more stable.

[0073] 4. Multi-tasking collaborative advantages

[0074] The dynamic balance mechanism of boundary loss, segmentation loss and auxiliary loss achieves the coordinated optimization of pixel-level positioning accuracy and classification accuracy while maintaining segmentation integrity.

[0075] 5. Breakthrough in Industrial Applicability

[0076] The lightweight network architecture combined with efficient optimization strategies ensures detection accuracy while meeting the real-time processing needs of industrial assembly lines, resolving the contradiction between efficiency and accuracy in traditional methods.

[0077] 6. Generalization performance enhancement

[0078] Through multi-dimensional supervision and guidance, the model's robustness to interference factors such as changes in wood texture and differences in lighting conditions is significantly enhanced, making it suitable for complex defect detection scenarios on various wood surfaces. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:

[0080] Figure 1 Schematic diagram of the network structure of a lightweight model based on multi-dimensional boundary perception and guidance according to an embodiment of the present invention;

[0081] Figure 2 Schematic diagram of the overall process of an embodiment of the present invention. DETAILED DESCRIPTION

[0082] In order to make the features and advantages of the present invention more clearly understood, the following embodiments are given for detailed description:

[0083] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which this application belongs.

[0084] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0085] Embodiments of the present invention provide a lightweight wood defect segmentation method based on multidimensional boundary perception and guidance to achieve real-time classification and location of wood surface defects. Using Segformer as the baseline network, combined with a multidimensional supervised learning strategy, and through loss function design and optimized feature fusion mechanisms, the model is guided to accurately learn and extract effective defect description features within a lightweight parameter architecture. The model's recognition and differentiation capabilities are significantly enhanced, especially when dealing with fuzzy defect boundaries. This effectively balances defect detection accuracy and computational speed, providing a highly efficient solution for automated quality inspection in the wood industry.

[0086] It first uses Segformer as the baseline network to form the backbone feature extraction network and feature encoding network of the model, and then designs a dual-stream enhancement module to use multi-scale features of adjacent levels to refine the defect features. On this basis, a boundary supervision branch is introduced, and the boundary prediction loss is measured in combination with cosine similarity and Gaussian boundary labels. For the defect segmentation results, the prediction loss is calculated by combining Dice loss and cross entropy loss; at the same time, a two-dimensional auxiliary loss branch is introduced to further improve the integrity of the segmentation results. The application of this invention to the detection of wood surface defects can effectively overcome the diversity and complexity of defect features and improve the accuracy and real-time performance of defect detection.

[0087] like Figure 2 As shown, the specific steps are as follows:

[0088] (1) Data preparation: Obtaining RGB images of wood surface defects and its corresponding multi-category pixel-level label data ,in is the length, high, is the number of categories. According to the pixel-level label Get Gaussian boundary labels and two-category labels , boundary labels The steps to obtain it are as follows:

[0089] I. Calculate and obtain two-dimensional boundary labels , , is the convolution operation, is a binarization operation, is the Laplacian convolution kernel, as follows:

[0090] ,

[0091] II. Define Gaussian convolution kernel , ,in is the convolution kernel size, is the Gaussian variance, , , ;

[0092] III. Traversing 2D boundary labels For each coordinate point, if , then The length and width centered at this coordinate point are The values ​​within the rectangular range are set as Gaussian convolution kernel The value of , thus obtaining the Gaussian boundary label .

[0093] (2) Segmentation model construction: Segformer is used as the baseline network of the defect detection model to form the model's feature extraction backbone network and feature decoding network. The backbone network is MiT-B0. The output of the feature decoding network is the defect segmentation result. , which will be used for loss calculation during training. In addition, a dual-stream enhancement module DFEM is introduced to fuse the adjacent layer features of the backbone network to refine the multi-scale semantic information. The output features of the backbone feature extraction network are defined as , ;Dual-stream feature enhancement module DFEM, the input of this module is the deep features of adjacent levels and shallow features , the output is ,like Figure 1 As shown, the implementation process is as follows:

[0094] I. For deep features First, we use 1×1 convolution, BatchNorm normalization layer and ReLU activation function to integrate features , and upsampled by bilinear method to generate features .

[0095] II. Features Input spatial attention module SAM to generate spatial feature weight map The implementation process of the spatial attention module SAM is as follows: express A combination of convolution, BatchNorm normalization layer and ReLU activation function, represents the splicing in the feature channel dimension, and Represent the global average pooling function and the global maximum pooling function respectively:

[0096]

[0097] III. and After being element-wise multiplied with the shallow features, they are input into the channel attention module CAM to obtain enhanced features respectively. and .

[0098] IV. Combine the two enhanced features and After splicing by channel, a combination of 1×1 convolution, BatchNorm normalization layer and ReLU activation function is used to integrate features, and finally combined with shallow features Pixel-level phase acquisition features , this feature will replace the original feature Input to the feature decoding network.

[0099] (3) Construction of boundary supervision branch network: The decoding network of Segformer is used as the boundary supervision branch network, and the input of the network is as well as , output boundary prediction results , during the training process, this result will be used for loss calculation.

[0100] (4) Loss function design: The loss function includes defect segmentation loss, auxiliary loss and boundary prediction loss, so the total loss function is expressed as ,in and is the weight parameter. The specific calculation process of the loss function is as follows:

[0101] I. Defect Segmentation Loss ; The loss consists of cross entropy loss and Dice loss, where for The specific calculation process of the Softmax calculation result of the loss value is as follows:

[0102]

[0103]

[0104]

[0105] II. Boundary Prediction Loss ; The loss is implemented by the cosine similarity function, and the specific calculation process of the loss value is as follows:

[0106]

[0107]

[0108] III. Auxiliary losses ; The loss consists of two-category cross entropy loss and Dice loss, where For the two-category prediction result, the specific calculation process of the loss value is as follows:

[0109]

[0110]

[0111] (5) Model training: AdamW was used as the optimizer for this model, with a decay rate of 0.01 and a momentum of 0.9. In the initial stage of model training, the learning rate was set to 0.0001 and adjusted according to the cosine annealing algorithm.

[0112] The solution provided in the above embodiments of the present invention focuses on the design of the loss function and proposes a lightweight wood defect segmentation method. While effectively improving the defect detection accuracy, it ensures a high model detection efficiency and achieves a balance between accuracy and efficiency.

[0113] Furthermore, Gaussian boundary labels and cosine similarity are combined for boundary prediction supervision, transforming the traditional classification problem into a distance regression problem between the predicted boundary and the true boundary, effectively reducing the gradient oscillation in the boundary supervision process and improving the stability of model training.

[0114] Then, model training is carried out based on a multi-task learning architecture, which coordinates the boundary supervision branch, defect segmentation network and auxiliary loss, and utilizes the feature commonality and regularity between tasks to effectively guide the model to learn discriminative semantic features, thereby improving the generalization and robustness of the model.

[0115] The following is a further demonstration and introduction of the above solutions of the embodiment of the present invention in conjunction with specific test and verification examples:

[0116] (1) Data preparation: Obtaining RGB images of wood surface defects and its corresponding multi-category pixel-level label data , where the number of defect categories is 4. According to the pixel-level label Get Gaussian boundary labels and two-category labels , boundary labels The steps to obtain it are as follows:

[0117] I. Calculate and obtain two-dimensional boundary labels , , is the convolution operation, is a binarization operation, is the Laplacian convolution kernel, as follows:

[0118] ,

[0119] II. Define Gaussian convolution kernel , , where the convolution kernel size is is 37, Gaussian variance is 1, , , ;

[0120] III. Traversing 2D boundary labels For each coordinate point, if , then The length and width centered at this coordinate point are The values ​​within the rectangular range are set as Gaussian convolution kernel The value of , thus obtaining the Gaussian boundary label ;

[0121] (2) Segmentation model construction: Segformer is used as the baseline network of the defect detection model to form the model's feature extraction backbone network and feature decoding network. The backbone network is MiT-B0. The output of the feature decoding network is the defect segmentation result. , which will be used for loss calculation during training. In addition, a dual-stream enhancement module DFEM is introduced to fuse the adjacent layer features of the backbone network to refine the multi-scale semantic information. The output features of the backbone feature extraction network are defined as , ;Dual-stream feature enhancement module DFEM, the input of this module is the deep features of adjacent levels and shallow features , the output is , and its implementation process is as follows:

[0122] I. For deep features First, we use 1×1 convolution, BatchNorm normalization layer and ReLU activation function to integrate features , and upsampled by bilinear method to generate features .

[0123] II. Features Input spatial attention module SAM to generate spatial feature weight map The implementation process of the spatial attention module SAM is as follows: express A combination of convolution, BatchNorm normalization layer and ReLU activation function, represents the splicing in the feature channel dimension, and Represent the global average pooling function and the global maximum pooling function respectively:

[0124]

[0125] III. and After being element-wise multiplied with the shallow features, they are input into the channel attention module CAM to obtain enhanced features respectively. and .

[0126] IV. Combine the two enhanced features and After splicing by channel, a combination of 1×1 convolution, BatchNorm normalization layer and ReLU activation function is used to integrate features, and finally combined with shallow features Pixel-level phase acquisition features , this feature will replace the original feature Input to the feature decoding network.

[0127] (3) Construction of boundary supervision branch network: The decoding network of Segformer is used as the boundary supervision branch network, and the input of the network is as well as , output boundary prediction results , during the training process, this result will be used for loss calculation.

[0128] (4) Loss function design: The loss function includes defect segmentation loss, auxiliary loss and boundary prediction loss, so the total loss function is expressed as , where the weight parameter and are 0.7 and 0.1 respectively. The specific calculation process of the loss function is as follows:

[0129] I. Defect Segmentation Loss ; The loss consists of cross entropy loss and Dice loss, where for The specific calculation process of the Softmax calculation result of the loss value is as follows:

[0130]

[0131]

[0132]

[0133] II. Boundary Prediction Loss ; The loss is implemented by the cosine similarity function, and the specific calculation process of the loss value is as follows:

[0134]

[0135]

[0136] III. Auxiliary losses ; The loss consists of two-category cross entropy loss and Dice loss, where For the two-category prediction result, the specific calculation process of the loss value is as follows:

[0137]

[0138]

[0139] (5) Model training: AdamW was used as the optimizer for this model, with a decay rate of 0.01 and a momentum of 0.9. In the initial stage of model training, the learning rate was set to 0.0001 and adjusted according to the cosine annealing algorithm.

[0140] Based on the same inventive concept, the present invention also provides a computer device, which includes: one or more processors and a memory for storing one or more computer programs; the program includes program instructions, and the processor is used to execute the program instructions stored in the memory. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is used to implement one or more instructions, specifically for loading and executing one or more instructions in a computer storage medium to implement the above method.

[0141] It should be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium having a computer program stored thereon, which, when executed by a processor, performs the above-described method. The storage medium may be any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0142] It should be noted that, unless otherwise defined, the technical or scientific terms used in the present invention should have the usual meanings understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship may also change accordingly.

[0143] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other manner. Any person skilled in the art may utilize the above-disclosed technical content to modify or modify the present invention into equivalent embodiments. However, any simple modifications, equivalent variations, and modifications to the above embodiments that do not depart from the technical content of the present invention and are based on the technical essence of the present invention remain within the scope of protection of the present invention.

[0144] The present invention is not limited to the above-mentioned optimal implementation mode. Anyone can derive various other forms of lightweight wood defect segmentation methods based on multi-dimensional boundary perception and guidance under the inspiration of the present invention. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by the scope of the present invention.

Claims

1. A lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance, characterized in that: include: Obtain an RGB image of wood surface defects, extract the initial boundary based on its pixel-level label using the Laplacian operator, and replace the initial boundary neighborhood value with a Gaussian convolution kernel to generate a Gaussian boundary label; The image is input into the Segformer-based encoder-decoder network, which decouples features through spatial attention flow and channel attention flow, and outputs a multi-scale fused feature map; Based on the multi-scale fusion feature map: The segmentation decoding network outputs the defect segmentation map, and the boundary supervision branch predicts the boundary probability map; The segmentation loss is calculated using cross entropy loss and Dice loss, and the boundary prediction loss is calculated by combining Gaussian boundary labels and cosine similarity function; The model is optimized by combining boundary prediction loss, segmentation loss and auxiliary loss, and the boundary positioning and segmentation accuracy are balanced through weighted summation. The boundary prediction and segmentation process is iteratively performed, and the defect category segmentation map is output in real time through the backbone network.

2. The lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance according to claim 1 is characterized by: The generation of the Gaussian boundary label includes: A 3×3 Laplacian convolution kernel with a center weight of 8 and an edge weight of -1 is used to extract the initial boundary; The convolution kernel weights are generated based on the Gaussian function distribution, so that the weight values ​​change exponentially with the spatial position.

3. The lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance according to claim 1 is characterized by: The spatial attention flow upsamples the deep features, concatenates the global average pooling and maximum pooling features, and generates a spatial weight map through 3×3 convolution; Multiply the spatial weight map and its inverse weight map with the shallow features respectively, and generate enhanced features through the channel attention mechanism; The two-way enhanced features are spliced ​​and integrated through the dual-stream enhancement module, and the feature integration results are added to the original shallow features at the pixel level to form a residual connection structure.

4. The lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance according to claim 1 is characterized by: The input of the boundary supervision branch includes four feature maps of different scales, including three shallow features enhanced by two streams and one original deep feature; Output boundary probability map through decoding network; The cosine similarity loss value is calculated by the following steps: Perform Softmax normalization on the boundary probability map; Calculate the cosine similarity between the normalized result and the Gaussian boundary label.

5. The lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance according to claim 1 is characterized by: Also includes: Generate two-category predictions based on the segmentation results: the first channel takes the probability of the defect class, and the second channel takes the maximum probability of the remaining classes; Combine the binary cross entropy and Dice loss to calculate the auxiliary loss.

6. The lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance according to claim 1 is characterized by: The backbone network adopts MiT-B0 structure; Model training uses: AdamW optimizer with cosine annealing learning rate adjustment; Dynamically balance boundary loss and segmentation loss through preset weight parameters.

7. The lightweight wood defect segmentation method based on multi-dimensional boundary perception and guidance according to claim 3 is characterized by: The dual-stream enhancement module processes deep features and shallow features of adjacent levels in sequence.

8. A lightweight wood defect segmentation system based on multi-dimensional boundary perception and guidance, characterized by: include: Data acquisition module, used to obtain RGB images of wood surface defects and their pixel-level labels; Boundary label generation module, configured as follows: Extract the initial boundary through the Laplacian operator; Replace the initial boundary neighborhood value with the Gaussian convolution kernel to generate Gaussian boundary labels; The feature processing module includes a Segformer-based encoder-decoder network, which decouples features through spatial attention streams and channel attention streams and outputs multi-scale fused feature maps; A boundary supervision module is used to output a defect segmentation map through a segmentation decoding network based on the multi-scale fusion feature map, predict a boundary probability map through a boundary supervision branch, calculate the segmentation loss using cross entropy loss and Dice loss, and calculate the boundary prediction loss by combining Gaussian boundary labels and cosine similarity function; Segmentation decoding module, used to output defect segmentation map; Multi-task optimization module, configured as: Combine boundary prediction loss, segmentation loss and auxiliary loss to optimize the model, and balance boundary positioning and segmentation accuracy through weighted summation Output module, used to output defect category segmentation map in real time.

9. A wood automated quality inspection device, characterized in that: include: An image acquisition unit, used for acquiring an RGB image of the wood surface; A processing unit, configured to execute the method according to any one of claims 1 to 7; The defect labeling unit automatically labels defects based on the output defect category segmentation map.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Wood surface defect detection method, system, medium and equipment

    CN119205758A

  • Wood surface defect detection system, detection method and training method

    CN119762434A