Skip to content

Commit 5a505a5

Browse files
committed
Update README
1 parent f28fdee commit 5a505a5

18 files changed

Lines changed: 1105 additions & 168 deletions

File tree

README.md

Lines changed: 82 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ The project is organized as a research pipeline:
4040
Code: `src/sailsprep/id_tracking_model/`
4141

4242
This part of the repository generates detection and pose caches, tracks people
43-
across frames, and selects the target child track.
43+
across frames, and selects the target child track. See
44+
[`src/sailsprep/id_tracking_model/README.md`](src/sailsprep/id_tracking_model/README.md)
45+
for the full pipeline and command reference.
4446

4547
Important modules:
4648

@@ -57,7 +59,10 @@ Important modules:
5759
Code: `src/sailsprep/tracking_pose_model_testing/`
5860

5961
This directory contains scripts for testing or wrapping individual tracking and
60-
pose-estimation methods:
62+
pose-estimation methods. See
63+
[`src/sailsprep/tracking_pose_model_testing/README.md`](src/sailsprep/tracking_pose_model_testing/README.md)
64+
for which scripts are single-video demos versus CSV/SLURM batch pipelines,
65+
and the corresponding install groups:
6166

6267
- YOLO pose
6368
- HRNet
@@ -76,7 +81,10 @@ and visualized outputs.
7681
Code: `src/sailsprep/action_model_testing/`
7782

7883
This directory contains the model-training and inference scripts used for action
79-
classification experiments.
84+
classification experiments. See
85+
[`src/sailsprep/action_model_testing/README.md`](src/sailsprep/action_model_testing/README.md)
86+
for the full list of model folders, and each model folder's own README for
87+
setup and usage specific to that model.
8088

8189
Included model families:
8290

@@ -87,18 +95,23 @@ Included model families:
8795
- `slow_fast/` - SlowFast finetuning.
8896
- `motionbert/` - MotionBERT pose/action pipeline.
8997
- `mstcn2/` - MS-TCN++ sequence model over extracted features.
90-
- `open_tad/` - temporal action detection experiments.
91-
- `pyskl/` - PySKL config/logit utilities.
92-
- `vlm_models/` - Qwen/Ovis vision-language model classifiers.
93-
- `feature_extraction/` - I3D/R(2+1)D and V-JEPA feature extraction.
94-
- `vjepa/` - vjepa model variants.
95-
- `dlc_action/` - DLC2Action data preparation workflow.
98+
- `open_tad/` - temporal action detection experiments (requires the OpenTAD
99+
codebase).
100+
- `pyskl/` - PySKL config generation, training helpers, and logit fusion
101+
(requires the PySKL codebase).
102+
- `vlm_models/` - Qwen2.5-VL/Ovis2 vision-language model classifiers.
103+
- `feature_extraction/` - I3D/R(2+1)D and V-JEPA2 feature extraction.
104+
- `vjepa/` - V-JEPA2 feature extraction, probe training, and fine-tuning
105+
variants.
106+
- `dlc_action/` - DLC2Action data preparation and training pipeline.
96107

97108
### Fusion Models
98109

99110
Code: `src/sailsprep/fusion_model/`
100111

101-
Fusion scripts combine predictions from multiple model families.
112+
Fusion scripts combine predictions from multiple model families. See
113+
[`src/sailsprep/fusion_model/README.md`](src/sailsprep/fusion_model/README.md)
114+
for full usage.
102115

103116
- `late_fusion/two_model.py` - late fusion between two prediction sources.
104117
- `late_fusion/three_model.py` - late fusion among three prediction sources.
@@ -111,7 +124,9 @@ Fusion scripts combine predictions from multiple model families.
111124
Code: `src/sailsprep/analysis/`
112125

113126
Behavior-specific analysis scripts extract kinematic features from pose tracks
114-
and run statistical analyses. Behaviors include:
127+
and run statistical analyses. See
128+
[`src/sailsprep/analysis/README.md`](src/sailsprep/analysis/README.md) for
129+
run order, inputs, and outputs. Behaviors include:
115130

116131
- walking
117132
- running
@@ -133,7 +148,9 @@ leave-one-subject-out classification.
133148
Code: `src/sailsprep/annotation/`
134149

135150
The annotation tool is a FastAPI application with a browser UI for reviewing
136-
videos and assigning frame-level behavior labels.
151+
videos and assigning frame-level behavior labels. See
152+
[`src/sailsprep/annotation/README.md`](src/sailsprep/annotation/README.md)
153+
for the API endpoints and label set.
137154

138155
```bash
139156
uvicorn sailsprep.annotation.annotation:app --reload
@@ -159,35 +176,51 @@ poetry install --with dev
159176
poetry run pytest
160177
```
161178

162-
Many model pipelines require optional heavy dependencies. Install only the
163-
groups needed for the experiment you want to reproduce.
164-
165-
Examples:
179+
Many model pipelines require optional heavy dependencies. `pyproject.toml`
180+
defines the following optional Poetry groups; install only the ones needed
181+
for the experiment you want to reproduce.
166182

167183
```bash
168184
# Pose/tracking experiments
169185
poetry install --with dev,pose-estimation,tracking
170186

187+
# EntitySAM
188+
poetry install --with dev,entity-sam
189+
190+
# ViTPose
191+
poetry install --with dev,vitpose
192+
193+
# Clip-level tracker (MMDetection/MMPose-based)
194+
poetry install --with dev,clip_tracker
195+
196+
# DLC2Action
197+
poetry install --with dev,dlc2action
198+
171199
# Video Swin experiments
172200
poetry install --with dev,video_swin
173201

174-
# VideoMAE / feature extraction style experiments
202+
# I3D / R(2+1)D / V-JEPA2 feature extraction
175203
poetry install --with dev,feature-extraction
176204

177-
# Vision-language model experiments
205+
# Vision-language model experiments (Qwen2.5-VL / Ovis2)
178206
poetry install --with dev,vlm
179207

180208
# OpenTAD experiments
181209
poetry install --with dev,opentad
182210

211+
# Statistical analysis (statsmodels, optionally rpy2/pymc/arviz)
212+
poetry install --with dev,stats-analysis
213+
183214
# Documentation
184215
poetry install --with docs
185216
```
186217

187-
Some third-party model stacks, especially PySKL, OpenTAD, MMDetection, MMPose,
188-
and CUDA-specific video libraries, may require separate environment setup on an
189-
HPC system. The job scripts in `jobs/` show the environments used for the
190-
original experiments.
218+
There is no Poetry group for VideoMAE2, InternVideo2, SlowFast, MotionBERT,
219+
MS-TCN++, or PySKL — those model folders list their own dependencies to
220+
`pip install` directly in their README. Some third-party model stacks,
221+
especially PySKL, OpenTAD, MMDetection, MMPose, and CUDA-specific video
222+
libraries, may require separate environment setup on an HPC system. The job
223+
scripts in `jobs/` show the environments used for the original experiments.
191224

192225
## Data Requirements
193226

@@ -314,40 +347,35 @@ need to be generated.
314347

315348
### 5. Train Action Models
316349

317-
Representative examples:
350+
The scripts in `action_model_testing/` mostly import their shared helpers with
351+
bare imports (e.g. `from common.utils import ...`, `from utils.bbox import
352+
...`), so each script is meant to be run with its own folder as the current
353+
directory, not as a `python -m` module. See the model's own README (linked
354+
from
355+
[`src/sailsprep/action_model_testing/README.md`](src/sailsprep/action_model_testing/README.md))
356+
for exact commands. Representative examples:
318357

319358
```bash
320359
# Video Swin full-video sliding-window classifier
321-
python -m sailsprep.action_model_testing.video_swin.sliding_window.video_swin_fullvideo_sliding \
322-
--task loco \
323-
--seed 42
360+
cd src/sailsprep/action_model_testing/video_swin/sliding_window
361+
python video_swin_fullvideo_sliding.py --task loco --seed 42
324362

325363
# Video Swin binary N/A vs non-N/A classifier
326-
python -m sailsprep.action_model_testing.video_swin.sliding_window.video_swin_binary_sliding \
327-
--task rmm \
328-
--seed 42
364+
python video_swin_binary_sliding.py --task rmm --seed 42
329365

330366
# Video Swin two-stage classifier
331-
python -m sailsprep.action_model_testing.video_swin.sliding_window.video_swin_twostage_joint \
332-
--task loco \
333-
--seed 42
367+
python video_swin_twostage_joint.py --task loco --seed 42
334368

335369
# VideoMAE2 full-video sliding-window classifier
336-
python -m sailsprep.action_model_testing.videomae2.videomae2_fullvideo_sliding \
337-
--task loco \
338-
--seed 42
370+
cd ../../videomae2
371+
python videomae2_fullvideo_sliding.py --task loco --seed 42
339372

340373
# VideoMAE2 two-stage classifier
341-
python -m sailsprep.action_model_testing.videomae2.videomae2_twostage_sliding \
342-
--task rmm \
343-
--seed 42
374+
python videomae2_twostage_sliding.py --task rmm --seed 42
344375

345376
# MS-TCN++ over extracted features
346-
python -m sailsprep.action_model_testing.mstcn2.mstcn2 \
347-
--label loco \
348-
--feature_type i3d \
349-
--action train \
350-
--seed 42
377+
cd ../mstcn2
378+
python mstcn2.py --label loco --feature_type i3d --action train --seed 42
351379
```
352380

353381
Most reported model experiments are run over three seeds:
@@ -451,14 +479,22 @@ Common edits:
451479

452480
Representative job scripts:
453481

454-
- `jobs/action_model_testing/video_swin/sliding_window/video_swin_full_video_multi_job.sh`
455-
- `jobs/action_model_testing/video_swin/sliding_window/video_swin_full_video_multi_job_twostage.sh`
456-
- `jobs/action_model_testing/video_swin/sliding_window/full_video_window_job_video_swin.sh`
482+
- `jobs/action_model_testing/Video_Swin/sliding_window/video_swin_full_video_multi_job.sh`
483+
- `jobs/action_model_testing/Video_Swin/sliding_window/video_swin_full_video_multi_job_twostage.sh`
484+
- `jobs/action_model_testing/Video_Swin/sliding_window/full_video_window_job_video_swin.sh`
485+
- `jobs/action_model_testing/videomae2/videomae2_job.sh`
457486
- `jobs/action_model_testing/videomae2/videomae2_submit_all.sh`
487+
- `jobs/action_model_testing/internvideo2/internvideo2_finetune.sh`
488+
- `jobs/action_model_testing/motionbert/motionbert.sh`
458489
- `jobs/action_model_testing/mstcn2/mstcn2.sh`
459490
- `jobs/action_model_testing/slow_fast/slow_fast.sh`
491+
- `jobs/action_model_testing/slow_fast/ablation/slowfast_ablation_job.sh`
492+
- `jobs/action_model_testing/feature_extraction/i3d_r2p1d_feature_extracion.sh`
493+
- `jobs/action_model_testing/feature_extraction/vjepa_feature_extracion.sh`
460494
- `jobs/action_model_testing/vlm_models/clips/submit_qwen_clip.sh`
461495
- `jobs/action_model_testing/vlm_models/clips/submit_ovis_clip.sh`
496+
- `jobs/action_model_testing/pyskl/pyskl_job.sh`
497+
- `jobs/action_model_testing/pyskl/test_job.sh`
462498
- `jobs/fusion_model/pyskl/train_pyskl_sw.sh`
463499
- `jobs/fusion_model/pyskl/test_pyskl_sw.sh`
464500
- `jobs/analysis/analysis_job.sh`
Lines changed: 52 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,52 @@
1-
# pyskl custom pipeline
2-
3-
This repo does **not** contain the [pyskl](https://github.com/kennymckormick/pyskl)
4-
codebase itself. It's a set of custom scripts (data conversion, config
5-
generation, SLURM job scripts, and late-fusion training) that must be dropped
6-
into an actual clone of the upstream `pyskl` repo to run.
7-
8-
## Setup
9-
10-
1. Clone the upstream repo and install it (see its README for full
11-
environment setup, e.g. mmcv, torch, etc.):
12-
13-
```bash
14-
git clone https://github.com/kennymckormick/pyskl.git
15-
cd pyskl
16-
pip install -e .
17-
```
18-
19-
2. Copy the contents of this repo into the root of that clone:
20-
21-
```bash
22-
cp -r scripts fusion jobs /path/to/pyskl/
23-
```
24-
25-
(`tools/dist_train.sh`, `tools/dist_test.sh`, and the `pyskl` Python
26-
package used by `extract_logits.py` all come from the upstream clone —
27-
they are not included here.)
28-
29-
## Pipeline / run order
30-
31-
All commands below are run **from the root of the upstream `pyskl` clone**
32-
(i.e. `cd /path/to/pyskl` first), after copying these files in — not from
33-
inside `scripts/` or `fusion/`. The scripts read/write paths like
34-
`configs/custom/...` and `work_dirs/...` relative to your current directory,
35-
not relative to the script's own location.
36-
37-
1. **Convert raw pose JSONs to pyskl's `.pkl` annotation format:**
38-
39-
```bash
40-
python scripts/pyskl_dataset.py --task rmm --out /path/to/rmm_pyskl.pkl
41-
python scripts/pyskl_dataset.py --task loco --out /path/to/loco_pyskl.pkl
42-
```
43-
44-
2. **Generate model configs** (writes into `configs/custom/<model>_<dataset>/`):
45-
46-
```bash
47-
python scripts/generate_stgcnpp_configs.py
48-
python scripts/generate_ctrgcn_configs.py
49-
python scripts/generate_posec3d_configs.py
50-
```
51-
52-
3. **Train** all model/feature combinations across 3 seeds via SLURM
53-
(edit `WORKSPACE` in the script, or set it as an env var, to match your
54-
cluster paths):
55-
56-
```bash
57-
bash jobs/pyskl/pyskl_job.sh
58-
```
59-
60-
4. **Test** the best checkpoint from each run:
61-
62-
```bash
63-
bash jobs/pyskl/test_job.sh
64-
```
65-
66-
5. **Extract per-model logits** on val + test splits, for fusion:
67-
68-
```bash
69-
python fusion/extract_logits.py --dataset rmm --split val
70-
python fusion/extract_logits.py --dataset rmm --split test
71-
python fusion/extract_logits.py --dataset loco --split val
72-
python fusion/extract_logits.py --dataset loco --split test
73-
```
74-
75-
6. **Train the fusion MLP** over the concatenated logits and evaluate:
76-
77-
```bash
78-
python fusion/train_mlp_fusion.py --dataset rmm
79-
python fusion/train_mlp_fusion.py --dataset loco
80-
```
81-
82-
1+
# Action Model Testing
2+
3+
Training and inference scripts for the action-recognition experiments run on
4+
the SAILS locomotion (`loco`) and repetitive motor movement (`rmm`) tasks.
5+
Each subfolder below is a separate model family with its own inputs, and most
6+
have their own README with setup and run instructions.
7+
8+
## Model folders
9+
10+
| Folder | Model | README |
11+
|---|---|---|
12+
| `video_swin/` | Video Swin Transformer (clip-based, binary/full-video/two-stage sliding window) | [video_swin/README.md](video_swin/README.md) |
13+
| `videomae2/` | VideoMAE V2 finetuning (per-clip, full-video sliding window, two-stage) | [videomae2/README.md](videomae2/README.md) |
14+
| `internvideo2/` | InternVideo2-6B finetuning | [internvideo2/README.md](internvideo2/README.md) |
15+
| `slow_fast/` | SlowFast finetuning (single clip pipeline + ablation experiments) | [slow_fast/README.md](slow_fast/README.md) |
16+
| `motionbert/` | MotionBERT 2D->3D pose lifting + skeleton action recognition | [motionbert/README.md](motionbert/README.md) |
17+
| `mstcn2/` | MS-TCN++ frame-level action segmentation over pre-extracted features | [mstcn2/README.md](mstcn2/README.md) |
18+
| `feature_extraction/` | I3D, R(2+1)D, and V-JEPA2 per-frame feature extraction | [feature_extraction/README.md](feature_extraction/README.md) |
19+
| `vjepa/` | V-JEPA2 feature extraction, attentive-probe training, and fine-tuning variants | [vjepa/README.md](vjepa/README.md) |
20+
| `open_tad/` | Feature-based temporal action detection with OpenTAD | [open_tad/README.md](open_tad/README.md) |
21+
| `pyskl/` | PySKL skeleton-based action recognition configs, training helpers, and logit fusion | [pyskl/README.md](pyskl/README.md) |
22+
| `vlm_models/` | Qwen2.5-VL / Ovis2 vision-language model classifiers | [vlm_models/README.md](vlm_models/README.md) |
23+
| `dlc_action/` | DLC2Action pipeline for pose-based locomotion classification | [dlc_action/README.md](dlc_action/README.md) |
24+
25+
## Tasks
26+
27+
Nearly every script here trains for one of two label sets from the SAILS
28+
annotation CSVs:
29+
30+
| Task flag | Annotation column | Classes |
31+
|---|---|---|
32+
| `loco` | `Locomotion` | Crawling, Cruising, Running, Vehicle, Walking |
33+
| `rmm` | `Repetitive_Motor_Movements` | Hands_flapping, Jumping, Rocking, Spinning |
34+
35+
## Conventions across these scripts
36+
37+
- Most scripts read a single split CSV (with `video_path`, `label_path`, and a
38+
`split` column of `train`/`val`/`test`) and take `--task`/`--label` plus
39+
`--seed` as CLI flags. Paths to that CSV, along with checkpoint/output
40+
directories, are set as constants near the top of each script rather than
41+
passed as flags — edit those constants for your environment.
42+
- Reported experiments are generally run over three seeds: `42`, `123`, `456`.
43+
- Several folders import shared helpers with bare imports (e.g.
44+
`from common.utils import ...`, `from utils.bbox import ...`). Those scripts
45+
must be run with their own folder as the working directory, not with
46+
`python -m`. Each model's README states which convention it uses.
47+
- `pyskl/` and `open_tad/` are standalone scripts that operate inside a
48+
separate upstream repo checkout (PySKL, OpenTAD) rather than importing
49+
`sailsprep` directly — see their READMEs for the copy-in setup.
50+
51+
Corresponding SLURM job scripts for these models live under
52+
`jobs/action_model_testing/`.

0 commit comments

Comments
 (0)