(B, L, T, J, C)PoseFormerFactorized
concat (default): feature concatenation + MLPxattn: shallow cross-attention (pose tokens ↔ image token)| Module | Description |
|---|---|
PoseFormerFactorized | Short-term pose transformer |
LongTermTemporalBlock | Long-range temporal modeling |
ImageEncoder | CNN-based RGB feature extractor |
MMFusionConcatLN | Concatenation-based multimodal fusion |
MMFusionCrossAttnShallow | Cross-attention multimodal fusion |
SSLHeads | Contrastive, reconstruction, temporal order heads |
(B, L, T, J, C)B: batch sizeL: number of temporal segmentsT: frames per segmentJ: number of joints (e.g. 17)C: joint channels (2D or 3D)(B, L, T, 3, H, W)3: RGB channelsH: image heightW: image width1from model_har_final import (
2 PoseFormerFactorized,
3 MultiScaleTemporalModel
4)1pose_backbone = PoseFormerFactorized(
2 joints=17,
3 in_ch=3,
4 dim=128,
5 layers=4,
6 num_classes=6,
7 return_tokens=True
8)
9
10model = MultiScaleTemporalModel(
11 short_seq_model=pose_backbone,
12 num_classes=6,
13 enable_long_term=True,
14 multimodal=True,
15 fusion_mode="concat" # or "xattn"
16)1import torch
2
3ckpt = torch.load("best_stage3_dual_sched.pth", map_location="cpu")
4model.load_state_dict(ckpt)
5model.eval()ℹ️ This model is saved usingstate_dict, not pickle-serialized objects, for maximum compatibility.
1with torch.no_grad():
2 logits = model(pose_seq, img_seq)
3 preds = logits.argmax(dim=-1)| Output | Shape |
|---|---|
| Logits | (B, num_classes) |
| Pose embedding | (B, D) |
| Pose tokens (optional) | (B, T, J, D) |
AutoModel.from_pretrained1@misc{kim2025multiscalehar,
2 title = {Multi-Scale Multimodal Pose Transformer for Human Activity Recognition},
3 author = {Minjae Kim},
4 year = {2025},
5 howpublished = {\url{https://huggingface.co/m97j/har-safety-model}}
6}