Spaces:
Running on T4
Running on T4
|
Download docs/TRAINING.md from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 3.78 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/docs/TRAINING.md
- Command line
-
hf download hf://spaces/modventures/baseball-engine/docs/TRAINING.md
-
curl -L -o TRAINING.md https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/docs/TRAINING.md
3.78 kB
| # Reviewed data and trained backends | |
| The engine ships trainable code, not pretrained baseball endpoint/phase weights. RTMW and YOLOX are the initial generic observation models. Training on two or three clips cannot establish generalization. | |
| Each JSON dataset index record contains `video_path`, `annotations_path`, `player_id`, `session_id`, `split` (`train`, `validation`, `test`), and optional `metadata`. Event records additionally contain `analysis_directory`, an existing analysis of the exact source video. No athlete, session or identical video may cross partitions. Use enough independent athletes for the preregistered evaluation scope. Keep participant/footage provenance with the source index. | |
| Endpoint labels use oriented image pixels, separate `knob` and `barrel` identities, a crop enclosing both endpoints, and explicit `bat_occluded` for reviewed absent visibility. Unknown endpoints are not negative labels. The dataset builder produces RGB 256×256 crops, two 64×64 Gaussian heatmaps and visibility masks. The CNN learns both heatmaps and endpoint visibility. Its output remains model-inferred. | |
| For events, reviewed labels also contain nonoverlapping `phases`: | |
| ```json | |
| {"phases":[{"phase":"setup","frame_interval":[0,8]}, | |
| {"phase":"load","frame_interval":[9,14]}, | |
| {"phase":"stride","frame_interval":[15,18]}, | |
| {"phase":"forward_swing","frame_interval":[19,25]}, | |
| {"phase":"follow_through","frame_interval":[26,40]}]} | |
| ``` | |
| Unknown frames remain ignored (`-100`). Confirmed event intervals train boundary outputs; reviewed absence trains presence/absence. Unknown contact does not become a negative label. Features retain each source frame and combine named body/object coordinates, masks and a compact visual descriptor. Deterministic image/object candidates remain a separate high-cadence branch. Network scores are not calibrated contact probabilities. | |
| ```bash | |
| python -m baseball_batting.cli dataset index.json --kind endpoint_cnn --output endpoint-data | |
| python -m baseball_batting.cli train endpoint-data --kind endpoint_cnn --output endpoint-model --epochs 30 --device cuda | |
| python -m baseball_batting.cli evaluate-checkpoint endpoint-data endpoint-model --thresholds preregistered-gates.json --scope recorded-task-and-view | |
| ``` | |
| For phases use `--kind mstcn_events` and the pinned `--mstcn-repo` for training and evaluation. The full-worker installer fetches official MS-TCN++ revision `aef4e46c31bc7b2462065354054f968f91e54be1`. The current upstream tip contains a syntax error, so it is not the selected revision. The architecture is loaded from the pinned source, and its hash is checked at inference. | |
| Training selects the lowest validation loss and writes checkpoint/hash, dataset hash, source, seed, architecture and training history. It does not qualify its own weights. Evaluation uses held-out test athletes and task-specific preregistered gates for error, misses, extra events and coverage. The example gates are deliberately inactive (`preregistered=false`); replace them with justified requirements first. | |
| Configure `endpoint_checkpoint_path` / `endpoint_manifest_path`, or `event_checkpoint_path` / `event_manifest_path`, `mstcn_repo` and `learned_events_enabled=true` only after evaluation passes. Qualification verifies the checkpoint and evaluation-file hashes. Trained candidates never overwrite reviewed confirmation, absence or unknown. Endpoint inference needs a single unambiguous bat ROI; proposals may still require review. | |
| Use a worker containing PyTorch for trained endpoints (`stage_python.observations`) and the selected ONNX distribution. Do not put CPU and GPU ONNX Runtime distributions in one environment. Trained events can use `stage_python.learned_events` independently. | |