Deep neural networks (DNNs) inevitably have defects like traditional software. When the defective DNN model is applied to safety-critical fields, it may lead to serious accidents. Therefore, how to effectively detect defective DNN models has become an urgent problem to be solved. Maintaining a high-quality test data set is an important guarantee for achieving the above goals for DNN models testing. In order to further improve the accuracy and diversity of test data that can detect model defects, thereby improving the efficiency of detecting DNN defects, a test data selection method based on self-attention mechanism and K-means clustering (SAKCL) is proposed in this paper. Experiments were conducted on the combination of five deep learning data sets and models. The results show that SAKCL is significantly better than the existing methods, whether it is the ratio of test cases that can detect model defects in the selected samples or the diversity of model defect types that test cases can detect.