tijayantML's picture
Tier 1: RIDM title, usage, requirements, walking config, drop internal ledger field
3838ef5 verified
|
Raw History Blame Contribute Delete
3.29 kB
---
license: apache-2.0
library_name: pytorch
pipeline_tag: video-classification
tags: [inverse-dynamics, camera-motion, optical-flow, counter-strike-2]
---
# IDM flow model (flow_transformer_phase5_v4)
This model predicts camera motion from video. It reads optical flow, not pixels.
- Keys: W, A, S, D, Shift (one probability each).
- Rotation: yaw and pitch in degrees.
Status: preliminary release. The scores marked † are unconfirmed.
## How it works
```text
video -> 5 frames (every 4th) -> RAFT-small flow x4 pairs -> FlowTransformer -> keys + yaw/pitch
128x128 frozen, downloaded 1.80 M params
```
- RAFT-small is a frozen torchvision model. Its weights are not in this folder.
The script downloads them on first run (BSD-3 license).
- The FlowTransformer has 1,795,337 parameters. It has 4 layers, width 192 and 4 heads.
- One window is 17 source frames (5 sampled frames, gap 4). Each window gives one prediction.
## Use
```bash
pip install torch torchvision av opencv-python safetensors numpy
python inference.py clip.mp4 --stride 17
```
The script prints JSON. Each window has `key_probabilities`, `keys_pressed`, `yaw_deg` and `pitch_deg`.
`keys_pressed` uses one threshold per key, tuned at 5 frames: W 0.54, A 0.40, S 0.54, D 0.70, Shift 0.20.
Yaw and pitch are signed. The sign is a classifier. The size comes from a log-magnitude regressor.
## Files
| File | Content |
|---|---|
| `model.safetensors` | FlowTransformer weights only. No optimizer state. Float32. |
| `config.json` | Architecture, thresholds, frame count, frame gap 4. |
| `config_walking.json` | The same, with frame gap 12, for walking-speed video. |
| `inference.py` | Standalone script. No internal imports. |
## Results
| Test set | Turn | Three-way |
|---|---|---|
| Real videos | 91.5 | 85.9 |
| Action-camera footage | 72.0 † | 75.0 † |
| Counter-Strike 2 | 84.9 | 84.5 |
- † means the number comes from a write-up. It has no run log yet. Treat it as unconfirmed.
- Key exact match on the held-out CS2 split (4,590 clips, 35,091 rows):
0.7960 at threshold 0.5 and 0.8390 with the tuned thresholds.
- Best validation loss in the checkpoint: 0.8741 (epoch 10).
## Limits
- The model trained on Counter-Strike 2 renders only.
- The default frame gap is 4 source frames, tuned on game footage. Other gaps change the result.
- Real walking is slower than game movement. On walking-tour video a gap of 12 gave a strong forward signal.
`config_walking.json` is `config.json` with `frame_gap` 12. Run it with
`python inference.py clip.mp4 --config config_walking.json --stride 49`.
The window is (num_frames - 1) * frame_gap + 1 = 49 source frames, so `--stride 49` gives no overlap.
The key thresholds were tuned at gap 4. They are not tuned again for gap 12.
- The gap embedding accepts values from 0 to 63.
- Yaw and pitch are per window, not per frame.
## License
- The weights and `inference.py` use the Apache License 2.0. See `LICENSE` in the repository root.
- RAFT-small weights: BSD-3, from torchvision.
- The models trained on Counter-Strike 2 gameplay captures. This repository holds no game assets, no clips and no training data.
- The terms of the evaluation datasets are not checked. Do not redistribute their clips.