This article aims to use deep learning image processing technology to propose a defect detec-tion algorithm based on YOLOv5 network structure to conduct experimental research on defect identifica-tion in ultrasonic B-scan images.By performing linear array phased array ultrasonic testing on the work-piece,multiple B-scan images are continuously collected or video data is collected in real time,and the ima-ges are preprocessed and enhanced.On this basis,a neural network model is constructed and a large num-ber of preprocessed data sets are calibrated.Using the Pytorch deep learning framework for data set train-ing,the results show that the improved YOLOv5 algorithm has a recall rate of 96.2%for defective target detection,and a recall rate of 96.3%for target detection with missing bottom waves.Experimental results show that the improved YOLOv5 algorithm has a 1.4%improvement in the mAP0.5 index and a 6%im-provement in detection performance in the mAP0.5:0.95 index.