To address the issues of strong subjectivity, low efficiency, and difficulty in on-site model deployment encountered in existing CCTV defect detection of pipelines, this article proposes an object detection model based on an improved YOLOv5s algorithm. Firstly, involution modules and GSConv simplified models are introduced into the backbone network and feature fusion network, respectively, to enhance the detection accuracy. Secondly, a CBAM attention mechanism is integrated to improve the detection accuracy of overlapping targets in complex backgrounds. Finally, knowledge distillation is performed on the improved model to further enhance its accuracy. Experimental results demonstrate that the improved YOLOv5s achieved an mAP@0.5 of 80.5%, which is a 2.4% increase over the baseline, and reduces the parameter and computation volume by 30.1% and 29.4%, respectively, with a detection speed of 75 FPS. This method offers good detection accuracy and robustness while ensuring real-time detection and can be employed in the on-site detection process of sewer pipeline defects.