Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- video-classification
|
| 5 |
+
- timesformer
|
| 6 |
+
- action-recognition
|
| 7 |
+
- ucf101
|
| 8 |
+
- pytorch
|
| 9 |
+
datasets:
|
| 10 |
+
- ucf101
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# ๐ฌ TimeSformer Fine-Tuned for Video Action Recognition
|
| 14 |
+
|
| 15 |
+
This model is a fine-tuned version of **TimeSformer (Time-Space Transformer)** for **video action recognition**, trained on the **UCF101 dataset**.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## ๐ Model Overview
|
| 20 |
+
|
| 21 |
+
- **Base Model:** facebook/timesformer-base-finetuned-k400
|
| 22 |
+
- **Task:** Video Classification / Action Recognition
|
| 23 |
+
- **Dataset:** UCF101 (101 action classes)
|
| 24 |
+
- **Framework:** PyTorch + Hugging Face Transformers
|
| 25 |
+
- **Training Environment:** Kaggle (GPU)
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## ๐ง Training Strategy
|
| 30 |
+
|
| 31 |
+
Due to Kaggleโs **12-hour session limit**, training was performed in **multiple stages**:
|
| 32 |
+
|
| 33 |
+
1. Initial training run
|
| 34 |
+
2. Checkpoint saving (best model)
|
| 35 |
+
3. Resume training from best checkpoint
|
| 36 |
+
4. Further fine-tuning across sessions
|
| 37 |
+
|
| 38 |
+
This approach ensures efficient long training without losing progress.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## ๐ Training Results
|
| 43 |
+
|
| 44 |
+
### ๐น Initial Training
|
| 45 |
+
|
| 46 |
+
| Epoch | Train Loss | Train Acc | Val Loss | Val Acc |
|
| 47 |
+
|------|------------|-----------|----------|---------|
|
| 48 |
+
| 1 | 4.5066 | 0.0622 | 4.1089 | 0.4245 |
|
| 49 |
+
| 2 | 3.5721 | 0.4711 | 2.5276 | 0.8007 |
|
| 50 |
+
| 3 | 2.3239 | 0.7323 | 1.4321 | 0.8993 |
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
### ๐น Continued Training (Checkpoint Resume)
|
| 55 |
+
|
| 56 |
+
| Epoch | Train Loss | Train Acc | Val Loss | Val Acc |
|
| 57 |
+
|------|------------|-----------|----------|---------|
|
| 58 |
+
| 4 | 1.8289 | 0.7991 | 1.1802 | 0.9199 |
|
| 59 |
+
| 5 | 1.7119 | 0.8094 | 1.1372 | 0.9128 |
|
| 60 |
+
| 6 | 1.6365 | 0.8153 | 1.1085 | 0.9191 |
|
| 61 |
+
| 7 | 1.5982 | 0.8139 | 1.0868 | 0.9218 |
|
| 62 |
+
| 8 | 1.5053 | 0.8194 | 1.0763 | **0.9262** |
|
| 63 |
+
| 9 | 1.4673 | 0.8201 | 1.0824 | 0.9225 |
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
+
|
| 67 |
+
## ๐ Best Performance
|
| 68 |
+
|
| 69 |
+
- **Best Validation Accuracy:** **92.62%**
|
| 70 |
+
- **F1 Score:** 0.9244
|
| 71 |
+
- **Precision:** 0.9315
|
| 72 |
+
- **Recall:** 0.9262
|
| 73 |
+
- Achieved at **Epoch 8**
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## ๐ Additional Metrics
|
| 78 |
+
|
| 79 |
+
| Metric | Value |
|
| 80 |
+
|-------|------|
|
| 81 |
+
| Precision | 0.9315 |
|
| 82 |
+
| Recall | 0.9262 |
|
| 83 |
+
| F1 Score | 0.9244 |
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## โ๏ธ Training Details
|
| 88 |
+
|
| 89 |
+
- Mixed Precision Training (`torch.cuda.amp`)
|
| 90 |
+
- GPU Memory Usage: ~9.3โ9.8 GB
|
| 91 |
+
- Training Time per Epoch: ~2.5 hours
|
| 92 |
+
- Evaluation Time per Epoch: ~20 minutes
|
| 93 |
+
- Best model checkpoint saved automatically
|
| 94 |
+
|
| 95 |
+
---
|
| 96 |
+
|
| 97 |
+
## ๐ Usage
|
| 98 |
+
|
| 99 |
+
### Install Dependencies
|
| 100 |
+
|
| 101 |
+
```bash
|
| 102 |
+
pip install torch torchvision transformers
|