A Die Casting Defect Detection Method Based on Clustering and Reconstruction Migration
Through the method based on clustering and reconstruction migration, a deep neural network model is constructed, which solves the problem of migrating die-cast defect detection model among different product models, and achieves better generalization capabilities and detection effects.
Patent Information
- Application Number
- CN202510423131.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-04-07
AI Technical Summary
In die-casting production, defect detection models are difficult to effectively migrate between different product models, resulting in performance degradation, especially on products with scarce defect data or single type, and existing methods are difficult to achieve good generalization effects.
Using a clustering and reconstruction migration method, a deep neural network model including feature extractors, reconstructors and classifiers is constructed, and the output data of the feature extractor is divided into different domains using clustering technology, and the generalization ability of the model is improved through adversarial training.
The adaptability and detection accuracy of the model among different product models is improved, especially when defect data is scarce or the type is single, which significantly improves the effect of defect detection.
Smart Images

Figure CN119941727B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial defect detection, and particularly to a die-casting defect detection method based on clustering and reconstruction transfer. Background Art
[0002] In the die-casting production process, product defect detection is crucial for improving production efficiency and reducing production costs. In the actual production process, the incidence of defective products is relatively low, and it is difficult to obtain sufficient labeled data for all types of products. It is possible that the production volume of some types of products is large, while that of other types of products is small. 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, a domain shift problem may occur, which may reduce the performance of the model. In the above scenarios, existing defect detection algorithms are difficult to achieve good results in all models of products, and a transfer method needs to be adopted to generalize the model. Summary of the Invention
[0003] Aiming at the deficiencies of the prior art, the present invention proposes a die-casting defect detection method based on clustering and reconstruction transfer. The specific technical solutions are as follows:
[0004] A die-casting defect detection method based on clustering and reconstruction transfer includes the following steps:
[0005] S1: Extract the historical industrial process data of die-casting production over a period of time, and perform data preprocessing on these data to avoid the interference of abnormal data on normal data while ensuring the quantity of data, thereby obtaining training data;
[0006] S2: Construct a defect detection model including a feature extractor, a reconstructor, and a classifier; among them, the feature extractor includes multiple fully connected layers for extracting high-dimensional features; both the reconstructor and the classifier 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: Use the training data obtained in S1 to train the defect detection model; among them, perform clustering on 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 clusters to which the output data belongs, and assign domain labels; during the training process, minimize the loss for the feature extractor and the classifier, and at the same time minimize the loss for the reconstructor, thereby obtaining the trained defect detection model; the loss is the reconstruction loss between the reconstructed sample and the input data and the distance loss between samples belonging to different domains in the reconstructed sample and the classification loss the weighted sum of these three losses; The loss is the reconstruction loss between the reconstructed samples and the input data and the distance loss between samples belonging to different domains in the reconstructed samples the weighted difference between these two losses;
[0008] S4: Obtain real-time die-casting production industrial process data. After preprocessing using the method of S1, input it into the trained defect detection model. The input data passes 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 result.
[0009] Furthermore, step S1 specifically includes the following sub-steps:
[0010] S1.1: Extract the die-casting production historical industrial process data within a period of time as the original data;
[0011] S1.2: Combine expert experience to screen out process parameters whose correlation with die-casting defect generation is not less than the set correlation threshold, and delete parameters with a correlation less than the set correlation threshold;
[0012] 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 to execute;
[0013] S1.4: For each piece of abnormal data, use the local linear regression method to calculate the regression prediction value based on the normal data near the abnormal data, and replace the original abnormal data;
[0014] S1.5: Integrate the normal data and the data obtained in step S1.4 to obtain the training data.
[0015] Furthermore, each fully connected layer of the feature extractor includes a linear layer, a ReLU activation function layer, and a dropout layer, and each fully connected layer of the reconstructor and the classifier includes a linear layer and a ReLU activation function layer.
[0016] Furthermore, the loss for training the feature extractor and the classifier and the loss for training the reconstructor The calculation formulas of the losses are as follows:
[0017] ;
[0018] ;
[0019] ;
[0020] ;
[0021] ;
[0022] ;
[0023] ;
[0024] wherein, is the weight coefficient of the reconstruction loss, is the weight coefficient of the 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; represents the pth sample in, represents the qth sample in; is the output value of the nth training sample after passing through the classifier, is the output value 's conditional score.
[0025] Furthermore, in step S4, if the output value of the classifier is greater than 0.5, it is considered that the input data has defects.
[0026] A die-casting defect detection device based on clustering and reconstruction transfer, including a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used to implement the die-casting defect detection method based on clustering and reconstruction transfer.
[0027] A computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, it implements the die-casting defect detection method based on clustering and reconstruction transfer.
[0028] The beneficial effects of the present invention are as follows:
[0029] When the defect data of certain product models is very limited and insufficient for training, the method and device proposed by the present invention can improve the generalization ability of the model through clustering-reconstruction-adversarial training; when the defect characteristics vary greatly among different product models, resulting in poor performance of traditional defect detection methods, the method and device proposed by the present invention can address the domain shift problem by learning more robust feature representations. When the model has a high generalization requirement, for example, when the same defect detection model needs to be applied to multiple different product models and it is desired that the model can maintain high performance on each model, the method and device proposed by the present invention can help the model better adapt to the data distributions of different domains. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a flowchart of the die-casting defect detection method based on clustering and reconstruction migration in an embodiment of the present invention.
[0031] Figure 2 is a flowchart of data preprocessing in an embodiment of the present invention.
[0032] Figure 3 is a schematic structural diagram of a feature extractor, a reconstructor, and a classifier in an embodiment of the present invention.
[0033] Figure 4 is a schematic structural diagram of the die-casting defect detection device based on clustering and reconstruction migration in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0034] The present invention will be described in detail below according to the accompanying drawings and preferred embodiments. The objectives and effects of the present invention will become more apparent. 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.
[0035] Die-casting defects are mainly divided into surface defects, internal defects, and dimensional defects, and have characteristics such as 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, sink marks (dents), imprints, delamination (skin inclusion and peeling), erosion, cracks, etc.; internal defects include gas holes, shrinkage cavities, shrinkage porosity, slag inclusions, etc. The complexity of die-casting defects lies mainly in the complex formation mechanism, which may be affected by a combination of multiple factors, such as die design, die-casting process parameters, raw material quality, equipment status, etc. The concealment and randomness of die-casting defects are mainly reflected in that some defects, such as internal gas holes and shrinkage cavities, are difficult to directly observe with the naked eye and require the aid of professional detection techniques; under the same process conditions, the occurrence of defects is uncertain and may occur due to minor process fluctuations or accidental factors.
[0036] Based on the characteristics of the above die-casting defects, defect detection of die-cast parts faces difficulties such as scarce data, high diversity and similarity of defects, and difficulty in detecting complex structures. Traditional defect detection methods are difficult to comprehensively detect die-casting defects. In addition, due to the imbalance in the number of products produced by the factory, the amount of data for some product models is extremely scarce, and it is difficult to deploy die-casting defect detection methods across different product models.
[0037] In view of the above characteristics and difficulties of 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 non-linear correlations 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 correlation relationships between various process variables and obtain feature expressions in a 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 fully connected layers, making the reconstructor more capable of extracting features from high-dimensional feature expressions and reconstructing and restoring them, and being able to 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, enabling it to consider the non-linear relationships between variables and make more accurate predictions. 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. Therefore, statistic vectors are calculated in the output of each layer of the feature extractor as the basis for dividing domain labels. At the same time, these statistics are a highly generalized summary of the process parameter distribution and can effectively reduce the noise interference caused by the complexity and similarity of die-casting defects.
[0038] As Figure 1 shown, the die-casting defect detection method based on clustering and reconstruction migration of the present invention includes the following steps:
[0039] S1: Extract historical industrial process production data within a certain period from the database of the die-casting factory, and perform data preprocessing on this data to ensure the quantity of data while avoiding the interference of abnormal data on normal data, thereby obtaining training data.
[0040] As Figure 2 shown, step S1 specifically includes the following sub-steps:
[0041] (1.1) Obtain the production data within a certain period from the database of the die-casting factory as the original data;
[0042] (1.2) Combine expert experience to screen out process parameters whose correlation with die-casting defect generation is not less than a set correlation threshold, and delete parameters with a correlation less than the set correlation threshold;
[0043] (1.3) Use the Isolation Forest method to detect outliers in the screened data. For the abnormal data, execute step (1.4); for the remaining data, jump to step (1.5) to execute;
[0044] (1.4) For each piece of abnormal data, use the local linear regression method to calculate the regression prediction value based on the normal data near the abnormal data, and replace the original abnormal data;
[0045] (1.5) Integrate the normal data and the data obtained in step (1.4) to obtain the training data.
[0046] S2: Build a defect detection model including a feature extractor, a reconstructor, and a classifier; among them, the feature extractor includes multiple fully connected layers for extracting high-dimensional features; both the reconstructor and the classifier include multiple fully connected layers. 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.
[0047] (1) Feature extractor
[0048] 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.
[0049] Let the input of the i-th fully connected layer be , then its output can be expressed as:
[0050]
[0051] where, 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, represents that the dropout layer discards each dimension of its input with a probability of p. In this embodiment, the probability p of the dropout layer in all fully connected layers takes the same value of 0.3, but taking other values is also applicable to the method proposed by the present invention.
[0052] The input-output expression of the above-mentioned i-th fully connected layer can be simplified as:
[0053]
[0054] where represents the i-th fully connected layer. The input-output expression of the entire feature extractor is:
[0055]
[0056] Among them, 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.
[0057] (2) Reconstructor
[0058] The input of the reconstructor is the high-dimensional feature 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 enhance the ability of the feature extractor 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 feature 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.
[0059] Suppose the reconstructor consists of R fully connected layers, and the input and output of each fully connected layer can be expressed as:
[0060]
[0061] Among them, is the input of the r-th fully connected layer, is the output of the r-th fully connected layer, is the weight matrix of the r-th fully connected layer, is the bias term of the r-th fully connected layer, represents the r-th fully connected layer of the reconstructor. The input and output of the entire reconstructor can be expressed as:
[0062]
[0063] Among them, Recon represents the reconstructor, z represents the high-dimensional feature output by the feature extractor, represents the new data reconstructed by the reconstructor.
[0064] (3) Classifier
[0065] The input of the first fully connected layer of the classifier is the high-dimensional feature 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 output dimension of the last fully connected layer of the classifier is the same as the number of defect categories. In this embodiment, it is for defect detection in the die-casting production process, so it is a binary classification, but the method proposed by the present invention is also applicable to the scenario of multi-classification.
[0066] Suppose the classifier consists of C fully connected layers, and the input and output of each fully connected layer can be expressed as:
[0067]
[0068] Among them, represents the input of the c-th fully connected layer, represents the output of the c-th fully connected layer, is the weight matrix of the c-th fully connected layer, is the bias term of the c-th fully connected layer, represents the c-th fully connected layer of the reconstructor. The input and output of the entire classifier can be expressed as:
[0069]
[0070] Among them, represents the classification operation of the classifier, z is the high-dimensional feature output by the feature extractor, and e is the output of the classifier, .
[0071] S3: Use the training data obtained in S1 to train the defect detection model. Among them, cluster the mean and standard deviation of the output data of each fully connected layer of the feature extractor, then divide the output data into different domains according to the clusters to which the output data belongs, and assign domain labels; at the same time, for the samples reconstructed by the reconstructor, maximize the distance between the samples belonging to each domain, which plays the role of adversarial training; the operation of adversarial training 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, minimize loss for the feature extractor and the classifier, and at the same time minimize loss for the reconstructor, so as to obtain the trained defect detection model; The loss is the weighted sum of the reconstruction loss between the reconstructed sample and the input data and the distance loss between the samples belonging to different domains in the reconstructed sample The loss is the weighted difference between the reconstruction loss between the reconstructed sample and the input data and the distance loss between the samples belonging to different domains in the reconstructed sample
[0072] Suppose the output of the i-th fully connected layer is , is a vector with ( ) dimensions, as shown in Figure 3 , and calculate its mean and standard deviation as follows:
[0073]
[0074]
[0075] Among them, 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, denotes the j-th dimension of. Suppose the feature extractor has F fully connected layers, then the mean and standard deviation of the outputs of all fully connected layers are concatenated into a vector, which can be expressed as:
[0076]
[0077] is the statistic vector of the input data x.
[0078] Suppose there are N data in a training batch, denoted as , among which is the n-th training data, is the label of the n-th training data. After these N training data pass through the feature extractor, N statistic vectors can be obtained. Clustering these N statistic vectors can divide them into K domains. At this time, the training data has an additional domain label in addition to the original label, denoted as , among which is the domain label of the n-th data, and the value range is .
[0079] This step artificially divides the data belonging to the same source domain into different sub-domains, which is beneficial for the model to learn domain-invariant features.
[0080] For the samples reconstructed by the reconstructor, the distance between samples belonging to different domains can be expressed as:
[0081]
[0082] Among them, 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 ; denotes the p-th sample in, denotes the q-th sample in.
[0083] Therefore, for the training of the feature extractor and the classifier, the calculation formula of the loss is as follows:
[0084]
[0085] Among them, is the weight coefficient of the reconstruction loss, is the weight coefficient of the distance loss.
[0086] For the training of the reconstructor The calculation formula of the loss is as follows:
[0087]
[0088] Among them, the reconstruction loss The calculation formula is:
[0089]
[0090] The distance loss of samples belonging to different domains in the reconstructed samples The calculation formula is:
[0091]
[0092] The classification loss can be expressed as:
[0093]
[0094] Among them, is the output value of the nth training sample passing through the classifier, and the output value The conditional score of can be expressed as:
[0095]
[0096] S4: Obtain real-time industrial process production data. After preprocessing by the method of S1, input it into the trained defect detection model. The input data passes 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 result.
[0097] As one of the implementation manners, if the output value of the classifier is greater than 0.5, it is considered that the input data has defects.
[0098] As Figure 4 shown, based on the die-casting defect detection method based on clustering and reconstruction migration, the embodiment of the present invention provides a die-casting defect detection migration device based on clustering and reconstruction. The device includes a memory and one or more processors. The memory stores executable code. When the one or more processors execute the executable code, it is used to implement the die-casting defect detection method based on clustering and reconstruction migration in the above embodiment.
[0099] The die-casting defect detection device based on clustering and reconstruction migration can be applied to any device with data processing capabilities, and such a 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 logically meaningful device, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory and running them through the processor of any device with data processing capabilities where it is located. From the hardware level, as Figure 4 shown, it is a hardware structure diagram of any device with data processing capabilities where the die-casting defect detection device based on clustering and reconstruction migration of the present invention is located. In addition to Figure 4 the processor, memory, network interface, and non-volatile memory shown, in the embodiments, any device with data processing capabilities where the device of the present invention is located usually includes other hardware according to the actual functions of the device with data processing capabilities, which will not be elaborated here.
[0100] For the implementation process of the functions and roles of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method for details, which will not be elaborated here.
[0101] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial descriptions of the method embodiments. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present invention. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0102] The embodiments of the present invention also provide 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 embodiments is implemented.
[0103] A computer-readable storage medium may be an internal storage unit of any data processing-capable device in any of the foregoing embodiments, such as a hard disk or memory. A computer-readable storage medium may also be an external storage device of any data processing-capable device, such as a plug-in hard disk, a Smart Media Card (SMC), an SD card, a Flash Card, etc. equipped on the device. Further, a computer-readable storage medium may also include both an internal storage unit and an external storage device of any data processing-capable device. The computer-readable storage medium is used to store computer programs and other programs and data required by any data processing-capable device, and may also be used to temporarily store data that has been output or will be output.
[0104] The effectiveness of the present invention is verified below by combining a specific industrial case of die-casting production. 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 includes three types of products: top covers, middle covers, and side covers. After preprocessing the original data, 5,423 pieces of data for top cover production, 13,173 pieces of data for middle cover production, and 102,174 pieces of data for side cover production were obtained. Defining the migration from top cover data to middle cover data as Task 1, the migration from top cover data to side cover data as Task 2, the migration from middle cover data to top cover data as Task 3, the migration from middle cover data to side cover data as Task 4, the migration from side cover data to top cover data as Task 5, and the migration from side cover data to middle cover data as Task 6. In each task, the model is trained on the source domain data and tested on the target domain data.
[0105] 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 the output dimension of the linear layer of the second fully connected layer are both 128; the input dimension and the 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.
[0106] In this embodiment, according to expert experience, process parameters such as the clamping force, the highest metal pressure in the boosting stage, and the cavity filling time, which have a correlation with the occurrence of die-casting defects not less than a set correlation threshold, are selected for defect detection, and other parameters with a correlation less than the set correlation threshold are excluded.
[0107] To illustrate the prediction effect of the method in this embodiment, other existing prediction methods are also used for prediction. The models for comparison include: Empirical Risk Minimization (hereinafter referred to as ERM) and Support Sample-assisted Adversarial Attacks (hereinafter referred to as SSAA). The model evaluation index is the area under the ROC curve (Area under ROC, hereinafter referred to as AUROC). The detection effects of each model on 6 transfer tasks are shown in Table 1.
[0108] Table 1 Comparison of the transfer effects of each method on the real die-casting production dataset
[0109] 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
[0110] It can be seen from the results in Table 1 that the method in this embodiment achieves the best results in 4 transfer tasks, and the average value is significantly higher than that of the comparative methods, thus confirming the effectiveness and superiority of the present invention for the transfer of die-casting defect detection.
[0111] Those of ordinary skill in the art can understand that the above are only preferred examples of the invention and are not used to limit the invention. Although the invention has been described in detail with reference to the foregoing examples, for those skilled in the art, they can still modify the technical solutions described in the foregoing examples, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, etc. made within the spirit and principle of the invention shall be included within 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, the reconstructor is used to output the reconstructed samples of the original samples 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; 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, Distance loss The weight coefficient; 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 of 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: In step S4, if the classifier output value is greater than 0.5, it is considered that the input data has defects.
5. 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 4.
6. 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 4 is implemented.
Citation Information
Patent Citations
Negative migration suppression method for cross-domain classification and recognition of apparent defects
CN116777896A
Defective gear classification method and device and computer readable storage medium
CN117892203A