Cross-domain gear surface defect detection method and system based on open set unknown separation

By constructing a cross-domain gear surface defect detection model and utilizing a fuzzy class separation module and an unknown class discriminator, the problem of identifying unknown classes in gear surface defect detection is solved, improving detection accuracy and adaptability, especially in complex industrial environments.

CN121033062BActive Publication Date: 2026-04-07JIANGNAN UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively identify unknown defects in gear surface defect detection, and their detection accuracy is low in complex and ever-changing industrial environments. In particular, they cannot adapt to interference from factors such as lighting and resolution in cross-domain scenarios.

Method used

A cross-domain gear surface defect detection method based on open set unknown separation is adopted. By constructing a gear surface defect detection model, including a feature extractor, a fuzzy class separation module, an unknown class discriminator and a sub-domain discriminator, a class clarity scoring mechanism is used to separate clear classes and fuzzy classes, and the class decision boundary is adjusted through risk calibration to improve the recognition capability of unknown classes and the detection accuracy of known classes.

Benefits of technology

While ensuring the alignment accuracy of known classes, misalignment of unknown classes is avoided, achieving fine-grained alignment and improving the overall accuracy of gear surface defect detection and the ability to identify unknown classes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121033062B_ABST
    Figure CN121033062B_ABST
Patent Text Reader

Abstract

The present application relates to gear surface defect detection technical field, disclose a kind of gear surface defect detection method and system based on open set unknown separation across domain, comprising: the surface image of different type gear is divided into training set and test set, training set is divided into source domain and target domain sample, the image in test set is target domain sample;Gear surface defect detection model including feature extractor, fuzzy class separation module, unknown class discriminator, sub-field discriminator and classifier is constructed, feature extractor extracts source domain and target domain feature data, and fuzzy class separation module divides clear class and fuzzy class;Using the feature data corresponding to source domain, clear class and fuzzy class trains model, the difference on the classification confidence of target domain sample for known class is applied in training process as weight;Test set is input into the model of training completion and obtains gear surface defect detection result in target domain.The present application can improve unknown class recognition ability, improve the detection precision of known class.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of gear surface defect detection, in particular to a cross-domain gear surface defect detection method and system based on open set unknown separation. BACKGROUND

[0002] As an important mechanical transmission element, gears are widely used in various mechanical equipment in industrial production, and their performance and reliability directly affect the operation efficiency and service life of the mechanical system. Due to the complex manufacturing process and high-strength working environment, various defects such as fatigue cracks, wear, scratches, etc. often occur on the surface of the gear, which may gradually develop under adverse conditions and eventually lead to gear failure. Therefore, the detection of defects on the surface of the gear is particularly important.

[0003] The detection of defects on the surface of the gear is usually detected by artificial or mechanical detection, which has high cost and low efficiency. In order to replace the traditional artificial and mechanical detection, the existing technology uses computer vision technology to detect defects on the surface of the gear. The traditional machine vision surface defect detection technology usually adopts the combination of image processing and shallow machine learning, and the core challenge is how to extract good feature representation so as to accurately distinguish between defect and non-defect areas, which often needs professional engineers to manually select and design feature extraction methods and appropriate classifiers according to different gear types and defect conditions in practice, which leads to the fact that this method cannot be applied to different gears or different defect conditions. Moreover, since the manually designed features may not cover all cases, the traditional machine vision surface defect detection technology usually performs poorly when dealing with complex and variable defect types.

[0004] Based on the deep learning model, the feature representation can be learned from the data automatically without relying on the manually designed features, so the existing technology uses the deep learning model to detect defects on the surface of the gear. However, in the actual industrial detection scene, because of the interference of various external factors such as light, resolution, equipment, etc., the defects on the surface of the gear are complex and diverse and new defects are prone to occur, and the collected gear surface images lack the knowledge of unknown class defects, which affects the accuracy of the deep learning model in detecting defects on the surface of the gear. SUMMARY

[0005] Therefore, the technical problem to be solved by the present application is to overcome the deficiencies in the prior art and provide a cross-domain gear surface defect detection method and system based on open set unknown separation, which can improve the unknown class recognition ability and improve the detection accuracy of known classes.

[0006] To solve the above technical problems, the present application provides a cross-domain gear surface defect detection method based on open set unknown separation, comprising:

[0007] Surface images of different types of gears are obtained and divided into a training set and a test set, the images in the training set are divided into source domain samples and target domain samples according to the gear types, the source domain samples have labels, and the target domain samples have no labels, and the images in the test set are all target domain samples;

[0008] A gear surface defect detection model is constructed, the gear surface defect detection model comprising a feature extractor, a fuzzy class separation module, an unknown class discriminator, a sub-field discriminator and a classifier, the feature extractor being configured to extract features of the source domain samples and the target domain samples to obtain source domain feature data and target domain feature data, the fuzzy class separation module being configured to estimate a known class feature space range according to the source domain feature data and the target domain feature data and divide the samples in the training set into clear classes and fuzzy classes based on a class clarity scoring mechanism;

[0009] The gear surface defect detection model is trained using the training set, specifically: the unknown class discriminator is trained using the source domain feature data, the feature data corresponding to the clear classes and the fuzzy classes, to realize class decision boundaries between known classes and unknown classes; the classifier is trained using the source domain feature data and the feature data corresponding to the fuzzy classes, to enable the model to distinguish all classes; the sub-field discriminator is trained using the source domain feature data and the feature data corresponding to the clear classes, to realize fine-grained distribution alignment at the class level; differences in classification confidence of the target domain samples for known classes are applied as weights in the training process of the unknown class discriminator, the classifier and the sub-field discriminator, to calibrate risks in the separation and adaptation processes to adapt to alignment difficulty and dynamically adjust class decision boundaries;

[0010] The test set is input into the trained gear surface defect detection model to obtain a result of gear surface defect detection in the target domain.

[0011] Further, the fuzzy class separation module estimates a known class feature space range according to the source domain feature data and the target domain feature data and divides the samples in the training set into clear classes and fuzzy classes based on a class clarity scoring mechanism, specifically:

[0012] The source domain feature data and the target domain feature data are input into the fuzzy class separation module, and a ratio of a distance of target domain feature data of each target domain sample to a corresponding class prototype to a robust boundary of all class feature spaces is calculated;

[0013] For each target domain sample, the smallest ratio among all ratios is selected as a class clarity score, and the target domain sample is divided into a clear class and a fuzzy class according to the size of the class clarity score.

[0014] Further, the ratio of the distance of the target domain feature data of each target domain sample to the corresponding class prototype to the robust boundary of all class feature spaces is calculated, specifically:

[0015] The distance of the target domain feature data of each target domain sample to the corresponding class prototype is calculated as:

[0016] ,

[0017] wherein, is the Euclidean distance between the target domain feature data of the ith target domain sample and the corresponding class prototype, c k is the kth class prototype of the target domain sample, is the target domain feature data of the ith target domain sample, is the Euclidean distance;

[0018] The class feature space robust boundary of the kth class is calculated as:

[0019] ,

[0020] wherein, is the class feature space robust boundary of the kth class, r is a variable to be solved, is the cumulative distribution function of the kernel density function corresponding to the kth class, q is a control coefficient;

[0021] The ratio of the distance of the target domain feature data of the ith target domain sample to the corresponding class prototype to the class feature space robust boundary of the kth class is calculated as: .

[0022] Further, the calculation method of the is:

[0023] ,

[0024] wherein, N k is the total number of the kth target domain sample, is the bandwidth parameter of the Gaussian kernel function.

[0025] Further, the loss function of the unknown class discriminator during training is:

[0026] ,

[0027] wherein, is the loss function of the unknown class discriminator during training, is the total number of source domain samples; is the label of the jth source domain sample, if it is a fuzzy class, it is marked as 1, if it is a clear class, it is marked as 0; is the label of the jth source domain sample, if it is a fuzzy class, it is marked as 1, if it is a clear class, it is marked as 0; is the jth source domain sample, is the output of the feature extractor, is the output of the unknown class discriminator;​ The total number of samples in the target domain. Let be the label of the i-th target domain sample. For the i-th target domain sample, The known class probability weights for the i-th target domain sample. Let be the unknown class probability weight of the i-th target domain sample.

[0028] Furthermore, the aforementioned The calculation method is as follows:

[0029] ,

[0030] Where μ represents the scaling factor. It is a preset constant. For the target domain, Let be the confidence level of the i-th target domain sample;

[0031] The The calculation method is as follows:

[0032] .

[0033] Furthermore, the aforementioned The calculation method is as follows:

[0034] ,

[0035] Where K is the number of known categories, For classifier output Category The probability of.

[0036] Furthermore, the loss function during classifier training is:

[0037] ,

[0038] in, The loss function during classifier training. The total number of samples in the source domain. For the i-th source domain sample, For the source domain, ( ) represents the cross-entropy loss function. ( ) represents the output of the feature extractor, and C() represents the output of the classifier. Let i be the label of the i-th source domain sample. For control parameters, The number of samples in the unknown class. For samples of unknown class, For the target domain, This represents an unknown class sample in the target domain; The open set pseudo-labels are assigned to the feature data corresponding to the unknown class. For the unknown class probability weights of all target samples; ; The total number of samples in the target domain. Let be the unknown class probability weight of the i-th target domain sample.

[0039] Furthermore, the loss function during the training of the sub-domain discriminator is:

[0040] ,

[0041] in, Let be the loss function for distribution alignment during the training of the sub-domain discriminator. K represents the total number of samples in the source domain, and K represents the total number of discriminators in the sub-domains. For the i-th source domain sample, For the source domain; Let the predicted label be the category label for the i-th source domain sample. This indicates whether the predicted label of the i-th source domain sample is class k. If it is class k, then... =1, if it is not category k. =0; ( ) represents the output of the sub-domain discriminator. ( ) represents the output of the feature extractor; For the target domain, The number of samples in the target domain after filtering out fuzzy classes. To filter out samples with blurred classes, This represents the samples in the target domain after filtering out fuzzy classes. for Category prediction labels; For the probability weights of all known classes, ; The total number of samples in the target domain. The known class probability weights are the i-th target domain sample.

[0042] This invention also provides a cross-domain gear surface defect detection system based on open set unknown separation, comprising:

[0043] The data acquisition module acquires surface images of different types of gears and divides them into training sets and test sets. The images in the training set are divided into source domain samples and target domain samples according to gear type. The source domain samples are labeled, and the target domain samples are unlabeled. The images in the test set are all target domain samples.

[0044] The detection model construction module constructs a gear surface defect detection model, which includes a feature extractor, a fuzzy class separation module, an unknown class discriminator, a sub-domain discriminator, and a classifier. The feature extractor is used to extract features from source domain samples and target domain samples to obtain source domain feature data and target domain feature data. The fuzzy class separation module estimates the known class feature space range based on the source domain feature data and target domain feature data and divides the samples in the training set into clear classes and fuzzy classes based on the class clarity scoring mechanism.

[0045] The training module trains the gear surface defect detection model using a training set. Specifically, it trains the unknown class discriminator using source domain feature data, clear class, and fuzzy class feature data to achieve class decision boundaries that distinguish between known and unknown classes; it trains the classifier using source domain feature data and fuzzy class feature data to enable the model to distinguish all categories; it trains the sub-domain discriminator using source domain feature data and clear class feature data to achieve fine-grained distribution alignment at the category level; and it applies the difference in confidence scores of target domain samples for known class classification as weights during the training of the unknown class discriminator, classifier, and sub-domain discriminator to perform risk calibration on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundaries.

[0046] The detection module inputs the test set into the trained gear surface defect detection model to obtain the results of gear surface defect detection in the target domain.

[0047] Compared with the prior art, the above-described technical solution of the present invention has the following advantages:

[0048] This invention separates fuzzy and clear classes through a fuzzy class separation module, which can avoid misalignment of unknown classes in the target domain while ensuring the alignment accuracy of known classes, thus achieving fine-grained alignment. On this basis, the unknown class discriminator, sub-domain discriminator, and classifier are trained, and the separation and adaptation process is risk-calibrated. The classifier confidence is introduced into the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundary, thereby improving the detection accuracy of known class defects on the gear surface and enhancing the identification ability of unknown class defects. Attached Figure Description

[0049] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein:

[0050] Figure 1 This is a flowchart of a method in a preferred embodiment of the present invention.

[0051] Figure 2 This is a structural diagram of the gear surface defect detection model in a preferred embodiment of the present invention.

[0052] Figure 3 This is a schematic diagram of the fuzzy class separation module in a preferred embodiment of the present invention. Detailed Implementation

[0053] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.

[0054] Unsupervised domain adaptation methods train models on labeled source domain data and unlabeled target domain data, extending the model from the source domain to the target domain. This allows them to leverage knowledge from the source domain data to compensate for the deficiencies of unlabeled data in the target domain, improving the model's generalization ability and adaptability. Most existing unsupervised domain adaptation methods are limited by the closed-set assumption. However, in real-world cross-domain industrial inspection scenarios, gear surface defects are complex and diverse, and novel defects are prone to emerge, severely impacting the detection accuracy and generalization ability of traditional domain adaptation methods. Therefore, this invention introduces the Open-Set Domain Adaptation (OSDA) method to address the new problems arising from unknown categories in the target domain.

[0055] Reference Figure 1 As shown, this invention discloses a cross-domain gear surface defect detection method based on open set unknown separation, comprising the following steps:

[0056] S1: Obtain surface images of different types of gears and divide them into training set and test set. Divide the images in the training set into source domain samples and target domain samples according to gear type. The source domain samples are labeled, and the target domain samples are unlabeled. The images in the test set are all target domain samples.

[0057] In this embodiment, images of Type I and Type II gears with four types of defects—cracks, dents, missing teeth, and powder shedding—are acquired. Type I and Type II gears represent gears manufactured using different processes. The training set includes 500 images of Type I gears with cracks, 500 images of Type I gears with dents, 300 images of Type I gears with missing teeth, and 400 images of Type I gears with powder shedding. The test set includes 100 images of Type II gears with cracks, 100 images of Type II gears with dents, 70 images of Type II gears with missing teeth, and 80 images of Type II gears with powder shedding. In the test set, the source domain is defined as the image samples corresponding to Type I gears, and the target domain is defined as the image samples corresponding to Type II gears.

[0058] S2: Construct as follows Figure 2The gear surface defect detection model shown includes a feature extractor, a fuzzy class separation module, an unknown class discriminator, a sub-neighborhood discriminator, and a classifier. The feature extractor is used to extract features from source domain samples and target domain samples to obtain source domain feature data and target domain feature data. The fuzzy class separation module estimates the known class feature space range based on the source domain feature data and target domain feature data and divides the samples in the training set into clear classes and fuzzy classes based on a class clarity scoring mechanism.

[0059] The feature extractor maps source and target domain samples to a feature space, and the classifier outputs the prediction results. To address the problem of difficulty in identifying unknown classes due to the lack of knowledge about unknown classes in the target domain within the source domain, a fuzzy class separation module and an unknown class discriminator are designed. These modules aim to autonomously explore the target domain category boundaries rather than relying on preset empirical thresholds. The sub-domain discriminator solves the problem of domain offset between domains and performs fine-grained alignment of common classes.

[0060] S2-1: In this embodiment, the feature extractor and classifier are initialized through pre-training. During the pre-training phase, the feature extractor and classifier are trained using source domain samples, learning some invariant features in the transfer task. This improves the initial performance of the model for formal training and accelerates convergence. Simultaneously, it ensures the establishment of a reliable category feature space in the early stages of formal training, laying the foundation for subsequent unknown class separation and known class alignment tasks. Subsequently, in the constructed gear surface defect detection model, the model progressively learns the unknown class knowledge from the fuzzy classes obtained by the fuzzy class separation module, achieving collaborative optimization by combining the unknown class separation and known class alignment mechanisms. The model's continuous optimization of the decision boundaries between unknown and known classes, as well as within known classes, significantly improves the model's transfer performance.

[0061] S2-2: Input labeled source domain samples and unlabeled target domain samples into the feature extractor of the gear surface defect detection model to obtain source domain feature data and target domain feature data, respectively.

[0062] S2-3: The fuzzy class separation module estimates the known class feature space range based on the source domain feature data and the target domain feature data, and divides the samples in the training set into clear and fuzzy classes based on the class sharpness scoring mechanism. Specifically:

[0063] S2-3-1: Input the source domain feature data and target domain feature data into the fuzzy class separation module. A schematic diagram of the fuzzy class separation module is shown below. Figure 3 As shown, the ratio of the distance from the target domain feature data of each target domain sample to the corresponding class prototype to the robust boundary of the feature space of all classes is calculated.

[0064] S2-3-1-1: Calculate the distance from the target domain feature data of each target domain sample to the corresponding class prototype:

[0065] ,

[0066] in, Let c be the Euclidean distance between the target domain feature data of the i-th target domain sample and the corresponding class prototype. k For the k-th class prototype of the target domain sample, The target domain feature data of the i-th target domain sample. The distance is Euclidean; the class prototype is a representative vector obtained by averaging the feature data of all samples under a certain class in a specific feature space, denoted as the prototype. Each class has a corresponding prototype. Since each target domain sample belongs to a specific class, the "corresponding class prototype" of that sample refers to the representative vector of its class.

[0067] S2-3-1-2: Calculate the robust boundary of the category feature space for the k-th class as follows:

[0068] ,

[0069] in, Let r be the robust boundary of the feature space of the k-th class, and r be the variable to be determined. Let be the kernel density function and cumulative distribution function corresponding to the k-th class, and q be the control coefficient used to control the truncation level of the distribution tails obtained from density estimation, so as to exclude outliers within the class and enhance the compactness of the feature distribution. Defined as making the cumulative distribution function The smallest value of r that is equal to 1-q;

[0070] In this embodiment, a Gaussian kernel function is used to model the distance distribution of the k-th class. The calculation method is as follows:

[0071] ,

[0072] Where, N k Let k be the total number of samples in the target domain of the kth class. This is the bandwidth parameter of the Gaussian kernel function;

[0073] S2-3-1-3: Calculate the ratio of the distance from the target domain feature data of the i-th target domain sample to the corresponding class prototype to the robust boundary of the class feature space of the k-th class: .

[0074] S2-3-2: For each target domain sample, select the smallest ratio among all categories as the category sharpness score, and divide the target domain sample into sharp and blurry classes according to the size of the category sharpness score.

[0075] S2-3-2-1: Select the ratio with the smallest ratio among all categories as the category sharpness score, that is, the category sharpness score of the i-th target domain sample is:

[0076] ,

[0077] Among them, CCS i Score the class clarity for i target domain samples;

[0078] S2-3-2-2: If CCS i If the value is greater than 1, the corresponding target domain sample class has low clarity and is difficult to determine as a known class, thus defining it as a fuzzy class; conversely, if CCS... i If the value is less than or equal to 1, it is defined as a clear class. During training, the clear class is treated as a known class (denoted as ). Processing is performed, and the fuzzy class is treated as the unknown class (denoted as ). ) to process.

[0079] S3: Train the gear surface defect detection model using the training set, specifically: train the unknown class discriminator using source domain feature data, clear class, and fuzzy class corresponding feature data to achieve class decision boundaries for distinguishing known and unknown classes; train the classifier using source domain feature data and fuzzy class corresponding feature data to enable the model to distinguish all categories; train the sub-domain discriminator using source domain feature data and clear class corresponding feature data to achieve fine-grained distribution alignment at the category level; use the difference in the confidence of target domain samples for known class classification as the main metric for their contribution to network performance, and apply the contribution performance as weights during the training of the unknown class discriminator, classifier, and sub-domain discriminator to perform risk calibration on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundaries; during backpropagation, use stochastic gradient descent to continuously optimize various losses and update model parameters. When the number of iterations reaches the optimal level, save the model parameters to complete the training.

[0080] The classification decision boundary between known and unknown classes is dynamically adjusted based on the confidence level of the classifier in identifying known classes of samples, and the probability weights of known classes are adjusted accordingly. and unknown class probability weights An unknown class discriminant is introduced, and the loss function for training the unknown class discriminant is:

[0081] ,

[0082] in, The loss function during training of the unknown class discriminator. This represents the total number of samples in the source domain. Let the label be the j-th source domain sample; if it is a fuzzy class, then... Marked as 1, if it is a clear class Marked as 0; The fuzzy class probability prediction value output by the unknown class discriminator. For the j-th source domain sample, ( ) represents the output of the feature extractor. ( ) represents the output of the unknown class discriminator; The total number of samples in the target domain. Let be the label of the i-th target domain sample. For the i-th target domain sample, Let be the probability weight of the known class (i.e., defect category) of the i-th target domain sample. Let be the unknown class probability weight of the i-th target domain sample.

[0083] The The calculation method is as follows:

[0084] ,

[0085] Where μ represents the scaling factor. It is a preset constant, that is, a tiny positive value to prevent the denominator from being zero. For the target domain, Let be the confidence level of the i-th target domain sample;

[0086] The The calculation method is as follows:

[0087] .

[0088] A classifier confidence score is introduced to calibrate the risk of the separation and adaptation process. Information entropy is used for sample-level weighting to adapt to the difficulty of aligning known class samples and dynamically adjust the classification decision boundaries between known and unknown classes. The classifier's output dimension is K+1 (K is the same as the number of sub-domain discriminators), where the first K classes belong to the known categories, and the unknown classes are assigned to the last category. This invention only considers the classifier's output results for the known classes to more accurately reflect the classifier's confidence in the known classes. The calculation method is as follows:

[0089] ,

[0090] Where K is the number of known categories, For classifier output Category The probability is given by C(), where C() is the output of the classifier.

[0091] In target domain classification learning, the process of partitioning fuzzy classes is easily affected by differences in domain distribution. Specifically, known class samples in the target domain that are not well aligned with the source domain distribution may be misclassified as fuzzy classes. Directly assigning open-set pseudo-labels to all fuzzy samples will negatively impact the learning of unknown class features, potentially causing the model to incorrectly incorporate some known class features into the unknown class distribution. To mitigate this problem, unknown class weights are introduced into the classification loss. The contribution of fuzzy class samples to the learning of unknown class features is dynamically adjusted. The loss function during classifier training is:

[0092] ,

[0093] in, The loss function during classifier training. The total number of samples in the source domain. For the i-th source domain sample, For the source domain, ( ) represents the cross-entropy loss function. ( ) represents the output of the feature extractor, and C() represents the output of the classifier. Let i be the label of the i-th source domain sample. These are control parameters used to control the model's ability to learn features of unknown classes in the target domain. The number of samples in the unknown class. For samples of unknown class, For the target domain, This represents an unknown class sample in the target domain. The open set pseudo-label is assigned to the feature data corresponding to the unknown class. The pseudo-label refers to the label automatically generated by the model for unlabeled data (not the real label labeled by humans) and is used to assist training or inference. The open set emphasizes that the label is for the unknown class in the open set scenario. =[0,…0,1], It includes K zeros, where K is the total number of known categories, 0 indicates that it does not belong to a known category, and the last 1 indicates that it belongs to an unknown category. For the unknown class probability weights of all target samples, , The total number of samples in the target domain; A smaller value indicates greater confidence in classifying the sample to a known class, prompting the model to ignore the impact of the sample being incorrectly classified into an unknown class. Conversely, a larger value indicates that the fuzzy class sample is difficult for the classifier to identify as a known class, and the model prioritizes classifying it as an unknown class. The classifier works by jointly minimizing the source domain label supervision loss, as well as the fuzzy class prediction and pseudo-label. The cross-entropy, together with the unknown class discriminator, distinguishes all categories.

[0094] K sub-domain discriminators are constructed for conditional distribution alignment. Ambiguous class samples in the target domain are filtered out using the classifier's probability prediction information and then assigned to the corresponding sub-domain discriminators. Samples from the source domain are assigned to the appropriate sub-domain discriminators based on their true labels. Each sub-domain discriminator independently optimizes its weights, focusing on the feature distribution of a specific class and reducing inter-class alignment interference, thereby achieving fine-grained distribution alignment at the class level.

[0095] In the process of aligning sub-domain distributions of known categories, there is a risk that samples of unknown classes may be misclassified as belonging to known categories. A sub-domain alignment loss is introduced... This allows the sub-domain discriminator to focus on aligning high-confidence known class features, while effectively ignoring the influence of difficult-to-transfer samples, thus avoiding incorrect alignment between unknown class features and source domain features. By dynamically adjusting the alignment strategy for known class samples, adaptive optimization training can be achieved based on the alignment difficulty of the samples. The loss function for training the sub-domain discriminator is:

[0096] ,

[0097] in, Let be the loss function for distribution alignment during the training of the sub-domain discriminator. K represents the total number of samples in the source domain, and K represents the total number of discriminators in the sub-domains. For the i-th source domain sample, Let the predicted label be the category label for the i-th source domain sample. This indicates whether the predicted label of the i-th source domain sample is class k. If it is class k, then... =1, if it is not category k. =0; ( ) represents the output of the sub-domain discriminator; For the target domain, The number of samples in the target domain after filtering out fuzzy classes. To filter out samples with blurred classes, This represents the samples in the target domain after filtering out fuzzy classes. for Category prediction labels, For the probability weights of all known classes, ; The total number of samples in the target domain. The known class probability weights are the i-th target domain sample.

[0098] Each sub-domain discriminator independently optimizes its weights, focusing on the feature distribution of a specific category and reducing inter-class alignment interference, thereby achieving fine-grained distribution alignment at the category level. By optimizing the loss of each sub-domain discriminator, features in the target domain can be better aligned with known category features in the source domain, reducing interference from unknown categories, thus improving the model's classification accuracy and adaptability.

[0099] S4: Input the test set into the trained gear surface defect detection model to obtain the results of gear surface defect detection in the target domain.

[0100] This invention also discloses a cross-domain gear surface defect detection system based on open set unknown separation, comprising:

[0101] The data acquisition module acquires surface images of different types of gears and divides them into training sets and test sets. The images in the training set are divided into source domain samples and target domain samples according to gear type. The source domain samples are labeled, and the target domain samples are unlabeled. The images in the test set are all target domain samples.

[0102] The detection model construction module constructs a gear surface defect detection model, which includes a feature extractor, a fuzzy class separation module, an unknown class discriminator, a sub-domain discriminator, and a classifier. The feature extractor is used to extract features from source domain samples and target domain samples to obtain source domain feature data and target domain feature data. The fuzzy class separation module estimates the known class feature space range based on the source domain feature data and target domain feature data and divides the samples in the training set into clear classes and fuzzy classes based on the class clarity scoring mechanism.

[0103] The training module trains the gear surface defect detection model using a training set. Specifically, it trains the unknown class discriminator using source domain feature data, clear class, and fuzzy class feature data to achieve class decision boundaries that distinguish between known and unknown classes; it trains the classifier using source domain feature data and fuzzy class feature data to enable the model to distinguish all categories; it trains the sub-domain discriminator using source domain feature data and clear class feature data to achieve fine-grained distribution alignment at the category level; and it applies the difference in confidence scores of target domain samples for known class classification as weights during the training of the unknown class discriminator, classifier, and sub-domain discriminator to perform risk calibration on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundaries.

[0104] The detection module inputs the test set into the trained gear surface defect detection model to obtain the results of gear surface defect detection in the target domain.

[0105] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a cross-domain gear surface defect detection method based on open set unknown separation.

[0106] The present invention also discloses an apparatus including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a cross-domain gear surface defect detection method based on open set unknown separation.

[0107] This invention first addresses the problem that the lack of knowledge about unknown classes in the target domain in the source domain prevents the model from constructing decision boundaries for known and unknown class defects. It designs a fuzzy class separation module and an unknown class discriminator, using center distance distribution to estimate the feature space range of known classes and separating fuzzy classes based on a class clarity scoring mechanism. Second, to avoid misalignment of unknown classes in the target domain while ensuring the alignment accuracy of known classes, a sub-domain discriminator is constructed to achieve fine-grained alignment. Finally, risk calibration is performed on the separation and adaptation process, incorporating classifier confidence into the process to adapt to alignment difficulty and dynamically adjust class decision boundaries. When using this invention for gear surface defect detection in cross-domain open set scenarios, it can improve the ability to identify unknown classes and significantly enhance the detection accuracy of known classes.

[0108] To further demonstrate the beneficial effects of this invention, this embodiment uses the method of this invention and existing methods such as OSBP (see the paper "Saito K, Yamamoto S, Ushiku Y, et al. Open set domain adaptation by backpropagation[C] Proceedings of the European conference on computer vision (ECCV). 2018: 153-168."), STA (see the paper "Liu H, Cao Z, Long M, et al. Separate to adapt: ​​Open set domain adaptation via progressive separation[C] Proceedings of the IEEE / CVF conference on computer vision and pattern recognition. 2019: 2927-2936."), and UADAL (see the paper "Jang JH, Na B, Shin DH, et al. Unknown-aware domain adversarial learning for open-set domain adaptation[J]. Advances in Neural Information Processing Systems, 2022"), respectively. Experiments were conducted using the method described in 35:16755-16767. Defect detection was performed on the acquired gear surface images. Common evaluation metrics for open-set domain adaptation tasks were used, including OS*, UNK, and HOS, which measure model performance from different perspectives. OS* represents the accuracy for the known class, UNK represents the accuracy for the unknown class, and HOS serves as the harmonic mean metric. The importance of both OS* and UNK was considered to balance the model's recognition performance for both known and unknown classes. The formula for calculating HOS is: The test results are shown in Table 1.

[0109] Table 1. Results of Gear Surface Image Defect Detection Using Different Methods

[0110]

[0111] In Table 1, "Type I gear → Type II gear" indicates that the image sample corresponding to Type I gear is the source domain and the image sample corresponding to Type II gear is the target domain, and "Type II gear → Type I gear" indicates that the image sample corresponding to Type II gear is the source domain and the image sample corresponding to Type I gear is the target domain. As can be seen from Table 1, the method of this invention can balance the detection accuracy of both known and unknown classes, and the harmonic mean index performs optimally, thus proving the advantages of this invention.

[0112] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0113] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0114] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0115] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0116] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for detecting cross-domain gear surface defects based on open set unknown separation, characterized in that, include: Surface images of different types of gears are acquired and divided into training and test sets. Images in the training set are divided into source domain samples and target domain samples according to gear type. The source domain samples are labeled, and the target domain samples are unlabeled. Images in the test set are all target domain samples. A gear surface defect detection model is constructed, which includes a feature extractor, a fuzzy class separation module, an unknown class discriminator, a sub-domain discriminator, and a classifier. The feature extractor is used to extract features from source domain samples and target domain samples to obtain source domain feature data and target domain feature data. The fuzzy class separation module estimates the known class feature space range based on the source domain feature data and target domain feature data and divides the samples in the training set into clear classes and fuzzy classes based on the class clarity scoring mechanism. The gear surface defect detection model is trained using a training set, specifically as follows: the unknown class discriminator is trained using source domain feature data, clear class and fuzzy class corresponding feature data to achieve class decision boundaries for distinguishing known and unknown classes; the classifier is trained using source domain feature data and fuzzy class corresponding feature data to enable the model to distinguish all categories; and the sub-domain discriminator is trained using source domain feature data and clear class corresponding feature data to achieve fine-grained distribution alignment at the category level. The difference in the confidence of the target domain samples with respect to the known class classification is used as a weight in the training process of the unknown class discriminator, classifier and sub-domain discriminator. Risk calibration is performed on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundary. Input the test set into the trained gear surface defect detection model to obtain the results of gear surface defect detection in the target domain; The method of using the difference in confidence scores of target domain samples for known class classification as weights in the training process of the unknown class discriminator, classifier, and sub-domain discriminator, performs risk calibration on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundary, specifically: The loss function for training the unknown class discriminator is: , in, The loss function is used during the training of the unknown class discriminator. This represents the total number of samples in the source domain. Let the label be the j-th source domain sample; if it is a fuzzy class, then... Marked as 1, if it is a clear class Marked as 0; For the j-th source domain sample, ( ) represents the output of the feature extractor. ( ) represents the output of the unknown class discriminator; The total number of samples in the target domain. Let be the label of the i-th target domain sample. For the i-th target domain sample, The known class probability weights for the i-th target domain sample. Let be the probability weight of the unknown class for the i-th target domain sample; The The calculation method is as follows: , Where μ represents the scaling factor. It is a preset constant. For the target domain, Let be the confidence level of the i-th target domain sample; The The calculation method is as follows: ; The loss function during classifier training is: , in, The loss function during classifier training. For the i-th source domain sample, For the source domain, ( ) represents the cross-entropy loss function, and C() represents the output of the classifier. Let i be the label of the i-th source domain sample. For control parameters, The number of samples in the unknown class. For samples of unknown class, This represents an unknown class sample in the target domain; The open set pseudo-labels are assigned to the feature data corresponding to the unknown class. The unknown class probability weights for all target samples; ; The loss function for training the sub-domain discriminator is: , in, Let K be the distribution alignment loss function during the training of the sub-domain discriminators, where K is the total number of sub-domain discriminators; Let the predicted label be the category label for the i-th source domain sample. This indicates whether the predicted label of the i-th source domain sample is class k. If it is class k, then... =1, if it is not category k. =0; ( ) represents the output of the sub-domain discriminator. The number of samples in the target domain after filtering out fuzzy classes. To filter out samples with blurred classes, This represents the samples in the target domain after filtering out fuzzy classes. for Category prediction labels; For the probability weights of all known classes, .

2. The method for detecting cross-domain gear surface defects based on open set unknown separation according to claim 1, characterized in that: The fuzzy class separation module estimates the known class feature space range based on source domain feature data and target domain feature data, and divides the samples in the training set into sharp and fuzzy classes based on a class sharpness scoring mechanism. Specifically: The source domain feature data and target domain feature data are input into the fuzzy class separation module, and the ratio of the distance from the target domain feature data of each target domain sample to the corresponding class prototype to the robust boundary of the feature space of all categories is calculated. For each target domain sample, the smallest ratio among all categories is selected as the category sharpness score. Based on the size of the category sharpness score, the target domain samples are divided into sharp and blurry classes.

3. The method for detecting cross-domain gear surface defects based on open set unknown separation according to claim 2, characterized in that: The calculation of the ratio of the distance from the target domain feature data of each target domain sample to the corresponding class prototype to the robust boundary of the feature space of all classes is specifically as follows: The distance from the target domain feature data of each target domain sample to the corresponding class prototype is calculated as follows: , in, Let c be the Euclidean distance between the target domain feature data of the i-th target domain sample and the corresponding class prototype. k For the k-th class prototype of the target domain sample, The target domain feature data of the i-th target domain sample. The distance is Euclidean. The robust boundary of the class feature space for the k-th class is calculated as follows: , in, Let r be the robust boundary of the feature space of the k-th class, and r be the variable to be determined. Let q be the kernel density function and cumulative distribution function corresponding to the kth class, and q be the control coefficient. The ratio of the distance from the target domain feature data of the i-th target domain sample to the corresponding class prototype to the robust boundary of the class feature space of the k-th class is calculated as follows: .

4. The method for detecting cross-domain gear surface defects based on open set unknown separation according to claim 3, characterized in that: The The calculation method is as follows: , Where, N k Let k be the total number of samples in the target domain of the kth class. This is the bandwidth parameter of the Gaussian kernel function.

5. The method for detecting cross-domain gear surface defects based on open set unknown separation according to claim 1, characterized in that: The The calculation method is as follows: , Where K is the number of known categories, For classifier output Category The probability of.

6. A cross-domain gear surface defect detection system based on open set unknown separation, characterized in that, include: The data acquisition module acquires surface images of different types of gears and divides them into training sets and test sets. The images in the training set are divided into source domain samples and target domain samples according to gear type. The source domain samples are labeled, and the target domain samples are unlabeled. The images in the test set are all target domain samples. The detection model construction module constructs a gear surface defect detection model, which includes a feature extractor, a fuzzy class separation module, an unknown class discriminator, a sub-domain discriminator, and a classifier. The feature extractor is used to extract features from source domain samples and target domain samples to obtain source domain feature data and target domain feature data. The fuzzy class separation module estimates the known class feature space range based on the source domain feature data and target domain feature data and divides the samples in the training set into clear classes and fuzzy classes based on the class clarity scoring mechanism. The training module trains the gear surface defect detection model using the training set. Specifically, it trains the unknown class discriminator using source domain feature data, clear class, and fuzzy class feature data to achieve class decision boundaries that distinguish between known and unknown classes; it trains the classifier using source domain feature data and fuzzy class feature data to enable the model to distinguish all categories; and it trains the sub-domain discriminator using source domain feature data and clear class feature data to achieve fine-grained distribution alignment at the category level. The difference in the confidence of the target domain samples with respect to the known class classification is used as a weight in the training process of the unknown class discriminator, classifier and sub-domain discriminator. Risk calibration is performed on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundary. The detection module takes the test set as input to the trained gear surface defect detection model and obtains the results of gear surface defect detection in the target domain. The method of using the difference in confidence scores of target domain samples for known class classification as weights in the training process of the unknown class discriminator, classifier, and sub-domain discriminator, performs risk calibration on the separation and adaptation process to adapt to the alignment difficulty and dynamically adjust the class decision boundary, specifically: The loss function for training the unknown class discriminator is: , in, The loss function is used during the training of the unknown class discriminator. This represents the total number of samples in the source domain. Let the label be the j-th source domain sample; if it is a fuzzy class, then... Marked as 1, if it is a clear class Marked as 0; For the j-th source domain sample, ( ) represents the output of the feature extractor. ( ) represents the output of the unknown class discriminator; The total number of samples in the target domain. Let be the label of the i-th target domain sample. For the i-th target domain sample, The known class probability weights for the i-th target domain sample. Let be the probability weight of the unknown class for the i-th target domain sample; The The calculation method is as follows: , Where μ represents the scaling factor. It is a preset constant. For the target domain, Let be the confidence level of the i-th target domain sample; The The calculation method is as follows: ; The loss function during classifier training is: , in, The loss function during classifier training. For the i-th source domain sample, For the source domain, ( ) represents the cross-entropy loss function, and C() represents the output of the classifier. Let i be the label of the i-th source domain sample. For control parameters, The number of samples in the unknown class. For samples of unknown class, This represents an unknown class sample in the target domain; The open set pseudo-labels are assigned to the feature data corresponding to the unknown class. The unknown class probability weights for all target samples; ; The loss function for training the sub-domain discriminator is: , in, Let K be the distribution alignment loss function during the training of the sub-domain discriminators, where K is the total number of sub-domain discriminators; Let the predicted label be the category label for the i-th source domain sample. This indicates whether the predicted label of the i-th source domain sample is class k. If it is class k, then... =1, if it is not category k. =0; ( ) represents the output of the sub-domain discriminator. The number of samples in the target domain after filtering out fuzzy classes. To filter out samples with blurred classes, This represents the samples in the target domain after filtering out fuzzy classes. for Category prediction labels; For the probability weights of all known classes, .

Citation Information

Patent Citations

  • Gear case fault diagnosis method based on deep transfer learning

    CN116894187A

  • Defective gear classification method and device and computer readable storage medium

    CN117892203A