File size: 1,282 Bytes
5cf8972
013216e
 
5cf8972
013216e
5cf8972
013216e
5cf8972
013216e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: golf_tracking
app_file: gradio_app.py
sdk: gradio
sdk_version: 5.10.0
---
# Golf Ball Trajectory Tracker

This application uses Meta's Segment Anything Model (SAM) 2.1 and physics-based trajectory fitting to track and analyze golf ball trajectories from videos.

## Setup

1. Download the SAM model checkpoint:
   - Visit: https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
   - Save the file in the project directory

2. Install dependencies:
```bash
pip install -r requirements.txt
```

## Usage

1. Run the application:
```bash
python app.py
```

2. Using the interface:
   - Upload a golf swing video
   - Click "Process Video" to load the video
   - Click on the golf ball position in key frames (at least 3 points recommended)
   - The application will fit and display the trajectory
   - Use "Clear Points" to start over

## Features

- Interactive point selection for trajectory tracking
- Physics-based trajectory fitting
- Real-time visualization of predicted path
- CPU-optimized for Intel UHD 630 graphics

## Notes

- The application uses the SAM base model optimized for CPU usage
- For best results, provide clear video footage with visible golf ball
- Select points at different stages of the ball's flight for better trajectory fitting