PurposeThe purpose of this study is to propose a new method for the end-to-end classification of steel surface defects.Design/methodology/approachThis study proposes an AM-AoN-SNN algorithm, which combines an attention mechanism (AM) with an All-optical Neuron-based spiking neural network (AoN-SNN). The AM enhances network learning and extracts defective features, while the AoN-SNN predicts both the labels of the defects and the final labels of the images. Compared to the conventional Leaky-Integrated and Fire SNN, the AoN-SNN has improved the activation of neurons.FindingsThe experimental findings on Northeast University (NEU)-CLS demonstrate that the proposed neural network detection approach outperforms other methods. Furthermore, the network’s effectiveness was tested, and the results indicate that the proposed method can achieve high detection accuracy and strong anti-interference capabilities while maintaining a basic structure.Originality/valueThis study introduces a novel approach to classifying steel surface defects using a combination of a shallow AoN-SNN and a hybrid AM with different network architectures. The proposed method is the first study of SNN networks applied to this task.