An swimmer's level and ability are often evaluated in swimming based on speed. Therefore, it is essential to quantify this speed accurately to guide their training. Swimming speed measurement methods are typically divided into two categories: using an LED as a reference object or wearing inertial navigation equipment. The former does not provide real-time feedback, while the latter can easily diverge. Through digital image processing and tracking, the speed can be accurately measured in real-time by analyzing the image's deep abstract features, frame by frame, even in complex and constantly changing sports scenes. To meet multiple swimmers' high-precision positioning and speed measurement requirements, YOLOv5 utilizes its advantages of full-view, low-latency, and high-precision multi-target recognition, making it well-suited for swimming speed measurement. DeepSort, on the other hand, leverages its powerful representation learning and accurate matching capability and, when combined with YOLOv5, can achieve real-time and precise tracking of multiple targets. Therefore, this paper proposes a real-time high-precision positioning and speed measurement algorithm for swimming based on YOLOv5 and DeepSort. The nine-point calibration method gets swimmers' positioning and speed information from swimmers' target boxes, which are tracked by YOLOv5 and DeepSort. The results of the multiple tests in the actual swimming competition scene show that the algorithm's tracking accuracy can reach more than 90%, and the positioning error of the first swimming lane is about 1.2cm. It has strong feasibility and engineering practicability.