A method for detecting terahertz defects in battery insulating coatings
By improving the backbone network and feature fusion neck network of the RT-DETR model, the BC-Thzdet model was constructed, which solved the problems of insufficient detection accuracy and limited ability to identify small-scale defects in terahertz detection, and realized high-precision detection of battery insulating coating.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AUTOMOTIVE ENGINEERING CORPORATION
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-30
AI Technical Summary
Existing terahertz defect detection technology suffers from insufficient detection accuracy and limited ability to identify small-scale or weakly significant defects in battery insulation coatings.
Based on the RT-DETR model, a BC-Thzdet model is constructed to detect terahertz defects by adding a multi-scale dilated convolutional attention module to the backbone network and a reparameterizable residual cross-stage feature fusion module to the feature fusion neck network.
It significantly improves the accuracy of terahertz defect detection in battery insulation coatings, making it suitable for automated and high-precision inspection in battery manufacturing processes.
Smart Images

Figure CN122084566B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of nondestructive testing technology, and more particularly to a method for detecting terahertz defects in battery insulating coatings. Background Technology
[0002] As a crucial component ensuring battery safety and reliability, the quality of the battery's insulating coating directly impacts its insulation performance and lifespan. During battery manufacturing, defects such as uneven coating, bubbles, peeling, and cracks are prone to occur in the insulating coating. Failure to detect and remove these defects in a timely manner can lead to safety hazards. Therefore, conducting high-precision detection of defects in battery insulating coatings has significant engineering application value.
[0003] Terahertz imaging technology offers advantages such as being non-contact, non-destructive, and having good penetration capabilities into non-metallic materials. Compared to visible light imaging, terahertz images can more effectively reflect the internal and surface structural information of insulating materials, making them suitable for non-destructive testing of defects in battery insulation coatings. However, terahertz imaging also has limitations, including limited imaging resolution, low image contrast, high noise levels, and blurred defect boundaries, which pose significant challenges to defect detection.
[0004] Object detection models such as YOLO and Faster R-CNN can automatically identify and locate defects through end-to-end learning and have been applied in various industrial inspection tasks. However, most existing object detection models are designed for natural images, and their feature extraction and fusion methods are difficult to fully adapt to the characteristics of weak texture, low contrast, and the coexistence of multi-scale defects in terahertz images. This leads to problems such as insufficient detection accuracy and limited ability to identify small-scale or weakly salient defects in terahertz defect detection tasks. RT-DETR, as an object detection model that balances detection accuracy and real-time performance, adopts an end-to-end detection strategy. Through the interaction between query vectors and multi-scale features, it achieves joint modeling of the overall structure and contextual relationships of the target. Compared with traditional anchor-box-based detection models, this type of model has stronger robustness and generalization ability when dealing with detection tasks with blurred target boundaries, incomplete structures, or large scale variations.
[0005] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0006] The main objective of this application is to provide a terahertz defect detection method for battery insulating coatings, so as to at least solve the problems of insufficient detection accuracy and limited ability to identify small-scale or weakly significant defects in related technologies.
[0007] To achieve the above objectives, according to one aspect of this application, a terahertz defect detection method for battery insulating coatings is provided. The method includes: acquiring a terahertz image of the battery insulating coating; annotating and preprocessing the terahertz image for defects; constructing a defect detection dataset, wherein the defect detection dataset includes at least one feature map; adding a multi-scale dilated convolutional attention module to the backbone network of the RT-DETR model; adding a reparameterizable residual cross-stage feature fusion module to the feature fusion neck network of the RT-DETR model to obtain a BC-Thzdet original model; training the BC-Thzdet original model using the defect detection dataset to obtain a BC-Thzdet trained model; and performing terahertz defect detection on the battery insulating coating using the BC-Thzdet trained model, outputting defect category and defect location information.
[0008] Optionally, a reference correction is performed on the terahertz image, calculated using the following formula: ,in, For position The reference correction result for that pixel. For reference only. The actual sampled values of the terahertz image. For a small constant; calculate the position The normalized intensity value of the reference correction result at that pixel is calculated using the following formula: ,in, This represents the minimum pixel value in a terahertz image. This represents the maximum value of a pixel in a terahertz image. For position The intensity value of the pixel after normalization.
[0009] Optionally, the feature map is input into the multi-scale dilated attention module to obtain multi-scale local enhancement features; in the feature fusion neck network, the input features are divided into cross-stage direct connection branches and feature transformation branches in the channel dimension. The feature transformation branches are transformed by multi-layer reparameterized residual structures and then spliced and fused with the cross-stage direct connection branches.
[0010] Optionally, the feature map can be divided into multiple sub-feature maps along the channel dimension, represented as follows: ,in, For feature maps, For sub-feature maps, Different void ratios are set for each sub-feature map, and the local receptive field is calculated based on the void ratio. The calculation formula is as follows: ,in, For local receptive fields, This represents the porosity corresponding to the sub-feature map.
[0011] Optionally, for each sub-feature map, query features, key features, and value features are generated through linear mapping, represented as follows: , , ,in, Sub-feature map Query features Sub-feature map Key features, Sub-feature map Value characteristics, For the weight matrix of query features, The key feature weight matrix, The weight matrix is the feature value matrix; for any spatial location in the sub-feature map, the correlation coefficient is calculated within the holed local window, using the formula: ,in, The current spatial location index is in the input feature map. This is an index for the neighborhood location, where the neighborhood location is the spatial location. Corresponding local neighborhood At any position within, satisfying , Spatial location The corresponding empty partial window, Indicates the single-head feature dimension. For the first Spatial location under individual feature maps Its neighboring location The correlation coefficient between them; normalizing the correlation coefficient yields the attention weight, calculated using the following formula: ,in, Sub-feature map Attention weights Let be the index of any neighborhood location; the local enhanced feature is calculated by weighted summation of the value features within the local neighborhood, using the following formula: , For the first Local enhancement features at each scale; the outputs of the hole attention at each scale are concatenated and fused to form multi-scale local enhancement features, as shown in the formula: ,in, This is a multi-scale local enhancement feature. For the first A set of local enhancement features at various scales. .
[0012] Optionally, the multi-layer feature transformation includes several residual structures, each residual structure including a [missing information] during the training phase. Convolutional branch and one Convolutional branches, represented during the training phase as ,in, This represents the output features after the input features have been processed by the residual structure shown. The input features representing the residual structure, For the convolution process, For the normalization process, This is the activation process.
[0013] This application employs the following steps: acquiring terahertz images of the battery insulating coating layer; performing defect annotation and preprocessing on the terahertz images to construct a defect detection dataset, wherein the defect detection dataset includes at least one feature map; adding a multi-scale dilated convolutional attention module to the backbone network of the RT-DETR model, and adding a reparameterizable residual cross-stage feature fusion module to the feature fusion neck network of the RT-DETR model to obtain the original BC-Thzdet model; training the original BC-Thzdet model using the defect detection dataset to obtain the BC-Thzdet trained model; and performing terahertz defect detection on the battery insulating coating layer using the BC-Thzdet trained model, outputting defect category and defect location information. This solves the problems of insufficient detection accuracy and limited ability to identify small-scale or weakly significant defects in related technologies for terahertz defect detection, thereby significantly improving the accuracy of terahertz defect detection of battery insulating coating layers and making it more suitable for automated and high-precision detection of insulating coating layer defects during battery manufacturing. Attached Figure Description
[0014] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0015] Figure 1 This is a flowchart of a terahertz defect detection method for a battery insulating coating provided in an embodiment of this application;
[0016] Figure 2 It is about improving the overall architecture of the model;
[0017] Figure 3 This is a comparison chart of test results for different models on a self-built dataset;
[0018] Figure 4 This is a comparison chart of the detection results from different models. Detailed Implementation
[0019] 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.
[0020] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0021] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0022] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0023] This embodiment provides a terahertz defect detection method for a battery insulating coating that runs on a mobile terminal, computer terminal, or similar computing device. 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. Also, although the 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.
[0024] Figure 1 This is a flowchart of a terahertz defect detection method for a battery insulating coating according to an embodiment of this application. Figure 1 As shown, the method includes the following steps:
[0025] Step S101: Obtain a terahertz image of the battery insulation coating layer, perform defect annotation and preprocessing on the terahertz image, and construct a defect detection dataset, wherein the defect detection dataset includes at least one feature map.
[0026] Specifically, the terahertz image undergoes reference correction and intensity normalization preprocessing to ensure that the input image size meets the input requirements of the BC-Thzdet model.
[0027] Step S102: Add a multi-scale dilated convolutional attention module to the backbone network of the RT-DETR model, and add a reparameterizable residual cross-stage feature fusion module to the feature fusion neck network of the RT-DETR model to obtain the original BC-Thzdet model.
[0028] Specifically, in this invention, the RT-DETR target detection model is used as the basis, and the feature extraction backbone network and feature fusion neck network of the original RT-DETR model are structurally improved in response to the imaging characteristics of terahertz image defects in battery insulation coating, thereby constructing a BC-Thzdet model suitable for terahertz defect detection.
[0029] The original RT-DETR model typically includes a feature extraction backbone network, a feature projection and fusion module, and a query-based Transformer decoder. The backbone network uses a convolutional neural network structure to extract features from the input image hierarchically, outputting feature maps at different scales level by level. The feature fusion module performs a unified dimensionality mapping on the multi-scale features output by the backbone network. The Transformer decoder outputs target-level detection results through the interaction between the query vector and the multi-scale features. However, the original RT-DETR backbone network mainly relies on conventional convolutional and residual structures for feature extraction, which has limited ability to express the weak texture, low contrast, and multi-scale defect features present in terahertz images, and lacks targeted modeling of local structural information and contextual relationships.
[0030] Step S103: Train the original BC-Thzdet model using the defect detection dataset to obtain the BC-Thzdet trained model.
[0031] Step S104: Use the BC-Thzdet training model to perform terahertz defect detection on the battery insulation coating and output the defect category and defect location information.
[0032] In one optional embodiment, the terahertz image is reference-corrected, and the calculation formula is as follows: ,in, For position The reference correction result for that pixel. For reference only. The actual sampled values of the terahertz image. For a small constant; calculate the position The normalized intensity value of the reference correction result at that pixel is calculated using the following formula: ,in, This represents the minimum pixel value in a terahertz image. This represents the maximum value of a pixel in a terahertz image. For position The intensity value of the pixel after normalization.
[0033] Specifically, terahertz images of the battery insulating coating are acquired using inspection equipment. Several terahertz images form a dataset, which is then used for defect annotation and preprocessing. The preprocessing begins with image reference correction. Since terahertz waves drift over time, a "metal substrate" or "air" is typically used as a reference. Before photographing the battery coating, a terahertz image of an uncoated metal substrate is captured as a reference value. Calculating the reference correction value mitigates errors introduced by the system and the environment. For position The result of reference correction of the pixel values is used to characterize the terahertz response characteristics of the reference-corrected sample. For position The normalized intensity value of the pixel indicates that the correction result will be referenced. According to the global minimum value of the image and maximum value The result of linear mapping to the interval [0,1] is used to unify the dynamic range of images and enhance the comparability between different samples.
[0034] In one optional embodiment, the feature map is input into a multi-scale dilated attention module to obtain multi-scale local enhancement features; in the feature fusion neck network, the input features are divided into cross-stage direct connection branches and feature transformation branches in the channel dimension. The feature transformation branches are transformed by multi-layer reparameterized residual structures and then spliced and fused with the cross-stage direct connection branches.
[0035] Specifically, refer to Figure 2 The residual module used for feature extraction in the backbone network of the original RT-DETR model is replaced with a module that introduces a multi-scale dilated attention mechanism, namely the multi-scale dilated attention module. A reparameterizable residual part is introduced into the feature fusion stage of the original RT-DETR model as a cross-stage feature fusion module to efficiently fuse feature maps from different levels.
[0036] In an optional embodiment, the feature map is divided into multiple sub-feature maps along the channel dimension, represented as follows: ,in, For feature maps, For sub-feature maps, Different void ratios are set for each sub-feature map, and the local receptive field is calculated based on the void ratio. The calculation formula is as follows: ,in, For local receptive fields, This represents the porosity corresponding to the sub-feature map.
[0037] Specifically, the sub-feature maps are input into the model. First, feature extraction is performed through the backbone network. After convolutional feature extraction, the intermediate features are input into the multi-scale dilated attention module for feature enhancement. Then, different dilation rates are set for each sub-feature map, corresponding to different local receptive field scales, for the first... Individual feature map Set the corresponding void ratio parameter. And expand the local neighborhood based on dilated convolution. It is to determine local enhancement features For the size of the "local" part, each For the corresponding different. The hole rate corresponds to the dilation rate of the sub-feature map, which controls the sampling interval of the local window in the spatial dimension. By setting different hole rates, each sub-feature map can perceive local contextual information within different scale ranges.
[0038] In an optional embodiment, for each sub-feature map, query features, key features, and value features are generated through a linear mapping, represented as follows: , , ,in, Sub-feature map Query features Sub-feature map Key features, Sub-feature map Value characteristics, For the weight matrix of query features, The key feature weight matrix, The weight matrix is the feature value matrix; for any spatial location in the sub-feature map, the correlation coefficient is calculated within the holed local window, using the formula: ,in, The current spatial location index is in the input feature map. This is an index for the neighborhood location, where the neighborhood location is the spatial location. Corresponding local neighborhood At any position within, satisfying , Spatial location The corresponding empty partial window, Indicates the single-head feature dimension. For the first Spatial location under individual feature maps Its neighboring location The correlation coefficient between them; normalizing the correlation coefficient yields the attention weight, calculated using the following formula: ,in, Sub-feature map Attention weights Let be the index of any neighborhood location; the local enhanced feature is calculated by weighted summation of the value features within the local neighborhood, using the following formula: , For the first Local enhancement features at each scale; the outputs of the hole attention at each scale are concatenated and fused to form multi-scale local enhancement features, as shown in the formula: ,in, This is a multi-scale local enhancement feature. For the first A set of local enhancement features at various scales. .
[0039] Specifically, for each porosity, attention modeling is performed on the feature map in units of local windows. By calculating the correlation between the query feature and its corresponding local neighborhood features, adaptive weighting of local key structures is achieved for each sub-feature map. Query features, key features, and value features are generated through linear mapping, respectively. Represented as the first Spatial location under individual feature maps Its neighboring location The correlation coefficient between them specifically represents the position. Query features With position Key features The dot product similarity is scaled up. Where the subscript... Indicates the current center position, subscript Indicates the candidate associated positions in the neighborhood, subscript combination Used to characterize the center position With neighboring locations A one-to-one correspondence between them.
[0040] In one optional embodiment, the multi-layer feature transformation includes several residual structures, each residual structure including a [missing information] during the training phase. Convolutional branch and one Convolutional branches, represented during the training phase as ,in, This represents the output features after the input features have been processed by the residual structure shown. The input features representing the residual structure, For the convolution process, For the normalization process, This is the activation process.
[0041] Specifically, four multi-scale dilated attention modules are used in the backbone network to obtain enhanced features of different sizes. These then proceed to the neck feature fusion section, where a reparameterizable residual cross-stage feature fusion module is used. Multiple scale feature maps are input, concatenated along the channel dimension, and then... Convolutional dimensionality reduction is performed through two branches: the main branch directly propagates across stages, while the enhancement branch undergoes multi-layer feature transformation before fusing with the aforementioned branch. This reduces redundant computation while enhancing feature representation. The multi-layer feature transformation includes several residual structures, each of which includes a [missing information - likely a function or feature] during the training phase. Convolutional branch and one Convolutional branches. During the model inference phase, the above multi-branch structure can be effectively fused into a single branch through reparameterization. Convolution is used to improve inference efficiency without affecting expressive power. This structure can effectively alleviate the redundancy problem generated in the multi-scale feature fusion process and improve gradient propagation efficiency.
[0042] In one optional embodiment, the target detection model of the present invention is tested on a self-built terahertz dataset of battery insulation coating layers, and compared with existing models RT-DETR, YOLOv8, and YOLOv11 to select the accuracy. Recall rate and Three metrics are used to evaluate model performance: precision represents the proportion of samples that the model predicts as positive, and the actual positive is the actual positive. Recall represents the proportion of samples that the model successfully predicts as positive, and the actual positive is the actual positive. Indicates in Calculate the mean of the average precision for all categories when the value is 0.50.
[0043] Figure 3 The figures show the test results of different models on a self-built terahertz dataset. As can be seen from the figures, compared with existing models, the object detection model of this invention achieves higher accuracy on both datasets. Recall rate and Both metrics have maximum values, indicating that the model has good detection accuracy. This is because the target detection model of this invention has undergone structural improvements in the feature extraction and feature fusion stages to address the imaging characteristics of terahertz images.
[0044] On the one hand, a multi-scale hole attention mechanism is introduced into the backbone network. By modeling attention in local regions at different receptive field scales, the model can more fully capture the local structural features and contextual information of defects in the battery insulation coating, effectively enhancing the representation ability of low-contrast, blurred-boundary defect regions, thereby reducing false negatives and improving recall.
[0045] On the other hand, in the feature fusion stage, a cross-stage feature fusion module with reparameterizable residuals is adopted. By directly transmitting some features across stages and then splicing and fusing the other features after multi-layer feature transformation, feature redundancy is reduced while the information interaction capability between multi-scale features is enhanced. This makes the fused features have stronger semantic expression capabilities while maintaining detailed information, thereby improving the stability and accuracy of the detection results.
[0046] at last Figure 4 This is a comparison chart of the detection results of different models. As you can see, the detection results of other models have missed detections and false detections, while the detection results of this model are closest to the real label map and have the highest confidence level.
[0047] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0048] 1. To address the characteristics of weak texture, low contrast, and multi-scale defects in terahertz images, the BC-Thzdet model is constructed. A multi-scale void attention mechanism is introduced into the backbone network. Through local attention modeling with multiple void rates, the model can accurately capture and enhance the features of defects at different scales, thereby improving its ability to identify small defects in complex backgrounds.
[0049] 2. A cross-stage feature fusion module with reparameterizable residuals is adopted. By directly transferring and transforming branch features, information redundancy in the feature fusion process is reduced and gradient propagation efficiency is improved. At the same time, reparameterization technology is used to achieve structural decoupling between training and inference, balancing detection accuracy and inference speed.
[0050] 3. The entire method is adapted to the terahertz detection scenario of battery insulation coating, which can effectively solve the detection bottleneck of existing technology and provide an efficient and accurate technical solution for the quality detection of battery insulation coating.
[0051] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0052] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0053] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0054] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0055] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0056] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0057] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0058] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0059] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for detecting terahertz defects in a battery insulating coating, characterized in that, include: A terahertz image of the battery insulating coating is acquired, and the terahertz image is labeled with defects and preprocessed to construct a defect detection dataset, wherein the defect detection dataset includes at least one feature map. A multi-scale dilated convolutional attention module is added to the backbone network of the RT-DETR model, and a reparameterizable residual cross-stage feature fusion module is added to the feature fusion neck network of the RT-DETR model to obtain the original BC-Thzdet model. The original BC-Thzdet model is trained using the defect detection dataset to obtain the BC-Thzdet trained model; The BC-Thzdet training model is used to detect terahertz defects in the battery insulating coating, and the defect category and location information are output.
2. The method according to claim 1, characterized in that, Acquire terahertz images of the battery insulation coating, perform defect annotation and preprocessing on the terahertz images, and construct a defect detection dataset, including: The terahertz image is reference-corrected using the following formula: ,in, For position The reference correction result for that pixel. For reference only. The actual sampled values of the terahertz image, It is a constant; Calculate position The normalized intensity value of the reference correction result at that pixel is calculated using the following formula: ,in, This represents the minimum value of a pixel in the terahertz image. The maximum value of the pixels in the terahertz image. For position The intensity value of the pixel after normalization.
3. The method according to claim 1, characterized in that, The original BC-Thzdet model is trained using the defect detection dataset to obtain the BC-Thzdet trained model, which includes: The feature map is input into the multi-scale hole attention module to obtain multi-scale local enhancement features; In the feature fusion neck network, the input features are divided into cross-stage direct connection branches and feature transformation branches in the channel dimension. The feature transformation branches are transformed by multi-layer reparameterized residual structures and then spliced and fused with the cross-stage direct connection branches.
4. The method according to claim 3, wherein the feature map is input into a multi-scale dilated attention module to obtain multi-scale local enhancement features, comprising: The feature map is divided into multiple sub-feature maps along the channel dimension, represented as follows: ,in, For the feature map, For the sub-feature map, ; Different void ratios are set for each of the sub-feature maps, and the local receptive field is calculated based on the void ratio using the following formula: ,in, This refers to the local receptive field. The void ratio corresponding to the sub-feature map.
5. The method according to claim 4, wherein the feature map is input into the multi-scale hole attention module to obtain multi-scale local enhancement features, comprising: For each of the sub-feature maps, query features, key features, and value features are generated through linear mapping, represented as follows: , , ,in, Sub-feature map Query features Sub-feature map Key features, Sub-feature map Value characteristics, For the weight matrix of query features, The key feature weight matrix, The weight matrix for the value features; For any spatial location in the sub-feature map, within the corresponding hole local window, calculate the correlation coefficient using the formula: ,in, The current spatial location index is in the input feature map. This is an index for a neighborhood location, where the neighborhood location is the spatial location. Corresponding local neighborhood At any position within, satisfying , For spatial location The corresponding empty partial window, Indicates the single-head feature dimension. For the first Spatial location under individual feature maps Its neighboring location The correlation coefficient between them; The correlation coefficients are normalized to obtain the attention weights, calculated using the following formula: ,in, Sub-feature map The attention weights, For any neighboring location; The local enhancement feature is calculated by weighted summation of the value features within the local neighborhood. The calculation formula is as follows: , For the first Local enhancement features at various scales; The outputs of the hole attention at each scale are concatenated and fused to form a multi-scale local enhancement feature, as shown in the formula: ,in, For the aforementioned multi-scale local enhancement features, For the first A set of local enhancement features at various scales. .
6. The method according to claim 3, characterized in that, In the feature fusion neck network, the input features are divided into a cross-stage direct connection branch and a feature transformation branch along the channel dimension. The feature transformation branch is transformed through a multi-layer reparameterized residual structure and then concatenated and fused with the cross-stage direct connection branch, including: Multi-layer feature transformation includes several residual structures, each of which includes a [missing information] during the training phase. Convolutional branch and one Convolutional branches, represented during the training phase as ,in, This represents the output features after the input features have been processed by the residual structure shown. The input features representing the residual structure For the convolution process, For the normalization process, This is the activation process.