Yuchn commited on
Commit
de1663d
·
verified ·
1 Parent(s): 82d0744

Upload ViT-B event graph model

Browse files
Files changed (4) hide show
  1. LICENSE +21 -0
  2. README.md +85 -0
  3. config.yaml +72 -0
  4. model.pt +3 -0
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yuchn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - video-understanding
5
+ - event-graph
6
+ - vjepa
7
+ - slot-attention
8
+ - pytorch
9
+ library_name: pytorch
10
+ pipeline_tag: video-classification
11
+ ---
12
+
13
+ # Event Graph Generation — ViT-B
14
+
15
+ 動画からイベントグラフ(誰が・何を・どこから・どこへ)を構造化JSONとして予測するモデル。
16
+
17
+ V-JEPA 2.1 ViT-B の時空間特徴トークンを入力とし、Object Pooling (Slot Attention) でオブジェクト表現を抽出した後、DETR風 Event Decoder でイベントを予測します。
18
+
19
+ ## Model Details
20
+
21
+ | 項目 | 値 |
22
+ |---|---|
23
+ | パラメータ数 | 14.9M |
24
+ | V-JEPA backbone | `vjepa2_1_vit_base_384` |
25
+ | V-JEPA hidden_size | 768 |
26
+ | Object Pooling slots | 24 |
27
+ | Event queries | 20 |
28
+ | d_model | 256 |
29
+ | Action classes | 13 |
30
+ | 学習エポック (best) | 20 |
31
+
32
+ ## Architecture
33
+
34
+ ```
35
+ Video → V-JEPA 2.1 ViT-B → spatiotemporal tokens (B, S, 768)
36
+ → ObjectPoolingModule (Slot Attention, K=24 slots)
37
+ → ObjectRepresentation (identity, trajectory, existence, categories)
38
+ → VJEPAEventDecoder (M=20 event queries)
39
+ → EventPredictions (interaction, action, agent_ptr, target_ptr, source_ptr, dest_ptr, frame)
40
+ ```
41
+
42
+ ## Prediction Heads
43
+
44
+ | Head | Shape | Description |
45
+ |---|---|---|
46
+ | interaction | (M, 1) | Is this a valid event? (BCE) |
47
+ | action | (M, 13) | Action classification |
48
+ | agent_ptr | (M, K) | Pointer to agent object slot |
49
+ | target_ptr | (M, K) | Pointer to target object slot |
50
+ | source_ptr | (M, K+1) | Pointer to source location (last = "none") |
51
+ | dest_ptr | (M, K+1) | Pointer to destination (last = "none") |
52
+ | frame | (M, T) | Event frame in temporal window |
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ import torch
58
+
59
+ # Load model weights
60
+ state_dict = torch.load("model.pt", map_location="cpu")
61
+
62
+ # Build model using the project's factory
63
+ from event_graph_generation.config import Config
64
+ from event_graph_generation.models.base import build_model
65
+
66
+ config = Config.from_yaml("config.yaml")
67
+ model = build_model(config.model, vjepa_config=config.vjepa)
68
+ model.load_state_dict(state_dict)
69
+ model.eval()
70
+ ```
71
+
72
+ ## Training
73
+
74
+ - **Optimizer**: adamw
75
+ - **Learning rate**: 0.0001
76
+ - **Scheduler**: cosine_warmup
77
+ - **Early stopping patience**: 15
78
+
79
+ ## License
80
+
81
+ MIT License
82
+
83
+ ## Links
84
+
85
+ - **Repository**: [ChanYu1224/event-graph-generation](https://github.com/ChanYu1224/event-graph-generation)
config.yaml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ data:
2
+ batch_size: 16
3
+ num_workers: 4
4
+ pin_memory: true
5
+ processed_dir: data/vjepa_aligned_v21_vitb
6
+ splits_dir: data/vjepa_aligned_v21_vitb/splits
7
+ evaluation:
8
+ eval_every_n_epochs: 1
9
+ metrics:
10
+ - event_detection_map
11
+ - action_accuracy
12
+ - pointer_accuracy
13
+ - frame_mae
14
+ - graph_f1
15
+ model:
16
+ d_model: 256
17
+ dropout: 0.1
18
+ name: vjepa_pipeline
19
+ nhead: 8
20
+ num_actions: 13
21
+ num_context_encoder_layers: 3
22
+ num_event_decoder_layers: 4
23
+ num_event_queries: 20
24
+ object_pooling:
25
+ d_model: 256
26
+ dropout: 0.1
27
+ n_categories: 29
28
+ nhead: 8
29
+ num_iterations: 3
30
+ num_refinement_layers: 2
31
+ num_slots: 24
32
+ training:
33
+ checkpoint_dir: checkpoints/vjepa_vitb
34
+ device: cuda
35
+ early_stopping_patience: 15
36
+ epochs: 100
37
+ grad_clip_norm: 1.0
38
+ learning_rate: 0.0001
39
+ loss_weights:
40
+ action: 1.0
41
+ agent_ptr: 1.0
42
+ dest_ptr: 0.5
43
+ frame: 0.5
44
+ interaction: 2.0
45
+ source_ptr: 0.5
46
+ target_ptr: 1.0
47
+ optimizer: adamw
48
+ save_every_n_epochs: 10
49
+ scheduler: cosine_warmup
50
+ scheduler_params:
51
+ T_max: 100
52
+ warmup_epochs: 5
53
+ seed: 42
54
+ weight_decay: 0.0001
55
+ vjepa:
56
+ backend: hub
57
+ features_dir: data/vjepa_features_v21_vitb
58
+ hidden_size: 768
59
+ hub_model_name: vjepa2_1_vit_base_384
60
+ spatial_tokens: 576
61
+ temporal_tokens: 8
62
+ total_tokens: 4608
63
+ wandb:
64
+ enabled: true
65
+ entity: null
66
+ notes: V-JEPA 2.1 ViT-B + Slot Attention + Event Decoder
67
+ project: event_graph_generation
68
+ tags:
69
+ - vjepa_pipeline
70
+ - slot_attention
71
+ - vjepa_2.1
72
+ - vit_b
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3492cc812f944f14a63164e759008ab1190242069231bd6df58b056dca41b4a
3
+ size 59823663