Abstract:The trouble of moving electric multiple units detection system (TEDS) needs to detect components with diverse shapes and sizes, which leads to high false positive and missed detection rates in existing detection methods. Therefore, a pseudo anomaly multi-head depth separable self-attention reverse knowledge distillation network is proposed to achieve anomaly detection on TEDS images. Firstly, the self-attention head vector is generated by replacing the matrix with depthwise separable convolution, and the sharp distribution of similarity is adjusted with a focus function. The constructed multi-head depthwise separable linear self-attention enjoys linear computational complexity. Secondly,a lightweight attention teacher-student model based reverse knowledge distillation network is constructed using a bottleneck residual module and a multi-head depth separable linear self-attention module, which improves the network’s feature extraction ability while reducing the number of trainable parameters, and accelerates the detection speed. Projection layers are set after each module of the teacher network. Meanwhile, the Simplex and random cropping pseudo-defect mechanisms are employed to simulate pseudo-defect samples during training. Through multi-loss guidance, the projection layers are pushed away from the normal feature space to exclude defect information, forcing them to focus on exploring deeper representations of normal features and restricting the flow of defect information to the student network, resulting in greater feature differences between the teacher and student networks for anomaly. Research shows that the improved network can effectively enhance the anomaly detection capability of TEDS images; the evaluation metrics of image-Auroc, pixel-Auroc, and Aupro reach 94.6%, 93.3%, 80.1%, respectively. Compared with other algorithms, these metrics show improvements of 3.3, 3.8, 4 percentage points, respectively. This method can achieve a detection speed of 0.37 seconds per sheet, meeting the real-time requirements of TEDS systems.