High-performance line-scan cameras are highly accurate and efficient for tunnel detection, however, the exponential growth of image data creates new challenges for real-time image processing. The inference speed of existing tunnel detection algorithms is insufficient for massive amounts of image data, and traditional data structures limit the parallelism of the detection system, thereby reducing the speed of image processing. In this study, a deep learning (DL) network is developed for real-time tunnel defect detection based on the you only look once (YOLO) family. The network includes innovative defect feature-extraction modules, optimization of the network architecture, and improvement of the decoupling heads to increase defect detection accuracy and efficiency. Furthermore, we developed critical technologies for real-time detection. First, our method employs a deployment method for DL networks based on TensorRT, which enables our network to be applied directly to C++ image acquisition programs away from the traditional DL frameworks. The proposed line-scan data structure enables the raw images to be fed into the neural network in batches, which, combined with the simultaneous technique of image acquisition, detection, and storage, significantly increases the efficiency of real-time detection. The paper demonstrates the advantages of the proposed model and hardware system through an experiment study. The test results indicate that the mean average precision and F1-score of our network were 86.07% and 84.53%, respectively, while it had 21.42 M parameters. Combined with the proposed storage strategy, a recall rate of more than 90% was achieved for defect detection. Moreover, batch image processing method has a significant advantage in terms of inference speed, with 243.9 FPS in PyTorch, 381.46 FPS in TensorRT, and 305.3 FPS in real-time detection, which is five times faster than existing defect-detection models. This study significantly increases the efficiency of tunnel lining detection, which has positive implications for the visual detection of other infrastructures.