Update README.md
Browse files
README.md
CHANGED
|
@@ -29,3 +29,140 @@ configs:
|
|
| 29 |
- split: split3
|
| 30 |
path: data/split3-*
|
| 31 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
- split: split3
|
| 30 |
path: data/split3-*
|
| 31 |
---
|
| 32 |
+
# π HMDB51 Dataset (with Protocol Splits + Video Streaming Support)
|
| 33 |
+
|
| 34 |
+
This repository hosts the **HMDB51** human action recognition dataset in a format optimized for modern deep learning research.
|
| 35 |
+
It provides:
|
| 36 |
+
|
| 37 |
+
- Three official evaluation protocols (`split1`, `split2`, `split3`)
|
| 38 |
+
- JSONL metadata files containing action labels and train/test assignments
|
| 39 |
+
- Raw video files stored directly on HuggingFace Hub
|
| 40 |
+
- Optional **WebDataset** tar shards for high-performance streaming
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## π Folder Layout
|
| 45 |
+
|
| 46 |
+
```
|
| 47 |
+
HMDB51/
|
| 48 |
+
β
|
| 49 |
+
βββ metadata_split1.jsonl
|
| 50 |
+
βββ metadata_split2.jsonl
|
| 51 |
+
βββ metadata_split3.jsonl
|
| 52 |
+
β
|
| 53 |
+
βββ Videos/
|
| 54 |
+
β βββ brush_hair/
|
| 55 |
+
β βββ climb/
|
| 56 |
+
β βββ ... (all 51 classes)
|
| 57 |
+
β
|
| 58 |
+
βββ webdataset/
|
| 59 |
+
βββ 000000.tar
|
| 60 |
+
βββ 000001.tar
|
| 61 |
+
βββ ...
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Each JSONL record:
|
| 65 |
+
|
| 66 |
+
```json
|
| 67 |
+
{
|
| 68 |
+
"video_path": "Videos/brush_hair/example.avi",
|
| 69 |
+
"label": "brush_hair",
|
| 70 |
+
"subset": 1
|
| 71 |
+
}
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## πΉ 1. Load Metadata (HF-native)
|
| 77 |
+
|
| 78 |
+
```python
|
| 79 |
+
from datasets import load_dataset
|
| 80 |
+
ds = load_dataset("json", data_files="metadata_split2.jsonl")["train"]
|
| 81 |
+
train = ds.filter(lambda x: x["subset"] == 1)
|
| 82 |
+
test = ds.filter(lambda x: x["subset"] == 2)
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## πΉ 2. Load a Video File
|
| 88 |
+
|
| 89 |
+
### Decord
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from decord import VideoReader
|
| 93 |
+
vr = VideoReader(train[0]["video_path"])
|
| 94 |
+
frame0 = vr[0]
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### TorchVision
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
from torchvision.io import read_video
|
| 101 |
+
video, audio, info = read_video(train[0]["video_path"])
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
---
|
| 105 |
+
|
| 106 |
+
## πΉ 3. WebDataset Version (Optional)
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
import webdataset as wds, jsonlines
|
| 110 |
+
ids = [rec["video_path"] for rec in jsonlines.open("metadata_split2.jsonl") if rec["subset"]==1]
|
| 111 |
+
train_wds = wds.WebDataset("webdataset/*.tar").select(lambda s: s["__key__"] in ids)
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## πΉ 4. PyTorch DataLoader Example
|
| 117 |
+
|
| 118 |
+
```python
|
| 119 |
+
from torch.utils.data import Dataset, DataLoader
|
| 120 |
+
from decord import VideoReader
|
| 121 |
+
|
| 122 |
+
class VideoDataset(Dataset):
|
| 123 |
+
def __init__(self, subset): self.subset = subset
|
| 124 |
+
def __getitem__(self, i):
|
| 125 |
+
item = self.subset[i]
|
| 126 |
+
vr = VideoReader(item["video_path"])
|
| 127 |
+
return vr.get_batch([0,8,16]), item["label"]
|
| 128 |
+
def __len__(self): return len(self.subset)
|
| 129 |
+
|
| 130 |
+
loader = DataLoader(VideoDataset(train), batch_size=4)
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
## πΉ 5. Protocol Files
|
| 136 |
+
|
| 137 |
+
```
|
| 138 |
+
metadata_split1.jsonl
|
| 139 |
+
metadata_split2.jsonl
|
| 140 |
+
metadata_split3.jsonl
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
Each matches the official HMDB51 evaluation protocol.
|
| 144 |
+
|
| 145 |
+
---
|
| 146 |
+
|
| 147 |
+
## π Citation
|
| 148 |
+
|
| 149 |
+
```bibtex
|
| 150 |
+
@inproceedings{kuehne2011hmdb,
|
| 151 |
+
title={HMDB: a large video database for human motion recognition},
|
| 152 |
+
author={Kuehne, Hildegard and Jhuang, Hueihan and Garrote, Est{'\i}baliz and Poggio, Tomaso and Serre, Thomas},
|
| 153 |
+
booktitle={2011 International conference on computer vision},
|
| 154 |
+
pages={2556--2563},
|
| 155 |
+
year={2011},
|
| 156 |
+
organization={IEEE}
|
| 157 |
+
}
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
## β Summary
|
| 163 |
+
|
| 164 |
+
- Simple 2β3 line loading
|
| 165 |
+
- Train/test splits for 3 protocols
|
| 166 |
+
- Lazy video downloading
|
| 167 |
+
- WebDataset streaming support
|
| 168 |
+
- Ideal for research and model benchmarking
|