Airport terminal welding seam defect detection method based on improved YOLOv12 model

By improving the YOLOv12 model, combining the DFFN and DYT modules to optimize feature aggregation and introducing an attention mechanism, the problems of low efficiency and insufficient accuracy in the inspection of weld seams on the metal roof of the terminal building were solved, and efficient and accurate weld defect detection was achieved.

CN121599952APending Publication Date: 2026-03-03ZHUHAI ANWEITE ENG TESTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511807117.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-03
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing technologies for detecting weld defects in metal roofs of airport terminals suffer from low detection efficiency, large errors, and susceptibility to human factors, making it difficult to achieve efficient and accurate detection.

Method used

An improved YOLOv12 model is adopted, which optimizes feature aggregation by introducing a dual-frequency aggregation feedforward module (DFFN) and a dynamic tanh module, and enhances the model's ability to focus on key information by combining an attention mechanism, for weld defect detection.

Benefits of technology

It significantly improves the model's ability to extract features and detect defects in the metal roof welds of airport terminals, achieving lightweight and efficient detection, which is suitable for the stringent requirements of accuracy and efficiency in actual engineering projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121599952A_ABST
    Figure CN121599952A_ABST
Patent Text Reader

Abstract

The invention discloses an improved YOLOv12 model-based terminal welding seam defect detection method. The method comprises the following steps of: obtaining a to-be-detected welding seam data set; the to-be-detected weld joint data set is input into an improved YOLOv12 model, a weld joint defect detection result is obtained, the improved YOLOv12 model optimizes feature aggregation and information expression ability by adding a double-frequency aggregation feedforward module and a dynamic tanh module to the YOLOv12 model, and an attention mechanism is introduced to enhance the attention ability of the YOLOv12 model to key information. Through the improved YOLOv12 model, a new thought is provided for automatic detection of weld defects, and reliable technical support is provided for application of an intelligent detection technology in practical engineering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of metal roof weld inspection technology, and particularly relates to a method for detecting defects in terminal building welds based on an improved YOLOv12 model. Background Technology

[0002] Weld defect detection plays a crucial role in airport terminal metal roofing projects, particularly in ensuring structural safety and extending service life. With the increasing complexity of modern engineering construction, traditional manual inspection methods often suffer from low efficiency and significant errors. To improve detection accuracy and efficiency, automated and intelligent defect detection technologies have received widespread attention. In recent years, continuously welded stainless steel metal roofing systems have been developed in coastal areas of my country due to their excellent wind resistance, waterproofing, and corrosion resistance. However, there are currently few application examples of this system in my country, and the continuous welding of the roof panels is a new technology and process, making construction difficult and technically complex. Currently, weld defect detection methods in airport terminals mainly rely on manual inspection or traditional non-destructive testing techniques, which are not only inefficient but also susceptible to human factors, making it difficult to guarantee efficient and accurate detection results. With the rapid development of artificial intelligence technology, deep learning-based image recognition technology has shown great potential in weld defect detection.

[0003] Target detection models have been applied to the automated detection of weld defects, achieving some success. These models mainly focus on extracting features through convolutional neural networks (CNNs) and combining various attention mechanisms or adaptive techniques to improve model performance. However, although these models have shown good results in some weld defect detection tasks, due to the surface complexity and diversity of welds in metal roofs, there is still room for improvement in the detection accuracy of existing models. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention proposes a terminal building weld defect detection method based on an improved YOLOv12 model. The improved YOLOv12 model provides a new approach for automated weld defect detection and offers reliable technical support for the application of intelligent detection technology in practical engineering.

[0005] To achieve the above objectives, this invention provides a method for detecting defects in terminal building welds based on an improved YOLOv12 model, comprising:

[0006] Obtain the dataset of the weld to be tested;

[0007] The dataset of the weld seam to be tested is input into the improved YOLOv12 model to obtain the weld seam defect detection results. The improved YOLOv12 model optimizes the feature aggregation and information expression capabilities by adding a dual-frequency aggregation feedforward module and a dynamic tanh module to the YOLOv12 model, and introduces an attention mechanism to enhance the YOLOv12 model's ability to focus on key information.

[0008] Optionally, the dataset of weld seams to be tested can be input into an improved YOLOv12 model to obtain weld defect detection results, including:

[0009] The dataset of the weld seam to be tested is preprocessed to obtain the preprocessed weld seam dataset;

[0010] The preprocessed weld dataset was inspected using an improved YOLOv12 model to obtain the weld defect detection results.

[0011] Optionally, the weld dataset to be tested is preprocessed to obtain the preprocessed weld dataset, including:

[0012] Video data of welds on the metal roof of the terminal building was collected using a data acquisition device;

[0013] The weld seam video data is subjected to frame extraction processing to obtain the target static frame;

[0014] The target static frames are labeled to obtain a labeled dataset;

[0015] The labeled dataset is classified to obtain datasets of different categories, including: misaligned welds, broken welds, over-welded welds, and weld penetrations.

[0016] Data augmentation processing is performed on the different categories of datasets to obtain the preprocessed weld dataset.

[0017] Optionally, data augmentation processing is performed on the different categories of datasets to obtain the preprocessed weld dataset, including:

[0018] Read the dataset images of the different categories and load the corresponding YOLO format label files;

[0019] Convert the tag file to Tensor format to obtain the target format data;

[0020] The target format data is subjected to pixel enhancement transformation and spatial enhancement transformation to obtain the preprocessed weld dataset.

[0021] Optionally, the dual-frequency aggregation feedforward module includes a high-frequency unit, a low-frequency unit, and an aggregation unit;

[0022] The high-frequency unit is used to extract high-frequency features of the input features using depthwise separable convolution;

[0023] The low-frequency unit is used to obtain low-frequency features by smoothing the input features through average pooling.

[0024] The aggregation unit is used to splice the high-frequency features and low-frequency features along the channel dimension to obtain aggregated features.

[0025] Optionally, the method for concatenating the high-frequency and low-frequency features along the channel dimension to obtain the aggregated features is as follows:

[0026] ;

[0027] ;

[0028] ;

[0029] ;

[0030] in, High-frequency characteristics For low-frequency features, DepthwiseConv is a depthwise separable convolution operation, and AvgPool is an average pooling operation. and It's a convolution kernel, and GELU is the activation function. These are features after high-frequency path processing. Features after low-frequency path processing For pooling cores, The features are fused together. Concat is the feature concatenation operation, Conv is the convolution operation, and Y is the aggregated feature.

[0031] Optionally, the dynamic tanh module includes: a global pooling unit and a dynamic slope parameter generation unit;

[0032] The global pooling unit is used to compress the spatial dimension through global average pooling to obtain a context vector representing the overall feature distribution.

[0033] The dynamic slope parameter generation unit is used to generate dynamic slope parameters through a strong-scale fully connected network based on the context vector, wherein the dynamic slope parameters are increased when processing high-frequency features and decreased when processing low-frequency features.

[0034] Optionally, introducing an attention mechanism to enhance the YOLOv12 model's ability to focus on key information includes:

[0035] The attention mechanism incorporates spatial coordinates into channel attention by explicitly encoding positional information, and performs weighted average pooling on the input feature map along the horizontal and vertical directions to obtain the feature encoding vector.

[0036] Optionally, weighted average pooling is performed on the input feature map along both the horizontal and vertical directions to obtain the feature encoding vector, including:

[0037] The input feature map is subjected to average pooling along the horizontal and vertical directions to obtain a first feature map and a second feature map.

[0038] The first and second feature maps are concatenated and their dimensions are reduced to obtain the third feature map.

[0039] The third feature map is segmented, batch normalized, and nonlinearly activated to obtain the first attention weight and the second attention weight.

[0040] The first attention weight and the second attention weight are applied to the input feature map to obtain the feature encoding vector.

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

[0042] This invention innovatively integrates the DFFN dual-frequency aggregation feedforward network and the DYT dynamic activation function into the A2C2f structure of the original YOLOv12 model, significantly improving the model's feature extraction capability for weld defects in the metal roof of an airport terminal. The DFFN module effectively addresses the representation bottleneck of traditional convolutional layers when simultaneously capturing local subtle features and global structural information by separating high-frequency details from low-frequency contour information. Meanwhile, the DYT technique, through a feature-adaptive slope adjustment mechanism, enables the network to dynamically adjust the intensity of nonlinear transformations based on the complexity of the input content. This dual composite improvement allows the model to maintain its lightweight characteristics while possessing a stronger representation capability for weld defect features in complex backgrounds.

[0043] This invention introduces the CoordAttention mechanism, explicitly encoding spatial coordinate information into the channel attention, enabling the model to more accurately locate key areas of weld defects. This technique, which improves detection accuracy while achieving model lightweighting, makes this invention particularly suitable for practical engineering scenarios involving weld defect detection in airport terminal metal roofs, where both accuracy and efficiency are critical. It provides reliable technical support for the practical application of intelligent detection technology. Attached Figure Description

[0044] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0045] Figure 1 This is a schematic diagram of a data acquisition device according to an embodiment of the present invention;

[0046] Figure 2 This is a flowchart of the dataset augmentation process according to an embodiment of the present invention;

[0047] Figure 3 This is a schematic diagram of the basic model of YOLOv12 in an embodiment of the present invention;

[0048] Figure 4 This is a schematic diagram of an improved model according to an embodiment of the present invention;

[0049] Figure 5 This is a schematic diagram of the dual-frequency aggregation feedforward network module according to an embodiment of the present invention;

[0050] Figure 6 This is a schematic diagram of the dynamic tanh module according to an embodiment of the present invention;

[0051] Figure 7 This is a schematic diagram of the coordinate attention mechanism module according to an embodiment of the present invention;

[0052] Figure 8 This is a schematic diagram of the precision-recall curve of an embodiment of the present invention;

[0053] Figure 9 This is a flowchart of a terminal building weld defect detection method based on an improved YOLOv12 model, according to an embodiment of the present invention. Detailed Implementation

[0054] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0055] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0056] This embodiment proposes a method for detecting weld defects in airport terminals based on an improved YOLOv12 model, such as... Figure 9 As shown, the specific steps include:

[0057] Obtain the dataset of the weld to be tested;

[0058] The dataset of the weld seam to be tested is input into the improved YOLOv12 model to obtain the weld seam defect detection results. The improved YOLOv12 model optimizes the feature aggregation and information expression capabilities by adding a dual-frequency aggregation feedforward module and a dynamic tanh module to the YOLOv12 model, and introduces an attention mechanism to enhance the YOLOv12 model's ability to focus on key information.

[0059] Specifically, this embodiment aims to improve the YOLOv12 model for the task of detecting weld defects in the metal roof of an airport terminal, thereby enhancing the model's detection accuracy and efficiency. To achieve this goal, this embodiment proposes an improved YOLOv12-based model that incorporates DFFN (Dual Frequency Aggregation FFN), DYT (Dynamic Tanh) technology, and the CoordAttention mechanism. The fusion of these technologies optimizes the model's feature extraction capabilities and information fusion effects, thus improving its defect detection performance in complex scenarios. The improved model in this embodiment demonstrates higher accuracy and efficiency in detecting weld defects in the metal roof of an airport terminal, promoting the application of deep learning technology in the field of intelligent building inspection. By optimizing the YOLOv12 model, this embodiment provides a new approach for the automated detection of weld defects and offers reliable technical support for the application of intelligent inspection technology in practical engineering.

[0060] Furthermore, the dataset of the weld seam to be tested is input into the improved YOLOv12 model to obtain the weld defect detection results, including:

[0061] The dataset of the weld seam to be tested is preprocessed to obtain the preprocessed weld seam dataset;

[0062] The preprocessed weld dataset was inspected using an improved YOLOv12 model to obtain the weld defect detection results.

[0063] Further, the dataset of weld seams to be tested is preprocessed to obtain the preprocessed weld seam dataset, including:

[0064] Video data of welds on the metal roof of the terminal building was collected using a data acquisition device;

[0065] The weld seam video data is subjected to frame extraction processing to obtain the target static frame;

[0066] The target static frames are labeled to obtain a labeled dataset;

[0067] The labeled dataset is classified to obtain datasets of different categories, including: misaligned welds, broken welds, over-welded welds, and weld penetrations.

[0068] Data augmentation processing is performed on the different categories of datasets to obtain the preprocessed weld dataset.

[0069] Specifically, this embodiment focuses on the automated detection of weld defects in the metal roof of an airport terminal. The construction of the dataset not only relies on efficient data acquisition devices but also involves accurate data classification and augmentation techniques to ensure that the model can accurately identify various weld defects in complex environments. This series of works provides ample data support for subsequent deep learning model training and lays a solid foundation for solving weld defect detection problems in practical engineering.

[0070] Dataset source:

[0071] The dataset used in this embodiment comes from the metal roof of Terminal 3 of a domestic international airport, and is representative and of practical value. For example... Figure 1 As shown, a data acquisition vehicle with autonomous driving capabilities was first designed. Equipped with high-precision cameras and sensors, this vehicle can autonomously navigate the metal roof of the terminal building and collect video data of the weld seams on both sides. The design of this vehicle fully considers the complexity and diversity of the terminal roof, enabling stable low-speed operation even in environments with certain slopes and obstacle limitations, ensuring efficient and accurate data acquisition. After collecting all video data, frame extraction technology was employed to extract high-quality static frames from the original video. Each processed frame was then input into an image annotation tool for manual annotation, ensuring the high quality and reliability of the dataset.

[0072] Dataset classification:

[0073] Damage datasets are categorized into four types: misaligned welds, incomplete welds, over-welds, and burn-through. Misaligned welds refer to the misalignment of metal plates on both sides of the weld, resulting in an irregular or misaligned weld. This type of defect typically has a significant impact on the strength and stability of the structure. Incomplete welds occur when poor welding results in an incomplete metal connection, forming a broken weld. This defect may lead to insufficient strength at the joint, affecting the structure's load-bearing capacity. Over-welds occur due to excessive welding material causing weld thickening. This defect may affect the aesthetics of the metal roof and add additional weight. Burn-through occurs when excessive welding heat causes the metal to melt and penetrate the entire metal plate; in severe cases, this defect may lead to complete structural failure.

[0074] The four datasets contain 1275 samples for "misaligned weld," 1196 samples for "broken weld," 993 samples for "over-welded," and 1592 samples for "weld penetration." The distribution of data categories reflects the frequency of different weld defects, with weld penetration defects having a relatively large number of samples. The overall dataset showcases different types of weld defects, covering a variety of problems that may be encountered during the welding process, aiming to provide comprehensive sample support for subsequent defect detection and model training.

[0075] Furthermore, data augmentation processing is performed on the different categories of datasets to obtain the preprocessed weld dataset, including:

[0076] Read the dataset images of the different categories and load the corresponding YOLO format label files;

[0077] Convert the tag file to Tensor format to obtain the target format data;

[0078] The target format data is subjected to pixel enhancement transformation and spatial enhancement transformation to obtain the preprocessed weld dataset.

[0079] Specifically, the main goal of the data augmentation process is to enhance images through a series of spatial and pixel transformation operations while ensuring label-image matching. The system traverses the image directory, randomly selects a portion of the dataset, reads images, loads the corresponding YOLO format label files, and converts them to Tensor format. Data augmentation is divided into two parts: spatial transformation and pixel transformation. Spatial transformations include horizontal flipping and center cropping, while pixel transformations include random brightness, contrast, and Gaussian noise operations. In each augmentation step, images and labels are updated synchronously; especially during spatial transformations, bounding box coordinates are recalculated to adapt to image changes. All augmented images and labels are saved to the corresponding output directory according to the augmentation type, retaining the augmentation type prefix in the filenames. The dataset augmentation process is as follows: Figure 2 As shown. The entire process involves iterating through each image and performing the corresponding enhancement operations until all images have been processed. In the enhanced data, the training set contains 24,982 images, the validation set contains 3,585 images, and the test set contains 722 images.

[0080] Furthermore, the YOLOv12 algorithm has achieved significant innovations at the infrastructure level. Its meticulously crafted optimized backbone network R-ELAN, its ingenious 7×7 separable convolutional design, and its region-based attention mechanism powerfully driven by FlashAttention have brought comprehensive improvements to the algorithm's performance. These innovative improvements have yielded remarkable results in several key dimensions, including feature extraction capabilities, computational efficiency, and model robustness.

[0081] like Figure 3 The image shows the basic model of YOLOv12. YOLOv12 provides a highly scalable solution for latency-sensitive applications and complex tasks requiring high accuracy. In practical applications, it has not only continuously improved its average accuracy, a key metric, but also achieved a significant leap in inference speed, making it the preferred algorithm in many fields such as autonomous system development, security monitoring, and real-time data analysis.

[0082] Furthermore, the dual-frequency aggregation feedforward module includes a high-frequency unit, a low-frequency unit, and an aggregation unit;

[0083] The high-frequency unit is used to extract high-frequency features of the input features using depthwise separable convolution;

[0084] The low-frequency unit is used to obtain low-frequency features by smoothing the input features through average pooling.

[0085] The aggregation unit is used to splice the high-frequency features and low-frequency features along the channel dimension to obtain aggregated features.

[0086] Specifically, the model improves upon the A2C2f structure of YOLOv12 and incorporates an attention mechanism. The improved A2C2f-DFFN-DYT module deeply optimizes the original YOLOv12 A2C2f structure by introducing DFFN (Dual Frequency Aggregation FFN) and DyT (Dynamic Tanh) techniques and integrating the CoordAttention mechanism. This significantly enhances the module's feature extraction capability, computational efficiency, and robustness. The framework of the improved YOLOv12 model is as follows: Figure 4 As shown, the original A2C2f module was upgraded to an A2C2f-DFFN-DYT composite structure. This structure achieves dual-path collaborative feature extraction of high-frequency details and low-frequency contours through the DFFN submodule, effectively enhancing the model's multi-scale perception capability of weld defects. The DyT dynamic activation function endows the model with adaptive nonlinear transformation capabilities, improving feature representation. Finally, the CoordAttention mechanism is integrated to accurately enhance the spatial location information of defects through a direction-aware weight map. These three components work together to achieve comprehensive optimization from feature extraction and nonlinear transformation to spatial context, significantly improving the model's accuracy and robustness in terminal weld defect detection tasks.

[0087] Improved A2C2f module:

[0088] On the YOLOv12 A2C2f infrastructure, we innovatively integrate a dual-frequency aggregation feedforward network (DFFN) and dynamic... This technology led to the development of the A2C2f-DFFN-DYT enhancement module. The core design of the A2C2f-DFFN-DYT module lies in simulating the multi-frequency perceptual characteristics of the human visual system and the dynamic response mechanism of neurons. The dual-frequency aggregation structure originates from image signal processing theory, solving the representation bottleneck of traditional convolutional layers when simultaneously capturing local subtle features and global structural information by separating and processing high-frequency details and low-frequency contour information. The depthwise separable convolution of the high-frequency path reduces computational complexity while maintaining sensitivity to details such as texture and edges; the pooling operation of the low-frequency path effectively suppresses noise interference, enhancing the overall perception of the target. Dynamic The design of activation functions is inspired by the adaptive response characteristics of biological neurons. They innovatively break through the limitations of the fixed form of traditional activation functions and enable the network to dynamically adjust the intensity of nonlinear transformation according to the complexity of the input content through a feature-adaptive slope adjustment mechanism.

[0089] The core design concept of DFFN originates from frequency domain analysis theory, simulating the human visual system's processing of multi-frequency information in images. This module divides the input features into two paths along the channel dimension, processing high-frequency and low-frequency features respectively. The high-frequency path uses depthwise separable convolutions to extract local details, such as edges and textures, and employs the GELU activation function to preserve non-linear representations. The low-frequency path uses average pooling for smoothing, suppressing noise and enhancing the overall contour and semantic information of the target. The features from the two paths are fused using 1×1 convolutions to enhance cross-channel information interaction. This dual-frequency separation processing architecture overcomes the limitations of traditional convolutional layers, improving multi-scale feature modeling and the perception of targets in complex scenes. The specific process of the DFFN module is as follows: Figure 5 As shown.

[0090] Furthermore, As the quantization matrix, in the feedforward channel, the input is converted to frequency domain information via FFT, and then compared with the quantization matrix. Multiplication occurs, and the output of the DFFN module is used as part of the final output of the current layer's encoder block for multi-scale input in the next layer. This process incorporates the input features. Segmented into high-frequency features along the channel dimension. and low frequency characteristics :

[0091] (1);

[0092] High-frequency paths extract high-frequency information through depthwise separable convolution operations, using a 3×3 convolution kernel. and Activation function. Low-frequency paths are smoothed using average pooling operations, assuming a pooling kernel is used. The features of high-frequency and low-frequency paths are concatenated along the channel dimension to obtain the fused features. The final output features are obtained by performing cross-channel information interaction and feature recombination through a 1×1 convolutional layer. .

[0093] (2);

[0094] (3);

[0095] (4);

[0096] (5);

[0097] Where DepthwiseConv represents depthwise separable convolution operation, and AvgPool represents average pooling operation. and It is the convolution kernel, and GELU is the activation function.

[0098] Furthermore, the dynamic tanh module includes: a global pooling unit and a dynamic slope parameter generation unit;

[0099] The global pooling unit is used to compress the spatial dimension through global average pooling to obtain a context vector representing the overall feature distribution.

[0100] The dynamic slope parameter generation unit is used to generate dynamic slope parameters through a strong-scale fully connected network based on the context vector, wherein the dynamic slope parameters are increased when processing high-frequency features and decreased when processing low-frequency features.

[0101] Specifically, given an input tensor x, the DyT layer is defined as follows:

[0102] (6);

[0103] Here, α is a learnable scalar parameter used to scale the input differently depending on its range. γ and β are learnable channel-separated vector parameters.

[0104] like Figure 6 As shown, the innovation of DyT technology lies in breaking through the static characteristics of traditional activation functions and introducing an adaptive adjustment mechanism based on input features. Its working principle first compresses the spatial dimension through global average pooling to obtain a context vector representing the overall feature distribution; then, a lightweight fully connected network generates a dynamic slope parameter α. The core innovation lies in transforming the static... Function refactoring to dynamic form The slope parameter α adapts adaptively to the input features. When processing high-frequency features rich in detail, increasing the value of α makes the activation function enter a high-sensitivity state, enhancing its ability to respond to subtle features; when dealing with smooth low-frequency features, decreasing the value of α makes the function work in a flat region, maintaining feature stability.

[0105] Furthermore, the introduction of an attention mechanism to enhance the YOLOv12 model's ability to focus on key information includes:

[0106] The attention mechanism incorporates spatial coordinates into channel attention by explicitly encoding positional information, and performs weighted average pooling on the input feature map along the horizontal and vertical directions to obtain the feature encoding vector.

[0107] Furthermore, weighted average pooling is performed on the input feature map along both the horizontal and vertical directions to obtain the feature encoding vector, including:

[0108] The input feature map is subjected to average pooling along the horizontal and vertical directions to obtain a first feature map and a second feature map.

[0109] The first and second feature maps are concatenated and their dimensions are reduced to obtain the third feature map.

[0110] The third feature map is segmented, batch normalized, and nonlinearly activated to obtain the first attention weight and the second attention weight.

[0111] The first attention weight and the second attention weight are applied to the input feature map to obtain the feature encoding vector.

[0112] Specifically, such as Figure 7 As shown, CoordAttention incorporates spatial coordinates into channel attention by explicitly encoding positional information. It performs weighted average pooling on the feature map along both the horizontal and vertical directions, generating feature encoding vectors for height and width. The input feature map, after global average pooling, generates... and The feature map.

[0113] (7);

[0114] (8);

[0115] Then through Concat and Convolution performs feature concatenation and dimensionality reduction to obtain The feature map.

[0116] (9);

[0117] The algorithm divides f into segments, performs batch normalization and non-linear activation, uses convolutional layers to increase the dimensionality, and generates attention weights through sigmoid activation. The output is... and .

[0118] (10);

[0119] (11);

[0120] Attention weights are applied to the input feature map to enhance information in important regions, and the output size is restored. We obtain coordinate attention:

[0121] (12);

[0122] The following is a detailed description of this embodiment with reference to the accompanying drawings:

[0123] This embodiment details the experimental section, aiming to verify the effectiveness and advantages of the proposed improved YOLOv12 model in detecting weld defects in airport terminal metal roofs. First, the experimental environment and parameter settings are introduced to ensure repeatability and reliability of the results. Various evaluation metrics used to assess model performance are explained in detail, providing a foundation for subsequent analysis of experimental results. Through comparative and ablation experiments, the performance differences between the improved model and the baseline model are comprehensively analyzed, further revealing the specific contributions of each improved module to model performance. Visualization experiments are used to intuitively demonstrate the model's performance during defect detection, facilitating a better understanding of the model's working mechanism. Through these experiments, this embodiment aims to comprehensively verify the superiority of the proposed method, providing a more efficient and accurate solution for detecting weld defects in airport terminal metal roofs.

[0124] The specific experimental environment for this experiment is shown in Table 1. To ensure a high degree of consistency and compatibility between hardware and software configurations, and to avoid performance fluctuations caused by environmental differences during the experiment, thereby guaranteeing the reliability and repeatability of the experimental results, a reasonable configuration can maximize the utilization of the system's computing resources, improve experimental efficiency, and ensure that the training and experimentation of complex models can be completed within a reasonable timeframe. The specific configuration is as follows:

[0125] Table 1

[0126] Software and hardware names Specific configuration Operating System Ubuntu 22.04 CPU 16 vCPU Intel(R) Xeon(R) Gold 6430 GPU RTX 4090 (24G) Memory 120GB PyTorch 2.5.1+cu124

[0127] During model training, the selection of hyperparameters is crucial for optimizing model performance. Table 2 lists the hyperparameter settings used in this experiment, including learning rate, momentum, regularization term, and data augmentation strategies. These hyperparameter settings have a significant impact on the convergence speed and final performance of model training. The specific settings for these hyperparameters are as follows:

[0128] Table 2

[0129] Hyperparameters value Hyperparameters value hyperparameters value lr0 0.01 lrf 0.01 momentum 0.937 warmup_epochs 3.0 warmup_momentum 0.8 warmup_bias_lr 0.1 weights_decay 0.0005 box 7.5 kobj 1.0 hsv_s 0.7 scale 0.5 fliplr 0.5 cls 0.5 dfl 1.5 pose 12.0 label_smoothing 0.0 nbs 64 hsv_h 0.015 hsv_v 0.4 degrees 0.0 translate 0.1 shear 0.0 perspective 0.0 flipud 0.0 mosaic 1.0 mixup 0.0 copy_paste 0.0

[0130] In object detection and classification tasks, precision, recall, and mean precision (mAP) are commonly used evaluation metrics. The specific formulas are as follows:

[0131] (13);

[0132] (14);

[0133] (15);

[0134] (16);

[0135] (17);

[0136] To calculate the FPS of a YOLO model, consider the time required for each stage: preprocessing, inference, loss calculation, and postprocessing.

[0137] (18);

[0138] In the formula, total time per image refers to the sum of the time spent on preprocessing, inference, loss calculation, and postprocessing.

[0139] Comparative experiment:

[0140] Table 3 shows the comparison results of different base models. Among multiple performance metrics, YOLOv12n performed stably, with a precision of 0.903 and a recall of 0.891. It is 0.912. The FPS is 0.506, with relatively low parameter count (2509124) and computational cost (5.8 GFLOPs). Although YOLOv5n has the best FPS (1428.57 frames / s), YOLOv12n has a slightly better overall performance in terms of accuracy and recall, and its FPS (454.54 frames / s) is still quite good, achieving a good balance between performance and computational efficiency.

[0141] Table 3

[0142] Model P / (%) R / (%) / (%) / (%) parameters FLOPs / G Size / MB FPS (frames per second) Hyper-YOLO 90.1 88.4 90.6 53.6 3621564 9.5 7.6 416 FasterNet 90.2 87.8 89.8 52.9 3902544 9.2 8.1 312 StarNet 90.1 87.8 90.2 50.5 1542172 4.5 3.4 344 Mamba-YOLO-T 89.9 87.7 90.5 55.1 5663508 12.3 11.7 322 GoldYOLO 90.6 88.7 91.1 51.8 5897124 9.2 12.4 303 rtdetr-l 87.7 87.5 89.7 42.8 28469208 101 59.1 192 yolov3-tiny 86.6 82.1 87.7 48.7 9521080 14.3 19.2 625 yolov5n 90.1 87.9 91.1 49.2 2182444 5.8 4.6 1428 yolov8n 90.2 88.9 90.8 51.9 3006428 8.1 4.3 1250 yolov9t 89.9 87.8 90.4 48.7 1730604 6.4 4.2 370 yolov10n 90.1 88.6 90.4 52.2 2695976 8.2 5.8 769 yolov11n 90.3 88.2 90.5 52.1 2582932 6.3 5.5 238 yolov12n 90.3 89.1 91.2 50.6 2509124 5.8 5.4 454

[0143] Table 4 shows the comparative results of different optimizers in the experiments. These optimizers were used to train deep learning models and help optimize the loss function. SGD is a stochastic gradient descent optimizer that accelerates training by considering gradients of mini-batch samples. Adam combines the advantages of momentum and RMSProp, automatically adjusting the learning rate of each parameter to accelerate convergence. AdamW is a variant of Adam that improves weight decay. NAdam combines Adam and Nesterov to accelerate gradients, improving convergence speed and accuracy. RAdam improves upon Adam by enhancing the stability of early training through a correction term. RMSProp adjusts the learning rate using the root mean square value, making it suitable for non-stationary objective optimization.

[0144] Table 4

[0145] Model P / (%) R / (%) / (%) / (%) SGD 90.3 89.1 91.2 50.6 Adam 88.3 86.3 89.7 43.6 AdamW 88.9 87.6 90.7 46.9 NAdam 89.3 85.7 89.7 44.9 RAdam 86.9 81.4 85.8 40.5 RMSProp 47.3 1.84 24.6 12

[0146] In comparative experiments of optimizers, SGD demonstrated the most stable and superior performance, outperforming other optimizers in precision, recall, and mAP. Particularly in multi-scale object detection tasks, SGD better balances precision and recall, showing stronger adaptability to small targets and complex scenes. This is mainly due to SGD's stable gradient descent updates, avoiding the late-training oscillations that might occur with adaptive optimizers (such as Adam), thus better meeting the convergence and stability requirements of industrial detection scenarios. In contrast, while the Adam family of optimizers showed balanced performance, their adaptive learning rate in multi-scale object detection may have weakened the capture of detailed features, resulting in a lower mAP50-95 compared to SGD. NAdam, despite its high precision, had a low recall, making its overall performance similar to Adam, indicating that its momentum correction mechanism had limited effectiveness in this task. RAdam and RMSProp performed poorly, especially RMSProp, which almost completely failed in this task, presumably due to parameter settings issues or data mismatch. In summary, SGD is the optimal choice, particularly suitable for detecting weld defects in airport terminal metal roofs, and its parameter tuning is relatively simple and its performance is robust. For situations requiring rapid convergence or with limited resources, AdamW can be considered as an alternative optimizer, but it requires additional parameter tuning to approach SGD performance. Overall, SGD provides a reliable technical solution in industrial inspection scenarios due to its excellent stability and feature capture capabilities.

[0147] Ablation experiment:

[0148] Table 5 shows the performance of different YOLOv12 models in ablation experiments. The YOLOv12-A2C2f-DFFN model performed excellently in all metrics, especially in recall and... A good balance was achieved. After introducing the CoordAtt mechanism, the model's...

[0149] The accuracy has been improved, especially in P, The models performed well in terms of metrics such as [list of metrics]. Meanwhile, the models incorporating the DYT and CoordAtt modules showed a reduction in parameters and computational cost, and exhibited better FPS, indicating that these models achieved a good balance between performance and efficiency.

[0150] Table 5

[0151] Serial Number Model P / (%) R / (%) / (%) / (%) parameters FLOPs / G Size / MB 1 YOLOv12 90..3 89.1 91.2 50.6 2509124 5.8 5.4 2 YOLOv12-CoordAtt 91.2 88.2 91.3 50.9 2550796 6.3 5.5 3 YOLOv12-A2C2f-DFFN 90.6 89.2 91.2 51.5 2519108 5.8 5.5 4 YOLOv12-A2C2f-DYT 90.5 88.5 90.6 50.6 2512212 5.8 5.4 5 YOLOv12-A2C2f-DFFN-DYT 91.1 87.9 91.4 48.9 2522196 5.8 5.5 6 YOLOv12-A2C2f-DFFN-DYT-CoordAtt 91.5 87.8 91.4 49.2 2492316 5.9 5.4

[0152] As can be seen from the data in Table 5, different model configurations have varying impacts on detection performance, computational complexity, and model size. YOLOv12 (Model 1), as the baseline model, performs relatively well across all metrics, with 2.5M parameters, 5.8G FLOPs, and a model size of 5.4MB. This model achieves an initial balance between performance and computational complexity; however, the introduction of multiple modules further improves both aspects.

[0153] The YOLOv12-CoordAtt (Model 2) with the addition of the Coordinate Attention module significantly improved P (0.912) and mAP (0.509). Compared to the baseline model, the Coordinate Attention module enhances the model's ability to understand contextual information, thereby improving detection accuracy. Although the addition of this module slightly increased the number of parameters (2.55M) and FLOPs (6.3G), the model size only increased to 5.5MB, demonstrating a good efficiency improvement. This experiment shows that adding specific modules can improve model performance without significantly increasing computational resource consumption.

[0154] The YOLOv12-A2C2f-DFFN (Model 3), which further incorporates the A2C2f and DFFN modules, shows a slight improvement in P (0.906) and mAP (0.515) compared to the baseline model, even though its parameter count and FLOPs are similar to YOLOv12-CoordAtt. This indicates that the DFFN module plays a role in enhancing the model's feature representation capabilities, although the performance improvement is relatively small. While this configuration brings a slight improvement in detection accuracy, the model's computational complexity and parameter count are similar to YOLOv12-CoordAtt, indicating that the improved feature representation capabilities do not lead to a significant increase in computational resource burden.

[0155] In contrast, YOLOv12-A2C2f-DYT (Model 4), after adding the DYT module, showed almost no improvement in P (0.905) and mAP (0.506), and its parameter count (2512212) and FLOPs (5.8G) were similar to the baseline model, indicating that this module failed to effectively improve performance in this scenario. The advantage of this configuration is that, despite not significantly improving detection accuracy, the model maintained low computational complexity and did not incur additional computational burden. This suggests that some modules may not deliver significant performance improvements in all situations.

[0156] YOLOv12-A2C2f-DFFN-DYT-CoordAtt (Model 6) exhibits the best detection accuracy, achieving a P-value of 0.915, the highest among all models in the table, although its mAP (0.492) is slightly lower than some models. This model enhances feature representation and contextual understanding by introducing DFFN, DYT, and CoordAttention modules, while maintaining relatively low computational complexity; FLOPs only slightly increase to 5.9G. The model has 2.49M parameters, and its size remains at 5.4MB, demonstrating that the introduction of multiple modules achieves a relatively ideal balance between performance and complexity.

[0157] These results demonstrate a balance between model complexity and detection accuracy. The introduction of different modules effectively enhances the model's feature representation and contextual understanding capabilities, leading to performance improvements without significantly increasing computational resource consumption. Particularly in YOLOv12-A2C2f-DFFN-DYT-CoordAtt (Model 6), the combination of multiple modules improves detection accuracy while maintaining efficient utilization of computational resources. This balance between performance and computational complexity is significant for practical applications where resource consumption is a crucial consideration.

[0158] Visualization Experiment:

[0159] The visualization results provide a clear visual representation of the model's performance in weld defect detection. Each weld defect is labeled with a specific category, and these confidence scores reflect the model's level of confidence in each defect category. Higher confidence scores generally indicate that the model is more certain in identifying that category, resulting in more reliable identification results. The visualization clearly shows differences in the accuracy of different weld defect identification categories. Some defect categories have higher confidence scores, demonstrating better detection performance, while others exhibit some error or are difficult to identify accurately.

[0160] PR curve as Figure 8 As shown, "misaligned weld" corresponds to 0.88, "broken weld" to 0.941, "over-welded" to 0.942, and "burn-through" to 0.894. These PR curve values ​​reveal differences in detection performance across different welding defect types. Among these four defects, over-welded and broken welds exhibit higher detection accuracies, at 0.942 and 0.941 respectively, indicating that the model demonstrates high accuracy and recall when identifying these two defects. This is likely because over-welded and broken welds are typical welding problems with readily distinguishable features, allowing the model to identify them effectively.

[0161] Experimental results show that the improved YOLOv12 model, compared with the original YOLOv12 baseline network, achieves better accuracy, recall, and performance in the task of detecting weld defects in the metal roof of the terminal building. Significant improvements were achieved in various metrics, validating the effectiveness of the model improvement, particularly in improving detection accuracy and reducing the number of parameters.

[0162] By introducing DFFN and DyT technologies, as well as the CoordAttention mechanism, the improved YOLOv12 model has been optimized in terms of feature extraction and information fusion capabilities, providing theoretical support and practical basis for the further development of intelligent weld defect detection technology.

[0163] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for detecting defects in airport terminal welds based on an improved YOLOv12 model, characterized in that, include: Obtain the dataset of the weld to be tested; The dataset of the weld seam to be tested is input into the improved YOLOv12 model to obtain the weld seam defect detection results. The improved YOLOv12 model optimizes the feature aggregation and information expression capabilities by adding a dual-frequency aggregation feedforward module and a dynamic tanh module to the YOLOv12 model, and introduces an attention mechanism to enhance the YOLOv12 model's ability to focus on key information.

2. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 1, characterized in that, The dataset of the weld seam to be tested is input into the improved YOLOv12 model to obtain the weld seam defect detection results, including: The dataset of the weld seam to be tested is preprocessed to obtain the preprocessed weld seam dataset; The preprocessed weld dataset was inspected using an improved YOLOv12 model to obtain the weld defect detection results.

3. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 2, characterized in that, The preprocessing of the weld dataset to be tested, resulting in the preprocessed weld dataset, includes: Video data of welds on the metal roof of the terminal building was collected using a data acquisition device; The weld seam video data is subjected to frame extraction processing to obtain the target static frame; The target static frames are labeled to obtain a labeled dataset; The labeled dataset is classified to obtain datasets of different categories, including: misaligned welds, broken welds, over-welded welds, and weld penetrations. Data augmentation processing is performed on the different categories of datasets to obtain the preprocessed weld dataset.

4. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 3, characterized in that, Data augmentation processing is performed on the different categories of datasets to obtain the preprocessed weld dataset, including: Read the dataset images of the different categories and load the corresponding YOLO format label files; Convert the tag file to Tensor format to obtain the target format data; The target format data is subjected to pixel enhancement transformation and spatial enhancement transformation to obtain the preprocessed weld dataset.

5. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 1, characterized in that, The dual-frequency aggregation feedforward module includes a high-frequency unit, a low-frequency unit, and an aggregation unit; The high-frequency unit is used to extract high-frequency features of the input features using depthwise separable convolution; The low-frequency unit is used to obtain low-frequency features by smoothing the input features through average pooling. The aggregation unit is used to splice the high-frequency features and low-frequency features along the channel dimension to obtain aggregated features.

6. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 5, characterized in that, The method for concatenating the high-frequency and low-frequency features along the channel dimension to obtain the aggregated features is as follows: ; ; ; ; in, High-frequency characteristics For low-frequency features, DepthwiseConv is a depthwise separable convolution operation, and AvgPool is an average pooling operation. and It's a convolution kernel, and GELU is the activation function. These are features after high-frequency path processing. These are the features after processing the low-frequency path. For pooling cores, The features are fused together. Concat is the feature concatenation operation, Conv is the convolution operation, and Y is the aggregated feature.

7. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 5, characterized in that, The dynamic tanh module includes: a global pooling unit and a dynamic slope parameter generation unit; The global pooling unit is used to compress the spatial dimension through global average pooling to obtain a context vector representing the overall feature distribution. The dynamic slope parameter generation unit is used to generate dynamic slope parameters through a strong-scale fully connected network based on the context vector, wherein the dynamic slope parameters are increased when processing high-frequency features and decreased when processing low-frequency features.

8. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 5, characterized in that, Introducing an attention mechanism to enhance the YOLOv12 model's ability to focus on key information includes: The attention mechanism incorporates spatial coordinates into channel attention by explicitly encoding positional information, and performs weighted average pooling on the input feature map along the horizontal and vertical directions to obtain the feature encoding vector.

9. The terminal building weld defect detection method based on the improved YOLOv12 model according to claim 8, characterized in that, Weighted average pooling is performed on the input feature map along both the horizontal and vertical directions to obtain the feature encoding vector, including: The input feature map is subjected to average pooling along the horizontal and vertical directions to obtain the first feature map and the second feature map. The first and second feature maps are concatenated and their dimensions are reduced to obtain the third feature map. The third feature map is segmented, batch normalized, and nonlinearly activated to obtain the first attention weight and the second attention weight. The first attention weight and the second attention weight are applied to the input feature map to obtain the feature encoding vector.