Model of defect identification and cause tracing in casting process based on transformer structure
摘要
To address the issues of insufficient recognition accuracy and poor explainability of defect causes in casting defect identification and cause tracing, this paper proposes a Transformer architecture that integrates Timesformer and MMCA. It aims to achieve accurate defect identification and high-confidence cause tracing analysis through the global modeling capability, multimodal fusion characteristics, and attention interpretability of the Transformer architecture. During the research process, the multi-moment casting images and process parameter time series are first encoded through a dual-branch feature extraction module. The image branch uses a shallow CNN to extract spatial features, and the parameter branch uses an improved Timesformer to capture the timing dynamics. Subsequently, a multimodal cross-attention mechanism is applied to achieve a deep interactive fusion of image and parameter features through bidirectional attention calculation. The position alignment and channel unification strategies are combined to ensure cross-modal semantic alignment. Finally, the fused features are input into the joint discrimination module to complete the end-to-end modeling of defect classification and cause tracing, and the explainable output of the defect cause is achieved through attention weight analysis. The experimental results show that the model constructed in this study has excellent overall performance, achieving an accuracy rate of up to 94.7% and an F1-Score of 0.947 in multi-category defect recognition. In the cause tracing interpretability evaluation, it has a traceability consistency score of 0.82 ± 0.06 and an attention entropy value of 0.97 ± 0.11.