Computer vision pipeline for table tennis analysis β player tracking with persistent identity, ball tracking, and bounce detection.
β οΈ This repository showcases the methodology and results. Source code and trained models are not included.
Video Input
β
βββ Players ββββ YOLO (fine-tuned) β ByteTrack β OSNet ReID
βββ Ball βββββββ YOLO (fine-tuned) + CVAT correction for demo
βββ Table ββββββ YOLO-Seg (fine-tuned)
βββ Bounces ββββ scipy.signal.find_peaks + table polygon filter
Player Re-Identification β ByteTrack handles frame-to-frame tracking. When a player exits the frame and re-enters (or switches sides), OSNet compares appearance embeddings against a gallery of known players to restore the correct identity. A position-based fallback and anti-duplicate enforcement guarantee stable IDs throughout the video.
Ball Detection β A fine-tuned YOLO model detects the ball. Missing detections were pre-annotated by the model then manually corrected in CVAT to achieve full coverage for the demo.
Bounce Detection β Peak detection (find_peaks) on the ball's Y-coordinate trajectory, filtered by whether the bounce point falls within the table polygon (cv2.pointPolygonTest).
Table Detection β A fine-tuned YOLOv8-seg model detects the table surface. For the final output, a 4-corner polygon calibration is used.
| Component | Tool |
|---|---|
| Player detection | YOLOv8n (fine-tuned on 2.3k images) |
| Player tracking | ByteTrack |
| Player ReID | OSNet x1_0 (torchreid) |
| Ball detection | YOLOv8n (fine-tuned on 15k images) |
| Table detection | YOLOv8n-seg (fine-tuned on 1K images) |
| Bounce detection | scipy.signal.find_peaks |
| Annotation | CVAT |
- Homography-based mini-map for top-down tactical visualization
- Serve detection and point scoring
- Player movement heatmaps
Built by @IIIllllIlIlllII
