Download scripts/download_urfd.py from minhy112/FallKLTN: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/minhy112/FallKLTN/resolve/main/scripts/download_urfd.py
- Command line
-
hf download hf://minhy112/FallKLTN/scripts/download_urfd.py
-
curl -L -o download_urfd.py https://huggingface.co/minhy112/FallKLTN/resolve/main/scripts/download_urfd.py
1.77 kB
| #!/usr/bin/env python3 | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from urllib.request import urlretrieve | |
| from tqdm import tqdm | |
| BASE_URL = "https://fenix.ur.edu.pl/~mkepski/ds/data" | |
| def download(url: str, destination: Path) -> None: | |
| destination.parent.mkdir(parents=True, exist_ok=True) | |
| if destination.exists() and destination.stat().st_size > 0: | |
| return | |
| temporary = destination.with_suffix(destination.suffix + ".part") | |
| urlretrieve(url, temporary) | |
| temporary.replace(destination) | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description="Download official URFD RGB videos") | |
| parser.add_argument("--output", type=Path, default=Path("data/videos")) | |
| args = parser.parse_args() | |
| items: list[tuple[str, Path]] = [] | |
| for index in range(1, 31): | |
| name = f"fall-{index:02d}-cam0.mp4" | |
| items.append((f"{BASE_URL}/{name}", args.output / "fall" / f"fall-{index:02d}" / name)) | |
| for index in range(1, 41): | |
| name = f"adl-{index:02d}-cam0.mp4" | |
| items.append((f"{BASE_URL}/{name}", args.output / "normal" / f"adl-{index:02d}" / name)) | |
| items.extend( | |
| [ | |
| ( | |
| f"{BASE_URL}/urfall-cam0-falls.csv", | |
| args.output / "annotations" / "urfall-cam0-falls.csv", | |
| ), | |
| ( | |
| f"{BASE_URL}/urfall-cam0-adls.csv", | |
| args.output / "annotations" / "urfall-cam0-adls.csv", | |
| ), | |
| ] | |
| ) | |
| for url, destination in tqdm(items, desc="Downloading URFD"): | |
| download(url, destination) | |
| print(f"Downloaded/verified {len(items)} files in {args.output}") | |
| print("License: CC BY-NC-SA 4.0, academic non-commercial use.") | |
| if __name__ == "__main__": | |
| main() | |