--- language: - en tags: - human-action-recognition - har - hog - cv - kth license: mit --- # KTH HOG Features (NPZ) 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. ## What this file contains `hog_aug_4framegap.npz` (~3GB) includes: - `features`: shape `(N, T*3780)` float32 - `bboxes`: shape `(N, T, 4)` float32, normalized `(cx, cy, w, h)` per frame - `labels`: shape `(N,)` int64 - `metadata`: list of dicts with `video_key`, `subject`, `action`, `split`, `group_idx`, `aug_idx`, `aug_name`, `frame_indices` - `config`: dict with generation settings (see below) 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**. --- ## How the file is generated (pipeline) This `.npz` is produced by `extract_hog_augmented.py` in the main repo: 1. Load **bbox metadata JSON** (groups of frame indices per clip). 2. For each video: - Read only the needed frames. 3. For each clip: - **Always include the original version** (no augmentation). - For **train clips only**, generate additional augmented versions (`num_aug - 1`). 4. For every variant: - Crop person bbox → resize to 64×128 - Optional flip + photometric changes - Compute HOG - Save HOG + normalized bbox info --- ## What `num_aug=4` means When `num_aug=4`, each **train clip** becomes **4 variants**: 1. `orig` — no augmentation 2. `flip` — horizontal flip only 3. `jit0` — random jitter + photometric + possible blur/noise 4. `jit1` — another random jitter + photometric + possible blur/noise Test clips always have **only the original version**. --- ## Augmentations used in `jit*` The `jit*` variants apply a random combination of: - **BBox jitter**: translation `(dx, dy)` + scale - **Random flip** (50%) - **Photometric changes**: contrast (`alpha`), brightness (`beta`) - **Gamma** - **Noise** (optional) - **Blur** (optional) ### `mild` profile (default) - scale: 0.92–1.08 - dx: ±5, dy: ±3 - alpha: 0.85–1.15 - beta: -15…+15 - gamma: 0.95–1.05 - noise: std 2.0 with p=0.5 - blur: p=0.15 (kernel 3) ### `strong` profile - scale: 0.88–1.15 - dx: ±8, dy: ±6 - alpha: 0.75–1.25 - beta: -25…+25 - gamma: 0.85–1.15 - noise: std 4.0 with p=0.7 - blur: p=0.25 (kernel 3) --- ## What `frame_gap=4` means The **frame gap** is defined in the bbox JSON (not in the extractor). Each clip groups frames spaced by a fixed gap (e.g., every 4th frame). That’s why this file is named `hog_aug_4framegap.npz`. --- ## Direct download - https://huggingface.co/datasets/Mihai20/kth-hog-npz/resolve/main/hog_aug_4framegap.npz --- ## Example usage (Python) ```python import numpy as np data = np.load("hog_aug_4framegap.npz", allow_pickle=True) features = data["features"] bboxes = data["bboxes"] labels = data["labels"] metadata = data["metadata"].tolist() config = data["config"].item() # contains num_aug, profile, etc. ``` ## Notes - Intended for inference + demo usage without raw video decoding. - The original videos are not required to use this .npz. - Augmentation settings are saved in config inside the file.