Basalt fiber 3D printing-oriented defect detection method
By using the MABD-Net defect detection model, combined with MobileNetV3 and SPPCSPC-ATT modules, the problem of accurate identification and localization of minute defects in basalt fiber 3D printing was solved, achieving efficient defect detection and localization, and improving the quality of printed products and the control capability of the production process.
Patent Information
- Application Number
- CN202610022500.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies struggle to accurately identify and locate minute defects, such as fiber path deviations, in basalt fiber 3D printing, which affects the structural integrity and functionality of the printed product.
The MABD-Net defect detection model is adopted, which combines the enhanced lightweight convolutional neural network MobileNetV3 and the SPPCSPC-ATT module for multi-scale feature extraction. Real-time defect detection is achieved through feature fusion network and detection head network. The SPPCSPC-ATT module is used to enhance target edge information and the BiFormer attention mechanism is used to enhance the long-distance dependency modeling ability between features. The convolution kernel weights are optimized by an adaptive adjustment mechanism to achieve efficient identification and localization of small defects.
It significantly improves the detection accuracy and adaptability of minute defects in the basalt fiber 3D printing process, and can accurately identify minute deviations, twists and out-of-control issues in the fiber path in real time, providing efficient quality control support.
Smart Images

Figure CN121982379A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of defect detection technology and relates to a defect detection method for basalt fiber 3D printing. Background Technology
[0002] 3D printing, as a cutting-edge additive manufacturing technology, has gradually become a focal point for applications in multiple fields. Its core principle is to directly transform a three-dimensional digital model into a physical product by layer-by-layer material deposition. Compared to traditional subtractive manufacturing methods, 3D printing technology has significant advantages in manufacturing complex structures, achieving personalized customization, and rapid prototyping. These advantages have enabled 3D printing technology to develop rapidly in a short period of time and has been widely applied in aerospace, defense, medical, and industrial manufacturing fields, demonstrating enormous market potential and technological prospects. To meet different application needs and complex usage scenarios, the types of 3D printing materials have gradually expanded, evolving from the initial thermoplastics to encompass a variety of material systems including plastics, metals, ceramics, and biomaterials.
[0003] In recent years, with the further development of 3D printing technology, the introduction of CFRCs into the 3D printing process has become a research direction of great interest. The unique advantages of CFRCs lie in their excellent mechanical properties and environmental adaptability, which can meet specific engineering requirements such as high strength, lightweight, and durability. Applying CFRCs to 3D printing enables the manufacture of high-strength fiber-reinforced parts, giving the printed products excellent structural strength and toughness, and making them widely applicable in industrial and engineering scenarios requiring wear resistance, pressure resistance, and lightweighting.
[0004] In the CFRCs 3D printing process, the matrix material is typically heated to a liquid state within a hot melt nozzle, impregnating continuous fibers and extruding them together. The matrix material and reinforcing fibers are then printed layer by layer onto a printing platform, where they cool and solidify to form the desired fiber-reinforced structural component. However, this process is extremely sensitive to printing parameter settings; improper parameter settings can lead to significant deviations between the fiber layup path and the intended path. For example, excessively high printing speeds may result in fibers not being fully impregnated in the matrix material, while improper temperature settings can affect the flowability of the matrix material and the adhesion of the fibers. Furthermore, printing accuracy issues and insufficient equipment calibration can also affect the accuracy of the printing path, leading to problems such as layer delamination and fiber misalignment, ultimately severely impacting the structural integrity and functionality of the printed product. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a defect detection method for basalt fiber 3D printing, which can accurately identify and locate minute defects. In particular, in practical applications, it demonstrates adaptability and efficiency for details such as complex fiber path deviations.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A defect detection method for basalt fiber 3D printing is disclosed. The method includes: constructing a defect dataset containing fiber path offsets; labeling and partitioning the dataset; establishing a MABD-Net defect detection model and training the model using the partitioned training set, optimizing model parameters during training; and applying the optimized MABD-Net defect detection model to a basalt fiber 3D printer for real-time defect detection. The MABD-Net defect detection model includes at least a feature extraction network, a feature fusion network, and a detection head network. The feature extraction network combines the enhanced lightweight convolutional neural network MobileNetV3 and the SPPCSPC-ATT module to perform multi-scale feature extraction. Specifically, two C2f modules are introduced into the MobileNetV3 network. Each C2f module extracts features at different scales and outputs them to the feature fusion network and the SPPCSPC-ATT module. The SPPCSPC-ATT module enhances the target edge information by introducing the SimAM attention mechanism and enhances the long-distance dependency modeling ability between features by introducing the BiFormer attention mechanism. The output features are also input into the feature fusion network. The feature fusion network includes the SE-AdaptiveConv module, the BiFPN-Concat module, the upsampling module, and the C2f-AdaptiveConv module. The BiFPN-Concat module receives the features processed by the SE-AdaptiveConv module and the upsampling module, as well as the features output by the feature extraction network, and performs bidirectional feature fusion. The C2f-AdaptiveConv module then performs some cross-stage feature connection processing. The SE-AdaptiveConv module introduces an adaptive adjustment mechanism to optimize the convolutional kernel weights in real time based on the path data features. The detection head network combines the decoupled detection head with the SE-AdaptiveConv module to independently process localization and classification tasks on different feature maps, thereby completing defect detection.
[0007] Furthermore, the input image of the feature extraction network is represented as First, the feature map is passed through a 2D convolutional layer, then batch normalization, and finally a Hardswish activation function. Feature map After processing by two bottleneck layers (Bneck) and the C2f module, the first-scale feature map is obtained. First-scale feature map It directly inputs the feature fusion network, and then further passes it through three bottleneck layers (Bneck) and a C2f module to obtain the second-scale feature map. Similarly, the second-scale feature map The feature map is obtained by directly inputting it into the feature fusion network, and then processing it through a bottleneck layer (Bneck) and a SPPCSPC-ATT module to obtain a third-scale feature map. Third-scale feature map Direct input feature fusion network; where, The input features of the SPPC-ATT module are first processed by two CBS blocks, then processed by the SimAM mechanism, and then subjected to max pooling in three branches. The features are then concatenated with the output features of the SimAM block by the Concat block. The concatenated features are then processed by two more CBS blocks and concatenated with the input features processed by one CBS block. The concatenated features are then processed by another CBS block and then processed by the BiFormer mechanism to obtain the final output.
[0008] Furthermore, the SimAM mechanism of the SPPC-ATT module is processed as follows: First, a nonlinear function is used to implement the attention mechanism, where the importance of each neuron is estimated by calculating an energy function, which is defined as follows:
[0009] In the formula, and yes and The linear transformation form, These are the weights and biases of the linear transformation, respectively. These represent the values that the target neuron and other neurons are expected to be mapped to, respectively. This represents the number of neurons in the channel. It is an index in the spatial dimension; Next, calculate the minimum energy:
[0010] In the formula, and These represent the mean and variance of the channel feature in the spatial dimension, respectively. For hyperparameters; Then, scaling operations are applied to refine and enhance the features in order to adjust the attention mechanism:
[0011] In the formula, Indicates the input feature map, Represents all channels and spatial dimensions Summary This is the normalization function.
[0012] Furthermore, the processing procedure of the BiFormer attention mechanism in the SPPCSPC-ATT module is as follows: First, input the feature map. Classified as Non-overlapping blocks of varying sizes, each region containing 1 feature vector, and the feature map Mapping to query, key, and value matrices:
[0013] This is the learned weight matrix, and the shape of the projected query, key, and value matrix is as follows: ; Then, for the query s and keys The matrix is averaged to obtain a region-level aggregated representation. and And calculate the correlation between regions and obtain the adjacency matrix. :
[0014] Next, for the adjacency matrix Perform a row-by-row Top-k operation to extract the most relevant neighboring regions for each query, thus obtaining the index matrix. :
[0015] in, It is an index matrix, representing the most relevant indexes for each query. One region; Then aggregate the relevant keys based on the index matrix. Sum Matrix, to obtain the aggregated matrix and :
[0016]
[0017] Finally, based on the aggregated matrix and Perform standard attention operations to compute the final output:
[0018] Among them, attention operations Yes , and We perform a weighted summation and introduce a loss function parameterized by depthwise convolution. ,optimization The characteristics are represented.
[0019] Furthermore, the third-scale features received by the feature fusion network The data is first processed by the SE-AdaptiveConv module and the upsampling module, and then input into a BiFPN-Concat module. The BiFPN-Concat module then combines it with the second-scale features processed by the SE-AdaptiveConv module. Bidirectional fusion is performed, and preliminary fusion features are obtained after further processing by C2f-AdaptiveConv. ; Preliminary fusion characteristics After further processing by the SE-AdaptiveConv module and the upsampling module, the BiFPN-Concat module is used to combine it with the first-scale features processed by the SE-AdaptiveConv module. Bidirectional fusion is performed, and the first fusion feature is obtained after further processing by C2f-AdaptiveConv. ; First fusion feature The input detection head network performs defect detection, and is also processed again by an SE-AdaptiveConv module, and then by a BiFPN-Concat module to combine it with the preliminary fusion features. The fusion is performed, and the second fusion feature is obtained after further processing by C2f-AdaptiveConv. ; Second fusion feature The defect detection is directly input into the detection head network, and then processed again by an SE-AdaptiveConv module before being combined with the third-scale features output by the feature extraction network by a BiFPN-Concat module. The fusion is performed, and the third fusion feature is obtained after further processing by C2f-AdaptiveConv. Third fusion feature Defect detection is performed by directly inputting the detection head network.
[0020] Furthermore, the processing procedure of the SE-AdaptiveConv module is as follows: Given the fiber path feature map as input It uses adaptive average pooling to compress its spatial dimensions into a single global feature vector:
[0021] Routing networks through linear transformation global feature vectors Mapped to a set of route weights w :
[0022] in, It is the size of The weight matrix of the linear transformation The number of channels in the input feature map. The number of expert convolution kernels, For bias terms , yes Sigmoid An activation function used to restrict weights to the range (0,1); Routing weight Determine each expert convolution kernel Contribution of multiple expert convolution kernels to the final convolution operation in conditional convolutional layers. It is pre-trained, and the final adaptive convolutional kernel Based on routing weight w Dynamic combination yields:
[0023] Use the obtained adaptive convolution kernel For the input fiber path feature map Perform convolution operations to generate output feature maps. :
[0024] The generated feature map Y is input into the SE attention mechanism module, and the SE module dynamically adjusts the features of interest. Furthermore, the C2f-AdaptiveConv module integrates the C2f and AdaptiveConv modules. The C2f module uses multi-scale convolution operations to extract features and fuses the features to improve the network's ability to process multi-scale information. The AdaptiveConv module is embedded at the bottleneck position of the network and dynamically adjusts the convolution kernel weights to make the network more flexible when facing different inputs.
[0025] Furthermore, the BiFPN-Concat module performs bidirectional feature fusion, fully utilizing feature information at different scales. The upsampling module is used to recover details from low-resolution feature maps, ensuring a tight combination of low-level and high-level features to capture global semantic information and pass it to lower-level feature maps. The downsampling operation reduces the spatial resolution of low-level feature maps and fuses them with high-level feature maps to capture detailed information and propagate it to higher-level feature maps. In BiFPN, feature fusion is achieved through a weighted summation operation. Each fusion node assigns learnable weights to the input feature map, which are then used for weighted summation to promote feature fusion. This allows the model to adjust the importance of feature maps at different scales, enhancing the fusion effect. The specific weighted fusion operation is as follows:
[0026] in, These are learnable weights. It is the input feature map. This is a very small number used to avoid division by zero errors. This operation ensures that the values of the output feature map remain within a reasonable range. By introducing learnable weights, the weighted fusion operation in BiFPN achieves accurate fusion of feature maps at different scales, significantly improving the performance of object detection tasks.
[0027] Furthermore, the head network combines the decoupled detection head with the SE-AdaptiveConv module. SE-AdaptiveConv dynamically adjusts input parameters to optimize the model's response to different image features, thereby enhancing the detection accuracy for minute defects. It independently processes localization and classification tasks on different feature maps, and the first fused feature output by the feature fusion network... Second fusion feature and third fusion features Each defect is processed by its corresponding SE-AdaptiveConv module to complete the defect detection.
[0028] Furthermore, the MABD-Net defect detection model is trained, and its loss function is jointly optimized by the bounding box loss, classification loss, and confidence loss. The bounding box loss employs a normalized weighted distance loss function, expressed as follows:
[0029] In the formula, Represents the normalized Wasserstein distance. and These represent the bounding boxes respectively. and The modeled Gaussian distribution; Both classification loss and confidence loss use the binary cross-entropy loss function to measure the consistency between the predicted probability and the true label, thereby distinguishing different defect categories. Its mathematical expression is as follows:
[0030] in, This indicates the total number of bounding boxes in the batch. Indicates the first The true label of the bounding box, 1 indicates that a defect exists, and 0 indicates that a defect does not exist; This represents the model's predicted probability of the defect type within the bounding box.
[0031] The beneficial effects of this invention are as follows: The MABD-Net model proposed in this invention demonstrates outstanding technical performance in the field of defect detection for basalt fiber 3D printing, thanks to its innovative feature extraction and fusion mechanism. This model can not only efficiently identify minute defects during the printing process, such as slight offsets, twists, and loss of control in the fiber path, but also achieve precise localization of these complex fiber path deviations, exhibiting extremely high adaptability and detection accuracy.
[0032] Specifically, the MABD-Net model significantly improves its feature extraction capabilities for small targets and complex fiber paths by introducing an enhanced version of MobileNetV3 combined with the SPPCSPC-ATT module as the feature extraction network. In particular, the improved SPPCSPC-ATT module effectively solves the problem of filtering edge information for small targets, preserving more detailed information and thus improving detection accuracy. Meanwhile, the feature fusion part employs a structure combining an enhanced feature pyramid network and a path aggregation network, further enhancing the fusion and representation capabilities of multi-scale features, enabling the model to more comprehensively understand the complex variations of fiber paths.
[0033] In practical applications, the MABD-Net model has demonstrated significant application prospects and industrial value. It can not only detect various defects in the basalt fiber 3D printing process in real time and accurately, providing strong support for quality control during production, but also comprehensively evaluate the performance of the detection algorithm by introducing visualization tools such as heat maps, providing valuable data for process optimization and product quality improvement. Therefore, the MABD-Net model has broad potential for promotion and application in the 3D printing industry.
[0034] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0035] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein: Figure 1 This is a flowchart illustrating a defect detection method for basalt fiber 3D printing according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the MABD-Net defect detection module established in an embodiment of the present invention; Figure 3 This is a schematic diagram of the SPPC-ATT module according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the BiFormer attention mechanism in the SPPC-ATT module according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the SE-AdaptiveConv module according to an embodiment of the present invention; Figure 6 This is a flowchart illustrating the SE attention mechanism in the SE-AdaptiveConv module according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the C2f-AdaptiveConv module according to an embodiment of the present invention; Figure 8 This is a schematic diagram showing the comparison results of real-time defect detection using different models in embodiments of the present invention; Figure 9 This is a thermal comparison diagram of defect detection performed on different models in embodiments of the present invention. Detailed Implementation
[0036] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0037] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0038] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0039] Please see Figures 1-9 This is a defect detection method for basalt fiber 3D printing.
[0040] This embodiment provides a defect detection method for basalt fiber 3D printing, such as... Figure 1 As shown, it includes the following detailed process: S1. Construct a defect dataset containing fiber path offsets and perform accurate annotation; S2. Divide the labeled dataset into a training set and a test set in a 7:3 ratio; S3. Design and build the MABD-Net defect detection model; S4. Train the MABD-Net model using the training set; S5. Optimize the training parameters of the model to improve detection accuracy; S6. Apply the optimized MABD-Net model to the basalt fiber 3D printer for real-time defect detection.
[0041] Step S1 in this embodiment specifically includes the following steps: S11. Use a dedicated image capture device to capture high-resolution images of the fiber laying path; S12. The printed objects are mainly cylinders and cubes, with fiber paths in a grid pattern and interlaced filling to showcase the model's superiority. S13. A total of 6 sets of cubes and 4 sets of cylinders were printed, with fiber filling rates of 10%, 20%, 30%, 40% and 50% respectively, generating a total of 500 high-resolution fiber laying path images. S14. To improve the model's generalization ability and robustness, data augmentation techniques were employed, including rotation, flipping, scaling, and translation. These techniques resulted in the generation of 1500 augmented experimental data images. S15. Use the LabelImg tool to label the collected image data to provide accurate labels for subsequent training and model optimization.
[0042] In step S2 of this embodiment, the fiber path offset in the dataset mainly manifests in three forms: path distortion, path loss of control, and path slight deviation. Both the training set and the dataset contain the above three forms of fiber path offset.
[0043] In step S3 of this embodiment, as Figure 2 As shown, the MABD-Net defect detection model includes a feature extraction part, a feature fusion part, and a detection head, wherein: In the feature extraction part, MABD-Net uses an enhanced version of MobileNetV3 and the SPPCSPC-ATT module as the feature extraction network. By introducing the C2f module into the Bneck (3×3×24) and Bneck (3×3×112) layers of MobileNetV3, the innovative design greatly improves the feature extraction capability of the network. In order to further improve the ability of the enhanced MobileNetV3 to handle small targets during feature extraction, the SPPCSPC-ATT module is introduced after feature extraction. This module only makes up for the limitations caused by the fixed scale of the basic features.
[0044] The feature extraction network receives an image with a size of 640x640 pixels and 3 channels. As input, it first passes through a 2D convolutional layer (Conv2D), combined with batch normalization (BN) and the Hardswish activation function, to output a feature map. Feature map After processing by the bottleneck layers Bneck (3×3×16), Bneck (3×3×24), and the C2f module, the first-scale feature map is obtained. First-scale feature map It directly inputs the feature fusion network, and then further passes through bottleneck layers Bneck (5×5×40), Bneck (3×3×80), Bneck (3×3×112) and the C2f module to obtain the second-scale feature map. Similarly, the second-scale feature map The feature map is directly input into the feature fusion network, and then further processed through the bottleneck layer Bneck (5×5×160) and the SPPCSPC-ATT module to obtain the third-scale feature map. Third-scale feature map Directly input feature fusion network.
[0045] The SPPCSPC-ATT module is an improvement upon the SPPCSPC module in YOLOv7. The original SPPCSPC module used three cascaded CBS modules located before the parallel pooling path. Because the operation of these three CBS modules caused the filtering out of edge information for small targets, it affected the detection performance of small targets, especially in applications with rich detail and small target sizes. To solve this problem, the third CBS module in the original design was replaced with the SimAM attention mechanism, such as... Figure 3 As shown, the original SPPCSPC module uses a pooling kernel size of (5,9,13). This design is effective in some applications, but for small targets, such a large pooling kernel may cause excessive blurring of details, thus affecting the accuracy of feature representation. To solve this problem, it is adjusted to (3,5,7). This smaller pooling kernel size can retain more detailed information while avoiding the loss of feature details due to excessive pooling. The SPPCSPC-ATT module significantly enhances the ability to model long-distance dependencies between features by introducing the BiFormer attention mechanism, thereby enabling the network to establish closer and richer contextual relationships between different layers.
[0046] Specifically, in the SPPCSPC-ATT module, such as Figure 3 As shown, the input features are first processed by two CBS blocks, then processed by the SimAM mechanism, and then subjected to max pooling in three branches. The features output by the SimAM block are concatenated by the Concat block. The concatenated features are then processed by two more CBS blocks and concatenated with the input features processed by one CBS block. The concatenated features are then processed by another CBS block and then processed by the BiFormer mechanism to obtain the final output. The SimAM attention mechanism in the SPPC-ATT module can enhance attention to small targets while maintaining feature integrity, making the features of these small targets clearer and more distinguishable in subsequent processing stages, thereby significantly improving detection accuracy. Specific operation steps are as follows: Step 1: First, the attention mechanism is implemented using a simple non-linear function, without relying on trainable parameters. To better achieve attention, the importance of each neuron needs to be estimated by calculating an energy function. The energy function of a neuron is defined as follows:
[0047] in, and yes and The linear transformations are calculated using weights and biases. These represent the values that the target neuron and other neurons are expected to be mapped to, respectively. This represents the number of neurons in the channel. It is an index in the spatial dimension.
[0048] Step 2: Next, calculate the minimum energy using the following method:
[0049] in, and , representing the mean and variance of the channel feature in the spatial dimension, respectively. For hyperparameters; lower Represents neurons It is more distinct from the surrounding neurons.
[0050] Step 3: Next, scaling operations are applied to refine and enhance features, thereby adjusting the attention mechanism, as shown in the following formula:
[0051] Among them, E will include all of Grouping is performed, and the sigmoid function is used to normalize E to avoid its value being too large, thus ensuring the stability of the attention weights.
[0052] The BiFormer attention mechanism in the SPPC-ATT module is an attention mechanism that combines bidirectional information. It introduces bidirectional contextual information into the traditional self-attention mechanism to better capture long-range dependencies in sequences, such as... Figure 4 As shown, the specific operation steps are as follows: Step 1: First, input the feature map. Classified as Non-overlapping blocks of varying sizes, each region containing Each feature vector. To compute the query, key, and value matrix, the feature map will be used next. The mapping formulas for these matrices are as follows:
[0053] in, This is the learned weight matrix, and the shape of the projected query, key, and value matrix is as follows: .
[0054] Step 2: Next, in order to capture the interaction between regions, it is necessary to first process the query. s and keys The matrix is averaged to obtain a region-level aggregated representation. and Then, the correlation between regions is calculated and the adjacency matrix is obtained. The calculation formula is as follows:
[0055] Step 3: Based on the adjacency matrix In order to further filter each region To enhance the effectiveness of information flow, a Top-k operation needs to be performed row-by-row on the adjacency matrix to extract the most relevant neighboring regions for each query, thus obtaining the index matrix. :
[0056] in, It is an index matrix, representing the most relevant indexes for each query. Each region.
[0057] Step 4: Then aggregate the relevant keys based on the index matrix. Sum Matrix, to obtain the aggregated matrix and
[0058]
[0059] Step 5: Finally, based on the aggregated matrix... and Perform standard attention operations to compute the final output:
[0060] Among them, attention operations are... , and To perform a weighted summation, a... The term is a loss function parameterized by depthwise convolution, which is further optimized. The characteristics are represented.
[0061] In the feature fusion part, the MABD-Net feature fusion network adopts a structure that combines an enhanced feature pyramid network and a path aggregation network to improve the feature extraction and fusion effect. The main modules of the network include SE-AdaptiveConv, BiFPN-Concat, upsampling, and C2f-AdaptiveConv, which further enhance the fusion and expression capabilities of multi-scale features.
[0062] In the feature fusion network, the received third-scale features The data is first processed by the SE-AdaptiveConv module and the upsampling module, and then input into a BiFPN-Concat module. The BiFPN-Concat module then combines it with the second-scale features processed by the SE-AdaptiveConv module. Bidirectional fusion is performed, and preliminary fusion features are obtained after further processing by C2f-AdaptiveConv. Preliminary fusion characteristics After further processing by the SE-AdaptiveConv module and the upsampling module, the BiFPN-Concat module is used to combine it with the first-scale features processed by the SE-AdaptiveConv module. Bidirectional fusion is performed, and the first fusion feature is obtained after further processing by C2f-AdaptiveConv. First fusion feature The input detection head network performs defect detection, and is also processed again by an SE-AdaptiveConv module, and then by a BiFPN-Concat module to combine it with the preliminary fusion features. The fusion is performed, and the second fusion feature is obtained after further processing by C2f-AdaptiveConv. Second fusion feature The defect detection is directly input into the detection head network, and then processed again by an SE-AdaptiveConv module before being combined with the third-scale features output by the feature extraction network by a BiFPN-Concat module. The fusion is performed, and the third fusion feature is obtained after further processing by C2f-AdaptiveConv. Third fusion feature Defect detection is performed by directly inputting the detection head network.
[0063] The core idea of the SE-AdaptiveConv module is to introduce an adaptive adjustment mechanism into the network, enabling the convolutional kernel weights to be optimized in real time based on the features of the input path data, such as... Figure 5 As shown, the specific steps are as follows: Given the fiber path feature map as input (size is) ×H×W Using adaptive average pooling, its spatial dimensions are compressed into a single global feature vector:
[0064] Routing networks through linear transformation global feature vectors Mapped to a set of route weights w :
[0065] in, It is the size of The weight matrix of the linear transformation For bias terms , yes Sigmoid An activation function is used to restrict the weights to the range (0,1), these routing weights The convolution kernel for each expert is determined. The contribution to the final convolution operation in the conditional convolutional layer; In conditional convolutional layers, multiple expert convolutional kernels It is pre-trained, and the final adaptive convolutional kernel It is based on route weight w Dynamically combined:
[0066] Use the obtained adaptive convolution kernel For the input fiber path feature map Perform convolution operations to generate output feature maps.
[0067]
[0068] The generated feature map Y is input into the SE attention mechanism module. The addition of the SE module enables the network to dynamically adjust the features it focuses on, thereby significantly improving task accuracy and network performance. The SE module in the SE-AdaptiveConv module is responsible for the feature map generated by the AdaptiveConv module. Process, such as Figure 6 As shown, the specific steps are as follows: Step 1: Input feature map Transform the original feature map. Transform into The formula is defined as follows:
[0069] in This represents a set of learned filter kernels. Indicates the first The parameters of each filter, This represents a two-dimensional spatial kernel, and * represents the convolution operation.
[0070] Step 2: To reduce redundancy between channels and extract key features, the "Squeeze" operation is performed next. This helps alleviate the dependency problem between channels, and its calculation method is as follows:
[0071] in express Z The c The "Squeeze" operation generates a global descriptive feature from the given elements.
[0072] Step 3: Next, the "Excitation" operation is introduced. The network can adaptively learn the importance weights of each channel and dynamically reweight the input features. The calculation method is as follows:
[0073] in, , This method employs a bottleneck structure with two fully connected layers, aiming to reduce model complexity and improve the model's generalization ability.
[0074] Step 4: Next, a reweighting operation is performed. Reweighting is a necessary step for dynamically adjusting the feature map, aiming to enhance attention to important features while suppressing responses to irrelevant features. The calculation method is as follows:
[0075] This dynamic reweighting mechanism helps improve the model's robustness, enabling it to better adapt to different input data and autonomously learn data features during training. Therefore, it enhances the model's overall predictive accuracy and generalization ability.
[0076] The C2f-AdaptiveConv module is a CNN architecture specifically designed to optimize small object detection, such as... Figure 7 As shown, the network integrates the C2f module and the AdaptiveConv module. The C2f module uses multi-scale convolution operations to extract features and fuses these features to improve the network's ability to process multi-scale information and enrich the expression of contextual information. The AdaptiveConv module is embedded at the bottleneck position of the network, replacing the traditional fixed convolution operation. The AdaptiveConv module can dynamically adjust the weights of the convolution kernel, making the network more flexible when facing different inputs, especially significantly improving the ability to detect small objects.
[0077] The BiFPN-Concat module implements bidirectional feature fusion, fully utilizing feature information at different scales. Upsampling effectively recovers details from low-resolution feature maps, ensuring a tight combination of low-level and high-level features to capture global semantic information and pass it to lower-level feature maps. Downsampling reduces the spatial resolution of low-level feature maps and fuses them with high-level feature maps to capture detailed information and propagate it to higher-level feature maps. In BiFPN, feature fusion is achieved through a weighted summation operation. Each fusion node assigns learnable weights to the input feature maps, which are then used for weighted summation to promote feature fusion. This allows the model to adjust the importance of feature maps at different scales, enhancing the fusion effect. The specific weighted fusion operation is as follows:
[0078] in, These are learnable weights. It is the input feature map. This is a very small number used to avoid division by zero errors. This operation ensures that the values of the output feature map remain within a reasonable range. By introducing learnable weights, the weighted fusion operation in BiFPN achieves accurate fusion of feature maps at different scales, significantly improving the performance of object detection tasks.
[0079] In the head detection section, MABD-Net employs an innovative defect detection head network. This network combines a decoupled detection head with the SE-AdaptiveConv module, enabling independent processing of localization and classification tasks on different feature maps. The first fused feature output by the feature fusion network... Second fusion feature and third fusion features Each defect is processed by its corresponding SE-AdaptiveConv module to complete the defect detection.
[0080] In step S4 of this embodiment, the MABD-Net defect detection model is trained. Its loss function jointly optimizes the bounding box loss, classification loss, and confidence loss. The bounding box loss adopts a normalized weighted distance loss function to reduce the impact of target size on the loss. By considering the differences in spatial and probability distributions, the robustness of small target detection is improved. The establishment process is as follows: Step 1: The bounding box of a small target often contains background and foreground pixels. To more accurately represent the importance of pixels within the bounding box, the bounding box is modeled as a two-dimensional Gaussian distribution model. The horizontal bounding box is represented as... The parameters represent its center coordinates, width, and height. The equation of its corresponding inscribed ellipse is:
[0081] in, Represents the coordinates of the center of the ellipse , and They represent the ellipse along... and The length of the semi-axis in the direction, 、 、 and .
[0082] Step 2, the probability density function formula for the two-dimensional Gaussian distribution is:
[0083] in, , and These are the mean vector and covariance matrix of a Gaussian distribution, respectively. When the probability density function of a two-dimensional Gaussian distribution satisfies the following condition: [Horizontal bounding box] It can be modeled as a two-dimensional Gaussian distribution. .
[0084] Step 3: Next, the Wasserstein distance from optimal transport theory is used to calculate the distance between distributions, assuming... and The formula for the second-order Wasserstein distance between the two is:
[0085] in, This represents the Frobenius norm.
[0086] Step 4: Next, for the bounding box... and Modeling Gaussian distribution and The formula for the second-order Wasserstein distance can be further simplified to:
[0087] Step 5: The above formula represents distance units and cannot be directly used for similarity calculation. A normalized exponential function is needed as a new metric. The formula for the normalized Wasserstein distance is:
[0088] Step 6: NWD can be improved based on IoU by designing an NWD-based loss function, the formula of which is as follows:
[0089] Both classification loss and confidence loss use the binary cross-entropy loss function, which effectively measures the consistency between the predicted probability and the true label, thereby accurately distinguishing different defect categories. Its mathematical expression is as follows:
[0090] in, This indicates the total number of bounding boxes in the batch. Indicates the first The true labels of the bounding boxes (1 indicates a defect exists, 0 indicates no defect exists). This represents the model's predicted probability of the defect type within the bounding box.
[0091] The MABD-Net model is trained using the training set, specifically including: Set the model hyperparameters, including: weight decay rate of 0.0005, learning rate of 0.01, optimizer of Adam, number of iterations of 300, batch size of 16, and loss functions of BCE and NWD. Use common evaluation metrics such as accuracy, precision, recall, training loss, and average precision to measure the effectiveness of a model:
[0092] in, This indicates that both the prediction and the reality are flawed. This indicates that the prediction was for a defect, but the actual condition is normal. This indicates that the prediction was normal, but the actual condition is defective.
[0093] In step S5 of this embodiment, the optimization of hyperparameters is included. The optimized hyperparameters mainly include: weight decay rate, learning rate, optimizer, batch size and loss function. By optimizing these parameters, the accuracy is improved to over 95%, especially for small target fiber path offset target recognition accuracy.
[0094] In step S6 of this embodiment, the optimized MABD-Net model is applied to the basalt fiber 3D printer for real-time defect detection. The optimized MABD-Net model is applied to the basalt fiber 3D printer for real-time defect detection; different models are applied to the 3D printer for real-time defect detection. Figure 8This diagram illustrates the comparison of real-time defect detection using different models, including existing FasterCNN, YOLOv5, YOLOv7, YOLOv8, and the MABD-Net model of this invention. It shows that while YOLOv5 and YOLOv7 perform well in defect detection, they have a high number of false positives / false negatives. YOLOv8 can reduce false negatives to some extent, but false positives are still significant. In contrast, MABD-Net has fewer false positives and false negatives, providing more comprehensive defect identification and more accurate results.
[0095] To comprehensively evaluate the performance of various detection algorithms in small target defect recognition tasks, heatmaps were introduced as the primary visualization tool. Through changes in color intensity, the response regions of the models in the test set images were clearly presented, identifying not only the specific location, size, and contour features of the defects, but also reflecting the severity of the defect regions. Figure 9 The results show heatmaps of defect detection using different models. Existing FasterCNN, YOLOv5, YOLOv7, and YOLOv8 models, as well as the MABD-Net model of this invention, were tested. It is evident that MABD-Net demonstrates greater focus and accuracy in defect localization. The high-response regions in the heatmap tightly cover the defects with clear boundaries, significantly enhancing the interpretability of the results and improving analysis and evaluation efficiency. In contrast, Faster-RCNN's response is more scattered with blurred boundaries, and it misses small defects, reflecting its insufficient ability to extract small target features. Compared to YOLOv7 / YOLOv8, although both perform stably in detecting large targets, their sensitivity to small defects is weaker, with indistinct gradients and unclear boundaries in the heatmaps, thus affecting the accuracy of small defect detection.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A defect detection method for basalt fiber 3D printing, characterized in that: The method includes: constructing a defect dataset containing fiber path offsets, labeling and partitioning the dataset; establishing a MABD-Net defect detection model, training the model using the partitioned training set, optimizing model parameters during training, and applying the optimized MABD-Net defect detection model to a basalt fiber 3D printer for real-time defect detection; the MABD-Net defect detection model includes at least a feature extraction network, a feature fusion network, and a detection head network. The feature extraction network combines the enhanced lightweight convolutional neural network MobileNetV3 and the SPPCSPC-ATT module to perform multi-scale feature extraction. Specifically, two C2f modules are introduced into the MobileNetV3 network. Each C2f module extracts features at different scales and outputs them to the feature fusion network and the SPPCSPC-ATT module. The SPPCSPC-ATT module enhances the target edge information by introducing the SimAM attention mechanism and enhances the long-distance dependency modeling ability between features by introducing the BiFormer attention mechanism. The output features are also input into the feature fusion network. The feature fusion network includes the SE-AdaptiveConv module, the BiFPN-Concat module, the upsampling module, and the C2f-AdaptiveConv module. The BiFPN-Concat module receives the features processed by the SE-AdaptiveConv module and the upsampling module, as well as the features output by the feature extraction network, and performs bidirectional feature fusion. The C2f-AdaptiveConv module then processes these features. The SE-AdaptiveConv module introduces an adaptive adjustment mechanism to optimize the convolutional kernel weights in real time based on the path data features. The detection head network combines the decoupled detection head with the SE-AdaptiveConv module to independently process localization and classification tasks on different feature maps, thereby completing defect detection.
2. The defect detection method for basalt fiber 3D printing according to claim 1, characterized in that: The input image of the feature extraction network is represented as follows: First, the feature map is passed through a 2D convolutional layer, then batch normalization, and finally a Hardswish activation function. Feature map After processing by two bottleneck layers (Bneck) and the C2f module, the first-scale feature map is obtained. First-scale feature map It directly inputs the feature fusion network, and then further passes it through three bottleneck layers (Bneck) and a C2f module to obtain the second-scale feature map. ; Similarly, the second-scale feature map The feature map is obtained by directly inputting it into the feature fusion network, and then processing it through a bottleneck layer (Bneck) and a SPPCSPC-ATT module to obtain a third-scale feature map. Third-scale feature map Direct input feature fusion network; where, The input features of the SPPC-ATT module are first processed by two CBS blocks, then processed by the SimAM mechanism, and then subjected to max pooling in three branches. The features are then concatenated with the output features of the SimAM block by the Concat block. The concatenated features are then processed by two more CBS blocks and concatenated with the input features processed by one CBS block. The concatenated features are then processed by another CBS block and then processed by the BiFormer mechanism to obtain the final output.
3. The defect detection method for basalt fiber 3D printing according to claim 2, characterized in that: The SimAM mechanism of the SPC-ATT module is processed as follows: First, a nonlinear function is used to implement the attention mechanism, where the importance of each neuron is estimated by calculating an energy function, which is defined as follows: In the formula, and yes and The linear transformation form, These are the weights and biases of the linear transformation, respectively. These represent the values that the target neuron and other neurons are expected to be mapped to, respectively. This represents the number of neurons in the channel. It is an index in the spatial dimension; Next, calculate the minimum energy: In the formula, and These represent the mean and variance of the channel feature in the spatial dimension, respectively. For hyperparameters; Then, scaling operations are applied to refine and enhance the features in order to adjust the attention mechanism: In the formula, Indicates the input feature map, Represents all channels and spatial dimensions Summary This is the normalization function.
4. A defect detection method for basalt fiber 3D printing according to claim 2, characterized in that: The processing procedure of the BiFormer attention mechanism in the SPC-ATT module is as follows: First, input the feature map. Classified as Non-overlapping blocks of varying sizes, each region containing 1 feature vector, and the feature map Mapping to query, key, and value matrices: This is the learned weight matrix, and the shape of the projected query, key, and value matrix is as follows: ; Then, for the query s and keys The matrix is averaged to obtain a region-level aggregated representation. and And calculate the correlation between regions and obtain the adjacency matrix. : Next, for the adjacency matrix Perform a row-by-row Top-k operation to extract the most relevant neighboring regions for each query, thus obtaining the index matrix. : in, It is an index matrix, representing the most relevant indexes for each query. One region; Then aggregate the relevant keys based on the index matrix. Sum Matrix, to obtain the aggregated matrix and : Finally, based on the aggregated matrix and Perform standard attention operations to compute the final output: Among them, attention operations Yes , and We perform a weighted summation and introduce a loss function parameterized by depthwise convolution. ,optimization The characteristics are represented.
5. A defect detection method for basalt fiber 3D printing according to claim 2, characterized in that: The third-scale features received by the feature fusion network The data is first processed by the SE-AdaptiveConv module and the upsampling module, and then input into a BiFPN-Concat module. The BiFPN-Concat module then combines it with the second-scale features processed by the SE-AdaptiveConv module. Bidirectional fusion is performed, and preliminary fusion features are obtained after further processing by C2f-AdaptiveConv. ; Preliminary fusion characteristics After further processing by the SE-AdaptiveConv module and the upsampling module, the BiFPN-Concat module is used to combine it with the first-scale features processed by the SE-AdaptiveConv module. Bidirectional fusion is performed, and the first fusion feature is obtained after further processing by C2f-AdaptiveConv. ; First fusion feature The input detection head network performs defect detection, and is also processed again by an SE-AdaptiveConv module, and then by a BiFPN-Concat module to combine it with the preliminary fusion features. The fusion is performed, and the second fusion feature is obtained after further processing by C2f-AdaptiveConv. ; Second fusion feature The defect detection is directly input into the detection head network, and then processed again by an SE-AdaptiveConv module before being combined with the third-scale features output by the feature extraction network by a BiFPN-Concat module. The fusion is performed, and the third fusion feature is obtained after further processing by C2f-AdaptiveConv. Third fusion feature Defect detection is performed by directly inputting the detection head network.
6. A defect detection method for basalt fiber 3D printing according to claim 5, characterized in that: The processing procedure of the SE-AdaptiveConv module is as follows: Given the fiber path feature map as input It uses adaptive average pooling to compress its spatial dimensions into a single global feature vector: Routing networks through linear transformation global feature vectors Mapped to a set of route weights w : in, It is the size of The weight matrix of the linear transformation The number of channels in the input feature map. The number of expert convolution kernels, For bias terms , yes Sigmoid An activation function used to restrict weights to the range (0,1); Routing weight Determine each expert convolution kernel Contribution of multiple expert convolution kernels to the final convolution operation in conditional convolutional layers. It is pre-trained, and the final adaptive convolutional kernel Based on routing weight w Dynamic combination yields: Use the obtained adaptive convolution kernel For the input fiber path feature map Perform convolution operations to generate output feature maps. : The generated feature map Y is input into the SE attention mechanism module, and the SE module dynamically adjusts the features of interest.
7. A defect detection method for basalt fiber 3D printing according to claim 5, characterized in that: The C2f-AdaptiveConv module integrates the C2f module and the AdaptiveConv module. The C2f module uses multi-scale convolution operations to extract features and fuses the features to improve the network's ability to process multi-scale information. The AdaptiveConv module is embedded at the bottleneck position of the network and dynamically adjusts the convolution kernel weights to make the network more flexible when facing different inputs.
8. A defect detection method for basalt fiber 3D printing according to claim 5, characterized in that: The BiFPN-Concat module performs bidirectional feature fusion, making full use of feature information at different scales; The upsampling module is used to recover the details of low-resolution feature maps, ensuring that low-level and high-level features are tightly combined to capture global semantic information and pass it to lower-level feature maps. The downsampling operation reduces the spatial resolution of low-level feature maps and fuses them with high-level feature maps to capture detailed information and propagate it to higher-level feature maps. In BiFPN, feature fusion is achieved through a weighted summation operation. Each fusion node assigns learnable weights to the input feature map, which are then used for weighted summation to promote feature fusion. The weighted fusion operation is as follows: in, These are learnable weights. It is the input feature map. It is a very small number used to avoid division by zero errors.
9. A defect detection method for basalt fiber 3D printing according to claim 5, characterized in that: The head network combines a decoupled detection head with the SE-AdaptiveConv module. SE-AdaptiveConv dynamically adjusts input parameters to independently process localization and classification tasks on different feature maps. The first fused feature is output by the feature fusion network. Second fusion feature and third fusion features Each defect is processed by its corresponding SE-AdaptiveConv module to complete the defect detection.
10. A defect detection method for basalt fiber 3D printing according to claim 9, characterized in that: The MABD-Net defect detection model is trained using a loss function that jointly optimizes the bounding box loss, classification loss, and confidence loss. The bounding box loss employs a normalized weighted distance loss function, expressed as follows: In the formula, Represents the normalized Wasserstein distance. and These represent the bounding boxes respectively. and The modeled Gaussian distribution; Both classification loss and confidence loss use the binary cross-entropy loss function to measure the consistency between the predicted probability and the true label, thereby distinguishing different defect categories. Its mathematical expression is as follows: in, This indicates the total number of bounding boxes in the batch. Indicates the first The true label of the bounding box, 1 indicates that a defect exists, and 0 indicates that a defect does not exist; This represents the model's predicted probability of the defect type within the bounding box.