Nguyen Van Huong commited on
Commit
1d76487
·
verified ·
1 Parent(s): b822e6b

Upload models

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ i3d_r50/i3d_training_history.png filter=lfs diff=lfs merge=lfs -text
37
+ r2plus1d_18/r2plus1d_training_history.png filter=lfs diff=lfs merge=lfs -text
38
+ slowfast_r50/slowfast_training_history.png filter=lfs diff=lfs merge=lfs -text
39
+ x3d_m/x3d_training_history.png filter=lfs diff=lfs merge=lfs -text
i3d_r50/MODEL_CARD.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # I3D-R50 for Violence Detection
2
+
3
+ Fine-tuned **I3D (Inflated 3D ConvNet)** với backbone **ResNet-50** cho bài toán phát hiện bạo lực.
4
+
5
+ ## Performance
6
+
7
+ | Metric | Value |
8
+ |--------|-------|
9
+ | Validation Accuracy | ~90.75% |
10
+ | Parameters | 27.2M |
11
+ | Checkpoint size | ~312 MB |
12
+ | GPU Memory (inference) | ~0.6 GB |
13
+ | Latency (CPU, 32 frames) | ~1.5-2.5 s |
14
+
15
+ ## Architecture
16
+
17
+ - Backbone: **i3d_r50** (PyTorchVideo), pretrained Kinetics-400
18
+ - "Inflated" 2D ResNet kernels thành 3D
19
+ - Input: `(B, 3, 32, 224, 224)`, mean=0.45, std=0.225
20
+
21
+ ## Files
22
+
23
+ | File | Description |
24
+ |------|-------------|
25
+ | `i3d_r50_best.pt` | Best checkpoint |
26
+ | `i3d_summary.json` | Training/eval metrics |
27
+ | `i3d_confusion_matrix.png` | Confusion matrix |
28
+ | `i3d_training_history.png` | Training curves |
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ import torch
34
+ from huggingface_hub import hf_hub_download
35
+ from pytorchvideo.models.hub import i3d_r50
36
+
37
+ ckpt_path = hf_hub_download(
38
+ repo_id="nauthui7/school-violence-detection-models",
39
+ filename="i3d_r50/i3d_r50_best.pt",
40
+ )
41
+
42
+ model = i3d_r50(pretrained=False)
43
+ # Replace head — chi tiết xem model/i3d_model.py trong source code
44
+ ...
45
+ ```
46
+
47
+ ## Use Case
48
+
49
+ I3D là model "kinh điển" cho video action recognition. Phù hợp:
50
+
51
+ - Baseline so sánh với các kiến trúc khác
52
+ - Khi cần inference trên GPU
53
+ - Nghiên cứu / phân tích feature transfer learning
54
+
55
+ ## Limitations
56
+
57
+ - Accuracy thấp nhất trong 4 models (~90.75%).
58
+ - Checkpoint lớn (312 MB), không phù hợp deploy edge.
i3d_r50/i3d_confusion_matrix.png ADDED
i3d_r50/i3d_r50_best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:367e6e69ca934402711b1b66e14684f7ab2ef6faa501714f5d79b7525be2dd07
3
+ size 327213702
i3d_r50/i3d_summary.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "i3d_r50",
3
+ "best_accuracy": 0.9075000214576722,
4
+ "best_epoch": 10,
5
+ "total_epochs": 16,
6
+ "evaluation": {
7
+ "accuracy": 0.9075,
8
+ "precision": 0.9222797927461139,
9
+ "recall": 0.89,
10
+ "f1_score": 0.905852417302799
11
+ },
12
+ "config": {
13
+ "epochs": 35,
14
+ "batch_size": 24,
15
+ "learning_rate": 0.0002,
16
+ "weight_decay": 0.01,
17
+ "dropout": 0.4,
18
+ "mixup_alpha": 0.2,
19
+ "warmup_epochs": 3,
20
+ "num_frames": 32,
21
+ "frame_size": 224
22
+ },
23
+ "parameters": {
24
+ "total": 27227970,
25
+ "trainable": 27227970,
26
+ "frozen": 0
27
+ }
28
+ }
i3d_r50/i3d_training_history.png ADDED

Git LFS Details

  • SHA256: c61fd3f3336b05df7f25f9af95c4a858d97da1dd7aea7589f31a0e206c1fa00a
  • Pointer size: 131 Bytes
  • Size of remote file: 133 kB
r2plus1d_18/MODEL_CARD.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # R(2+1)D-18 for Violence Detection
2
+
3
+ Fine-tuned **R(2+1)D-18** - factorized 3D convolution (decompose 3D conv thành 2D spatial + 1D temporal).
4
+
5
+ ## Performance
6
+
7
+ | Metric | Value |
8
+ |--------|-------|
9
+ | Validation Accuracy | **~93.0%** (best in this model zoo) |
10
+ | Parameters | 31.3M |
11
+ | Checkpoint size | ~358 MB |
12
+ | GPU Memory (inference) | ~0.5 GB |
13
+ | Latency (CPU, 32 frames) | ~2-3 s |
14
+
15
+ ## Architecture
16
+
17
+ - Backbone: **r2plus1d_18** (torchvision), pretrained Kinetics-400
18
+ - Factorized: 3D conv (t×h×w) → 2D conv (1×h×w) + 1D conv (t×1×1)
19
+ - Tăng độ phi tuyến giữa spatial/temporal modeling
20
+ - Input: `(B, 3, 32, 224, 224)`, mean=0.45, std=0.225
21
+
22
+ ## Files
23
+
24
+ | File | Description |
25
+ |------|-------------|
26
+ | `r2plus1d_best.pt` | Best checkpoint |
27
+ | `r2plus1d_confusion_matrix.png` | Confusion matrix |
28
+ | `r2plus1d_training_history.png` | Training curves |
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ import torch
34
+ from huggingface_hub import hf_hub_download
35
+ from torchvision.models.video import r2plus1d_18
36
+
37
+ ckpt_path = hf_hub_download(
38
+ repo_id="nauthui7/school-violence-detection-models",
39
+ filename="r2plus1d_18/r2plus1d_best.pt",
40
+ )
41
+
42
+ model = r2plus1d_18(weights=None)
43
+ model.fc = torch.nn.Linear(model.fc.in_features, 2)
44
+
45
+ ckpt = torch.load(ckpt_path, map_location="cpu")
46
+ state_dict = ckpt.get("model", ckpt.get("model_state_dict", ckpt))
47
+ model.load_state_dict(state_dict)
48
+ model.eval()
49
+ ```
50
+
51
+ > Khuyến nghị: dùng `ViolenceR2Plus1D` wrapper trong `model/r2plus1d_model.py`.
52
+
53
+ ## Use Case
54
+
55
+ R(2+1)D-18 đạt accuracy **cao nhất** trong bộ 4 model. Phù hợp:
56
+
57
+ - Khi accuracy là ưu tiên hàng đầu
58
+ - Có GPU để inference (CPU vẫn chạy được nhưng chậm)
59
+ - Production-like deployment với SLA chấp nhận ~2-3s/clip
60
+
61
+ ## Limitations
62
+
63
+ - Checkpoint lớn (358 MB).
64
+ - Vẫn cần input clip 32 frames (không streaming).
65
+ - Tốc độ CPU không nhanh bằng X3D-M.
r2plus1d_18/r2plus1d_best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa5aa0d7d4427ea7b81d410f5b5186ed64285ff8bebdd12462d976a36e86cdc0
3
+ size 375895599
r2plus1d_18/r2plus1d_confusion_matrix.png ADDED
r2plus1d_18/r2plus1d_training_history.png ADDED

Git LFS Details

  • SHA256: 93ed18d76346fbbd438a1a266e8e848b99e3c1db4be26510b5ec50554a4eb12d
  • Pointer size: 131 Bytes
  • Size of remote file: 130 kB
slowfast_r50/MODEL_CARD.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SlowFast-R50 for Violence Detection
2
+
3
+ Fine-tuned **SlowFast** với ResNet-50 backbone - kiến trúc dual-pathway cho video action recognition.
4
+
5
+ ## Performance
6
+
7
+ | Metric | Value |
8
+ |--------|-------|
9
+ | Validation Accuracy | ~92.5% |
10
+ | Parameters | 33.6M |
11
+ | Checkpoint size | ~386 MB |
12
+ | GPU Memory (inference) | ~1.8 GB |
13
+ | Latency (CPU, 32 frames) | ~3-5 s |
14
+
15
+ ## Architecture
16
+
17
+ - Backbone: **slowfast_r50** (PyTorchVideo), pretrained Kinetics-400
18
+ - **Slow pathway**: low frame rate, high channel - capture spatial semantic
19
+ - **Fast pathway**: high frame rate, low channel - capture motion
20
+ - Input: list `[slow_clip, fast_clip]`, slow=8 frames, fast=32 frames
21
+
22
+ ## Files
23
+
24
+ | File | Description |
25
+ |------|-------------|
26
+ | `slowfast_best.pt` | Best checkpoint |
27
+ | `slowfast_summary.json` | Training/eval metrics |
28
+ | `slowfast_confusion_matrix.png` | Confusion matrix |
29
+ | `slowfast_training_history.png` | Training curves |
30
+
31
+ ## Usage
32
+
33
+ > ⚠️ SlowFast cần input đặc biệt (pack pathway). Dùng `ViolenceSlowFast` wrapper trong `model/slowfast_model.py` để tự handle pathway splitting.
34
+
35
+ ```python
36
+ import torch
37
+ from huggingface_hub import hf_hub_download
38
+
39
+ ckpt_path = hf_hub_download(
40
+ repo_id="nauthui7/school-violence-detection-models",
41
+ filename="slowfast_r50/slowfast_best.pt",
42
+ )
43
+
44
+ # Khuyến nghị: dùng wrapper từ source code
45
+ # from model.slowfast_model import create_slowfast_model
46
+ # model = create_slowfast_model(num_classes=2, pretrained=False)
47
+ ```
48
+
49
+ ## Use Case
50
+
51
+ SlowFast là model có accuracy cao thứ 2, đặc biệt mạnh khi:
52
+
53
+ - Video có cả chi tiết tĩnh và chuyển động nhanh (xô đẩy, đánh nhau)
54
+ - Cần phân tích kỹ temporal dynamics
55
+ - Có GPU đủ mạnh (≥6GB VRAM)
56
+
57
+ ## Limitations
58
+
59
+ - Inference chậm trên CPU do hai pathway.
60
+ - Memory footprint lớn nhất (~1.8GB GPU).
61
+ - Cần preprocessing đặc biệt (pack pathways).
slowfast_r50/slowfast_best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c33809b5d72e015c391bc9bb4afb3fa2f7319bc60e8e848984ab33215470dc3
3
+ size 404601565
slowfast_r50/slowfast_confusion_matrix.png ADDED
slowfast_r50/slowfast_summary.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "slowfast_r50",
3
+ "best_accuracy": 0.9250000238418579,
4
+ "best_epoch": 3,
5
+ "total_epochs": 10,
6
+ "evaluation": {
7
+ "accuracy": 0.925,
8
+ "precision": 0.9047619047619048,
9
+ "recall": 0.95,
10
+ "f1_score": 0.926829268292683
11
+ },
12
+ "config": {
13
+ "epochs": 40,
14
+ "batch_size": 48,
15
+ "learning_rate": 0.0003,
16
+ "weight_decay": 0.02,
17
+ "dropout": 0.4,
18
+ "gradient_clip": 1.0,
19
+ "mixup_alpha": 0.2,
20
+ "warmup_epochs": 5,
21
+ "num_frames": 32,
22
+ "frame_size": 224
23
+ },
24
+ "parameters": {
25
+ "total": 33649098,
26
+ "trainable": 33649098,
27
+ "frozen": 0
28
+ }
29
+ }
slowfast_r50/slowfast_training_history.png ADDED

Git LFS Details

  • SHA256: 2ee481cf3a268828f9e7b61e1c4e692b8eef1d78de11305686417a46fab2b0ec
  • Pointer size: 131 Bytes
  • Size of remote file: 187 kB
x3d_m/MODEL_CARD.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # X3D-M for Violence Detection
2
+
3
+ Fine-tuned **X3D-M** (Expand-3D Medium) cho bài toán nhận diện hành vi bạo lực 2 lớp trên video.
4
+
5
+ ## Performance
6
+
7
+ | Metric | Value |
8
+ |--------|-------|
9
+ | Validation Accuracy | ~92.0% |
10
+ | Parameters | 3.0M |
11
+ | Checkpoint size | ~35 MB |
12
+ | GPU Memory (inference) | ~0.2 GB |
13
+ | Latency (CPU, 32 frames) | ~300-500 ms |
14
+
15
+ ## Architecture
16
+
17
+ - Backbone: **x3d_m** (PyTorchVideo), pretrained Kinetics-400
18
+ - Head: Linear(2048 → 2) thay cho head 400-class gốc
19
+ - Input: `(B, 3, 32, 224, 224)`, normalized với mean=0.45, std=0.225
20
+
21
+ ## Files
22
+
23
+ | File | Description |
24
+ |------|-------------|
25
+ | `x3d_m_best.pt` | Best checkpoint (state_dict + metadata) |
26
+ | `x3d_summary.json` | Training/eval metrics summary |
27
+ | `x3d_confusion_matrix.png` | Confusion matrix trên test set |
28
+ | `x3d_training_history.png` | Loss/accuracy theo epoch |
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ import torch
34
+ from huggingface_hub import hf_hub_download
35
+ from pytorchvideo.models.hub import x3d_m
36
+
37
+ ckpt_path = hf_hub_download(
38
+ repo_id="nauthui7/school-violence-detection-models",
39
+ filename="x3d_m/x3d_m_best.pt",
40
+ )
41
+
42
+ model = x3d_m(pretrained=False)
43
+ model.blocks[5].proj = torch.nn.Linear(2048, 2)
44
+
45
+ ckpt = torch.load(ckpt_path, map_location="cpu")
46
+ state_dict = ckpt.get("model", ckpt.get("model_state_dict", ckpt))
47
+ model.load_state_dict(state_dict)
48
+ model.eval()
49
+ ```
50
+
51
+ > Khuyến nghị: dùng class wrapper `ViolenceX3D` trong `model/x3d_model.py` (repo source) thay vì tự build head, để đảm bảo state_dict key khớp 100%.
52
+
53
+ ## Use Case
54
+
55
+ X3D-M là model **nhỏ nhất và nhanh nhất** trong bộ 4 model. Phù hợp:
56
+
57
+ - Real-time inference trên CPU (laptop, edge devices)
58
+ - Demo trên Hugging Face Spaces free tier
59
+ - Khi cần throughput cao
60
+
61
+ ## Limitations
62
+
63
+ - Accuracy thấp hơn ~1% so với R(2+1)D-18 và SlowFast-R50.
64
+ - Vẫn dùng input clip 32 frames - không phải streaming.
x3d_m/x3d_confusion_matrix.png ADDED
x3d_m/x3d_m_best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b8e4f95d3b7aa0d9df941f3fffbf07b8b35dac82ded4e994c60b91daa138a50
3
+ size 36353579
x3d_m/x3d_summary.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "x3d_m",
3
+ "best_accuracy": 0.92,
4
+ "best_epoch": 14,
5
+ "total_epochs": 18,
6
+ "evaluation": {
7
+ "accuracy": 0.92,
8
+ "precision": 0.9421052631578948,
9
+ "recall": 0.895,
10
+ "f1_score": 0.9179487179487179
11
+ },
12
+ "config": {
13
+ "epochs": 30,
14
+ "batch_size": 32,
15
+ "learning_rate": 0.0001,
16
+ "weight_decay": 0.01,
17
+ "dropout": 0.3,
18
+ "mixup_alpha": 0.2,
19
+ "warmup_epochs": 3,
20
+ "num_frames": 32,
21
+ "frame_size": 224
22
+ },
23
+ "parameters": {
24
+ "total": 2978772,
25
+ "trainable": 2978772,
26
+ "frozen": 0
27
+ }
28
+ }
x3d_m/x3d_training_history.png ADDED

Git LFS Details

  • SHA256: 179da10a977adf5ebdc1e17345121d569bc53177d85c9f2c95317c23e0a53093
  • Pointer size: 131 Bytes
  • Size of remote file: 129 kB