Clustering and reconstruction migration-based die casting defect detection method

By adopting a deep neural network model based on clustering and reconstruction migration in die-cast defect detection, the problems of data scarcity and domain offset are solved, and the generalization ability and detection performance of the model are improved.

CN119941727AActive Publication Date: 2025-05-06NINGBO SHUYI GONGLIAN TECH CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510423131.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-05-06
Estimated Expiration
2045-04-07

AI Technical Summary

Technical Problem

During the die-casting production process, existing defect detection algorithms are difficult to achieve better results in different models of products, especially when data scarcity and domain offset problems are prominent.

Method used

A die-cast defect detection method based on clustering and reconstruction migration is proposed. By constructing a deep neural network model including feature extractor, restructuring and classifier, domains are divided using clustering technology, and the generalization ability of the model is improved through adversarial training of restructuring and classifiers.

Benefits of technology

This method can improve the generalization ability of the model and improve the detection performance on different product models when data is scarce and domain differences are large, solving the problem of poor results of traditional methods in migration deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119941727A_ABST
    Figure CN119941727A_ABST
Patent Text Reader

Abstract

The invention discloses a die casting defect detection method based on clustering and reconstruction migration. The method comprises the following steps: preprocessing historical industrial process production data; constructing a defect detection model comprising a feature extractor, a reconstructor and a classifier; during training, clustering the mean value and the standard deviation of the output data of each full connection layer of the feature extractor, and dividing the data into different domains; minimizing the loss I of the feature extractor and the classifier, and minimizing the loss II of the reconstructor, so as to obtain a trained defect detection model; the loss I is a weighted sum of reconstruction loss, distance loss of samples belonging to different domains in reconstruction samples and classification loss; the loss II is a weighted difference value between the reconstruction loss and the distance loss of the reconstruction sample and the input data. According to the method, the transferable classifier can be trained on the single-source-domain die-casting defect data, the method is suitable for the situation that the defect data is insufficient or the type is single, and the method can better adapt to data distribution of different domains.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial defect detection, and in particular to a die-casting defect detection method based on clustering and reconstruction migration. Background Art

[0002] In the die-casting production process, product defect detection is crucial to improving production efficiency and reducing production costs. In the actual production process, the incidence of defective products is low, and it is difficult to obtain sufficient labeled data for all types of products. Some types of products may have a large production volume, while other types of products may have a small production volume. Secondly, there are differences in defect information between different types of products. When a defect detection model trained on a specific type of product is applied to other types of products, domain shift problems will occur, which may reduce the performance of the model. In the above scenario, it is difficult for existing defect detection algorithms to achieve good results in all types of products, and a migration method is needed to generalize the model. Summary of the invention

[0003] In view of the shortcomings of the prior art, the present invention proposes a die-casting defect detection method based on clustering and reconstruction migration. The specific technical solution is as follows:

[0004] A die-casting defect detection method based on clustering and reconstruction migration comprises the following steps:

[0005] S1: Extract the historical industrial process data of die-casting production within a period of time, perform data preprocessing on these data, and avoid the interference of abnormal data on normal data while ensuring the data quantity, so as to obtain training data;

[0006] S2: Construct a defect detection model including a feature extractor, a reconstructor and a classifier; wherein the feature extractor includes multiple fully connected layers for extracting high-dimensional features; the reconstructor and the classifier both include multiple fully connected layers, and the reconstructor is used to output a reconstructed sample that is as close as possible to the original sample input to the feature extractor; the classifier is used to classify the high-dimensional features output by the feature extractor;

[0007] S3: train the defect detection model using the training data obtained in S1; cluster the mean and standard deviation of the output data of each fully connected layer of the feature extractor, and then divide the output data into different domains according to the cluster to which the output data belongs, and assign domain labels; during the training process, minimize the feature extractor and classifier loss, while minimizing the reconstructor loss, thereby obtaining the trained defect detection model; The loss is the reconstruction loss of the reconstructed sample and the input data , the distance loss of samples belonging to different domains in the reconstruction sample And the classification loss The weighted sum of these three losses; The loss is the reconstruction loss of the reconstructed sample and the input data , the distance loss of samples belonging to different domains in the reconstruction sample The weighted difference of these two losses;

[0008] S4: Obtain real-time die-casting production industrial process data, pre-process it using the method of S1, and input it into the trained defect detection model. The input data is passed through the feature extractor to obtain high-dimensional features, and then the high-dimensional features are input into the classifier to obtain defect detection results.

[0009] Furthermore, step S1 specifically includes the following sub-steps: S1.1: Extract the historical industrial process data of die casting production over a period of time as the original data; S1.2: Based on expert experience, screen the process parameters whose correlation with die-casting defects is not less than the set correlation threshold, and delete the parameters whose correlation is less than the set correlation threshold; S1.3: Use the isolation forest method to detect outliers in the original data. For abnormal data, execute S1.4; for the remaining data, jump to step S1.5 for execution; S1.4: For each abnormal data, a local linear regression method is used to calculate the regression prediction value based on the normal data near the abnormal data, and the original abnormal data is replaced; S1.5: Integrate the normal data and the data obtained in step S1.4 to obtain training data.

[0010] Furthermore, each fully connected layer of the feature extractor includes a linear layer, a ReLU activation function layer and a discard layer, and each fully connected layer of the reconstructor and the classifier includes a linear layer and a ReLU activation function layer.

[0011] Furthermore, the feature extractor and classifier training loss, training of the reconstructor The loss is calculated as follows: ; ; ; ; ; ; ;

[0012] in, is the weight coefficient of reconstruction loss, is the weight coefficient of distance loss; N is the amount of data in a training batch, is the nth training data, is the label of the nth training data; K is the number of domains obtained by clustering N statistical vectors; represents the distance between samples belonging to the domain with domain label b and the domain with domain label a; represents the set of reconstructed samples with domain label a among the reconstructed samples generated by the reconstructor; represents the set of reconstructed samples with domain label b among the reconstructed samples generated by the reconstructor; A is The total number of samples in, B is The total number of samples in ; express The pth sample in express The qth sample in ; is the output value of the nth training sample after the classifier, Output value The conditional score.

[0013] Furthermore, in step S4, if the classifier output value is greater than 0.5, it is considered that the input data has defects.

[0014] A die-casting defect detection device based on clustering and reconstruction migration comprises a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a die-casting defect detection method based on clustering and reconstruction migration.

[0015] A computer-readable storage medium stores a program, which, when executed by a processor, implements a die-casting defect detection method based on clustering and reconstruction migration.

[0016] The beneficial effects of the present invention are as follows:

[0017] When the defect data of certain product models is very limited and cannot be fully trained, the method and device proposed in the present invention can improve the generalization ability of the model through clustering-reconstruction-adversarial training; when the defect features between different product models vary greatly, resulting in poor results of traditional defect detection methods, the method and device proposed in the present invention can deal with the domain shift problem by learning more robust feature representations. When the model generalization requirements are high, for example, the same defect detection model needs to be applied to multiple different product models, and it is hoped that the model can maintain high performance on each model, the method and device proposed in the present invention can help the model better adapt to the data distribution of different domains. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a flow chart of a die-casting defect detection method based on clustering and reconstruction migration in an embodiment of the present invention.

[0019] Figure 2 4 is a flow chart of data preprocessing in an embodiment of the present invention.

[0020] Figure 3 It is a schematic diagram of the structure of the feature extractor, reconstructor and classifier in an embodiment of the present invention.

[0021] Figure 4 It is a schematic diagram of the structure of a die-casting defect detection device based on clustering and reconstruction migration in an embodiment of the present invention. DETAILED DESCRIPTION

[0022] The present invention will be described in detail below based on the accompanying drawings and preferred embodiments, and the purpose and effects of the present invention will become more clear. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0023] Die-casting defects are mainly divided into surface defects, internal defects and size defects, which are characterized by diversity, complexity, concealment and randomness. The diversity of die-casting defects is mainly reflected in the rich types of defects. Common surface defects include flow marks, cold shuts, shrinkage (dents), marks, delamination (skinning and peeling), erosion, cracks, etc.; internal defects include pores, shrinkage cavities, shrinkage, slag inclusions, etc. The complexity of die-casting defects mainly lies in the complexity of their formation mechanism, which may be affected by a variety of factors, such as mold design, die-casting process parameters, raw material quality, equipment status, etc. The concealment and randomness of die-casting defects are mainly reflected in: some defects such as internal pores and shrinkage cavities are difficult to observe directly with the naked eye and require the help of professional detection technology; under the same process conditions, the occurrence of defects is uncertain and may occur due to minor process fluctuations or accidental factors.

[0024] Based on the above characteristics of die-casting defects, defect detection for die-casting parts faces difficulties such as data scarcity, high defect diversity and similarity, and difficulty in detecting complex structures. Traditional defect detection methods are difficult to perform comprehensive detection of die-casting defects. In addition, due to the uneven number of products produced by factories, the amount of product data for some models is extremely scarce, and die-casting defect detection methods are difficult to migrate and deploy between product models.

[0025] In view of the characteristics and difficulties of the above-mentioned die-casting defect detection, the present invention proposes a die-casting defect detection method based on clustering and reconstruction migration. Since the mechanism of die-casting defect formation is relatively complex, and there are coupling and nonlinear associations between different process variables, the present invention uses a deep neural network containing multiple fully connected layers as a feature extractor to effectively extract the association between each process variable and obtain feature expressions in high-dimensional space at the same time; similarly, due to the complexity and diversity of die-casting data, the reconstructor uses a structure connected by multiple layers of fully connected layers, so that the reconstructor has a stronger ability to extract features from high-dimensional feature expressions and reconstruct and restore, and can obtain more accurate reconstructed samples during training; in addition, due to the similarity of die-casting defects, a deep neural network composed of fully connected layers is used as a classifier, so that it considers the nonlinear relationship between variables and makes predictions with higher accuracy; when dividing domain labels, the present invention takes into account that samples belonging to different hidden domains will have differences in statistics such as mean and standard deviation, so the statistic vector is calculated in each layer output of the feature extractor as the basis for dividing domain labels, and these statistics are a high-level summary of the distribution of process parameters, which can effectively reduce the noise interference caused by the complexity and similarity of die-casting defects.

[0026] like Figure 1 As shown, the die-casting defect detection method based on clustering and reconstruction migration of the present invention comprises the following steps:

[0027] S1: Extract historical industrial process production data over a period of time from the database of the die-casting factory, perform data preprocessing on these data, and avoid the interference of abnormal data on normal data while ensuring the data quantity, so as to obtain training data.

[0028] like Figure 2 As shown, step S1 specifically includes the following sub-steps: (1.1) Obtain production data for a period of time from the database of the die-casting factory as raw data; (1.2) Based on expert experience, screen the process parameters whose correlation with the generation of die-casting defects is not less than the set correlation threshold, and delete the parameters whose correlation is less than the set correlation threshold; (1.3) Use the isolation forest method to detect outliers in the filtered data. For abnormal data, execute step (1.4); for the remaining data, jump to step (1.5); (1.4) For each abnormal data, a local linear regression method is used to calculate the regression prediction value based on the normal data near the abnormal data, and replace the original abnormal data; (1.5) Integrate the normal data and the data obtained in step (1.4) to obtain training data.

[0029] S2: Construct a defect detection model including a feature extractor, a reconstructor and a classifier; wherein the feature extractor includes multiple fully connected layers for extracting high-dimensional features; the reconstructor and the classifier both include multiple fully connected layers, and the reconstructor is used to output reconstructed samples that are as close as possible to the original samples input to the feature extractor; the classifier is used to classify the high-dimensional features output by the feature extractor.

[0030] (1) Feature Extractor

[0031] Each fully connected layer of the feature extractor contains a linear layer, a ReLU (Rectified Linear Unit) activation function layer, and a dropout layer. The input of the first fully connected layer is the input of the feature extractor, and the input of each subsequent fully connected layer is the output of the previous fully connected layer. Each fully connected layer extracts higher-dimensional information in turn, and finally obtains the output of the feature extractor.

[0032] Suppose the input of the i-th fully connected layer is , then its output It can be expressed as:

[0033]

[0034] in, is the weight matrix of the linear layer of the i-th fully connected layer, is the bias vector of the linear layer of the i-th fully connected layer, It means that the drop layer drops each dimension of its input with probability p. In this embodiment, the probability p of the drop layer in all fully connected layers takes the same value of 0.3, but other values ​​are also applicable to the method proposed by the present invention.

[0035] The input and output expressions of the above i-th fully connected layer can be simplified as:

[0036]

[0037] in represents the i-th fully connected layer. The input and output expressions of the entire feature extractor are:

[0038]

[0039] Where x represents the input of the feature extractor, z represents the output of the feature extractor, and Feat represents the extraction operation of the feature extractor.

[0040] (2) Reconstructor

[0041] The input of the reconstructor is the high-dimensional features output by the feature extractor, and the output is a reconstructed sample that is as close as possible to the original sample input to the feature extractor. This reconstruction step can improve the feature extractor's ability to extract domain-invariant features. Each fully connected layer of the reconstructor includes a linear layer and a ReLU activation function layer. The input of the first fully connected layer is the high-dimensional features output by the feature extractor, and the input of each subsequent fully connected layer is the output of the previous fully connected layer. The output dimension of the last fully connected layer is the same as the input dimension of the first fully connected layer of the feature extractor.

[0042] Assume that the reconstructor consists of R fully connected layers, and the input and output of each fully connected layer can be expressed as:

[0043]

[0044] in, is the input of the rth fully connected layer, is the output of the rth fully connected layer, is the weight matrix of the rth fully connected layer, is the bias term of the rth fully connected layer, represents the rth fully connected layer of the reconstructor. The input and output of the entire reconstructor can be expressed as:

[0045]

[0046] Among them, Recon represents the reconstructor, z represents the high-dimensional features output by the feature extractor, Represents the new data reconstructed by the reconstructor.

[0047] (3) Classifier

[0048] The input of the first fully connected layer of the classifier is the high-dimensional features output by the feature extractor, and the input of each subsequent fully connected layer is the output of the previous fully connected layer. Each fully connected layer includes a linear layer and a ReLU activation function layer. The dimension of the output of the last fully connected layer of the classifier is the same as the number of defect categories. This embodiment is aimed at defect detection in the die-casting production process, so it is a two-class classification, but the method proposed in the present invention is also applicable to multi-classification scenarios.

[0049] Assume that the classifier consists of C fully connected layers, and the input and output of each fully connected layer can be expressed as:

[0050]

[0051] in, represents the input of the cth fully connected layer, represents the output of the cth fully connected layer, is the weight matrix of the cth fully connected layer, is the bias term of the cth fully connected layer, represents the cth fully connected layer of the reconstructor. The input and output of the entire classifier can be expressed as:

[0052]

[0053] in, represents the classification operation of the classifier, z is the high-dimensional feature output by the feature extractor, e is the output of the classifier, .

[0054] S3: Use the training data obtained in S1 to train the defect detection model, in which the mean and standard deviation of the output data of each fully connected layer of the feature extractor are clustered, and then the output data is divided into different domains according to the cluster to which the output data belongs, and the domain labels are assigned; at the same time, for the samples reconstructed by the reconstructor, the distance between the samples belonging to each domain is maximized, which plays the role of adversarial training; the adversarial training operation can prompt the feature extractor to learn domain-invariant features in the confrontation with the reconstructor and improve the generalization performance; during the training process, the feature extractor and classifier are minimized. loss, while minimizing the reconstructor Loss, thus obtaining the trained defect detection model; The loss is the reconstruction loss of the reconstructed sample and the input data , the distance loss of samples belonging to different domains in the reconstruction sample and the weighted sum of classification losses; The loss is the reconstruction loss of the reconstructed sample and the input data , the distance loss of samples belonging to different domains in the reconstruction sample The weighted difference of .

[0055] Suppose the output of the i-th fully connected layer is , Is has ( )-dimensional vector, such as Figure 3 As shown, the mean and standard deviation are calculated as follows:

[0056]

[0057]

[0058] in, is the mean of the output of the i-th fully connected layer, is the standard deviation of the output of the i-th fully connected layer, express The jth dimension of . Assuming that the feature extractor has a total of F fully connected layers, the mean and standard deviation of the outputs of all fully connected layers can be concatenated into a vector and expressed as:

[0059]

[0060] is the statistic vector of the input data x.

[0061] Assume that there are N data in a training batch, expressed as ,in is the nth training data, is the label of the nth training data. After this batch of training data passes through the feature extractor, N statistical vectors can be obtained. Clustering these N statistical vectors can be divided into K domains. At this time, the training data has an additional domain label in addition to the original label, which is expressed as ,in is the domain label of the nth data, and its value is .

[0062] This step artificially divides the data originally belonging to the same source domain into different subdomains, which is conducive to the model learning domain-invariant features.

[0063] For the samples reconstructed by the reconstructor, the distance between samples belonging to different domains can be expressed as:

[0064]

[0065] in, represents the set of reconstructed samples with domain label a among the reconstructed samples generated by the reconstructor; represents the set of reconstructed samples with domain label b among the reconstructed samples generated by the reconstructor; A is The total number of samples in, B is The total number of samples in ; express The pth sample in express The qth sample in .

[0066] Therefore, the feature extractor and classifier training The loss is calculated as follows:

[0067]

[0068] in, is the weight coefficient of reconstruction loss, is the weight coefficient of distance loss.

[0069] The reconstruction training The loss is calculated as follows:

[0070]

[0071] Among them, the reconstruction loss The calculation formula is:

[0072]

[0073] Distance loss for reconstructing samples belonging to different domains The calculation formula is:

[0074]

[0075] Classification Loss It can be expressed as:

[0076]

[0077] in, is the output value of the nth training sample after the classifier, the output value The conditional score It can be expressed as:

[0078]

[0079] S4: Obtain real-time industrial process production data, pre-process it using the method of S1, and input it into the trained defect detection model. The input data is passed through the feature extractor to obtain high-dimensional features, and then the high-dimensional features are input into the classifier to obtain the defect detection results.

[0080] As one implementation method, if the classifier output value is greater than 0.5, it is considered that the input data has defects.

[0081] like Figure 4 As shown, an embodiment of the present invention provides a die-casting defect detection migration device based on clustering and reconstruction on the basis of a die-casting defect detection method based on clustering and reconstruction migration. The device includes a memory and one or more processors. The memory stores executable codes. When one or more processors execute the executable codes, they are used to implement the die-casting defect detection method based on clustering and reconstruction migration in the above embodiment.

[0082] The die-casting defect detection device based on clustering and reconstruction migration can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The die-casting defect detection migration device based on clustering and reconstruction can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located, reading the corresponding computer program instructions in the non-volatile memory into the internal memory for execution. From the hardware level, if Figure 4 As shown, it is a hardware structure diagram of a die casting defect detection device based on clustering and reconstruction migration of the present invention, in which any device with data processing capability is located, except Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus of the present invention is located in the embodiments may also include other hardware, which will not be described in detail herein, based on the actual functions of the device with data processing capabilities.

[0083] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0084] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only exemplary, and the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.

[0085] An embodiment of the present invention further provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the die-casting defect detection method based on clustering and reconstruction migration in the above embodiment is implemented.

[0086] The computer-readable storage medium may be an internal storage unit of any device with data processing capability in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device of any device with data processing capability, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store computer programs and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.

[0087] The following is a specific industrial case of die-casting production to verify the effectiveness of the present invention. The data of this case was obtained from a die-casting factory between January 1 and August 21, 2024, and the time interval of the data was about 30 seconds. 14 features were selected from the die-casting factory database as input variables. This batch of data contains three types of products: top cover, middle cover and side cover. After preprocessing the original data, 5423 data of top cover production, 13173 data of middle cover production, and 102174 data of side cover production were obtained. It is defined that the migration from top cover data to middle cover data is task 1, the migration of top cover data to side cover data is task 2, the migration of middle cover data to top cover data is task 3, the migration of middle cover data to side cover data is task 4, the migration of side cover data to top cover data is task 5, and the migration of side cover data to middle cover data is task 6. In each task, the model is trained on the source domain data and tested on the target domain data.

[0088] In this embodiment, the feature extractor of the defect detection model includes 4 fully connected layers, the input dimension of the linear layer of the first fully connected layer is 14, and the output dimension is 128; the input dimension and output dimension of the linear layer of the second fully connected layer are both 128; the input dimension and output dimension of the linear layer of the third fully connected layer are both 128; the input dimension of the linear layer of the fourth fully connected layer is 128, and the output dimension is 16. The reconstructor includes 2 fully connected layers, the input dimension of the linear layer of the first fully connected layer is 16, and the output dimension is 64; the input dimension of the linear layer of the second fully connected layer is 64, and the output dimension is 14. The classifier includes 2 fully connected layers, the input dimension of the linear layer of the first fully connected layer is 16, and the output dimension is 32; the input dimension of the linear layer of the second fully connected layer is 32, and the output dimension is 1.

[0089] In this embodiment, based on expert experience, process parameters such as clamping force, maximum metal pressure in the pressurization stage, and cavity filling time, whose correlation with die-casting defects is not less than the set correlation threshold, are selected for defect detection, and other parameters whose correlation is less than the set correlation threshold are eliminated.

[0090] In order to illustrate the prediction effect of the method of this embodiment, other existing prediction methods are also used for prediction. The models used for comparison include: Empirical Risk Minimization (ERM) and Support Sample-assisted Adversarial Attacks (SSAA). The model evaluation indicator is the area under the ROC curve (AUROC). The detection effects of each model on the six migration tasks are shown in Table 1.

[0091] Table 1 Comparison of the migration effects of various methods on the real die casting production dataset

[0092] method Task 1 Task 2 Task 3 Task 4 Task 5 Task 6 average value ERM 0.9852 0.3323 0.4887 0.7381 0.7841 0.7391 0.6779 SSAA 0.9990 0.3834 0.5817 0.7441 0.7810 0.9947 0.7473 The present invention 0.9834 0.5626 0.8091 0.7442 0.8574 0.9927 0.8249

[0093] It can be seen from the results in Table 1 that the method of this embodiment achieves the best results in the four migration tasks, and the average value is significantly higher than that of the comparison method, thereby confirming the effectiveness and superiority of the present invention in the migration of die-casting defect detection.

[0094] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention shall be included in the protection scope of the invention.

Claims

1. A die-casting defect detection method based on clustering and reconstruction migration, characterized in that: The following steps are involved: S1: Extract the historical industrial process data of die-casting production within a period of time, perform data preprocessing on these data, and avoid the interference of abnormal data on normal data while ensuring the data quantity, so as to obtain training data; S2: Construct a defect detection model including a feature extractor, a reconstructor and a classifier; wherein the feature extractor includes multiple fully connected layers for extracting high-dimensional features; the reconstructor and the classifier both include multiple fully connected layers, and the reconstructor is used to output a reconstructed sample that is as close as possible to the original sample input to the feature extractor; the classifier is used to classify the high-dimensional features output by the feature extractor; S3: train the defect detection model using the training data obtained in S1; cluster the mean and standard deviation of the output data of each fully connected layer of the feature extractor, and then divide the output data into different domains according to the cluster to which the output data belongs, and assign domain labels; during the training process, minimize the feature extractor and classifier loss, while minimizing the reconstructor loss, thereby obtaining the trained defect detection model; The loss is the reconstruction loss of the reconstructed sample and the input data , the distance loss of samples belonging to different domains in the reconstruction sample And the classification loss The weighted sum of these three losses; The loss is the reconstruction loss of the reconstructed sample and the input data , the distance loss of samples belonging to different domains in the reconstruction sample The weighted difference of these two losses; S4: Obtain real-time die-casting production industrial process data, pre-process it using the method of S1, and input it into the trained defect detection model. The input data is passed through the feature extractor to obtain high-dimensional features, and then the high-dimensional features are input into the classifier to obtain defect detection results.

2. The die-casting defect detection method based on clustering and reconstruction migration according to claim 1 is characterized in that: Step S1 specifically includes the following sub-steps: S1.1: Extract the historical industrial process data of die casting production over a period of time as the original data; S1.2: Based on expert experience, screen the process parameters whose correlation with die-casting defects is not less than the set correlation threshold, and delete the parameters whose correlation is less than the set correlation threshold; S1.3: Use the isolation forest method to detect outliers in the original data. For abnormal data, execute S1.4; for the remaining data, jump to step S1.5 for execution; S1.4: For each abnormal data, a local linear regression method is used to calculate the regression prediction value based on the normal data near the abnormal data, and the original abnormal data is replaced; S1.5: Integrate the normal data and the data obtained in step S1.4 to obtain training data.

3. The die-casting defect detection method based on clustering and reconstruction migration according to claim 1 is characterized in that: Each fully connected layer of the feature extractor includes a linear layer, a ReLU activation function layer and a discard layer, and each fully connected layer of the reconstructor and the classifier includes a linear layer and a ReLU activation function layer.

4. The die-casting defect detection method based on clustering and reconstruction migration according to claim 1 is characterized in that: Training of feature extractors and classifiers loss, training of the reconstructor The loss is calculated as follows: ; ; ; ; ; ; ; in, is the weight coefficient of reconstruction loss, is the weight coefficient of distance loss; N is the amount of data in a training batch, is the nth training data, is the label of the nth training data; K is the number of domains obtained by clustering N statistical vectors; represents the distance between samples belonging to the domain with domain label b and the domain with domain label a; represents the set of reconstructed samples with domain label a among the reconstructed samples generated by the reconstructor; represents the set of reconstructed samples with domain label b among the reconstructed samples generated by the reconstructor; A is The total number of samples in, B is The total number of samples in ; express The pth sample in express The qth sample in ; is the output value of the nth training sample after the classifier, Output value The conditional score.

5. The die-casting defect detection method based on clustering and reconstruction migration according to claim 1 is characterized in that: In step S4, if the classifier output value is greater than 0.5, it is considered that the input data has defects.

6. A die-casting defect detection device based on clustering and reconstruction migration, characterized in that: It comprises a memory and one or more processors, wherein the memory stores executable codes, and when the one or more processors execute the executable codes, they are used to implement the die-casting defect detection method based on clustering and reconstruction migration as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the die-casting defect detection method based on clustering and reconstruction migration as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Negative migration suppression method for cross-domain classification and recognition of apparent defects

    CN116777896A

  • Product detection model training method and device, product detection method and device and storage medium

    CN117668686A

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

    CN117892203A

  • Photovoltaic module online defect detection method and system, storage medium and equipment

    CN119006880A

  • Device-free localization robust to environmental changes

    US20210241173A1