Accurate detection and tracking of dynamic objects are critical for enabling skill demonstration and effective skill generalization in robotic skill learning and application scenarios. To further improve the detection accuracy and tracking speed of the YOLOv8s model in dynamic object tracking tasks, this paper proposes a method to enhance both detection precision and speed based on YOLOv8s architecture. Specifically, a Focused Linear Attention mechanism is introduced into the YOLOv8s backbone network to enhance dynamic object detection accuracy, while the Ghost module is incorporated into the neck network to improve the model’s tracking speed for dynamic objects. By mapping the motion of dynamic objects across frames, the proposed method achieves accurate trajectory tracking. This paper provides a detailed explanation of the improvements made to YOLOv8s for enhancing detection accuracy and speed in dynamic object detection tasks. Comparative experiments on the MS-COCO dataset and the custom dataset demonstrate that the proposed method has a clear advantage in terms of detection accuracy and processing speed. The dynamic object detection experiments further validate the effectiveness of the proposed method for detecting and tracking objects at different speeds. The proposed method offers a valuable reference for the field of dynamic object detection, providing actionable insights for applications such as robotic skill learning, generalization, and artificial intelligence-driven robotics.