Engine part defect detection method, device and equipment based on AI vision and medium

By constructing a multi-scale topology-aware feature extraction network and a dynamic domain adaptive module, and combining knowledge distillation technology, a large-scale synthetic training dataset and a lightweight detection engine are generated. This solves the problems of sample scarcity and poor adaptability to multiple operating conditions in engine part defect detection, and achieves efficient and accurate defect detection.

CN122115383APending Publication Date: 2026-05-29张贺

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
张贺
Filing Date
2026-02-13
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing AI visual inspection methods for engine parts defect detection suffer from problems such as sample scarcity, high annotation costs, insufficient model generalization ability, and poor adaptability to multiple operating conditions, making it difficult to meet the needs for efficient and accurate defect detection.

Method used

A multi-scale topology-aware feature extraction network is constructed. Defects are encoded using deep feature maps and topological saliency maps to generate a large-scale synthetic augmented training dataset. A defect detection framework integrating a dynamic domain adaptive module is constructed. Combined with two-stage progressive knowledge distillation processing, a lightweight defect detection engine is generated.

Benefits of technology

It improves the accuracy and robustness of defect detection, enhances the adaptability to complex defect morphologies and multi-condition environments, and meets the high-efficiency detection needs of industrial production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115383A_ABST
    Figure CN122115383A_ABST
Patent Text Reader

Abstract

The application relates to an AI vision-based engine part defect detection method, device, equipment and medium. The method comprises the following steps: acquiring labeled real engine part images and defect masks to form initial samples, training by using a multi-scale topological perception feature extraction network, generating a deep feature map and a topological saliency map, and based on this, performing defect data coding and feature space synthesis to construct a large-scale synthetic augmented training dataset; taking the trained feature extraction network as a backbone, integrating a dynamic domain self-adaptive module to construct a defect detection framework, obtaining a robust teacher detection model and a parameter offset library through multi-working-condition simulation training, and performing two-stage progressive knowledge distillation processing to obtain a defect detection engine. The method significantly improves the accuracy, robustness and efficiency of engine part defect detection through multi-scale topological perception feature extraction, dynamic domain self-adaptation and progressive knowledge distillation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology, and in particular relates to a method, device, equipment and medium for detecting defects in engine parts based on AI vision. Background Technology

[0002] As a core component of power equipment, engine parts are directly affected by surface and internal defects (such as cracks, wear, and porosity), which directly impact the reliability and safety of equipment operation. Therefore, defect detection is a crucial step in engine manufacturing and maintenance. Traditional defect detection methods rely primarily on manual visual inspection, depending on the experience and judgment of inspectors. This approach suffers from low efficiency, strong subjectivity, and high rates of missed and false detections, making it difficult to meet the high-efficiency inspection requirements of modern industrial production lines. With the development of machine vision technology, detection schemes based on traditional image processing algorithms are gradually being applied. However, these methods require manual design of defect feature operators, have poor adaptability to complex defect morphologies and changing production environments, and limited generalization ability.

[0003] In recent years, the rise of artificial intelligence (AI) vision technology, especially deep learning methods, has provided new solutions for defect detection in engine parts. These methods can automatically learn defect features by constructing neural network models, significantly improving the intelligence level of detection. However, existing AI vision inspection methods still face many technical bottlenecks in real-world industrial scenarios: First, training deep learning models typically requires large-scale annotation of defect samples, but engine part defect samples are scarce, and pixel-level annotation is time-consuming and labor-intensive, making insufficient samples a core issue restricting model performance. Second, variations in lighting, oil contamination, and part orientation shifts during production can easily cause domain shifts in the model, leading to a significant decrease in detection accuracy for models trained under single conditions in complex real-world scenarios. Third, existing feature extraction methods often focus on shallow visual features of defects, lacking in-depth mining of defect topology and multi-scale features, resulting in insufficient ability to identify minute defects and complex-shaped defects. Furthermore, synthetic data generation technology is lacking in the authenticity and diversity of defect features, and the optimization of domain adaptation and knowledge distillation technologies in terms of lightweight model performance preservation and dynamic adaptation under multiple operating conditions is still insufficient, further limiting the large-scale application of AI vision technology in engine part defect detection. Summary of the Invention

[0004] Therefore, it is necessary to provide AI vision-based methods, devices, equipment, and media for engine part defect detection to address the aforementioned technical issues, aiming to improve the accuracy, robustness, and efficiency of defect detection, and enhance the model's adaptability to complex defect morphologies and various working conditions.

[0005] Firstly, this application provides a method for detecting defects in engine parts based on AI vision, including:

[0006] Obtain labeled real engine parts images and corresponding defect masks to form initial samples; construct a multi-scale topology-aware feature extraction network, and train the multi-scale topology-aware feature extraction network based on the initial samples to obtain the trained feature extraction network.

[0007] Defect samples are selected from the initial samples, and the trained feature extraction network is used to process the defect samples to obtain the deep feature map and topological saliency map of the defect samples. Defect data is encoded based on the deep feature map and topological saliency map to obtain the defect encoding result. Feature space is synthesized based on the defect encoding result to generate a large-scale synthetic augmented training dataset.

[0008] A defect detection framework integrating dynamic domain adaptive modules is constructed using the trained feature extraction network as a fixed and non-updateable backbone. The defect detection framework is trained under multiple working conditions based on a large-scale synthetic augmentation training dataset to obtain a robust teacher detection model and parameter offset library. Based on the robust teacher detection model and parameter offset library, a two-stage progressive knowledge distillation process is performed on the preset lightweight student network architecture to obtain a defect detection engine.

[0009] In one embodiment, a multi-scale topology-aware feature extraction network is constructed, and the multi-scale topology-aware feature extraction network is trained based on initial samples to obtain a trained feature extraction network, including:

[0010] An initial feature extraction network with a dual-branch structure and a multi-scale feature pyramid is constructed. The dual-branch structure is used to collaboratively extract features of different dimensions.

[0011] A topology-aware attention module is embedded in each layer of the multi-scale feature pyramid to construct a multi-scale topology-aware feature extraction network; the topology-aware attention module includes a channel attention submodule, a spatial attention submodule, and a topological saliency calculation submodule;

[0012] The joint loss function of the multi-scale topology-aware feature extraction network is determined. The joint loss function is composed of a weighted sum of defect segmentation loss and topology-aware auxiliary loss. The topology-aware auxiliary loss is used to constrain the multi-scale topology-aware feature extraction network to learn the topological structure features of defects.

[0013] The initial samples are input into the multi-scale topology-aware feature extraction network. The multi-scale topology-aware feature extraction network is iteratively trained based on the joint loss function. When the value of the joint loss function converges to a preset threshold, the training is stopped, and the trained feature extraction network is obtained.

[0014] In one embodiment, defect data is encoded based on a deep feature map and a topological saliency map to obtain defect encoding results; feature space synthesis is performed based on the defect encoding results to generate a large-scale synthetic augmented training dataset, including:

[0015] S2.1 Construct a meta-learning task set based on deep feature maps and topological saliency maps. The meta-learning task set contains multiple K-shot defect classification sub-tasks.

[0016] S2.2 Training the meta-learner based on the meta-learning task set to obtain a fully trained defect condition encoder;

[0017] S2.3. Obtain normal images of defect-free engine parts, and use the trained feature extraction network to extract features from the normal images of defect-free engine parts to obtain normal intermediate feature maps output by the preset intermediate layer in the trained feature extraction network.

[0018] S2.4 Construct a conditional generative adversarial network, which includes a generator and an image decoder;

[0019] S2.5. Encode the preset defect categories by training a complete defect condition encoder, generate defect condition vectors that represent the core semantics and topological patterns of the defect categories, and output the defect condition vectors as the defect encoding results.

[0020] S2.6 Input the normal intermediate feature map, defect condition vector and random noise into the generator, and learn the defect feature perturbation through the generator to generate the synthetic defect feature perturbation; superimpose the normal intermediate feature map and the synthetic defect feature perturbation element by element to obtain the synthetic defect feature map.

[0021] S2.7 Input the synthesized defect feature map into the trained feature extraction network and image decoder respectively to generate a synthesized image with defects and the corresponding pixel-level synthesized defect mask.

[0022] S2.8. Change to different preset defect categories and repeat steps S2.5 to S2.7 to accumulate and generate a large-scale synthetic augmented training dataset.

[0023] In one embodiment, a defect detection framework integrating a dynamic domain adaptive module is constructed using a trained feature extraction network as a fixed and non-updateable backbone. The defect detection framework is then trained under multiple operating conditions using a large-scale synthetic augmentation training dataset to obtain a robust teacher detection model and a parameter offset library, including:

[0024] The trained feature extraction network is used as a fixed and non-updateable backbone, and combined with the defect detection head to build a basic detection model; the basic detection model contains multiple feature extraction layers, and the weights of the basic detection model include dynamic target layer weights.

[0025] In the multi-layer feature extraction layer of the basic detection model, a high-level feature layer is determined, and a dynamic domain adaptive module is integrated after the high-level feature layer to form a defect detection framework; the dynamic domain adaptive module includes a domain classifier and a parameter offset generator; the high-level feature layer is used to output abstract feature representations;

[0026] Multi-condition simulation enhancement operations are performed on images in a large-scale synthetic enhancement training dataset, and a corresponding simulation condition domain label is assigned to each enhanced image to obtain the synthetic enhancement training dataset. The multi-condition simulation enhancement operations include brightness and contrast adjustment, oil stain noise addition, and random affine transformation.

[0027] The synthetic augmented training dataset is input into the defect detection framework for training. During training, a domain classifier identifies the working conditions of the training images in the synthetic augmented training dataset, outputting a domain description vector. A parameter offset generator generates corresponding parameter offsets based on the domain description vector. The parameter offsets are dynamically superimposed onto the dynamic target layer weights of the base detection model to form an instantaneous inference model adapted to the current working conditions. Defect detection is performed on the training images based on the instantaneous inference model, and the detection loss and domain classification alignment loss are calculated.

[0028] The trainable parameters of the defect detection framework are updated by backpropagation based on the detection loss and the domain classification alignment loss, resulting in a robust teacher detection model. Effective parameter offsets generated during training for each preset stable simulation condition are collected, classified and stored according to the domain label of the simulation condition, forming a parameter offset library.

[0029] In one embodiment, based on a robust teacher detection model and a parameter offset library, a two-stage progressive knowledge distillation process is performed on a pre-defined lightweight student network architecture to obtain a defect detection engine, including:

[0030] We construct medium-sized and lightweight student network architectures. The number of parameters in the medium-sized student network is between that of the robust teacher detection model and the lightweight student network architecture. The lightweight student network architecture is constructed using depthwise separable convolutions and compact attention modules.

[0031] A large-scale synthetic augmentation training dataset is input into the robust teacher detection model to obtain the teacher intermediate feature map, the teacher final prediction result, and the teacher topological saliency map. The teacher intermediate feature map, the teacher final prediction result, and the teacher topological saliency map are used as supervision signals to train the medium-sized student network and obtain the first-stage distilled student model.

[0032] Select multiple sets of parameter offsets corresponding to different working conditions from the parameter offset library, and superimpose the parameter offsets corresponding to different working conditions onto the robust teacher detection model to construct multiple domain expert models adapted to different working conditions.

[0033] The large-scale synthetic augmented training dataset is augmented according to the corresponding working conditions to obtain multiple sets of working condition adaptation datasets; each set of working condition adaptation datasets is input into the corresponding domain expert model to obtain multiple sets of expert output results;

[0034] The first-stage distillation student model is used as the intermediate teacher model, and the lightweight student network architecture is used as the student model. The large-scale synthetic augmentation training dataset and the working condition adaptation datasets of each group are respectively input into the intermediate teacher model and the student model. The student model is trained so that the output of the student model simultaneously approximates the prediction results of the intermediate teacher model and the output results of each group of experts, thus obtaining the lightweight student model.

[0035] The lightweight student model is subjected to structured channel pruning. The feature contribution of each channel in the lightweight student model is calculated, and redundant channels with feature contribution values ​​lower than the preset contribution threshold are removed to obtain the pruned model.

[0036] The pruned model is subjected to integer quantization to obtain the quantized model; the inference compiler of the target edge computing platform is used to compile and optimize the quantized model to generate a defect detection engine.

[0037] In one embodiment, the defect samples are processed using a trained feature extraction network to obtain a depth feature map and a topological saliency map of the defect samples, including:

[0038] The defect sample is input into the trained feature extraction network. The local detail features and long-range global dependency features of the defect sample are extracted through a dual-branch structure, and then fused through a multi-scale feature pyramid to obtain a preliminary multi-scale feature map.

[0039] The initial multi-scale feature map is input into the topology-aware attention module. The importance weight of each feature channel is calculated through the channel attention submodule to optimize the initial multi-scale feature map and obtain the optimized feature map.

[0040] The spatial attention submodule is used to enhance the spatial dimension features of the optimized feature map, generating a spatially enhanced feature map.

[0041] The topological saliency calculation submodule extracts the defect topology from the spatial enhancement feature map and generates a topological saliency map.

[0042] The spatial augmentation feature map and the topological saliency map are fused to obtain the deep feature map.

[0043] In one embodiment, the mathematical expression for the joint loss function is:

[0044]

[0045]

[0046]

[0047] in, These are the loss weighting coefficients; Defect segmentation loss; Predicted defect mask output by a multi-scale topology-aware feature extraction network. This is a mask for the actual defect. and The height and width of the mask; For predicting defect masks The pixel value at the i-th row and j-th column position is either 0 or 1. mask for real defects The pixel value at the i-th row and j-th column position takes the value 0 or 1; It is a minterm, and ; Topology-aware auxiliary loss; This is the k-layer feature map output by the multi-scale feature pyramid, and K is the total number of layers in the feature pyramid; To match the feature map of the kth layer The corresponding preset standard defect topology feature map; Euler ( The function is calculated for the Euler number. The square of the L2 norm.

[0048] Secondly, this application also provides an AI vision-based engine part defect detection device, including:

[0049] The feature extraction and data augmentation module is used to acquire labeled real engine parts images and corresponding defect masks to form initial samples; a multi-scale topology-aware feature extraction network is constructed, and the multi-scale topology-aware feature extraction network is trained based on the initial samples to obtain the trained feature extraction network.

[0050] The framework construction and working condition training module is used to select defect samples from the initial samples, process the defect samples using the trained feature extraction network to obtain the deep feature map and topological saliency map of the defect samples; encode the defect data based on the deep feature map and topological saliency map to obtain the defect encoding result; and synthesize the feature space based on the defect encoding result to generate a large-scale synthetic augmented training dataset.

[0051] The knowledge distillation and engine generation module is used to construct a defect detection framework integrating a dynamic domain adaptive module, using the trained feature extraction network as a fixed and non-updateable backbone. The defect detection framework is trained under multiple conditions based on a large-scale synthetic augmentation training dataset to obtain a robust teacher detection model and parameter offset library. Based on the robust teacher detection model and parameter offset library, a two-stage progressive knowledge distillation process is performed on the preset lightweight student network architecture to obtain the defect detection engine.

[0052] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the first aspect.

[0053] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the first aspect.

[0054] The aforementioned AI vision-based engine part defect detection method, device, equipment, and medium first acquire initial samples and train a multi-scale topology-aware feature extraction network, addressing the lack of defect topology structure and multi-scale feature mining in traditional feature extraction, thus improving the depth and accuracy of defect feature extraction. Secondly, defect encoding and feature space synthesis are performed based on deep feature maps and topological saliency maps to generate a large-scale synthetic augmented training dataset, solving the problems of scarce defect samples and high annotation costs, and improving the diversity and sufficiency of training data. Furthermore, a defect detection framework integrating a dynamic domain adaptive module is constructed and trained under multi-condition simulations, solving the model domain shift problem under multiple conditions and improving the robustness and environmental adaptability of the detection model. Finally, a defect detection engine is obtained through two-stage progressive knowledge distillation, improving the model's lightweight nature and edge deployment adaptability. Attached Figure Description

[0055] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0056] Figure 1 A flowchart of an AI vision-based engine part defect detection method provided as an exemplary embodiment of the present invention;

[0057] Figure 2 A flowchart of a method for generating a large-scale synthetic augmented training dataset is provided as an exemplary embodiment of the present invention;

[0058] Figure 3 This is a schematic diagram of an AI vision-based engine part defect detection device provided as an exemplary embodiment of the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0060] In one embodiment, such as Figure 1 As shown, an AI vision-based method for detecting defects in engine parts is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, or to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0061] S101: Obtain labeled real engine parts images and corresponding defect masks to form initial samples; construct a multi-scale topology-aware feature extraction network, and train the multi-scale topology-aware feature extraction network based on the initial samples to obtain the trained feature extraction network.

[0062] Specifically, defects in engine parts, such as cracks and pores, possess both microscopic details and macroscopic topological features. Therefore, by constructing a multi-scale topology-aware feature extraction network, it is possible to simultaneously capture the multi-scale semantic information and topological relationships of defects, laying the foundation for subsequent encoding and data synthesis. For example, firstly, images of real parts from the engine production line are captured using industrial cameras. Pixel-level annotation tools are then used to label defect areas, forming corresponding defect masks. This ensures the accuracy and effectiveness of the initial sample annotations. While the initial sample size does not need to be large, it must cover common defect types to guarantee the effectiveness of the network initialization training. Subsequently, a multi-scale topology-aware feature extraction network can be constructed based on a deep learning framework such as PyTorch. This integrates feature outputs from different levels through a multi-scale feature fusion mechanism, while embedding a topology-aware mechanism to enhance the learning of the spatial structure of defects. During training, the initial samples can be divided into training and validation sets according to a preset ratio. The defect segmentation loss is the core optimization objective. The network parameters are iteratively updated through the backpropagation algorithm. During training, the defect feature extraction accuracy and loss value changes on the validation set are monitored in real time. If the loss value remains stable below the preset threshold for a preset number of consecutive rounds, training can be stopped, and the trained feature extraction network can be obtained.

[0063] S102: Select defective samples from the initial samples, process the defective samples using the trained feature extraction network to obtain the deep feature map and topological saliency map of the defective samples; encode the defective data based on the deep feature map and topological saliency map to obtain the defect encoding result; synthesize the feature space based on the defect encoding result to generate a large-scale synthetic augmented training dataset.

[0064] Specifically, the depth feature maps and topological saliency maps of a small number of real defect samples already contain the core semantic information and structural features of the defects. By encoding these core information into structured defect coding results, the abstraction and reuse of defect features can be achieved. Furthermore, images of defect-free normal parts possess a sufficient quantity and diverse background information. Spatially synthesizing the defect coding results with the features of normal images can accurately implant defect features while preserving the background authenticity of normal part images, generating synthetic defect samples that combine authenticity and diversity. For example, based on the defect mask in the initial samples, defect samples containing effective defect regions are first selected, while defect-free normal samples are excluded to ensure the targeting of feature processing. Subsequently, the selected defect samples are input into the feature extraction network trained in S101. Through the forward propagation calculation of the network, the output is a depth feature map that can characterize the essential features of the defects and a topological saliency map that highlights the spatial distribution of the defects. The depth feature map contains semantic information such as the texture, grayscale, and shape of the defects, while the topological saliency map can clearly define the boundary and internal structural relationship between the defects and the background. Defect data encoding based on the two types of feature maps described above can transform high-dimensional features into low-dimensional, structured defect encoding results through feature dimension compression and core information extraction. This encoding result can accurately represent the category, morphology, and topological features of defects. Subsequently, a large number of defect-free engine part images can be collected, and a trained feature extraction network can be used to extract normal intermediate feature maps from their preset intermediate layers, preserving the background and structural features of normal parts. Finally, based on the defect encoding results, defect features can be embedded and synthesized in the feature space of the normal intermediate feature maps. Through feature-level fusion and reconstruction, a synthetic feature map containing defects is generated, which is then restored to a visualized synthetic image with defects through image decoding, and a corresponding pixel-level synthetic defect mask is generated simultaneously. The large-scale synthetic augmentation training dataset generated through this process is not only abundant but also exhibits diversity in the morphology and location of synthetic defects, while maintaining background and imaging characteristics consistent with real part images. This effectively compensates for the scarcity of real defect samples and reduces the time and cost of manual annotation.

[0065] S103: Using the trained feature extraction network as a fixed and non-updateable backbone, a defect detection framework integrating dynamic domain adaptive modules is constructed; the defect detection framework is trained under multiple working conditions based on a large-scale synthetic augmentation training dataset to obtain a robust teacher detection model and parameter offset library; based on the robust teacher detection model and parameter offset library, a two-stage progressive knowledge distillation process is performed on the preset lightweight student network architecture to obtain a defect detection engine.

[0066] Specifically, the actual engine production environment presents various operating conditions, such as changes in light intensity, oil contamination, and component orientation shifts, which can easily lead to domain shift in the model. Fixed-structure models struggle to adapt to dynamically changing conditions, and traditional detection models have large parameter counts and high computational complexity, failing to meet the low-computing-power, low-latency requirements of edge devices. Therefore, a dynamic domain adaptive module can be integrated to achieve multi-condition adaptation of the model, and a two-stage progressive knowledge distillation process can be used to retain core detection capabilities within a lightweight model. For example, the feature extraction network trained in S101 is first used as a fixed and non-updateable backbone to ensure that the backbone network already possesses defect feature extraction capabilities, and its weights are fixed to prevent subsequent training from damaging the basic feature extraction capabilities. Subsequently, a dynamic domain adaptive module is integrated into the backbone network to construct a defect detection framework. This module can perceive the operating condition information of the input image in real time and dynamically adjust the model parameters to adapt to the detection requirements under different operating conditions. By employing a large-scale synthetic augmentation training dataset generated by S102 to perform multi-condition simulation enhancement on the framework, it can simulate the differences in working conditions such as lighting changes, noise interference, and geometric transformations in actual production. This allows the framework to learn the changing patterns of defect characteristics under various complex working conditions, thereby improving the model's robustness and resulting in a robust teacher detection model and a parameter offset library. The robust teacher detection model exhibits high detection accuracy and adaptability to complex environments, while the parameter offset library records the adjustment patterns of model parameters under different working conditions, providing a basis for subsequent lightweight model optimization.

[0067] In illustrative terms, knowledge distillation is a model compression technique designed to transfer knowledge from a complex teacher model to a lightweight student model while preserving the teacher model's performance. Based on a pre-defined lightweight student network architecture, a two-stage progressive knowledge distillation technique can transfer the multi-domain adaptation capabilities of a robust teacher detection model and its parameter offset library to the lightweight student network. The first stage supervises the training of the medium-sized student network using the teacher model's output, ensuring the transfer of core detection capabilities. The second stage combines the parameter offset library to construct a multi-domain expert model, guiding the lightweight network to learn cross-condition adaptation capabilities and ensuring that the detection performance of the model does not degrade after lightweighting. Finally, model optimization yields a defect detection engine. This engine significantly reduces the number of parameters and computational cost while retaining the core detection capabilities of the teacher model, meeting the deployment requirements of edge devices.

[0068] The aforementioned method first processes engine part images through a multi-scale topology-aware feature extraction network to accurately extract depth feature maps and topological saliency maps, addressing the shortcomings of traditional methods in mining complex defect features and improving defect recognition capabilities. Second, based on a large-scale synthetic augmented training dataset and a dynamic domain adaptive module, the defect detection framework is trained under multiple operating conditions, overcoming the challenge of model domain shift under complex conditions and enhancing model robustness. Finally, through a two-stage progressive knowledge distillation process, the knowledge from the robust teacher model is transferred to a lightweight student network to generate a defect detection engine, improving detection efficiency and meeting the demands of industrial production for high-efficiency inspection.

[0069] In one embodiment, a multi-scale topology-aware feature extraction network is constructed, and the multi-scale topology-aware feature extraction network is trained based on initial samples to obtain a trained feature extraction network, including:

[0070] An initial feature extraction network with a dual-branch structure and a multi-scale feature pyramid is constructed. The dual-branch structure is used to collaboratively extract features of different dimensions.

[0071] A topology-aware attention module is embedded in each layer of the multi-scale feature pyramid to construct a multi-scale topology-aware feature extraction network; the topology-aware attention module includes a channel attention submodule, a spatial attention submodule, and a topological saliency calculation submodule;

[0072] The joint loss function of the multi-scale topology-aware feature extraction network is determined. The joint loss function is composed of a weighted sum of defect segmentation loss and topology-aware auxiliary loss. The topology-aware auxiliary loss is used to constrain the multi-scale topology-aware feature extraction network to learn the topological structure features of defects.

[0073] The initial samples are input into the multi-scale topology-aware feature extraction network. The multi-scale topology-aware feature extraction network is iteratively trained based on the joint loss function. When the value of the joint loss function converges to a preset threshold, the training is stopped, and the trained feature extraction network is obtained.

[0074] Specifically, the dual-branch structure comprises two feature extraction branches, each targeting different dimensions of engine part defects. These branches work together to cover both local details and global correlation information of the defects. The multi-scale feature pyramid integrates the feature maps output by each node at different levels of the initial feature extraction network, forming a feature set containing defect features at different scales, thus enabling feature capture of defects of different sizes. Subsequently, topology-aware attention modules can be embedded in each layer of the multi-scale feature pyramid to construct a multi-scale topology-aware feature extraction network. The channel attention submodule within the topology-aware attention module calculates the importance weight of each channel by statistically calculating the channel dimension of the feature map, thereby strengthening the information of defect-related feature channels. The spatial attention submodule enhances the spatial dimension of the feature map, highlighting the feature information of the spatial region where the defect is located. The topological saliency calculation submodule extracts and encodes topological information from the feature map based on the topological characteristics of the defect, enabling the module to capture the topological features of the defect.

[0075] Furthermore, the joint loss function of the multi-scale topology-aware feature extraction network can be determined. This function is used to simultaneously constrain the network's defect segmentation accuracy and topology feature learning effect during training. Its mathematical expression is:

[0076]

[0077] in, This is the loss weighting coefficient, used to balance the contribution of the two loss terms; The defect segmentation loss is expressed as follows:

[0078]

[0079] In the formula, Predicted defect mask output by a multi-scale topology-aware feature extraction network. This is a mask for the actual defect. and The height and width of the mask; For predicting defect masks The pixel value at the i-th row and j-th column takes the value 0 or 1. 0 indicates that there is no defect at the position, and 1 indicates that there is a defect at the position. It is used to characterize the local pixel state of the defect area predicted by the model. mask for real defects The pixel value at the i-th row and j-th column takes the value 0 or 1, and its semantics are... Consistency refers to the pixel-level true labels used in model training to constrain the accuracy of the predicted mask; It is a minterm, and This is used to avoid cases where the denominator is 0; Topology-aware auxiliary loss, its expression is:

[0080]

[0081] In the formula, This is the k-layer feature map output by the multi-scale feature pyramid, and K is the total number of layers in the feature pyramid; To match the feature map of the kth layer The corresponding preset standard defect topology feature map; Euler ( The Euler number calculation function is used to characterize the topological structure information after the feature map and the real defect mask are fused. The square of the L2 norm is used to calculate the difference between the topological information corresponding to the network output features and the standard defect topological information.

[0082] The initial samples are input into a multi-scale topology-aware feature extraction network. The network can be iteratively trained based on the aforementioned joint loss function. In each training round, the network performs forward computation on the initial input samples to obtain the predicted defect mask and feature maps for each layer. Then, the loss value for the current training round is calculated using the joint loss function. Subsequently, the loss value is propagated to the parameters of each layer of the network through backpropagation, and the parameters are updated to reduce the loss value. This iterative process is continued until the joint loss function value stabilizes below a preset threshold for several consecutive training rounds. At this point, the network training is considered converged, training is stopped, and the trained feature extraction network is obtained.

[0083] In one embodiment, the trained feature extraction network is used to process the defect samples to obtain a deep feature map and a topological saliency map of the defect samples, including:

[0084] The defect sample is input into the trained feature extraction network. The local detail features and long-range global dependency features of the defect sample are extracted through a dual-branch structure, and then fused through a multi-scale feature pyramid to obtain a preliminary multi-scale feature map.

[0085] The initial multi-scale feature map is input into the topology-aware attention module. The importance weight of each feature channel is calculated through the channel attention submodule to optimize the initial multi-scale feature map and obtain the optimized feature map.

[0086] The spatial attention submodule is used to enhance the spatial dimension features of the optimized feature map, generating a spatially enhanced feature map.

[0087] The topological saliency calculation submodule extracts the defect topology from the spatial augmented feature map to generate a topological saliency map; the spatial augmented feature map and the topological saliency map are then fused to obtain a depth feature map.

[0088] Specifically, based on the defect mask in the initial samples, it can be determined whether there are non-zero pixel regions (i.e., corresponding defect regions) within the mask. This allows for the selection of samples containing valid defects and the exclusion of normal samples without defects, ensuring the targeted nature of subsequent feature processing. The selected defect samples are then input into a trained feature extraction network. This network's dual-branch structure can perform feature extraction separately. For example, one branch uses a convolutional neural network structure, extracting local detail features of the defect samples, such as edge textures and microscopic features like small protrusions, through multi-layer convolution and pooling operations. The other branch can use a visual transformer structure, capturing long-range global dependencies between defects and background, and between different regions of the defect, by dividing the sample image into blocks and calculating attention weights between image blocks. This captures features such as the continuous distribution of cracks and the spatial clustering of pores. The extracted features are then input into a multi-scale feature pyramid, where each layer corresponds to a different feature scale. By upsampling and element-wise addition, the features from both branches are fused at each scale to obtain a preliminary multi-scale feature map covering defect information of different sizes, denoted as . , Each element corresponds to a feature value at a certain location in the feature map, and its dimension matches the scale of the input sample and the network structure.

[0089] Subsequently, the preliminary multi-scale feature maps will be generated. The input to the topology-aware attention module is first processed by the channel attention submodule, which first... Performing global average pooling and global max pooling along the spatial dimension yields two channel description vectors, denoted as follows: and ,in Each element is the average value of all spatial location features of the corresponding channel. Each element represents the maximum value of all spatial location features for the corresponding channel. These two vectors are concatenated along the channel dimension and input into a network containing two fully connected layers to calculate the importance weight vector for each feature channel. The formula for its calculation is:

[0090]

[0091] In the formula, This is the Sigmoid activation function, used to map weight values ​​to the range of 0 to 1; It is the ReLU activation function, used to introduce nonlinear feature transformation; , The learnable parameter matrix of the fully connected layer; This indicates that the two channel description vectors are concatenated along the channel dimension. and By performing channel-by-channel weighted multiplication, the optimized feature map is obtained. This strengthens the feature channels related to defects and suppresses interference from irrelevant channels.

[0092] Specifically, the optimized feature map can be processed through the spatial attention submodule. Processing is then performed. For example, this submodule first processes... Performing global average pooling and global max pooling along the channel dimension yields two single-channel spatial feature maps, denoted as follows: and ,in The value at each spatial location is the average of the features of all channels at that location. Each spatial location value is the maximum value of all channel features at that location. These two spatial feature maps are concatenated along the channel dimension to form a dual-channel feature map, which is then mapped to a single-channel spatial weight map via a convolutional layer. , Each element corresponds to an importance weight for a specific spatial location in the feature map. and Element-wise multiplication can generate spatially enhanced feature maps. This highlights the feature information of the spatial region where the defect is located and weakens the interference from the background region. Furthermore, the spatial feature map can be enhanced using the topological saliency calculation submodule. For each spatial location, a local neighborhood of a preset size is selected. Topological properties such as connectivity and number of holes within the neighborhood are calculated. Then, a convolutional layer maps these local topological properties to corresponding topological saliency values, ultimately generating a representation of the topological saliency value. A scale-consistent topological saliency map T is generated. Larger element values ​​in T indicate more significant defect topological structures at the corresponding locations (e.g., linear connections of cracks, closed regions of pores). Finally, the spatially enhanced feature map can be... Feature fusion is performed with the topological saliency graph T, i.e., T is first expanded to include features from the topological saliency graph T. Using the same number of channels, we then perform element-wise addition on both to obtain the depth feature map. This feature map contains both the details and spatial information of the defect, as well as the topological features of the defect, which can more accurately represent the essential attributes of the defect.

[0093] In one embodiment, such as Figure 2 As shown, defect data is encoded based on deep feature maps and topological saliency maps to obtain defect encoding results; feature space synthesis is performed based on the defect encoding results to generate a large-scale synthetic augmented training dataset, including:

[0094] S201. Construct a meta-learning task set based on deep feature maps and topological saliency maps. The meta-learning task set contains multiple K-shot defect classification sub-tasks.

[0095] Specifically, the K-shot defect classification subtask is defined as follows: each subtask corresponds to a specific defect category. The task includes a support set and a query set. The support set consists of the deep feature maps and topological saliency maps of K defect samples within that category. The query set consists of the deep feature maps and topological saliency maps of samples from that category and several other defect categories. The objective is to determine whether a sample in the query set belongs to the defect category based on the feature information of the support set. When constructing the meta-learning task set, the deep feature maps and topological saliency maps of different defect categories can be used as sample feature representations. For each defect category, K sample features are randomly selected to form the support set, and then sample features from the same category and different categories are selected to form the query set, thus constructing a K-shot subtask. This process is repeated to cover all target defect categories, ultimately forming a meta-learning task set containing multiple subtasks.

[0096] S202. The meta-learner is trained based on the meta-learning task set to obtain a fully trained defect condition encoder.

[0097] The meta-learner can adopt a prototype network structure. During training, for each K-shot subtask, the meta-learner can first perform feature fusion (e.g., element-wise addition) on the deep feature map and topological saliency map within the support set, and then calculate the mean of the fused features to obtain the feature prototype for that defect category. The calculation formula is as follows:

[0098]

[0099] In the formula, For the feature prototype of the defect category, To support the depth feature map of the i-th sample in the set, This is the topological saliency map for the corresponding samples. This represents a feature fusion operation that adds elements one by one. To support the number of samples within the set, the meta-learner then calculates the distance between the fused features of the query set samples and the prototype, using this distance to determine the category of the query set samples. This process is iterated across multiple K-shot subtasks, and the parameters of the meta-learner are updated via backpropagation, enabling the meta-learner to quickly summarize the core features of the defect category from a small number of samples. After training, the module in the meta-learner used to calculate the feature prototype is the defect conditional encoder, which encodes the deep feature maps and topological saliency maps of a small number of defect samples into vectors representing the core semantics and topological patterns of that category.

[0100] S203. Obtain a normal image of a defect-free engine part, and use the trained feature extraction network to extract features from the normal image of the defect-free engine part to obtain a normal intermediate feature map output by the preset intermediate layer in the trained feature extraction network.

[0101] Indicatively, the preset intermediate layer can be a layer in the feature extraction network that preserves the background structure and texture information of normal parts (such as the penultimate layer of the network). During the extraction process, a defect-free normal image can be input into the trained feature extraction network to perform forward propagation. When the operation reaches this preset intermediate layer, the corresponding feature map is output, which is the normal intermediate feature map. This feature map preserves the background information such as the shape and surface texture of normal engine parts, while also possessing features similar to those of defective samples. Figure 1 The dimensions and feature distribution of the given information.

[0102] S204. Construct a conditional generative adversarial network, which includes a generator and an image decoder.

[0103] Specifically, the generator's structure consists of deconvolutional layers, batch normalization layers, and activation function layers, with its input being a concatenation of multimodal information. The image decoder's structure can consist of upsampling layers, convolutional layers, and activation function layers, its function being to reconstruct the feature map into a pixel-level visual image. The training objective of the conditional generative adversarial network is: the generator generates feature perturbations that meet the requirements based on the input conditions, the image decoder decodes the feature map into a realistic image, and simultaneously prevents the discriminator from distinguishing between generated and real samples.

[0104] S205. Encode the preset defect categories by training a complete defect condition encoder, generate defect condition vectors that represent the core semantics and topological patterns of the defect categories, and output the defect condition vectors as the defect encoding results.

[0105] Specifically, the preset defect category can be the type of defect detected by the target, such as cracks or pores. During the encoding process, a small number of samples of this preset defect category can be selected, and their depth feature maps and topological saliency maps can be input into the defect conditional encoder. The encoder calculates the feature prototypes of these samples, and the output feature prototypes are the defect conditional vectors. This vector integrates the core semantics of this type of defect (such as the linear texture of cracks) and topological patterns (such as the connectivity of cracks), which can guide the generation of subsequent defect features.

[0106] S206. Input the normal intermediate feature map, defect condition vector and random noise into the generator, and learn the defect feature perturbation through the generator to generate the synthetic defect feature perturbation; superimpose the normal intermediate feature map and the synthetic defect feature perturbation element by element to obtain the synthetic defect feature map.

[0107] Specifically, before inputting the normal intermediate feature map, defect condition vector, and random noise into the generator, the defect condition vector can be expanded to the same spatial size as the normal intermediate feature map, and the three can be concatenated along the channel dimension. After input, the generator can learn the feature change rules that conform to the defect condition vector through deconvolution and activation function operations, and output a synthetic defect feature perturbation with the same size as the normal intermediate feature map. This perturbation corresponds to the feature representation of the defect in the feature space. Subsequently, the feature value of each spatial position of the normal intermediate feature map can be added to the feature value of the corresponding position of the synthetic defect feature perturbation, thus obtaining a synthetic defect feature map that integrates the features of the normal background and the defect.

[0108] S207. Input the synthesized defect feature map into the trained feature extraction network and image decoder respectively to generate a synthesized image with defects and the corresponding pixel-level synthesized defect mask.

[0109] Schematic illustration: Inputting the synthesized defect feature map into the trained feature extraction network allows for forward propagation to adjust the features to the network's output feature distribution. The adjusted features are then input into an image decoder, which uses upsampling and convolution operations to reconstruct a pixel-level synthesized image with defects. This image retains the background information of the normal part while containing defect morphologies conforming to a preset defect category. Simultaneously, a corresponding pixel-level synthesized defect mask can be generated based on the spatial location of the perturbation in the synthesized defect features. In this mask, pixels in the perturbation area have a value of 1, representing the defect area, while pixels in other areas have a value of 0, representing the background area.

[0110] S208. Change to different preset defect categories and repeat steps S205 to S207 to accumulate and generate a large-scale synthetic augmented training dataset.

[0111] For each target defect category (such as sand holes and scratches), steps S205 to S207 can be performed, namely, the process of "encoding and generating defect condition vectors - generating synthetic defect feature maps - generating synthetic images and masks". Then, all generated synthetic images with defects and corresponding pixel-level synthetic defect masks are summarized, and finally a large-scale synthetic augmentation training dataset with sufficient quantity and covering multiple defect categories can be formed.

[0112] In one embodiment, a defect detection framework integrating a dynamic domain adaptive module is constructed using a trained feature extraction network as a fixed and non-updateable backbone. The defect detection framework is then trained under multiple operating conditions using a large-scale synthetic augmentation training dataset to obtain a robust teacher detection model and a parameter offset library, including:

[0113] The trained feature extraction network is used as a fixed and non-updateable backbone, and combined with the defect detection head to build a basic detection model; the basic detection model contains multiple feature extraction layers, and the weights of the basic detection model include dynamic target layer weights.

[0114] In the multi-layer feature extraction layer of the basic detection model, a high-level feature layer is determined, and a dynamic domain adaptive module is integrated after the high-level feature layer to form a defect detection framework; the dynamic domain adaptive module includes a domain classifier and a parameter offset generator; the high-level feature layer is used to output abstract feature representations;

[0115] Multi-condition simulation enhancement operations are performed on images in a large-scale synthetic enhancement training dataset, and a corresponding simulation condition domain label is assigned to each enhanced image to obtain the synthetic enhancement training dataset. The multi-condition simulation enhancement operations include brightness and contrast adjustment, oil stain noise addition, and random affine transformation.

[0116] The synthetic augmented training dataset is input into the defect detection framework for training. During training, a domain classifier identifies the working conditions of the training images in the synthetic augmented training dataset, outputting a domain description vector. A parameter offset generator generates corresponding parameter offsets based on the domain description vector. The parameter offsets are dynamically superimposed onto the dynamic target layer weights of the base detection model to form an instantaneous inference model adapted to the current working conditions. Defect detection is performed on the training images based on the instantaneous inference model, and the detection loss and domain classification alignment loss are calculated.

[0117] The trainable parameters of the defect detection framework are updated by backpropagation based on the detection loss and the domain classification alignment loss, resulting in a robust teacher detection model. Effective parameter offsets generated during training for each preset stable simulation condition are collected, classified and stored according to the domain label of the simulation condition, forming a parameter offset library.

[0118] Specifically, the defect detection head can consist of a classification branch and a regression branch. The classification branch outputs the probability distribution of defect categories through fully connected layers, while the regression branch outputs the bounding box coordinates of the defect region through convolutional layers. Together, they can achieve defect identification and localization. The multi-layer feature extraction layers of the basic detection model correspond to different levels of the backbone network. The dynamic target layer weights refer to several preset weights (such as the weights of the last two convolutional layers of the backbone network). These weights can be adjusted by superimposing parameter offsets to adapt to different working conditions.

[0119] Indicatively, the high-level feature layer is the deepest feature extraction layer in the basic detection model. Its output abstract features can represent the global semantic information of the image and are more likely to capture the feature distribution differences under different working conditions. The domain classifier can be composed of multiple fully connected layers and activation functions. Its input is the output of the high-level feature layer, and its function is to identify the working condition type corresponding to the input image, outputting a domain description vector with a dimension matching the number of working condition categories. The parameter offset generator can be composed of convolutional layers and batch normalization layers. Its input is the domain description vector output by the domain classifier, and its output is a parameter offset with the same dimension as the weights of the dynamic target layer in the basic detection model, used to adjust the feature extraction logic of the dynamic target layer. Subsequently, multi-working-condition simulation enhancement operations can be performed on images in the large-scale synthetic enhancement training dataset. Among them, brightness and contrast adjustment can be achieved by adjusting the grayscale range of image pixels through linear transformation to simulate the changes in light intensity in the production environment. Oil stain noise addition can be achieved by generating pixel blocks with irregular textures and superimposing them on the image surface to simulate the oil stain adhesion state on the surface of the parts, while random affine transformation can be achieved by performing rotation, translation, and scaling operations on the image to simulate the working condition of part posture displacement. Furthermore, each enhanced image can be assigned a corresponding simulated working condition domain label, which is an identifier corresponding to the enhancement operation (such as low brightness, heavy oil stains, attitude shift), and can be used for subsequent working condition classification and alignment.

[0120] Specifically, a synthetic augmented training dataset can be input into the defect detection framework for training. During the forward pass of training, after the training image is input into the basic detection model, high-level abstract features are obtained through multi-layer feature extraction. These features are input into the domain classifier to obtain a domain description vector. The parameter offset generator can generate parameter offsets based on the domain description vector, which are then added element-wise to the dynamic target layer weights of the basic detection model to obtain the adjusted dynamic target layer weights. These weights form the instantaneous inference model, which can perform defect detection on the image, outputting defect category predictions and bounding box predictions, and calculating the detection loss and domain classification alignment loss. Illustratively, the detection loss consists of classification loss and regression loss. The classification loss can use cross-entropy loss to characterize the error in category prediction, while the regression loss can use IOU loss to characterize the error in bounding box localization. The domain classification alignment loss is used to constrain the feature distribution of the same working condition to be more concentrated; its expression is:

[0121]

[0122] In the formula, For the number of working condition categories, To train the real-world labels (one-hot encoded) corresponding to the images, This represents the predicted probability of the corresponding working condition output by the domain classifier.

[0123] Specifically, the trainable parameters of the defect detection framework can be updated through backpropagation based on the detection loss and domain classification alignment loss. This means only the trainable parameters of the dynamic domain adaptation module (domain classifier, parameter offset generator) and the defect detection head are updated, while the backbone weights of the basic detection model remain fixed, ensuring that the feature extraction capability of the backbone is not affected. Training can be stopped when the detection loss and domain classification alignment loss remain consistently below the preset loss threshold for multiple rounds. At this point, the defect detection framework is a robust teacher detection model, capable of adapting to defect detection needs under various operating conditions. Furthermore, effective parameter offsets generated during training for each preset stable simulated operating condition are collected. These effective parameter offsets refer to parameter offsets that improve defect detection accuracy under the corresponding simulated operating condition. After collection, they can be stored according to the simulated operating condition domain labels, with each domain label corresponding to a set of parameter offsets. The resulting parameter offset library can then be used for cross-operating condition adaptation of the lightweight model.

[0124] In one embodiment, based on a robust teacher detection model and a parameter offset library, a two-stage progressive knowledge distillation process is performed on a pre-defined lightweight student network architecture to obtain a defect detection engine, including:

[0125] We construct medium-sized and lightweight student network architectures. The number of parameters in the medium-sized student network is between that of the robust teacher detection model and the lightweight student network architecture. The lightweight student network architecture is constructed using depthwise separable convolutions and compact attention modules.

[0126] A large-scale synthetic augmentation training dataset is input into the robust teacher detection model to obtain the teacher intermediate feature map, the teacher final prediction result, and the teacher topological saliency map. The teacher intermediate feature map, the teacher final prediction result, and the teacher topological saliency map are used as supervision signals to train the medium-sized student network and obtain the first-stage distilled student model.

[0127] Select multiple sets of parameter offsets corresponding to different working conditions from the parameter offset library, and superimpose the parameter offsets corresponding to different working conditions onto the robust teacher detection model to construct multiple domain expert models adapted to different working conditions.

[0128] The large-scale synthetic augmented training dataset is augmented according to the corresponding working conditions to obtain multiple sets of working condition adaptation datasets; each set of working condition adaptation datasets is input into the corresponding domain expert model to obtain multiple sets of expert output results;

[0129] The first-stage distillation student model is used as the intermediate teacher model, and the lightweight student network architecture is used as the student model. The large-scale synthetic augmentation training dataset and the working condition adaptation datasets of each group are respectively input into the intermediate teacher model and the student model. The student model is trained so that the output of the student model simultaneously approximates the prediction results of the intermediate teacher model and the output results of each group of experts, thus obtaining the lightweight student model.

[0130] The lightweight student model is subjected to structured channel pruning. The feature contribution of each channel in the lightweight student model is calculated, and redundant channels with feature contribution values ​​lower than the preset contribution threshold are removed to obtain the pruned model.

[0131] The pruned model is subjected to integer quantization to obtain the quantized model; the inference compiler of the target edge computing platform is used to compile and optimize the quantized model to generate a defect detection engine.

[0132] Specifically, directly transferring knowledge from a large-parameter teacher model to a lightweight model can easily lead to the loss of core feature information. Therefore, a medium-sized student network can be used as a transitional carrier for knowledge transfer to reduce information attenuation. The lightweight student network architecture is constructed using depthwise separable convolutions and compact attention modules. Depthwise separable convolutions can decompose standard convolutions into depthwise convolutions (channel-wise convolutions) and pointwise convolutions (1×1 convolutions), significantly reducing the number of parameters and computational cost while maintaining feature extraction capabilities. The compact attention module can retain only the core computational logic of channel attention (global pooling + a single fully connected layer), simplifying redundant computations of spatial attention to adapt to the resource constraints of the lightweight model.

[0133] Inputting a large-scale synthetic augmentation training dataset into a robust teacher detection model yields teacher intermediate feature maps, teacher final prediction results, and teacher topological saliency maps. The teacher intermediate feature maps are the feature outputs of a pre-defined layer in the teacher model, containing intermediate semantic representations of defects. The teacher final prediction results include defect category probabilities and bounding box coordinates. The teacher topological saliency map represents the defect topological structure distribution output by the teacher model. These three datasets can then be used as supervision signals to train a medium-sized student network. During training, a joint distillation loss can be used to constrain the learning of the medium-sized student network; the loss expression is as follows:

[0134]

[0135] In the formula, , These are intermediate feature maps for the medium-sized student network and the teacher model, respectively. MSE is the mean squared error, used to constrain the feature distribution. , These are the final prediction results for the two, and KL represents the KL divergence to constrain prediction consistency. , These are the topological saliency graphs of the two, respectively. The L2 norm is used to constrain topological learning; , , represents the weighting coefficients of each loss term. Through backpropagation of this joint loss, the medium-sized student network can learn the feature extraction, defect prediction, and topology awareness capabilities of the teacher model, thus obtaining the first-stage distilled student model.

[0136] Specifically, multiple sets of parameter offsets corresponding to different working conditions can be selected from the parameter offset library. These offsets are then superimposed onto the robust teacher detection model, meaning each set of parameter offsets is element-wise added to the preset dynamic target layer weights in the teacher model to obtain adjusted weights. Each adjusted teacher model corresponds to a specific working condition, thus becoming a domain expert model adapted to that condition. This model maintains the same detection accuracy as the teacher model under the corresponding working condition while possessing working condition-specific feature processing capabilities. Similarly, based on the multi-working-condition simulation enhancement operation described in the above embodiments, the large-scale synthetic enhancement training dataset can be enhanced according to the corresponding working conditions to obtain multiple sets of working-condition adapted datasets. Each dataset corresponds to one working condition, and when input into the corresponding domain expert model, the expert output results are accurate defect predictions (category + bounding box) for that working condition. These results contain defect detection knowledge under multiple working conditions and can be used to constrain the cross-working-condition capabilities of subsequent lightweight models. Subsequently, the student model distilled in the first stage can be used as the intermediate teacher model, and a lightweight student network architecture can be used as the student model. The large-scale synthetic augmentation training dataset and the various work condition adaptation datasets are input into the intermediate teacher model and the student model, respectively. Since the intermediate teacher model has mastered the core capabilities of the teacher model, its prediction results can convey basic detection knowledge, while the output results of each group of experts can convey multi-work condition adaptation knowledge. Therefore, during training, the loss of the student model can include the prediction loss of the intermediate teacher model and the prediction loss of the output results of each group of experts. By weighted summation to constrain the consistency of the student model's output, it is ensured that it simultaneously possesses basic detection accuracy and cross-work condition robustness. Through iterative training, the output of the student model can simultaneously approximate the prediction results of the intermediate teacher model and the output results of each group of experts, resulting in a lightweight student model.

[0137] Furthermore, structured channel pruning can be performed on the lightweight student model to calculate the feature contribution of each channel. The channel contribution is calculated as follows: forward computation is performed on the validation set, recording the absolute value of the gradient of each channel's output with respect to the final loss. The average of these values ​​is taken as the contribution of that channel; a lower contribution indicates a smaller impact on the detection result. When removing redundant channels, only channels with contributions higher than a preset threshold can be retained, and the input dimension of subsequent layers can be adjusted to match the number of pruned channels. This further reduces the model's parameter count and computational cost while avoiding the loss of core feature channels. By performing integer quantization on the pruned model, the floating-point weights and activation values ​​can be converted to low-bit integers (e.g., INT8). For example, forward computation on a calibration dataset can be used to statistically analyze the distribution range of weights and activation values, determine the scaling factor, multiply the floating-point number by the scaling factor, and then round down to reduce storage and computational resource consumption. Finally, the quantized model can be compiled and optimized using the inference compiler of the target edge computing platform. This can be achieved through operator fusion (merging consecutive convolution and batch normalization operations into a single operator), memory reuse (optimizing tensor memory allocation), and platform-specific operator mapping (converting model operators into hardware-accelerated operators for the edge platform). This will generate a defect detection engine adapted to the target edge device, which can achieve efficient and accurate defect detection of engine parts under low computing power.

[0138] Based on the same inventive concept, this application also provides an AI vision-based engine part defect detection device for implementing the aforementioned AI vision-based engine part defect detection method. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of one or more AI vision-based engine part defect detection device embodiments provided below can be found in the limitations of the AI ​​vision-based engine part defect detection method described above, and will not be repeated here.

[0139] In one exemplary embodiment, such as Figure 3 As shown, an AI vision-based engine part defect detection device 300 is provided, including:

[0140] The feature extraction and data augmentation module 301 is used to acquire labeled real engine part images and corresponding defect masks to form initial samples; construct a multi-scale topology-aware feature extraction network, and train the multi-scale topology-aware feature extraction network based on the initial samples to obtain the trained feature extraction network.

[0141] The framework construction and working condition training module 302 is used to select defect samples from the initial samples, process the defect samples using the trained feature extraction network, and obtain the depth feature map and topological saliency map of the defect samples; encode the defect data based on the depth feature map and topological saliency map to obtain the defect encoding result; and synthesize the feature space based on the defect encoding result to generate a large-scale synthetic augmented training dataset.

[0142] The knowledge distillation and engine generation module 303 is used to construct a defect detection framework integrating a dynamic domain adaptive module, using the trained feature extraction network as a fixed and non-updateable backbone; the defect detection framework is trained under multiple working conditions based on a large-scale synthetic augmentation training dataset to obtain a robust teacher detection model and parameter offset library; based on the robust teacher detection model and parameter offset library, a two-stage progressive knowledge distillation process is performed on the preset lightweight student network architecture to obtain the defect detection engine.

[0143] In one exemplary embodiment, the present invention also provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the AI ​​vision-based engine part defect detection method of this application. A multi-core processor is preferred to improve the system's parallel processing capability. The memory provides sufficient temporary storage space to support program execution and data processing. The memory capacity should be large enough to accommodate large amounts of data and computational tasks.

[0144] In one exemplary embodiment, the present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the AI ​​vision-based engine part defect detection method of this application. The computer-readable storage medium may include: a read-only memory, a random access memory (RAM), a solid-state drive (SSD), or an optical disc, etc.

[0145] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.

Claims

1. A method for detecting defects in engine parts based on AI vision, characterized in that, The method includes: Obtain labeled real engine parts images and corresponding defect masks to form initial samples; construct a multi-scale topology-aware feature extraction network, and train the multi-scale topology-aware feature extraction network based on the initial samples to obtain the trained feature extraction network. Defect samples are selected from the initial samples, and the trained feature extraction network is used to process the defect samples to obtain the depth feature map and topological saliency map of the defect samples; defect data is encoded based on the depth feature map and the topological saliency map to obtain the defect encoding result; feature space is synthesized based on the defect encoding result to generate a large-scale synthetic augmented training dataset. Using the trained feature extraction network as a fixed and non-updateable backbone, a defect detection framework integrating a dynamic domain adaptive module is constructed. Based on the large-scale synthetic augmentation training dataset, the defect detection framework is trained under multiple working conditions to obtain a robust teacher detection model and a parameter offset library. Based on the robust teacher detection model and the parameter offset library, a two-stage progressive knowledge distillation process is performed on the preset lightweight student network architecture to obtain a defect detection engine.

2. The method according to claim 1, characterized in that, The construction of a multi-scale topology-aware feature extraction network, which is trained based on the initial samples to obtain a trained feature extraction network, includes: An initial feature extraction network with a dual-branch structure and a multi-scale feature pyramid is constructed, wherein the dual-branch structure is used to collaboratively extract features of different dimensions; A topology-aware attention module is embedded in each layer of the multi-scale feature pyramid to construct the multi-scale topology-aware feature extraction network; the topology-aware attention module includes a channel attention submodule, a spatial attention submodule, and a topological saliency calculation submodule; The joint loss function of the multi-scale topology-aware feature extraction network is determined. The joint loss function is composed of a defect segmentation loss and a topology-aware auxiliary loss weighted together. The topology-aware auxiliary loss is used to constrain the multi-scale topology-aware feature extraction network to learn the topological structure features of the defects. The initial sample is input into the multi-scale topology-aware feature extraction network. The multi-scale topology-aware feature extraction network is iteratively trained based on the joint loss function. When the value of the joint loss function converges to a preset threshold, the training is stopped, and the trained feature extraction network is obtained.

3. The method according to claim 1, characterized in that, The defect data is encoded based on the depth feature map and the topological saliency map to obtain the defect encoding result; Based on the defect encoding results, feature space synthesis is performed to generate a large-scale synthetic augmented training dataset, including: S2.1 Construct a meta-learning task set based on the deep feature map and the topological saliency map, wherein the meta-learning task set contains multiple K-shot defect classification sub-tasks; S2.

2. The meta-learner is trained based on the meta-learning task set to obtain a fully trained defect condition encoder. S2.

3. Obtain a normal image of a defect-free engine part, and use the trained feature extraction network to extract features from the normal image of the defect-free engine part to obtain a normal intermediate feature map output by the preset intermediate layer in the trained feature extraction network. S2.4 Construct a conditional generative adversarial network, wherein the conditional generative adversarial network includes a generator and an image decoder; S2.

5. Encode the preset defect categories using the fully trained defect condition encoder to generate defect condition vectors that characterize the core semantics and topological patterns of the defect categories, and output the defect condition vectors as the defect encoding results. S2.6 Input the normal intermediate feature map, the defect condition vector, and random noise into the generator, and perform defect feature perturbation learning through the generator to generate a synthetic defect feature perturbation; superimpose the normal intermediate feature map and the synthetic defect feature perturbation element by element to obtain a synthetic defect feature map; S2.

7. Input the synthesized defect feature map into the trained feature extraction network and the image decoder respectively to generate a synthesized image with defects and a corresponding pixel-level synthesized defect mask. S2.

8. Change to different preset defect categories and repeat steps S2.5 to S2.7 to accumulate and generate the large-scale synthetic augmented training dataset.

4. The method according to claim 1, characterized in that, The defect detection framework, which integrates a dynamic domain adaptive module, is constructed using the trained feature extraction network as a fixed and non-updateable backbone. The defect detection framework is trained using multi-condition simulations based on the large-scale synthetic augmentation training dataset, resulting in a robust teacher detection model and parameter offset library, including: The trained feature extraction network is used as a fixed and non-updateable backbone, and combined with a defect detection head to construct a basic detection model; the basic detection model contains multiple feature extraction layers, and the weights of the basic detection model include dynamic target layer weights. A high-level feature layer is determined in the multi-layer feature extraction layer of the basic detection model, and the dynamic domain adaptive module is integrated after the high-level feature layer to form the defect detection framework; the dynamic domain adaptive module includes a domain classifier and a parameter offset generator; the high-level feature layer is used to output abstract feature representation; Multi-condition simulation enhancement operations are performed on the images in the large-scale synthetic enhancement training dataset, and a corresponding simulation condition domain label is assigned to each enhanced image to obtain the synthetic enhancement training dataset; the multi-condition simulation enhancement operations include brightness and contrast adjustment, oil stain noise addition, and random affine transformation; The synthetic augmented training dataset is input into the defect detection framework to train it. During training, the domain classifier identifies the working conditions of the training images in the synthetic augmented training dataset, outputs a domain description vector, and the parameter offset generator generates corresponding parameter offsets based on the domain description vector. The parameter offsets are dynamically superimposed on the dynamic target layer weights of the base detection model to form an instantaneous inference model adapted to the current working conditions. Based on the instantaneous inference model, defect detection is performed on the training images, and the detection loss and domain classification alignment loss are calculated. The trainable parameters of the defect detection framework are updated by backpropagation based on the detection loss and domain classification alignment loss to obtain the robust teacher detection model. The effective parameter offsets generated during the training process for each preset stable simulation condition are collected and stored according to the domain label of the simulation condition to form the parameter offset library.

5. The method according to claim 1, characterized in that, The method involves performing a two-stage progressive knowledge distillation process on a pre-defined lightweight student network architecture based on the robust teacher detection model and the parameter offset library to obtain a defect detection engine, including: Construct a medium-sized student network and a lightweight student network architecture. The number of parameters in the medium-sized student network is between that in the robust teacher detection model and the lightweight student network architecture. The lightweight student network architecture is constructed using depthwise separable convolutions and compact attention modules. The large-scale synthetic augmentation training dataset is input into the robust teacher detection model to obtain the teacher intermediate feature map, the teacher final prediction result, and the teacher topological saliency map; the teacher intermediate feature map, the teacher final prediction result, and the teacher topological saliency map are used as supervision signals to train the medium-sized student network to obtain the first-stage distilled student model; Select multiple sets of parameter offsets corresponding to different working conditions from the parameter offset library, and superimpose the parameter offsets corresponding to different working conditions onto the robust teacher detection model to construct multiple domain expert models adapted to different working conditions. The large-scale synthetic augmented training dataset is augmented according to the working conditions to obtain multiple sets of working condition adaptation datasets; each set of working condition adaptation datasets is input into the corresponding domain expert model to obtain multiple sets of expert output results. Using the first-stage distillation student model as the intermediate teacher model and the lightweight student network architecture as the student model; inputting the large-scale synthetic augmentation training dataset and the working condition adaptation datasets of each group into the intermediate teacher model and the student model respectively; training the student model so that the output of the student model simultaneously approximates the prediction results of the intermediate teacher model and the expert output results of each group, thus obtaining the lightweight student model; The lightweight student model is subjected to structured channel pruning. The feature contribution of each channel in the lightweight student model is calculated, and redundant channels with feature contribution values ​​lower than a preset contribution threshold are removed to obtain the pruned model. The pruned model is subjected to integer quantization to obtain a quantized model; the quantized model is then compiled and optimized using the inference compiler of the target edge computing platform to generate the defect detection engine.

6. The method according to claim 2, characterized in that, The step of processing the defect sample using the trained feature extraction network to obtain the depth feature map and topological saliency map of the defect sample includes: The defect sample is input into the trained feature extraction network, and the local detail features and long-range global dependency features of the defect sample are extracted through the dual-branch structure, and then fused through the multi-scale feature pyramid to obtain a preliminary multi-scale feature map. The preliminary multi-scale feature map is input into the topology-aware attention module, and the importance weight of each feature channel is calculated through the channel attention submodule to optimize the preliminary multi-scale feature map and obtain the optimized feature map. The spatial attention submodule is used to enhance the spatial dimension features of the optimized feature map to generate a spatially enhanced feature map. The topological saliency calculation submodule extracts the defect topology from the spatial enhancement feature map to generate the topological saliency map. The spatial augmentation feature map and the topological saliency map are fused to obtain the depth feature map.

7. The method according to claim 2, characterized in that, The mathematical expression for the joint loss function is: in, These are the loss weighting coefficients; The defect segmentation loss; The predicted defect mask output by the multi-scale topology-aware feature extraction network. This is a mask for the actual defect. and The height and width of the mask; For predicting defect masks The pixel value at the i-th row and j-th column position is either 0 or 1. mask for real defects The pixel value at the i-th row and j-th column position takes the value 0 or 1; It is a minterm, and ; The topology-aware auxiliary loss; The k-layer feature map output by the multi-scale feature pyramid is shown below. K is the total number of layers in the feature pyramid; To match the feature map of the kth layer The corresponding preset standard defect topology feature map; Euler ( The function is calculated for the Euler number. The square of the L2 norm.

8. An engine part defect detection device based on AI vision, characterized in that, The device includes: The feature extraction and data augmentation module is used to acquire labeled real engine parts images and corresponding defect masks to form initial samples; construct a multi-scale topology-aware feature extraction network, and train the multi-scale topology-aware feature extraction network based on the initial samples to obtain the trained feature extraction network. The framework construction and working condition training module is used to select defect samples from the initial samples, process the defect samples using the trained feature extraction network to obtain the depth feature map and topological saliency map of the defect samples; encode the defect data based on the depth feature map and the topological saliency map to obtain the defect encoding result; and synthesize the feature space based on the defect encoding result to generate a large-scale synthetic augmented training dataset. The knowledge distillation and engine generation module is used to construct a defect detection framework integrating a dynamic domain adaptive module, using the trained feature extraction network as a fixed and non-updateable backbone; to perform multi-condition simulation training on the defect detection framework based on the large-scale synthetic augmentation training dataset, thereby obtaining a robust teacher detection model and a parameter offset library; and to perform a two-stage progressive knowledge distillation process on the preset lightweight student network architecture based on the robust teacher detection model and the parameter offset library, thereby obtaining a defect detection engine.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

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