Considering the problems of strong subjectivity,slow detection speed and great harm to workers in the surface defect identification of temperature measuring samples,an improved YOLOv5s defect detection algorithm is proposed,and machine vision is introduced into the defect identification process of temperature measuring samples.The data set was enhanced to ensure the balance of data distribution and improve the reliability of the results.To ensure the lightweight design and obtain more abundant gradient flow information,C2f module was added to the backbone network.More effective feature information was extracted through the introduced CAM module,which improves the defect location and further aggregates the coordinate information.Then the improved network model was compressed by layer adaptive amplitude pruning(LAMP),which further improves the loading and running speed of the model.Finally,the improved model was tested on the data set,mAP@0.5 and mAP@0.5~0.95 reached 89.1%and 64.5%respectively,and the reasoning time of each graph was 0.002 04 s,which is better than the original model.The results show that the improved model is more efficient in defect detection of temperature measurement samples.