The optical imaging of the target motion process is susceptible to occlusion, resulting in detection failure and tracking loss. Aiming at the problems of low detection accuracy and poor robustness of existing multi-target tracking algorithms, this paper improves the YOLOv8 detection algorithm and DeepSort tracking algorithm, and constructs a YOLOv8 + DeepSort multi-target detection and tracking joint algorithm. In order to enhance the feature extraction ability of the model, the CBAM module is introduced into the YOLOv8 detection algorithm to retain more feature information. In order to further improve the tracking performance of the DeepSort algorithm, the Hungarian algorithm is selected to achieve the optimal matching of the detection box and the prediction box. The Euclidean distance is used to replace the IOU for the second matching of the failed detection box. The improved YOLOv8 and DeepSort joint algorithm is verified by experiments. The experimental results show that the average accuracy of the detection algorithm based on the improved YOLOv8 reaches 99.5 %, and the comprehensive detection and evaluation data are better than YOLOv4-tiny, YOLOv5, and YOLOv7 algorithms., The moving target is tracked in combined with the improved DeepSort, such that the Multiple Object Tracking Accuracy (MOTA) and Multiple Object Tracking Precision (MOTP) can reach 66.1 % and 84.3 % respectively, and the count of ID conversion is reduced by 16, verifying the effectiveness of the algorithm.