Datasets:
Modalities:
Video
Size:
n<1K
Tags:
respiratory-rate
respiration
contactless-sensing
remote-physiological-sensing
video
computer-vision
License:
Download scripts/load_example.py from shadman-sakib/MPSC-RespView: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/datasets/shadman-sakib/MPSC-RespView/resolve/main/scripts/load_example.py
- Command line
-
hf download hf://datasets/shadman-sakib/MPSC-RespView/scripts/load_example.py
-
curl -L -o load_example.py https://huggingface.co/datasets/shadman-sakib/MPSC-RespView/resolve/main/scripts/load_example.py
1.05 kB
| #!/usr/bin/env python3 | |
| """Minimal example: iterate over recordings, read frames, and (if present) load the belt reference. | |
| python load_example.py --root <download_dir> --domain outdoor --max-frames 300 | |
| """ | |
| import argparse | |
| import cv2 | |
| import pandas as pd | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--root", required=True) | |
| ap.add_argument("--domain", choices=["indoor", "outdoor"], default="outdoor") | |
| ap.add_argument("--max-frames", type=int, default=300) | |
| a = ap.parse_args() | |
| meta = pd.read_csv(f"{a.root}/metadata.csv") | |
| meta = meta[meta.domain == a.domain] | |
| for _, r in meta.iterrows(): | |
| cap = cv2.VideoCapture(f"{a.root}/{r.file_name}") | |
| if not cap.isOpened(): | |
| print("not downloaded:", r.file_name) | |
| continue | |
| n = 0 | |
| while n < a.max_frames: | |
| ok, frame = cap.read() | |
| if not ok: | |
| break | |
| n += 1 # frame is a BGR uint8 array, shape (H, W, 3) | |
| print(f"{r.file_name:38s} {int(r.width)}x{int(r.height)} @ {r.fps:g} fps, {r.duration_s:.0f} s, read {n} frames") | |
| cap.release() | |