choucsan commited on
Commit
859e4ef
Β·
verified Β·
1 Parent(s): 4846f97

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +238 -0
README.md CHANGED
@@ -1,3 +1,241 @@
1
  ---
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model: Qwen/Qwen2.5-VL-7B-Instruct
3
+ library_name: peft
4
  license: apache-2.0
5
+ tags:
6
+ - peft
7
+ - lora
8
+ - vision-language
9
+ - video
10
+ - optical-flow
11
+ - uav
12
+ - drone
13
+ - motion
14
+ - embodied-ai
15
+ - spatial-intelligence
16
  ---
17
+
18
+ # SIS-Motion
19
+
20
+ <p align="center">
21
+ <img src="images/poster.jpeg" alt="SIS-Motion" width="900"/>
22
+ </p>
23
+ <p align="center">
24
+ <a href="https://arxiv.org"><img src="https://img.shields.io/badge/arXiv-Paper-b31b1b?style=for-the-badge&logo=arxiv" alt="arXiv"></a>
25
+ <a href="https://choucisan.github.io/publications/self-in-space"><img src="https://img.shields.io/badge/Website-Project_Page-blue?style=for-the-badge" alt="Website"></a>
26
+ <a href="https://github.com/IntelliSensing/Self-in-Space"><img src="https://img.shields.io/badge/GitHub-Self--in--Space-181717?style=for-the-badge&logo=github" alt="GitHub"></a>
27
+ <a href="https://huggingface.co/choucsan/SIS-Motion"><img src="https://img.shields.io/badge/%F0%9F%A4%97_HuggingFace-Model-yellow?style=for-the-badge" alt="Hugging Face"></a>
28
+ <a href="https://choosealicense.com/licenses/apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-green?style=for-the-badge" alt="License"></a>
29
+ </p>
30
+
31
+
32
+ SIS-Motion is a motion-aware extension of a standard video MLLM, designed to investigate whether explicitly modeling self-related dynamics can improve the joint understanding of *space* and *self* in embodied UAV scenarios.
33
+
34
+ > **Important:** SIS-Motion is **NOT a state-of-the-art model.** It is a **controlled experiment** where the only difference from the visual-only backbone is the addition of a frozen optical-flow estimator, a motion-feature branch, and a lightweight fusion connector. All other settings β€” base model, training data, LoRA rank, learning rate, and optimization β€” are kept identical. This ensures that any observed gain can be cleanly attributed to motion-aware integration rather than differences in scale or recipe.
35
+
36
+ ---
37
+
38
+ ## Architecture
39
+
40
+ SIS-Motion extends Qwen2.5-VL with a motion-aware branch. Video frames are processed in parallel through a shared vision encoder β€” once for appearance and once for optical-flow-derived motion features β€” then fused via a lightweight additive connector before the language model.
41
+
42
+ <p align="center">
43
+ <img src="images/sis-motion-framework.webp" alt="SIS-Motion Framework" width="900"/>
44
+ </p>
45
+
46
+ The forward path is:
47
+
48
+ ```text
49
+ video frames
50
+ β”œβ”€β”€ Qwen2.5-VL vision encoder (frozen) ───────────────> visual tokens
51
+ └── VideoFlow MOFNet (frozen, FP32)
52
+ └── forward/backward flow [T, 4, H/8, W/8]
53
+ └── forward flow (dx, dy)
54
+ └── pseudo-images [magnitude, dx, dy]
55
+ └── Qwen2.5-VL vision encoder (shared, frozen) -> motion tokens
56
+
57
+ motion tokens -> LayerNorm -> Linear(3584, 2048) -> GELU
58
+ -> Linear(2048, 3584)
59
+ visual tokens + projected motion tokens -> Qwen2.5-VL language model with LoRA
60
+ ```
61
+
62
+ ### 1. Appearance branch
63
+
64
+ The standard Qwen2.5-VL video processor and frozen vision encoder produce the appearance tokens used by the base model.
65
+
66
+ ### 2. Motion branch
67
+
68
+ VideoFlow MOFNet receives at least three RGB frames, resizes them to `320x480`, and predicts forward and backward optical flow at `1/8` resolution. SIS-Motion uses the forward `(dx, dy)` channels, clamps invalid/extreme values, and builds a three-channel pseudo-image `[magnitude, dx, dy]`. These pseudo-images are patchified with the Qwen2.5-VL video grid and passed through the same frozen Qwen vision encoder to produce token-aligned motion features.
69
+
70
+ ### 3. Additive connector
71
+
72
+ The trained `visual_flow` connector applies LayerNorm and a two-layer MLP to each motion token, then adds the result to the corresponding appearance token:
73
+
74
+ ```text
75
+ motion' = Linear(GELU(Linear(LayerNorm(motion))))
76
+ fused = visual + motion'
77
+ ```
78
+
79
+ The fused tokens replace the normal video-token embeddings before the language model forward pass. During inference, the LoRA adapter is merged into the base language model.
80
+
81
+ | Component | Parameters | Training state | Included here |
82
+ | --- | ---: | --- | --- |
83
+ | Qwen2.5-VL-7B base model and vision encoder | See base model | Frozen base weights; LoRA on LLM | No, downloaded separately |
84
+ | VideoFlow MOFNet | 13,453,240 | Frozen | Yes |
85
+ | `visual_flow` connector | 14,692,864 | Trained | Yes |
86
+ | LoRA adapter (`r=32`, `alpha=64`) | 20,185,088 | Trained | Yes |
87
+ | **Trainable parameters** | **34,877,952** | LoRA + connector | Yes |
88
+ | **Bundled model parameters** | **48,331,192** | Includes frozen MOFNet | Yes |
89
+
90
+ ---
91
+
92
+ ## Why a Controlled Experiment?
93
+
94
+ Current MLLMs show a consistent gap: they are substantially better at modeling *space* (objects, scenes, layouts) than *self* (motion, actions, agent state). To test whether explicit motion cues can alleviate this, we constructed SIS-Motion under strict controls:
95
+
96
+ - βœ… **Same base model** β€” Qwen2.5-VL-7B-Instruct
97
+ - βœ… **Same training data** β€” SIS-Motion-54K (perception + memory tasks only)
98
+ - βœ… **Same LoRA configuration** β€” `r=32`, `Ξ±=64`, identical target modules
99
+ - βœ… **Same optimization** β€” identical learning rate, schedule, and batch size
100
+ - ⬜ **Only difference** β€” the optical-flow-driven motion branch + additive connector
101
+
102
+ The visual-only SFT baseline serves as the direct comparison point. Any difference in results can be interpreted as the marginal contribution of motion-aware modeling.
103
+
104
+ ---
105
+
106
+ ## Training Configuration
107
+
108
+ | Setting | Value |
109
+ | ---------------- | ---------------------------------------------- |
110
+ | Base model | `Qwen/Qwen2.5-VL-7B-Instruct` |
111
+ | Training data | SIS-Motion-54K (MCQ + Open QA + Description) |
112
+ | Data scope | Perception & memory tasks (no reasoning tasks) |
113
+ | LoRA rank `r` | 32 |
114
+ | LoRA alpha | 64 |
115
+ | LoRA dropout | 0.05 |
116
+ | LoRA targets | `q_proj`, `k_proj`, `v_proj`, `o_proj` |
117
+ | Optimizer | AdamW |
118
+ | Precision | BF16 |
119
+ | Trainable params | 34,877,952 (20,185,088 LoRA + 14,692,864 connector) |
120
+ | Frozen params | Visual encoder, VideoFlow optical-flow estimator, LLM base (~7B) |
121
+
122
+ ---
123
+
124
+ ## Results
125
+
126
+ ### SIS-Bench
127
+
128
+ | Model | Spatial Avg | Self Avg | Overall |
129
+ | ------------------------ | ----------- | -------- | -------- |
130
+ | ZeroShot (Qwen2.5-VL 3B) | 65.8 | 40.5 | 53.6 |
131
+ | SFT visual-only | 72.0 | 60.3 | 66.4 |
132
+ | **SIS-Motion** | **74.2** | **63.7** | **69.1** |
133
+
134
+ Motion-aware modeling improves both spatial cognition (+2.2) and self-awareness (+3.4) over the visual-only SFT baseline. The gains are most pronounced on memory-level tasks, where temporal integration matters most.
135
+
136
+ ### Downstream Transfer β€” Zero-Shot UAV Navigation
137
+
138
+ Evaluated on the [OpenUAV-QA](https://huggingface.co/datasets/choucsan/OpenUAV-QA) navigation benchmark without any task-specific fine-tuning:
139
+
140
+ | Model | Accuracy |
141
+ | ------------------------ | --------- |
142
+ | Qwen2.5-VL 3B (backbone) | 71.2% |
143
+ | **SIS-Motion** | **92.2%** |
144
+
145
+ The +21.0 point gain demonstrates that motion-aware representations transfer beyond the original benchmark to practical UAV decision-making scenarios.
146
+
147
+ > **Note on reported results:** The results above are from the paper's **3B** backbone (Qwen2.5-VL-3B-Instruct). This repository hosts a **7B** variant (Qwen2.5-VL-7B-Instruct) with the same architecture and training protocol. The 3B model can be reproduced using the open-source [training code](https://github.com/IntelliSensing/Self-in-Space). We release the 7B version here as a stronger off-the-shelf checkpoint; the controlled-experiment conclusion (motion-aware gains over visual-only SFT) holds across both scales.
148
+
149
+ ---
150
+
151
+ ## Repository Files
152
+
153
+ ```text
154
+ sis_motion_config.json Architecture manifest (connector type, paths)
155
+ adapter_config.json LoRA configuration (r=32, alpha=64)
156
+ adapter_model.safetensors LoRA weights (20,185,088 params)
157
+ connector_weights.pt Motion fusion MLP weights (14,692,864 params)
158
+ MOF_kitti.pth Frozen VideoFlow MOFNet checkpoint (13,453,240 params)
159
+ images/poster.jpeg Model poster
160
+ ```
161
+
162
+ **Note:** The Qwen2.5-VL-7B-Instruct base weights are **NOT included** in this repository. They are downloaded automatically from HuggingFace at inference time.
163
+
164
+ ---
165
+
166
+ ## Usage
167
+
168
+ This model package is not a standalone Transformers architecture. It must be loaded through the SIS-Motion evaluator, which constructs the motion branch before applying the PEFT adapter.
169
+
170
+ ### 1. Clone the codebase
171
+
172
+ ```bash
173
+ git clone https://github.com/IntelliSensing/Self-in-Space.git
174
+ cd Self-in-Space
175
+ ```
176
+
177
+ ### 2. Create the motion environment
178
+
179
+ With Conda:
180
+
181
+ ```bash
182
+ bash scripts/setup_conda.sh motion
183
+ conda activate sis-motion-motion
184
+ ```
185
+
186
+ Or with uv:
187
+
188
+ ```bash
189
+ bash scripts/setup_uv.sh motion
190
+ source .venv-motion/bin/activate
191
+ ```
192
+
193
+ The motion environment uses Python 3.10, PyTorch 2.6 with CUDA 12.4, Transformers 4.57.1, PEFT 0.18.1, and FlashAttention 2.7.4.
194
+
195
+ ### 3. Prepare SIS-Bench
196
+
197
+ Place SIS-Bench under the registered data root or override the paths directly:
198
+
199
+ ```text
200
+ data/SIS-Bench/SIS-Bench.jsonl
201
+ data/SIS-Bench/frames/
202
+ ```
203
+
204
+ ### 4. Run inference
205
+
206
+ The evaluator automatically downloads this model from HuggingFace, reads `sis_motion_config.json`, loads the VideoFlow optical-flow estimator (`MOF_kitti.pth`), applies the LoRA adapter, loads `connector_weights.pt`, and runs the full appearance-plus-motion pipeline:
207
+
208
+ ```bash
209
+ MODEL_PATH=choucsan/SIS-Motion \
210
+ bash scripts/eval_motion.sh
211
+ ```
212
+
213
+ An already downloaded model directory is also accepted:
214
+
215
+ ```bash
216
+ MODEL_PATH=/path/to/SIS-Motion \
217
+ DATA_FILE=/path/to/SIS-Bench.jsonl \
218
+ FRAMES_DIR=/path/to/SIS-Bench/frames \
219
+ bash scripts/eval_motion.sh
220
+ ```
221
+
222
+ The Qwen2.5-VL-7B base model is fetched from the `base_model_name_or_path` stored in `adapter_config.json`; it is not duplicated in this repository.
223
+
224
+ > **Note on the optical flow estimator:** The default checkpoint (`MOF_kitti.pth`) is a VideoFlow MOFNet pretrained on KITTI. Replacing it with another optical-flow estimator (e.g., RAFT or GMFlow) requires adapting the optical-flow loading and output-conversion logic. The connector weights may not transfer to a different flow backbone and would likely require retraining.
225
+
226
+ ---
227
+
228
+ ## Limitations
229
+
230
+ - **Not a SOTA model.** SIS-Motion is a controlled research prototype built on a 7B backbone. Stronger base models would likely yield higher absolute scores under the same setup.
231
+ - **Optical flow estimation.** The VideoFlow optical-flow estimator runs on each input video, adding compute not required by the visual-only baseline.
232
+ - **Training scope.** SIS-Motion-54K covers perception and memory tasks. Reasoning-level improvements come from generalization, not direct supervision.
233
+ - **Inference cost.** The runtime adds 28,146,104 module parameters over the base path (13,453,240 frozen MOFNet + 14,692,864 connector). The 20,185,088 LoRA parameters are merged into the base model before generation.
234
+
235
+ ---
236
+
237
+ ## Contact
238
+
239
+ For questions or collaboration requests:
240
+
241
+ [choucisan@gmail.com](mailto:choucisan@gmail.com)