A wood small sample defect detection method based on meta learning and deep learning

CN121685437BActive Publication Date: 2026-08-11SOUTHWEST FORESTRY UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

然而,实际工业生产中存在样本数量有限、类别分布不均、缺陷形态复杂等问题,导致深度模型在训练过程中易出现过拟合,对新类或少样本缺陷的识别能力不足

Benefits of technology

[0006]本实施例提供一种基于元学习与深度学习的木材小样本缺陷检测方法,基于MAML元学习框架与深度学习网络的小样本木材表面缺陷检测模型,在小样本学习、跨场景泛化、鲁棒性提升以及检测精度与实时性平衡方面具有显著优势。通过元训练和元测试的方式,能够有效应对木材表面缺陷检测中的多样化挑战,并在不同场景下快速适应新类缺陷的检测任务。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121685437B_ABST
    Figure CN121685437B_ABST
Patent Text Reader

Abstract

This invention provides a method for detecting wood defects in small samples based on meta-learning and deep learning, comprising: acquiring an image of the wood to be detected; inputting the image of the wood to be detected into a pre-trained wood defect detection model to obtain the wood defect detection result, wherein the wood defect detection model is a deep learning model trained based on meta-learning. By implementing this invention, the small sample wood surface defect detection model based on the MAML meta-learning framework and deep learning network exhibits significant advantages in small sample learning, cross-scene generalization, robustness improvement, and a balance between detection accuracy and real-time performance. Through meta-training and meta-testing, it can effectively address the diverse challenges in wood surface defect detection and quickly adapt to the detection tasks of new types of defects in different scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image detection technology, specifically relating to a method for detecting defects in small samples of wood based on meta-learning and deep learning. Background Technology

[0002] Surface defect detection in wood is a crucial step in wood processing and quality assessment, directly impacting the grading, value assessment, and subsequent process optimization of wood products. With the development of intelligent manufacturing and industrial vision inspection technologies, automated surface defect identification is gradually replacing traditional manual inspection methods, becoming a core technology for ensuring the efficiency and quality stability of wood product production. Traditional manual inspection relies on the experience and subjective judgment of inspectors, resulting in high workload, low efficiency, and inconsistencies between different inspectors. In large-scale wood production and processing, manual inspection not only struggles to meet the real-time requirements of high-throughput detection but is also susceptible to the effects of lighting, texture complexity, and the diversity of defect morphologies, leading to missed and false detections.

[0003] Currently, the detection of surface defects in wood mainly relies on computer vision-based automatic recognition systems. Early methods often combined image processing with traditional machine learning, using algorithms such as texture feature extraction, edge detection, and gray-level co-occurrence matrix (GLCM) to identify surface anomalies. However, these methods are sensitive to lighting, background noise, and wood species, exhibiting poor robustness and difficulty in adapting to complex production scenarios. In recent years, the development of deep learning has driven rapid progress in wood defect detection technology. Target detection models based on convolutional neural networks (CNNs), such as YOLO and Faster R-CNN, can automatically extract deep features from raw images, significantly improving detection accuracy and speed. These models have been widely applied to the identification of common defects in wood, such as knots, cracks, and wormholes. However, actual industrial production faces challenges such as limited sample size, uneven category distribution, and complex defect morphologies, leading to overfitting during the training process of deep models and insufficient ability to identify new or scarce defect types. Furthermore, some defect areas are highly similar to wood textures, and traditional detection models still have limitations in feature discrimination and scale adaptation. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a wood defect detection method based on meta-learning and deep learning to meet the need to improve the ability to identify new types or few samples of defects.

[0005] To achieve the above objectives, the present invention provides the following technical solution: This invention provides a method for detecting small-sample defects in wood based on meta-learning and deep learning, comprising: acquiring an image of wood to be detected; inputting the image of wood to be detected into a pre-trained wood defect detection model to obtain a wood defect detection result, wherein the wood defect detection model is a deep learning model trained based on meta-learning.

[0006] This embodiment provides a few-sample defect detection method for wood based on meta-learning and deep learning. The few-sample wood surface defect detection model, based on the MAML meta-learning framework and a deep learning network, has significant advantages in few-sample learning, cross-scenario generalization, robustness improvement, and a balance between detection accuracy and real-time performance. Through meta-training and meta-testing, it can effectively address the diverse challenges in wood surface defect detection and quickly adapt to the detection of new types of defects in different scenarios.

[0007] Other advantages, objectives, and features of the invention will be set forth in the following description and will be apparent to those skilled in the art in some respects, or may be learned by practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description

[0008] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the following figures are provided for illustration: Figure 1 This is a flowchart illustrating a specific example of a small-sample defect detection method for wood based on meta-learning and deep learning in this invention. Figure 2 This is a schematic diagram of the model training and usage process based on meta-learning and deep learning in this invention; Figure 3 This refers to the dataset table constructed in this invention; Figure 4 This is a structural diagram of the MAML model in this invention; Figure 5 This is a schematic diagram of the overall structure of the YOLOv11 network in this invention; Figure 6 This is a diagram illustrating the overall framework of the solution constructed in two phases in this invention. Detailed Implementation

[0009] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0010] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can also refer to the internal connection of two components; and they can refer to a wireless connection or a wired connection. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0011] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0012] The following are the technical terms used in this embodiment: Model-Agnostic Meta-Learning (MAML) is a meta-learning algorithm with model-independent characteristics. Its core idea is to enable the model to learn an initial state with good transferability in the parameter space through joint learning of multiple different tasks during the training phase. Unlike traditional deep learning methods that rely on large-scale data for single-task training, MAML focuses on "how to learn quickly," that is, enabling the model to rapidly complete parameter tuning and performance adaptation with only a small number of samples when facing new tasks.

[0013] In wood processing and quality inspection, surface defects (such as cracks, knots, insect infestation, scratches, etc.) are important factors affecting product grade and economic value. Traditional wood surface defect detection relies on manual experience or deep learning models with a large number of labeled samples. However, in actual industrial environments, different tree species, lighting conditions, and shooting angles cause significant differences in sample distribution, and the number of samples of new defect types is extremely limited, making it difficult to meet the dependence of deep learning models on large-scale data. Therefore, researching a wood defect detection model that can still have good generalization ability and robustness under small sample conditions is of great practical significance. Based on this, this invention provides a wood defect detection method based on meta-learning and deep learning for small sample tests, such as... Figure 1 As shown, it includes: S101, Obtain the image of the wood to be detected; S102, input the wood image to be detected into the pre-trained wood defect detection model to obtain the wood defect detection result. The wood defect detection model is a deep learning model trained based on meta-learning.

[0014] For example, such as Figure 2As shown, the wood image to be detected can be various types of wood defect images (i.e., new classes). By inputting any wood defect image into a pre-trained wood defect detection model, the wood defect detection result can be obtained. In this embodiment, the pre-trained wood defect detection model is a deep learning model trained based on meta-learning.

[0015] In wood surface defect detection tasks, due to the limited number of samples, uneven distribution of defect categories, and significant differences in scenarios, directly training the detection network often leads to a decline in generalization ability. This embodiment proposes a few-sample wood surface defect detection method (hereinafter referred to as MLTE-YOLO11) that combines the MAML (Model-Agnostic Meta-Learning) meta-learning framework with the YOLO11 object detection network. This method introduces a meta-learning mechanism into the outer layer of the YOLO11 network, enabling the model to quickly adapt to new tasks under limited sample conditions. The overall structure of the MAML-YOLO11 few-sample wood surface defect detection model proposed in this embodiment is as follows: The model consists of three core modules: data augmentation, MAML meta-learning module, and YOLO11 optimized object detection module. Through the collaborative optimization of task-level meta-training and detection-level feature extraction, the model achieves rapid generalization and accurate detection for different wood scenarios and defect categories.

[0016] The Meta-Learning Model (MAML) is introduced into the YOLO11 network framework. Through a meta-learning mechanism, it optimizes the model at the task level, enabling it to learn shared feature representations across different tasks and thus obtain rapidly transferable initialization parameters for new tasks. The entire MAML process is divided into a meta-training phase and a meta-testing phase. The former obtains universally applicable initial parameters through iterative learning under a multi-task distribution, while the latter uses a small number of new wood defect samples for rapid fine-tuning, achieving efficient adaptation and detection of the model under small sample conditions. The overall MAML process consists of two stages: meta-training and meta-testing. The former learns a shared knowledge structure and transferable feature representations across tasks through iterative optimization across multiple tasks; the latter uses a small number of samples to fine-tune the model on new tasks, achieving rapid detection and identification of new types of defects. The overall MAML process consists of two stages: meta-training and meta-testing.

[0017] The construction process of combining the MAML (Model-Agnostic Meta-Learning) meta-learning framework with the YOLO11 object detection network model (wood defect detection model) includes: obtaining multiple types of wood defect samples; training the first deep learning model based on the multiple types of wood defect samples using meta-learning to obtain the wood defect detection model, with the YOLO11 network as the base network of the first deep learning model.

[0018] Specifically, the wood defect detection dataset used in this embodiment was collected after multiple detailed surveys. This dataset comprehensively covers six different types of wood defects, such as... Figure 3 As shown. To ensure data diversity and representativeness, this embodiment collected 632 high-quality images from multiple sources and precisely labeled the defects in each image, resulting in a total of 4320 defect check boxes. These images and labeled data provide a solid foundation for this embodiment and help improve the performance of the wood defect detection model.

[0019] The overall process of MAML is divided into two stages: meta-training and meta-testing. The former learns the knowledge structure and transferable feature representation shared across tasks through multi-task iterative optimization; the latter uses a small number of samples to fine-tune the model on new tasks to achieve rapid detection and recognition of new types of defects.

[0020] Specifically, based on multi-class wood defect samples, a first deep learning model is trained using a meta-learning approach to obtain a wood defect detection model. This includes: smoothing the labels in the multi-class wood defect samples to obtain target multi-class wood defect samples, which include image data and corresponding smoothed labels; constructing multiple task sample sets from the target multi-class wood defect samples; dividing each task sample set into a support set and a query set; for any single task, inputting the corresponding task's support set into the first deep learning model to determine the support set loss value for that single task during the inner loop; and updating the temporary parameters corresponding to that task based on the support set loss value and learning rate during the inner loop to obtain the temporary parameter model for that task, with the learning rate set as specified. Based on the change in the loss value of the task, input the query set into the temporary parameter model corresponding to the task and calculate the query set loss; repeat the step of inputting the support set of the corresponding task into the first deep learning model to the step of calculating the query set loss to obtain the query set loss of all tasks; determine the loss value in the outer loop process based on the query set loss of all tasks; update the initial meta-parameters of the first deep learning model based on the loss value of the outer loop until the termination iteration condition is reached to obtain the initial wood defect detection model; select at least one unused defect category from the task sample set as the target detection set, each target detection set corresponding to a support set and a query set; test the preliminary wood defect detection model based on the target detection set, and when the preset requirements are met, the wood defect detection model is obtained.

[0021] During meta-training, in small-sample wood defect detection tasks, the complex surface texture of wood, the blurred defect boundaries, and the uncertainty of some labeled samples can easily lead to overfitting or overconfidence in class judgments during model training. The traditional one-hot encoding method sets the label of the true class to 1 and the labels of the other classes to 0. This "hard label" method can cause the model to produce an overly strong confidence response to a certain class in samples with complex textures or blurred boundaries, thus reducing the model's generalization performance.

[0022] To address this, this embodiment introduces label smoothing as a regularization method to alleviate the phenomenon of the model over-relying on precise labels. Label smoothing perturbs the true label, transforming it from a "hard label" into a "soft label," making the confidence of the true class slightly lower than 1, while assigning smaller probabilities to other non-target classes, thus forming a more gentle class distribution.

[0023] in, This represents the smoothed label distribution. Indicates the original category label, For smoothing parameters, This represents the total number of categories.

[0024] This mechanism essentially introduces a certain degree of "fuzziness" into the objective function, thereby suppressing the model's excessive reliance on a single category during the training phase and improving the model's discrimination stability on uncertain samples. In the small sample wood defect detection task, the introduction of label smoothing has the following advantages: (1) Reduces the impact of noise labeling: Wood defect boundaries are often unclear, and manual labeling has biases. Label smoothing can effectively alleviate overfitting caused by incorrect labeling; (2) Improves class discrimination ability: By fuzzing the label distribution, the model can form a more flexible discrimination boundary between similar texture categories; (3) Enhances generalization ability: The smoothed label distribution prompts the model to learn a more stable decision boundary, showing stronger robustness when facing samples without defects or with weak features.

[0025] In summary, the label smoothing mechanism not only suppresses overconfidence during training but also improves the model's generalization performance under complex backgrounds and limited sample conditions, providing a more stable feature learning foundation for subsequent task-adaptive decay and query minimization mechanisms. This yields target multi-class wood defect samples, including image data and corresponding smoothed labels.

[0026] In the meta-training phase, such as Figure 4 As shown, the model constructs multiple task sample sets from target multi-class wood defect samples. Each task sample set contains a support set and a query set. The support set is used to learn task-specific fast adaptation capabilities, and the query set is used to evaluate task-level generalization performance.

[0027] For any single task, the support set of the corresponding task is input into the first deep learning model to determine the support set loss value of the single task during the inner loop. Specifically, in each task... First, the detection loss is calculated using the support set. The parameters are updated in an inner loop based on the gradient direction to obtain task-specific parameters. The update formula is as follows: in, Indicates globally shared parameters. For the inner loop learning rate, This is a YOLO11 detection model. Based on the support set loss value and learning rate of a single task during the inner loop, the temporary parameters corresponding to that task are updated to obtain the temporary parameter model for that task.

[0028] Next, the query set is input into the temporary parameter model corresponding to the task, and the query set loss is calculated. This process of inputting the support set of the corresponding task into the first deep learning model is repeated until the query set loss is calculated, yielding the query set loss for all tasks. Based on the query set loss for all tasks, the loss value in the outer loop process is determined. The outer loop loss is: Based on this, the model updates the global parameters through outer loop gradient descent to obtain the initial wood defect detection model: in, The learning rate is denoted as .

[0029] In the above process, a task-adaptive decay mechanism is introduced and embedded in the inner loop update stage of MAML. In the meta-learning process of small-sample wood defect detection, the sample complexity and loss convergence speed of different tasks vary significantly. For example, crack defects often have obvious linear textures and are easy to converge, while wormhole or decay defects, due to their irregular shapes and complex backgrounds, are prone to gradient oscillations or divergence during training. If a fixed learning rate is used for optimization, simple tasks may converge prematurely and get stuck in local optima, while complex tasks may fail to converge stably, thus affecting the overall generalization performance.

[0030] To address this issue, this embodiment proposes a Task-Adaptive Decay Mechanism. During the support set update phase of each task, the inner learning rate is dynamically adjusted based on changes in loss, achieving task-level adaptive optimization. The learning rate is updated according to the following segmented rules: in, The learning rate for step t+1. Let t be the learning rate for each step. , For the loss of step t, The loss is for step t+1. To prevent extremely small constants with a denominator of 0, this mechanism monitors the loss ratio between two consecutive iterations. When the task loss increases rapidly, it automatically reduces the learning rate to prevent over-updating; when the loss stabilizes or decreases, it slowly adjusts the learning rate to maintain learning continuity, thereby achieving balanced optimization across different tasks.

[0031] The above process describes the implementation of the meta-training phase. The following section moves to the meta-testing phase, whose goal is to verify the model's rapid adaptability to new defect tasks. In this phase, parameters are not re-initialized; instead, the optimal parameters learned during the meta-training phase are directly used. As the initial state, in a few-sample task involving novel wood defects, the model first updates the parameters a finite number of times using the support set to obtain task-specific weights. Because MAML has learned good parameter initialization and feature transfer methods during the training phase, the model can still converge quickly to a high-performance state even with a limited number of samples.

[0032] In the task of wood defect detection, some query areas ( query set Complex textures, blurred boundaries, or strong background interference can easily cause the model to generate a high-entropy prediction distribution (uncertainty) during the query phase. To improve the model's determinism on query samples, this embodiment introduces a query entropy minimization mechanism without introducing additional structural constraints: by minimizing the entropy of the query sample prediction distribution, the model outputs a more certain category distribution, thereby improving stability and robustness.

[0033] Let the predicted class distribution of the query sample be... Its information entropy is defined as: ; This embodiment only performs a query on each task during the query phase. query area Applying an entropy constraint, the loss is: ; ; in, The query set loss for task T. The original loss for task T, For entropy regularization weights, For the task T The query set sample set used for evaluation The predicted class distribution of the query set samples. C Here are the predicted class distribution parameters for the query set samples. The predicted class distribution for the query set samples is as follows: , To predict the th class distribution i The probability value of the class. By reducing the high-entropy prediction in the query region, the model tends to output a more deterministic and accurately distinguishable class distribution, thereby improving stability and robustness in complex background regions.

[0034] After optimization through two stages of meta-training and meta-testing, the model gained the ability to generalize to different wood materials, lighting conditions and defect types, achieving efficient detection under small sample conditions.

[0035] The pseudocode for the MAML algorithm flow is shown below: The meta-learning process has been described above. The following describes YOLOv11: YOLOv11 is an advanced single-stage object detection algorithm proposed in recent years, continuing the YOLO series' advantage in balancing speed and accuracy. Compared to its predecessor, YOLOv8, YOLOv11 has made comprehensive improvements in network structure design, feature fusion methods, and training strategies. It introduces a more efficient feature extraction module and an adaptive attention mechanism, significantly improving the model's detection accuracy, generalization performance, and robustness in small-sample scenarios. Considering the high requirements for real-time performance and accuracy in wood surface defect detection tasks, this embodiment selects YOLOv11 as the main detection framework of the algorithm. Its overall structure is as follows: Figure 5 As shown.

[0036] The YOLOv11 network mainly consists of three parts: Backbone (feature extraction network), Neck (feature fusion module), and Head (detection head). The model adopts a unified end-to-end detection framework, modeling the object detection problem as a joint optimization problem of bounding box regression and class prediction, which improves detection accuracy while ensuring high inference speed.

[0037] (1) Backbone: Deep optimization of feature extraction capability YOLOv11 significantly improved its backbone structure, primarily replacing the previous C2f or ELAN structures with the C3k2 module, and introducing C2PSA (C2 Partial Self-Attention) and SPPF (Spatial Pyramid Pooling-Fast) layers at key levels. The C3k2 module enhances the non-linear expressiveness of feature extraction and the gradient flow efficiency of the network through dual-path convolution and cross-layer feature aggregation. When the shallow C3k2 modules are disabled, its structure is equivalent to C2f, thus maintaining good feature fidelity with low computational cost. Simultaneously, the C2PSA module introduces a multi-head attention mechanism in the channel and spatial dimensions, enabling the model to more accurately focus on local textures and fine structures, resulting in better responses to small-scale defects such as cracks and pores on steel surfaces. The SPPF module enhances the integration of contextual information through multi-scale pooling operations, further improving the model's target recognition accuracy in complex backgrounds.

[0038] Advantages Summary: Higher feature reuse rate, improving network computational efficiency and memory utilization; enhanced attention mechanism, improving the recognition of fine-grained features; stronger multi-scale context awareness, performing exceptionally well in small object detection.

[0039] (2) Neck: Efficient feature fusion across multiple paths The YOLOv11 Neck architecture introduces the C3k2 module and a lightweight attention mechanism on top of the YOLOv8 PAN-FPN framework, forming a more efficient feature fusion channel. The introduction of C3k2 makes feature fusion during upsampling and downsampling more flexible, enabling richer semantic interactions while maintaining low latency. Simultaneously, the C2PSA module embedded in key fusion nodes, through joint channel and spatial modeling, allows the network to dynamically adjust the weight allocation of features at different scales.

[0040] This multi-path feature fusion structure effectively enhances the fidelity of small targets and detailed features, significantly improving the model's detection performance for defective targets in complex scenes. Furthermore, the new fusion strategy reduces convolutional computation while optimizing information flow paths, enabling the model to exhibit higher stability and speed in industrial-grade real-time detection tasks.

[0041] Advantages Summary: Improved feature fusion efficiency reduces redundant computation; enhanced multi-scale adaptability makes small target detection more sensitive; stronger feature representation robustness improves recognition accuracy in complex backgrounds.

[0042] (3) Head: A detection head that combines lightweight design with high precision In terms of detection head design, YOLOv11 continues the decoupled head structure and further improves the lightweight design of convolutional units. The new version adopts a combination of DWConv (Depthwise Convolution) + 1×1 point convolution to replace the traditional standard convolution, thereby significantly reducing the computational cost and parameter size while maintaining feature representation capabilities. In addition, the C3k2 module is also introduced in the detection head to enhance feature selectivity and gradient stability. To further improve localization and classification performance, YOLOv11 uses the E-IoU (Enhanced IoU) loss function instead of the traditional CIoU, thus more comprehensively considering the overlap rate of bounding boxes, center distance, and aspect ratio consistency. At the same time, it is combined with a dynamic sample matching strategy (Task-Aligned Assigner) to make the allocation of positive and negative samples more reasonable and the model training more stable.

[0043] Advantages Summary: The combination of structural reparameterization and DWConv reduces redundant computation and accelerates inference; the detection head is more flexible and stable, effectively alleviating the conflict between classification and localization tasks; the number of parameters is significantly reduced, achieving higher mAP performance under the same hardware conditions.

[0044] In summary, the optimizations in the Backbone, Neck, and Head layers of YOLOv11 enable the model to maintain high accuracy while further improving inference speed. Community testing results show that YOLOv11m achieves approximately 1.2% better mAP on the COCO dataset compared to YOLOv8m, while reducing the number of parameters by approximately 22%, demonstrating a superior performance-efficiency balance. This architecture is particularly suitable for real-time industrial inspection and small-sample target recognition scenarios, providing a solid foundation for future improvements in the field of steel surface defect detection.

[0045] This few-shot wood surface defect detection model, based on the MAML (Model-Agnostic Meta-Learning) framework and the YOLO11 object detection network, offers several significant advantages while addressing the few-shot learning problem. These advantages make the model robust and applicable in practical wood surface defect detection. The main advantages of this model are as follows: (1) Small sample learning ability Traditional deep learning models typically rely on large-scale labeled data for training. However, in wood surface defect detection, especially for novel defects, obtaining sufficient data is extremely difficult. The MAML framework, through meta-learning, can quickly adapt to new tasks with limited samples. During the meta-training phase, the model learns how to rapidly adjust its parameters through multiple tasks. This allows it to fine-tune with a small number of support set samples when facing new tasks, quickly adapting and improving detection accuracy.

[0046] (2) Cross-scenario generalization capability Wood surface defect detection is applicable to a wide variety of scenarios, involving different backgrounds, lighting conditions, and defect types. Traditional object detection methods often perform well in specific scenarios, but their performance tends to degrade in different scenarios. A model combining YOLO11 and MAML can effectively address the challenges of various scenarios. During the meta-training phase, YOLO11 learns feature information from different scenarios through multi-task learning, enabling the model to acquire universal initialization parameters. During the meta-testing phase, the model quickly adapts to new tasks through fine-tuning, achieving efficient detection across scenarios. By introducing a domain adaptation optimizer, the model can further reduce the distribution difference between the meta-domain and the target domain, improving the model's detection performance in diverse scenarios.

[0047] (3) Enhanced model robustness Wood surface defect detection faces challenges such as high similarity between the background and the target, and labeling uncertainty. To address these issues, this model introduces label smoothing technology. Label smoothing effectively reduces overfitting of the model to the training data, making the model more robust during training. By softening the probability distribution of the true labels, label smoothing reduces the model's over-reliance on class labels, thereby enhancing its tolerance to complex backgrounds and ambiguous labels. This allows the model to better handle defects under different lighting and background conditions in real-world detection.

[0048] (4) Quickly adapt to new types of defects In wood surface defect detection tasks, new defect categories often emerge. The number of samples for these new categories is very limited, making it difficult for traditional models to maintain good performance under such circumstances. However, the YOLO11 model based on the MAML framework can learn cross-task shared knowledge during the meta-training phase, ensuring rapid adaptation when encountering new classes. By fine-tuning the model on new class samples, it quickly adjusts parameters and achieves high-precision detection, significantly improving the model's flexibility and adaptability.

[0049] (5) High-efficiency training and reasoning speed YOLO11 inherits the high efficiency of the YOLO series models, enabling rapid image processing and output of results during object detection. YOLO11 employs an anchor-less architecture, avoiding complex post-processing steps such as candidate box generation and non-maximum suppression (NMS) in traditional object detection methods, significantly improving the model's inference speed. Combined with the MAML meta-learning framework, the model can be efficiently trained and fine-tuned even in scenarios with limited sample sizes, making full use of limited training samples and improving training efficiency.

[0050] (6) Balancing model accuracy and real-time performance In industrial applications, especially for wood surface defect detection, both high accuracy and real-time performance are required. YOLO11 achieves high accuracy while boasting fast inference speed, making the model highly practical. By combining with the MAML framework, YOLO11 can quickly adapt to detecting new types of defects even with small sample sizes, further improving detection accuracy. Simultaneously, YOLO11's efficiency ensures its applicability in real-time industrial inspection scenarios.

[0051] (7) Easy to expand and apply The combination of YOLO11 and MAML gives the model strong flexibility and scalability. For other types of defect detection tasks, users can easily transfer the model to other domains by adjusting model parameters and training strategies. Furthermore, the MAML-based training method enables the model to perform transfer learning and adapt quickly across multiple tasks and scenarios, greatly improving its applicability and scalability in practical applications.

[0052] In summary, the few-shot wood surface defect detection model based on the MAML meta-learning framework and the YOLO11 object detection network exhibits significant advantages in few-shot learning, cross-scene generalization, robustness improvement, and a balance between detection accuracy and real-time performance. Through meta-training and meta-testing, combined with techniques such as label smoothing and domain adaptation optimization, this model can effectively address the diverse challenges in wood surface defect detection and quickly adapt to detecting new types of defects in different scenarios.

[0053] In the above embodiments, the wood defect detection model is constructed by combining the MAML (Model-Agnostic Meta-Learning) framework with the YOLO11 object detection network. However, when faced with small-sized, low-contrast, and complex-textured defects such as cracks, wormholes, and pinholes, wood surface defect detection still suffers from problems such as insufficient feature extraction, inaccurate target localization, and decreased detection accuracy. Traditional detection models have weak feature responses to small targets and weakly textured regions, making it difficult to effectively distinguish defects from normal textures. At the same time, the target regression stage is not sensitive enough to samples with scale differences and uneven quality, which easily leads to problems such as low gradient utilization of high-quality candidate boxes and large interference from noisy samples. To address the aforementioned shortcomings, this embodiment proposes an improved model that integrates hybrid attention and IoU optimization within the YOLOv11+ meta-learning framework. A hybrid attention module of CBAM + SimAM is introduced into the backbone network to enhance the model's feature perception and saliency representation of fine-grained textures and key regions. In the loss design, Dynamic IoU and Wise-IoU v3 are combined to achieve joint optimization based on center alignment and quality perception, strengthening the gradient contribution of high-quality samples and improving the localization accuracy and generalization ability of small targets and novel defect types. This improvement effectively enhances the detection performance and robustness of complex texture defects on wood surfaces while maintaining the model's lightweight nature.

[0054] Therefore, as an optional implementation method, the construction process of the wood defect detection model includes: acquiring multiple types of wood defect samples; training a second deep learning model using a meta-learning approach based on the multiple types of wood defect samples to obtain a base model, wherein the base network of the second deep learning model is YOLO11; adding a hybrid attention module to the backbone of the base model network to construct the second deep learning model to be trained; and co-training a third deep learning model using a meta-learning framework based on the multiple types of wood defect samples to obtain the wood defect detection model, wherein the loss function for training is a loss function constructed based on a combination of dynamic IoU and Wise-IoU v3.

[0055] For example, such as Figure 6 The diagram shows the overall framework of this embodiment. Based on the previous embodiment, Part Two, which incorporates fused attention and weighted IoU optimization, has been added. To address the issue of insignificant features of wood surface defects under small size, low contrast, and complex texture conditions, this embodiment introduces a CBAM + SimAM hybrid attention mechanism into the backbone network to enhance the model's ability to perceive key regions and fine-grained features.

[0056] In this embodiment, the hybrid attention module includes a channel attention module, a spatial attention module, and a simple attention module. The hybrid attention module is added to the backbone of the basic model network to construct the second deep learning model to be trained. This includes embedding a hybrid attention module, composed of a channel attention submodule, a spatial attention submodule, and a simple attention module (SimAM module), in series at the first key node and / or the second key node of the basic model network backbone. The first key node corresponds to a medium semantic level in the network structure used to extract local structural features of the object, and the second key node corresponds to a high semantic level in the network structure used to extract global semantic information of the object. This mechanism comprehensively utilizes the global filtering capabilities of channel and spatial attention, as well as the local saliency enhancement capabilities based on energy distribution, to achieve feature representation optimization through "global filtering + local enhancement".

[0057] Based on multiple types of wood defect samples, a second deep learning model is trained using a meta-learning approach. The process of obtaining the basic model is described in the above embodiment and will not be repeated here. The following focuses on describing the newly added module in this embodiment: (1) CBAM module CBAM (Convolutional Block Attention Module) consists of two parts: Channel Attention and Spatial Attention, used to adaptively adjust feature weights globally. In the Channel Attention part, the model extracts global statistical information of the features through global average pooling and max pooling. Let the input feature map feature be... (Number of channels C, height H, width W), then the channel attention weights The calculation is as follows: in, Represented as an activation function, and For the weight of the science department, To The global average pooling result, To The result of global max pooling. The resulting channel attention weights. Reflecting the importance of each channel, it is used to weight and adjust the input features: In the spatial attention part, the model performs average pooling and max pooling on the feature maps along the channel dimension, concatenates the results, and then calculates the spatial weights through a 7×7 convolution. picture: ; in, express convolution, To The global average pooling result; To The result of global max pooling.

[0058] The final output features are: The CBAM module achieves adaptive enhancement at the channel and spatial levels through the above two steps, enabling the model to focus on potential defect areas and suppress irrelevant background.

[0059] (2) SimAM module SimAM (Simple Attention Module) is a parameter-free attention mechanism that measures significance by analyzing the difference between each pixel in the feature map and its local mean and variance. Let the feature value be... Their mean and variance are respectively and Then the energy function of SimAM Defined as: in, This is a constant used to prevent the denominator from being zero. Energy value. The larger the value, the more significant the feature difference at that location. The model uses... function pairs Normalize the data and multiply it by the original features as a weight to obtain the final output: ; The module requires no additional parameters, has low computational cost, and can significantly improve the response intensity of small targets and weakly textured regions while maintaining the network's lightweight nature.

[0060] (3) Fusion method and embedding position This embodiment employs a serial fusion approach. After embedding the SimAM module into the CBAM module, CBAM first performs global feature filtering, and then SimAM performs local saliency enhancement. The overall output of the hybrid attention mechanism is represented as follows: ; This module is embedded in the middle and high-level feature extraction stages of the backbone network, effectively improving the model's ability to perceive complex textures and small defects on the wood surface while maintaining the network's lightweight nature.

[0061] In wood surface defect detection tasks, there are issues such as significant size differences between small samples and novel samples, blurred target boundaries, and localization offsets. Traditional IoU loss can easily lead to insufficient training and unstable convergence for small targets due to gradient allocation problems. To address this, this embodiment introduces the Wise-IoU v3 (WIoU v3) optimization mechanism. By introducing quality-aware weighting and dynamic non-monotonic focusing mechanisms, the learning weights of candidate boxes with different quality are adaptively adjusted, thereby significantly improving the robustness and localization accuracy of the model in small sample detection scenarios.

[0062] Wise-IoU v3's basic form based on IoU loss: in, Indicates the prediction box. This represents the true bounding box. When there are significant deviations in the size or position of the target, traditional IoU cannot reflect the degree of center alignment and scale matching. Therefore, WIoU v3 introduces center distance constraints and a quality-aware coefficient to dynamically weight different candidate boxes. Its overall form can be described as: ; in, This represents the center distance offset between the predicted bounding box and the ground truth bounding box. This indicates the difference in aspect ratio. and This is a dynamic adjustment coefficient used to balance positioning and scale sensitivity. This is the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box.

[0063] In WIoU v3, a non-monotonic focusing mechanism was introduced into the loss function, using quality scores. The core adaptive parameter is defined as follows. This mechanism calculates the IoU quality score for each sample and adjusts its gradient weight, allowing high-quality candidate boxes to receive greater gradient weights in regression optimization, while the weights of low-quality or noisy samples are automatically reduced, thus achieving the optimization goal of "strengthening superior samples and suppressing noise". Its dynamic weighting term can be expressed as: ; in, This is the focus intensity coefficient. When When the overlap is large (i.e., the overlap between the predicted bounding box and the ground truth bounding box is high), The value is close to 1; when When the weights are small, the weights decay rapidly, thus effectively avoiding the problem of noisy samples dominating the training.

[0064] That is, the loss function constructed based on the combination of dynamic IoU and Wise-IoU v3 is: ; in, For dynamically weighted terms, , To focus the intensity coefficient, For quality score, based on Sure, The larger, The larger, The loss function is characterized by Wise-IoU v3. , This represents the center distance offset between the predicted bounding box and the ground truth bounding box. This indicates the difference in aspect ratio. and This is a dynamic adjustment coefficient. The intersection-union ratio (IUU) of the predicted bounding box and the ground truth bounding box is given by N, where N is the total number of samples.

[0065] Furthermore, Wise-IoU v3 employs a gradient equilibrium mechanism during training to dynamically redistribute gradients among samples. This ensures that high-quality samples maintain stable updates during optimization, while small target samples still receive effective gradient feedback even with significant scale differences. This mechanism is particularly suitable for detecting small-sized, low-contrast defects on wood surfaces, such as cracks, wormholes, and pinholes, helping to mitigate overfitting caused by sample scarcity.

[0066] By combining with dynamic IoU, Wise-IoU v3 achieves an integrated bounding box regression optimization strategy of "center alignment + quality awareness + dynamic focusing". Combined with the hybrid attention mechanism proposed in this embodiment, this loss design effectively improves the localization accuracy and generalization ability of small sample wood defects while maintaining the model's lightweight nature. Experimental results show that it significantly improves the mean accuracy (mAP) and stability in multi-scale defect detection.

[0067] To provide a detailed explanation of this embodiment, the entire embodiment is summarized below according to different stages: This embodiment focuses on "small sample wood defect detection" as its core task. The overall process, from data input and model training to detection optimization, is divided into two main stages: a small sample detection process based on meta-learning and a detection process that integrates attention and weighted IoU optimization. The two are interconnected at the architectural level, jointly supporting the final new framework for wood defect detection.

[0068] Phase 1: Small-sample wood defect detection process based on meta-learning This stage primarily targets small-sample scenarios, combining the Meta-Learning (MAML) framework with the YOLO11 model to achieve rapid adaptation and efficient learning for new tasks. The specific process is as follows: (1) Data preparation and task allocation After augmenting the wood defect sample data, it is divided into a meta-train set (Meta-train) and a meta-test set (Meta-test), and multiple small sample detection tasks are formed through task-level sampling to enhance the generalization ability of the model.

[0069] (2) Label smoothing and task adaptive optimization In task-level training, a label smoothing mechanism is introduced to reduce the impact of noisy labels; at the same time, a task-adaptive decay mechanism is used to dynamically adjust the learning rate and weight update strategy according to the task difficulty.

[0070] (3) Training of the domain adaptation optimizer To address differences in wood texture, lighting, and shooting angle, a domain adaptation optimization strategy is employed to achieve cross-domain feature alignment, thereby improving the model's robustness to different data distributions.

[0071] (4) Optimization of YOLO11 and MAML By embedding the meta-learning framework into the YOLO11 detection structure, rapid convergence with few samples and improved detection accuracy are achieved through two-stage optimization (rapid adaptation of the inner loop and global update of the outer loop).

[0072] After this training phase, the model possesses strong small-sample adaptability and transferability, providing a foundation for subsequent optimization of detection accuracy.

[0073] Phase Two: Integrating Attention and Weighted IoU to Optimize the Detection Process This stage focuses on further optimizing the model's feature representation and target localization capabilities. By introducing an attention mechanism and an IoU optimization module, the precision of wood defect detection is improved. The process is as follows: (1) Feature enhancement stage (hybrid attention module) By integrating channel attention and spatial attention mechanisms, important defect areas are weighted and amplified during the feature extraction stage, thereby highlighting key features such as wood cracks, knots, and wormholes.

[0074] (2) Detection optimization stage (dynamically weighted IoU) A dynamically weighted IoU loss function is introduced in the model prediction stage, which dynamically adjusts the weights according to the target size, shape and position, thereby optimizing the bounding box regression and detection stability.

[0075] (3) Multi-module collaborative training and model output The detection head and attention module are optimized synchronously through a multi-module joint training mechanism, ultimately outputting high-precision defect detection results.

[0076] The connection between the two stages in the overall architecture of this embodiment is as follows: the first stage improves the model's generalization ability and rapid adaptability in small sample environments through meta-learning strategies; the second stage further improves the accuracy and robustness of detection through attention mechanisms and IoU optimization. This ultimately forms a new framework for wood defect detection in small sample scenarios, achieving a complete closed loop from feature extraction and task adaptation to detection optimization.

[0077] To address the challenges in wood surface defect detection, such as small sample size, significant differences in novel classes, uneven target size, and complex textures, this embodiment proposes an improved detection model based on the YOLOv11+ meta-learning framework, integrating a hybrid attention mechanism and an IoU optimization strategy. Through collaborative improvements in the structural and optimization layers, this model achieves enhanced perception of small targets and improved regression accuracy, offering the following benefits: (1) A hybrid attention feature enhancement mechanism (CBAM + SimAM) is proposed. To address the issues of complex textures and low contrast in defective areas such as cracks, wormholes, and pinholes on wood surfaces, this embodiment introduces a hybrid attention module composed of CBAM and SimAM into the backbone network. The CBAM module adaptively adjusts the feature response using both channel and spatial attention, highlighting key defect areas and suppressing background interference; the SimAM module performs parameter-free enhancement of the feature map based on the neuron saliency distribution, further improving the response intensity of small targets and edge regions. The combination of these two modules achieves synergistic optimization of global feature selection and local saliency enhancement, effectively improving the model's feature representation capability and small target detection accuracy without significantly increasing computational cost.

[0078] (2) Construct a quality-aware IoU optimization mechanism (Wise-IoU v3) To address the issues of uneven gradient distribution and difficulty in distinguishing between high-quality and low-quality candidate boxes in small-sample detection using traditional IoU loss, this embodiment introduces the Wise-IoU v3 optimization mechanism. This mechanism adaptively adjusts sample gradient weights through a non-monotonic focusing function, enhancing the learning contribution of high-quality candidate boxes and suppressing noise and abnormal sample interference. Simultaneously, by combining center distance and scale difference constraints, it achieves a comprehensive optimization strategy of "center alignment + quality perception + dynamic focusing." This design significantly improves the model's localization accuracy and generalization ability in multi-scale defect detection.

[0079] (3) Construct a lightweight detection box suitable for small sample scenarios To address the issues of limited sample size and class imbalance in wood defect data, this embodiment implements a lightweight improvement to the feature extraction and regression modules within the YOLOv11 framework. By using a hybrid attention module to enhance feature utilization and Wise-IoU v3 to improve optimization stability, the model maintains real-time detection performance while achieving stronger small-sample adaptability and cross-scenario robustness.

[0080] In summary, the detection model proposed in this embodiment enhances the perception of small target features at the structural level and introduces a quality-aware IoU regression mechanism at the optimization level, achieving efficient detection and accurate localization of defects in complex textured wood. This provides a generalizable reference solution for small-sample industrial visual inspection.

[0081] To enhance the model's generalization ability and robustness in few-shot learning environments, this embodiment introduces a task-adaptive data augmentation module into the meta-learning framework. This module augments samples in the support set stage of each meta-learning episode using two strategies: Mosaic image stitching and MixUp image blending. This enriches the spatial composition and lighting / texture distribution of the samples, thereby improving the model's feature extraction ability and task transfer performance in few-shot tasks. The augmentation module only operates on the support set; the query set retains its original distribution to ensure the stability of the outer gradient estimation in the meta-learning process.

[0082] Therefore, as an optional implementation, after each task sample set is divided into a support set and a query set, for any single task, the support set of the corresponding task is input into the first deep learning model. Before determining the support set loss value of a single task in the inner loop, the following steps are taken: obtaining the current training progress and sample size; determining the Mosaic image stitching probability and the MixUp image mixing probability based on the current training progress and sample size; and determining the data augmentation strategy for the support set based on the Mosaic image stitching probability and the MixUp image mixing probability.

[0083] For example, the data augmentation module mainly includes two types of operations: 1. Mosaic image stitching (Mosaic Augmentation): This involves stitching four images together in a specific ratio to create a new image, forming a composite sample with multiple targets and scales. 2. MixUp Image Fusion: This method linearly weights and fuses two images with a certain probability, preserving their target labels to improve the model's ability to smoothly learn class boundaries.

[0084] During the support set construction phase of each episode, the system determines whether to execute the corresponding enhancement strategy based on dynamic probability, and finally generates an enhanced support sample set for rapid adaptive training within the MAML inner loop.

[0085] Mosaic data augmentation achieves image-level compositing by stitching four randomly selected samples onto the same canvas. Let the original input image size be... The canvas is then divided into four sub-regions, each with a size of [size missing]. The enhancement process includes the following steps: 1. Subimage scaling and fitting: Each subimage is scaled using bilinear interpolation to... And offset according to its position on the canvas. Fit into the global image; 2. Label Remapping: To ensure the accuracy of the label positions relative to the target scale, the original YOLO coordinates are remapped. Perform affine transformation and normalization to obtain new labeled coordinates. , , , ): in, as well as These are the width scaling factor and height scaling factor of the original image when stitching it together in Mosaic, respectively.

[0086] 3. Label Merging: The target labels of the four images are integrated into a single label file, forming multi-class, multi-scale composite samples. This method can significantly improve the robustness of the model to multi-scale targets and complex texture backgrounds, and is particularly suitable for diverse surface structures such as cracks, knots, and wormholes in wood defect detection.

[0087] The MixUp enhancement strategy constructs a smooth sample distribution space by performing pixel-level linear weighted superposition of two images. Its mathematical form can be expressed as: in, The new image generated after blending, Original image, The weighting coefficients follow the rules. Distribution (in this embodiment) =0.4). This method achieves transitional fusion between samples at the visual level, thereby improving the model's ability to distinguish between boundary samples and difficult-to-classify samples. Unlike classification tasks, MixUp does not weight the labels in the detection task, but directly merges the target box sets of the two images to maintain the consistency of the supervision signal for object detection.

[0088] To achieve adaptive control of the enhancement intensity, this embodiment proposes a two-dimensional dynamic scheduling strategy based on training progress and sample size. The specific design is as follows: in, Indicates training progress; for k-shot Normalization factor.

[0089] This mechanism maintains strong data perturbation in the early stages of training to promote feature generalization; it gradually reduces the enhancement intensity in the later stages of training to ensure model convergence and stability. For tasks with a large k value (sufficient samples), the system automatically reduces the enhancement probability to avoid "over-enhancement".

[0090] In this embodiment, the enhancement intensity is dynamically adjusted with the epoch and task size to balance convergence speed and robustness. Furthermore, enhancement is performed only on the support set to avoid distribution shift in the outer loop gradient estimation. Meanwhile, the diversity of the limited samples is enhanced by concatenation and fusion to improve the rapid adaptability of the meta-learning model. Finally, the module is implemented on a GPU and optimized using caching and batch processing to ensure computational efficiency during the training process.

[0091] Finally, it should be noted that the above preferred embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail through the above preferred embodiments, those skilled in the art should understand that various changes can be made to it in form and detail without departing from the scope defined by the claims of the present invention.

Claims

1. A method for detecting defects in wood samples based on meta-learning and deep learning, characterized in that, include: Acquire images of the wood to be inspected; The wood image to be detected is input into a pre-trained wood defect detection model to obtain the wood defect detection result. The wood defect detection model is a deep learning model trained based on meta-learning. The process of constructing a wood defect detection model includes: Obtain samples of various types of wood defects; Based on multiple types of wood defect samples, a second deep learning model is trained using a meta-learning approach to obtain a base model. The base network of the second deep learning model is YOLO11. A hybrid attention module is added to the backbone of the basic model network to construct a third deep learning model to be trained; Based on multiple types of wood defect samples, a third deep learning model is co-trained under the meta-learning framework to obtain a wood defect detection model. The training loss function is a loss function constructed based on the combination of dynamic IoU and Wise-IoU v3. The hybrid attention module includes channel attention, spatial attention, and simple attention modules. By adding the hybrid attention module to the backbone of the basic model network, a third deep learning model to be trained is constructed, including: In the backbone of the basic model network, a hybrid attention module is embedded at the first key node and / or the second key node. The module consists of a channel attention submodule, a spatial attention submodule, and a simple attention module connected in series. The first key node corresponds to the intermediate semantic level in the network structure for extracting local structural features of the object, and the second key node corresponds to the high semantic level in the network structure for extracting global semantic information of the object. The output of the hybrid attention module is: ; in, ; Spatial weights; ; express convolution; Represented as an activation function; , The input feature map features are those of the channel attention part; To The global average pooling result; To The result of global max pooling; For channel attention weights, , and As a weight for the science department, To The global average pooling result, To The global max pooling result, This represents the processing function of a simple attention module. , Let be the energy function of a simple attention module.

2. The method for detecting small-sample defects in wood based on meta-learning and deep learning according to claim 1, characterized in that, Multi-class wood defect samples include image data and labels. Based on these samples, a second deep learning model is trained using a meta-learning approach to obtain the base model, which includes: The labels in the multi-class wood defect samples are smoothed to obtain the target multi-class wood defect samples, which include image data and corresponding smoothed labels. Multiple task sample sets are constructed from target wood defect samples of various types. Each task's sample set is divided into a support set and a query set; For any single task, the support set of the corresponding task is input into the second deep learning model to determine the support set loss value of the single task in the inner loop process; Based on the support set loss value and learning rate of a single task in the inner loop, the temporary parameters corresponding to the task are updated to obtain the temporary parameter model corresponding to the task. The learning rate changes according to the loss value of the task. Input its query set into the temporary parameter model corresponding to the task, and calculate the query set loss; Repeat the steps of inputting the support set of the corresponding task into the second deep learning model to calculate the query set loss, and obtain the query set loss for all tasks. Determine the loss value in the outer loop process based on the query set loss of all tasks; Based on the loss value of the outer loop, the initial meta-parameters of the second deep learning model are updated until the termination iteration condition is met, thus obtaining the initial wood defect detection model. Select at least one unused defect category from the task sample set as the target detection set. Each target detection set contains a support set and a query set. The preliminary wood defect detection model is tested based on the target detection set. When the preset requirements are met, the basic model is obtained.

3. The method for detecting small-sample defects in wood based on meta-learning and deep learning according to claim 2, characterized in that, The loss function used in the test is: ; in, The query set loss for task T, The original loss for task T, For entropy regularization weights, , For the task T The query set sample set used for evaluation , The predicted class distribution of the query set samples. C Here are the predicted class distribution parameters for the query set samples. The predicted class distribution for the query set samples is as follows: , To predict the th class distribution i The probability value of the class.

4. The method for detecting small-sample defects in wood based on meta-learning and deep learning according to claim 1, characterized in that, The loss function constructed based on the combination of dynamic IoU and Wise-IoU v3 is as follows: ; in, For dynamically weighted terms, , To focus the intensity coefficient, For quality score, based on Sure, The larger, The larger, The loss function is characterized by Wise-IoU v3. , This represents the center distance offset between the predicted bounding box and the ground truth bounding box. This indicates the difference in aspect ratio. and This is a dynamic adjustment coefficient. The intersection-union ratio (IUU) of the predicted bounding box and the ground truth bounding box is given by N, where N is the total number of samples.

5. The method for detecting small-sample defects in wood based on meta-learning and deep learning according to claim 2, characterized in that, After dividing the sample set for each task into a support set and a query set, for any single task, the support set of the corresponding task is input into the second deep learning model. Before determining the support set loss value of a single task in the inner loop, the following steps are taken: Get the current training progress and sample size; Based on the current training progress and sample size, determine the Mosaic image stitching probability and the MixUp image mixing probability; Based on the Mosaic image stitching probability and the MixUp image mixing probability, a data augmentation strategy for the support set is determined.

6. The method for detecting small-sample defects in wood based on meta-learning and deep learning according to claim 2, characterized in that, The learning rate varies based on the task's loss value, including: in, The learning rate for step t+1. Let t be the learning rate for each step. , For the loss of step t, The loss is for step t+1. To prevent extremely small constants with a denominator of 0.

Citation Information

Patent Citations

  • Wood defect detection method and system based on deep neural network

    CN117876663A

  • Wood board surface defect detection method based on improved Yolov7-tiny network

    CN117893497A