Tier 1: RIDM title, usage, requirements, walking config, drop internal ledger field
Browse files- README.md +27 -4
- flow/README.md +6 -3
- flow/config.json +18 -3
- flow/config_walking.json +38 -0
- requirements.txt +6 -0
README.md
CHANGED
|
@@ -9,7 +9,7 @@ tags:
|
|
| 9 |
- counter-strike-2
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
Two models predict camera motion (W/A/S/D/Shift, yaw, pitch) from video.
|
| 15 |
Both trained on Counter-Strike 2 renders.
|
|
@@ -26,12 +26,30 @@ Both trained on Counter-Strike 2 renders.
|
|
| 26 |
† The number comes from a write-up and has no run log yet.
|
| 27 |
|
| 28 |
```text
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
pixel/ model.safetensors config.json inference.py README.md
|
| 32 |
```
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
Status: preliminary release. The scores marked † are unconfirmed.
|
| 37 |
|
|
@@ -40,3 +58,8 @@ Status: preliminary release. The scores marked † are unconfirmed.
|
|
| 40 |
- The weights and the code in this repository use the Apache License 2.0. See `LICENSE`.
|
| 41 |
- RAFT-small weights use the BSD-3 license. They come from torchvision and are not in this repository. See `NOTICE`.
|
| 42 |
- The models trained on Counter-Strike 2 gameplay captures. This repository holds no game assets, no clips and no training data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
- counter-strike-2
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Reka Inverse Dynamics Model (RIDM)
|
| 13 |
|
| 14 |
Two models predict camera motion (W/A/S/D/Shift, yaw, pitch) from video.
|
| 15 |
Both trained on Counter-Strike 2 renders.
|
|
|
|
| 26 |
† The number comes from a write-up and has no run log yet.
|
| 27 |
|
| 28 |
```text
|
| 29 |
+
Reka-Inverse-Dynamics-Model/
|
| 30 |
+
README.md LICENSE NOTICE requirements.txt
|
| 31 |
+
flow/ model.safetensors config.json config_walking.json inference.py README.md
|
| 32 |
pixel/ model.safetensors config.json inference.py README.md
|
| 33 |
```
|
| 34 |
|
| 35 |
+
## Which model to use
|
| 36 |
+
|
| 37 |
+
Use the flow model for real video. The pixel model gives no clear signal on real footage.
|
| 38 |
+
Its card says so. Use the pixel model for Counter-Strike 2 footage only.
|
| 39 |
+
|
| 40 |
+
## Use
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
pip install -r requirements.txt
|
| 44 |
+
hf download RekaAI/Reka-Inverse-Dynamics-Model --local-dir ridm
|
| 45 |
+
python ridm/flow/inference.py clip.mp4 --stride 17
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
- The script prints JSON. Each window has `key_probabilities`, `keys_pressed`, `yaw_deg` and `pitch_deg`.
|
| 49 |
+
- Default settings match game footage. For walking video, run
|
| 50 |
+
`python ridm/flow/inference.py clip.mp4 --config ridm/flow/config_walking.json --stride 49`.
|
| 51 |
+
- Each folder runs alone. See `flow/README.md` and `pixel/README.md` for details.
|
| 52 |
+
- Tested with Python 3.12 and the versions in `requirements.txt`. Newer versions are untested.
|
| 53 |
|
| 54 |
Status: preliminary release. The scores marked † are unconfirmed.
|
| 55 |
|
|
|
|
| 58 |
- The weights and the code in this repository use the Apache License 2.0. See `LICENSE`.
|
| 59 |
- RAFT-small weights use the BSD-3 license. They come from torchvision and are not in this repository. See `NOTICE`.
|
| 60 |
- The models trained on Counter-Strike 2 gameplay captures. This repository holds no game assets, no clips and no training data.
|
| 61 |
+
|
| 62 |
+
## Contact and citation
|
| 63 |
+
|
| 64 |
+
- Questions and problems: open a discussion on this repository.
|
| 65 |
+
- To cite, name this repository: Reka AI, Reka Inverse Dynamics Model (RIDM), Hugging Face, `RekaAI/Reka-Inverse-Dynamics-Model`.
|
flow/README.md
CHANGED
|
@@ -43,7 +43,8 @@ Yaw and pitch are signed. The sign is a classifier. The size comes from a log-ma
|
|
| 43 |
| File | Content |
|
| 44 |
|---|---|
|
| 45 |
| `model.safetensors` | FlowTransformer weights only. No optimizer state. Float32. |
|
| 46 |
-
| `config.json` | Architecture, thresholds, frame count, frame gap. |
|
|
|
|
| 47 |
| `inference.py` | Standalone script. No internal imports. |
|
| 48 |
|
| 49 |
## Results
|
|
@@ -64,8 +65,10 @@ Yaw and pitch are signed. The sign is a classifier. The size comes from a log-ma
|
|
| 64 |
- The model trained on Counter-Strike 2 renders only.
|
| 65 |
- The default frame gap is 4 source frames, tuned on game footage. Other gaps change the result.
|
| 66 |
- Real walking is slower than game movement. On walking-tour video a gap of 12 gave a strong forward signal.
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
- The gap embedding accepts values from 0 to 63.
|
| 70 |
- Yaw and pitch are per window, not per frame.
|
| 71 |
|
|
|
|
| 43 |
| File | Content |
|
| 44 |
|---|---|
|
| 45 |
| `model.safetensors` | FlowTransformer weights only. No optimizer state. Float32. |
|
| 46 |
+
| `config.json` | Architecture, thresholds, frame count, frame gap 4. |
|
| 47 |
+
| `config_walking.json` | The same, with frame gap 12, for walking-speed video. |
|
| 48 |
| `inference.py` | Standalone script. No internal imports. |
|
| 49 |
|
| 50 |
## Results
|
|
|
|
| 65 |
- The model trained on Counter-Strike 2 renders only.
|
| 66 |
- The default frame gap is 4 source frames, tuned on game footage. Other gaps change the result.
|
| 67 |
- Real walking is slower than game movement. On walking-tour video a gap of 12 gave a strong forward signal.
|
| 68 |
+
`config_walking.json` is `config.json` with `frame_gap` 12. Run it with
|
| 69 |
+
`python inference.py clip.mp4 --config config_walking.json --stride 49`.
|
| 70 |
+
The window is (num_frames - 1) * frame_gap + 1 = 49 source frames, so `--stride 49` gives no overlap.
|
| 71 |
+
The key thresholds were tuned at gap 4. They are not tuned again for gap 12.
|
| 72 |
- The gap embedding accepts values from 0 to 63.
|
| 73 |
- Yaw and pitch are per window, not per frame.
|
| 74 |
|
flow/config.json
CHANGED
|
@@ -2,8 +2,20 @@
|
|
| 2 |
"model_type": "idm-flow-transformer",
|
| 3 |
"name": "flow_transformer_phase5_v4",
|
| 4 |
"num_keys": 5,
|
| 5 |
-
"key_order": [
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"thresholds_tuned_at_num_frames": 5,
|
| 8 |
"token_dim": 192,
|
| 9 |
"num_layers": 4,
|
|
@@ -19,5 +31,8 @@
|
|
| 19 |
"frame_gap": 4,
|
| 20 |
"flow_backbone": "torchvision.models.optical_flow.raft_small (Raft_Small_Weights.DEFAULT, frozen, not in this repo)",
|
| 21 |
"num_parameters": 1795337,
|
| 22 |
-
"training_checkpoint": {
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
|
|
|
| 2 |
"model_type": "idm-flow-transformer",
|
| 3 |
"name": "flow_transformer_phase5_v4",
|
| 4 |
"num_keys": 5,
|
| 5 |
+
"key_order": [
|
| 6 |
+
"W",
|
| 7 |
+
"A",
|
| 8 |
+
"S",
|
| 9 |
+
"D",
|
| 10 |
+
"Shift"
|
| 11 |
+
],
|
| 12 |
+
"key_thresholds": {
|
| 13 |
+
"W": 0.54,
|
| 14 |
+
"A": 0.4,
|
| 15 |
+
"S": 0.54,
|
| 16 |
+
"D": 0.7,
|
| 17 |
+
"Shift": 0.2
|
| 18 |
+
},
|
| 19 |
"thresholds_tuned_at_num_frames": 5,
|
| 20 |
"token_dim": 192,
|
| 21 |
"num_layers": 4,
|
|
|
|
| 31 |
"frame_gap": 4,
|
| 32 |
"flow_backbone": "torchvision.models.optical_flow.raft_small (Raft_Small_Weights.DEFAULT, frozen, not in this repo)",
|
| 33 |
"num_parameters": 1795337,
|
| 34 |
+
"training_checkpoint": {
|
| 35 |
+
"epoch": 10,
|
| 36 |
+
"best_val_loss": 0.8741227431995112
|
| 37 |
+
}
|
| 38 |
}
|
flow/config_walking.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "idm-flow-transformer",
|
| 3 |
+
"name": "flow_transformer_phase5_v4_gap12",
|
| 4 |
+
"num_keys": 5,
|
| 5 |
+
"key_order": [
|
| 6 |
+
"W",
|
| 7 |
+
"A",
|
| 8 |
+
"S",
|
| 9 |
+
"D",
|
| 10 |
+
"Shift"
|
| 11 |
+
],
|
| 12 |
+
"key_thresholds": {
|
| 13 |
+
"W": 0.54,
|
| 14 |
+
"A": 0.4,
|
| 15 |
+
"S": 0.54,
|
| 16 |
+
"D": 0.7,
|
| 17 |
+
"Shift": 0.2
|
| 18 |
+
},
|
| 19 |
+
"thresholds_tuned_at_num_frames": 5,
|
| 20 |
+
"token_dim": 192,
|
| 21 |
+
"num_layers": 4,
|
| 22 |
+
"num_heads": 4,
|
| 23 |
+
"ffn_dim": 512,
|
| 24 |
+
"head_hidden": 256,
|
| 25 |
+
"dropout": 0.1,
|
| 26 |
+
"num_flow_frames": 9,
|
| 27 |
+
"patch_grid": 8,
|
| 28 |
+
"rotation_head_type": "sign_magnitude",
|
| 29 |
+
"resolution": 128,
|
| 30 |
+
"num_frames": 5,
|
| 31 |
+
"frame_gap": 12,
|
| 32 |
+
"flow_backbone": "torchvision.models.optical_flow.raft_small (Raft_Small_Weights.DEFAULT, frozen, not in this repo)",
|
| 33 |
+
"num_parameters": 1795337,
|
| 34 |
+
"training_checkpoint": {
|
| 35 |
+
"epoch": 10,
|
| 36 |
+
"best_val_loss": 0.8741227431995112
|
| 37 |
+
}
|
| 38 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch==2.14.0
|
| 2 |
+
torchvision==0.29.0
|
| 3 |
+
av==19.0.0
|
| 4 |
+
opencv-python==5.0.0
|
| 5 |
+
safetensors==0.8.0
|
| 6 |
+
numpy==2.5.3
|