Update README.md
Browse files
README.md
CHANGED
|
@@ -12,21 +12,99 @@ license: mit
|
|
| 12 |
|
| 13 |
# KTH HOG Features (NPZ)
|
| 14 |
|
| 15 |
-
This repository hosts a precomputed HOG feature dataset derived from the KTH Human Action Recognition
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- `features`: shape `(N, T*3780)` float32
|
| 19 |
-
- `bboxes`: shape `(N, T, 4)` float32
|
| 20 |
-
- `labels`: shape `(N,)` int64
|
| 21 |
-
- `metadata`: list of dicts with split/subject/action/video info
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Direct download
|
| 27 |
-
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Example usage (Python)
|
|
|
|
| 30 |
```python
|
| 31 |
import numpy as np
|
| 32 |
|
|
@@ -35,14 +113,10 @@ features = data["features"]
|
|
| 35 |
bboxes = data["bboxes"]
|
| 36 |
labels = data["labels"]
|
| 37 |
metadata = data["metadata"].tolist()
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |
## Notes
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
## License
|
| 45 |
-
MIT (same as the main project).
|
| 46 |
-
|
| 47 |
-
## Contact
|
| 48 |
-
If you use this dataset, please cite or link the main project: https://github.com/Mihai20/CNN_for_HAR
|
|
|
|
| 12 |
|
| 13 |
# KTH HOG Features (NPZ)
|
| 14 |
|
| 15 |
+
This repository hosts a precomputed HOG feature dataset derived from the KTH Human Action Recognition (KTH-HAR) videos. It is used by the CNN-for-HAR Streamlit demo and allows fast inference/training without decoding raw videos at runtime.
|
| 16 |
|
| 17 |
+
## What this file contains
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
`hog_aug_4framegap.npz` (~3GB) includes:
|
| 20 |
+
|
| 21 |
+
- `features`: shape `(N, T*3780)` float32
|
| 22 |
+
- `bboxes`: shape `(N, T, 4)` float32, normalized `(cx, cy, w, h)` per frame
|
| 23 |
+
- `labels`: shape `(N,)` int64
|
| 24 |
+
- `metadata`: list of dicts with `video_key`, `subject`, `action`, `split`, `group_idx`, `aug_idx`, `aug_name`, `frame_indices`
|
| 25 |
+
- `config`: dict with generation settings (see below)
|
| 26 |
+
|
| 27 |
+
Each sample is a clip of **T frames**, stored as a flattened HOG vector. HOG is computed on 64×128 crops (OpenCV HOG defaults), which yields **3780 features per frame**.
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## How the file is generated (pipeline)
|
| 32 |
+
|
| 33 |
+
This `.npz` is produced by `extract_hog_augmented.py` in the main repo:
|
| 34 |
+
|
| 35 |
+
1. Load **bbox metadata JSON** (groups of frame indices per clip).
|
| 36 |
+
2. For each video:
|
| 37 |
+
- Read only the needed frames.
|
| 38 |
+
3. For each clip:
|
| 39 |
+
- **Always include the original version** (no augmentation).
|
| 40 |
+
- For **train clips only**, generate additional augmented versions (`num_aug - 1`).
|
| 41 |
+
4. For every variant:
|
| 42 |
+
- Crop person bbox → resize to 64×128
|
| 43 |
+
- Optional flip + photometric changes
|
| 44 |
+
- Compute HOG
|
| 45 |
+
- Save HOG + normalized bbox info
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
## What `num_aug=4` means
|
| 50 |
+
|
| 51 |
+
When `num_aug=4`, each **train clip** becomes **4 variants**:
|
| 52 |
+
|
| 53 |
+
1. `orig` — no augmentation
|
| 54 |
+
2. `flip` — horizontal flip only
|
| 55 |
+
3. `jit0` — random jitter + photometric + possible blur/noise
|
| 56 |
+
4. `jit1` — another random jitter + photometric + possible blur/noise
|
| 57 |
+
|
| 58 |
+
Test clips always have **only the original version**.
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Augmentations used in `jit*`
|
| 63 |
+
|
| 64 |
+
The `jit*` variants apply a random combination of:
|
| 65 |
+
|
| 66 |
+
- **BBox jitter**: translation `(dx, dy)` + scale
|
| 67 |
+
- **Random flip** (50%)
|
| 68 |
+
- **Photometric changes**: contrast (`alpha`), brightness (`beta`)
|
| 69 |
+
- **Gamma**
|
| 70 |
+
- **Noise** (optional)
|
| 71 |
+
- **Blur** (optional)
|
| 72 |
+
|
| 73 |
+
### `mild` profile (default)
|
| 74 |
+
- scale: 0.92–1.08
|
| 75 |
+
- dx: ±5, dy: ±3
|
| 76 |
+
- alpha: 0.85–1.15
|
| 77 |
+
- beta: -15…+15
|
| 78 |
+
- gamma: 0.95–1.05
|
| 79 |
+
- noise: std 2.0 with p=0.5
|
| 80 |
+
- blur: p=0.15 (kernel 3)
|
| 81 |
+
|
| 82 |
+
### `strong` profile
|
| 83 |
+
- scale: 0.88–1.15
|
| 84 |
+
- dx: ±8, dy: ±6
|
| 85 |
+
- alpha: 0.75–1.25
|
| 86 |
+
- beta: -25…+25
|
| 87 |
+
- gamma: 0.85–1.15
|
| 88 |
+
- noise: std 4.0 with p=0.7
|
| 89 |
+
- blur: p=0.25 (kernel 3)
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## What `frame_gap=4` means
|
| 94 |
+
|
| 95 |
+
The **frame gap** is defined in the bbox JSON (not in the extractor).
|
| 96 |
+
Each clip groups frames spaced by a fixed gap (e.g., every 4th frame).
|
| 97 |
+
That’s why this file is named `hog_aug_4framegap.npz`.
|
| 98 |
+
|
| 99 |
+
---
|
| 100 |
|
| 101 |
## Direct download
|
| 102 |
+
- https://huggingface.co/datasets/Mihai20/kth-hog-npz/resolve/main/hog_aug_4framegap.npz
|
| 103 |
+
|
| 104 |
+
---
|
| 105 |
|
| 106 |
## Example usage (Python)
|
| 107 |
+
|
| 108 |
```python
|
| 109 |
import numpy as np
|
| 110 |
|
|
|
|
| 113 |
bboxes = data["bboxes"]
|
| 114 |
labels = data["labels"]
|
| 115 |
metadata = data["metadata"].tolist()
|
| 116 |
+
config = data["config"].item() # contains num_aug, profile, etc.
|
| 117 |
```
|
| 118 |
|
| 119 |
## Notes
|
| 120 |
+
- Intended for inference + demo usage without raw video decoding.
|
| 121 |
+
- The original videos are not required to use this .npz.
|
| 122 |
+
- Augmentation settings are saved in config inside the file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|