Datasets:
Tasks:
Image-to-3D
Sub-tasks:
semantic-segmentation
Languages:
English
ArXiv:
Tags:
3d scene understanding
3d-scene-completion
aerial perception
autonomous flying
dataset
benchmark
License:
minor changes
Browse files- download_occufly.py +0 -188
download_occufly.py
DELETED
|
@@ -1,188 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Simple script to download OccuFly dataset from Hugging Face Hub.
|
| 4 |
-
|
| 5 |
-
Downloads scene zips, predicted depths, and extracts them locally.
|
| 6 |
-
|
| 7 |
-
Usage:
|
| 8 |
-
python download_occufly.py
|
| 9 |
-
python download_occufly.py --split train
|
| 10 |
-
python download_occufly.py --split validation
|
| 11 |
-
python download_occufly.py --scenes 1 2 3
|
| 12 |
-
python download_occufly.py --include_depth_predictions
|
| 13 |
-
python download_occufly.py --only_depth_predictions
|
| 14 |
-
python download_occufly.py --output ./my_data
|
| 15 |
-
"""
|
| 16 |
-
|
| 17 |
-
import sys
|
| 18 |
-
from pathlib import Path
|
| 19 |
-
import zipfile
|
| 20 |
-
import argparse
|
| 21 |
-
|
| 22 |
-
try:
|
| 23 |
-
from huggingface_hub import hf_hub_download
|
| 24 |
-
from tqdm import tqdm
|
| 25 |
-
except ImportError:
|
| 26 |
-
print("Error: Required packages not installed.")
|
| 27 |
-
print("Install with: pip install huggingface-hub tqdm")
|
| 28 |
-
sys.exit(1)
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
class OccuFlyDownloader:
|
| 32 |
-
"""Download OccuFly dataset from HF Hub."""
|
| 33 |
-
|
| 34 |
-
DATASET_ID = "markus-42/OccuFly"
|
| 35 |
-
SCENES = list(range(1, 10))
|
| 36 |
-
SPLITS = {
|
| 37 |
-
"train": [1, 2, 3, 4, 5],
|
| 38 |
-
"validation": [6, 7],
|
| 39 |
-
"test": [8, 9]
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
def __init__(self, output_dir="./OccuFly", dataset_id=None):
|
| 43 |
-
self.output_dir = Path(output_dir)
|
| 44 |
-
self.dataset_id = dataset_id or self.DATASET_ID
|
| 45 |
-
self.output_dir.mkdir(parents=True, exist_ok=True)
|
| 46 |
-
|
| 47 |
-
def download_scene(self, scene_num):
|
| 48 |
-
"""Download a scene zip."""
|
| 49 |
-
if scene_num not in range(1, 10):
|
| 50 |
-
raise ValueError(f"Invalid scene {scene_num}. Must be 1-9.")
|
| 51 |
-
|
| 52 |
-
scene_name = f"scene_{scene_num:02d}"
|
| 53 |
-
filename = f"OccuFly_Dataset/{scene_name}.zip"
|
| 54 |
-
|
| 55 |
-
print(f"\n[DOWNLOAD] {scene_name}...")
|
| 56 |
-
|
| 57 |
-
try:
|
| 58 |
-
zip_path = hf_hub_download(
|
| 59 |
-
repo_id=self.dataset_id,
|
| 60 |
-
filename=filename,
|
| 61 |
-
repo_type="dataset"
|
| 62 |
-
)
|
| 63 |
-
|
| 64 |
-
print(f"[EXTRACT] Extracting {scene_name}...")
|
| 65 |
-
with zipfile.ZipFile(zip_path, 'r') as z:
|
| 66 |
-
z.extractall(self.output_dir)
|
| 67 |
-
|
| 68 |
-
print(f"[OK] Scene extracted to: {self.output_dir / scene_name}")
|
| 69 |
-
return True
|
| 70 |
-
|
| 71 |
-
except Exception as e:
|
| 72 |
-
print(f"[ERROR] Failed to download {scene_name}: {e}")
|
| 73 |
-
return False
|
| 74 |
-
|
| 75 |
-
def download_depth_predictions(self):
|
| 76 |
-
"""Download predicted depth maps."""
|
| 77 |
-
filename = "OccuFly_Predicted_DepthMaps/OccuFly_Predicted_DepthMaps.zip"
|
| 78 |
-
|
| 79 |
-
print(f"\n[DOWNLOAD] Predicted depth maps...")
|
| 80 |
-
|
| 81 |
-
try:
|
| 82 |
-
zip_path = hf_hub_download(
|
| 83 |
-
repo_id=self.dataset_id,
|
| 84 |
-
filename=filename,
|
| 85 |
-
repo_type="dataset"
|
| 86 |
-
)
|
| 87 |
-
|
| 88 |
-
print(f"[EXTRACT] Extracting...")
|
| 89 |
-
with zipfile.ZipFile(zip_path, 'r') as z:
|
| 90 |
-
z.extractall(self.output_dir)
|
| 91 |
-
|
| 92 |
-
print(f"[OK] Predictions extracted to: {self.output_dir}")
|
| 93 |
-
return True
|
| 94 |
-
|
| 95 |
-
except Exception as e:
|
| 96 |
-
print(f"[ERROR] Failed to download predictions: {e}")
|
| 97 |
-
return False
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
def main():
|
| 101 |
-
parser = argparse.ArgumentParser(
|
| 102 |
-
description="Download OccuFly dataset from Hugging Face Hub"
|
| 103 |
-
)
|
| 104 |
-
parser.add_argument(
|
| 105 |
-
"--split",
|
| 106 |
-
choices=["train", "validation", "test"],
|
| 107 |
-
help="Download a specific split (default: all splits)"
|
| 108 |
-
)
|
| 109 |
-
parser.add_argument(
|
| 110 |
-
"--scenes",
|
| 111 |
-
type=int,
|
| 112 |
-
nargs="+",
|
| 113 |
-
choices=range(1, 10),
|
| 114 |
-
help="Scenes to download (default: all 1-9). Overrides --split if specified."
|
| 115 |
-
)
|
| 116 |
-
parser.add_argument(
|
| 117 |
-
"--include_depth_predictions",
|
| 118 |
-
action="store_true",
|
| 119 |
-
help="Include predicted depth maps in download"
|
| 120 |
-
)
|
| 121 |
-
parser.add_argument(
|
| 122 |
-
"--only_depth_predictions",
|
| 123 |
-
action="store_true",
|
| 124 |
-
help="Download only predicted depth maps"
|
| 125 |
-
)
|
| 126 |
-
parser.add_argument(
|
| 127 |
-
"--output",
|
| 128 |
-
default="./OccuFly",
|
| 129 |
-
help="Output directory (default: ./OccuFly)"
|
| 130 |
-
)
|
| 131 |
-
parser.add_argument(
|
| 132 |
-
"--dataset-id",
|
| 133 |
-
default="markus-42/OccuFly",
|
| 134 |
-
help="HF dataset ID"
|
| 135 |
-
)
|
| 136 |
-
|
| 137 |
-
args = parser.parse_args()
|
| 138 |
-
|
| 139 |
-
print("=" * 80)
|
| 140 |
-
print("OccuFly Dataset Downloader")
|
| 141 |
-
print("=" * 80)
|
| 142 |
-
|
| 143 |
-
downloader = OccuFlyDownloader(
|
| 144 |
-
output_dir=args.output,
|
| 145 |
-
dataset_id=args.dataset_id
|
| 146 |
-
)
|
| 147 |
-
|
| 148 |
-
success = True
|
| 149 |
-
|
| 150 |
-
if args.only_depth_predictions:
|
| 151 |
-
success = downloader.download_depth_predictions()
|
| 152 |
-
else:
|
| 153 |
-
# Determine which scenes to download
|
| 154 |
-
if args.scenes:
|
| 155 |
-
# Explicit scenes take precedence
|
| 156 |
-
scenes = args.scenes
|
| 157 |
-
elif args.split:
|
| 158 |
-
# Download specific split
|
| 159 |
-
scenes = downloader.SPLITS[args.split]
|
| 160 |
-
else:
|
| 161 |
-
# Default: all scenes
|
| 162 |
-
scenes = list(range(1, 10))
|
| 163 |
-
|
| 164 |
-
print(f"\n[INFO] Downloading {len(scenes)} scenes...")
|
| 165 |
-
print(f"[INFO] Output directory: {downloader.output_dir}")
|
| 166 |
-
|
| 167 |
-
for scene_num in scenes:
|
| 168 |
-
if not downloader.download_scene(scene_num):
|
| 169 |
-
success = False
|
| 170 |
-
|
| 171 |
-
# Download depth predictions if requested
|
| 172 |
-
if args.include_depth_predictions:
|
| 173 |
-
downloader.download_depth_predictions()
|
| 174 |
-
|
| 175 |
-
print("\n" + "=" * 80)
|
| 176 |
-
if success:
|
| 177 |
-
print(f"[OK] Download complete!")
|
| 178 |
-
print(f"Data saved to: {downloader.output_dir}")
|
| 179 |
-
else:
|
| 180 |
-
print("[ERROR] Some downloads failed")
|
| 181 |
-
|
| 182 |
-
print("=" * 80)
|
| 183 |
-
|
| 184 |
-
sys.exit(0 if success else 1)
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
if __name__ == "__main__":
|
| 188 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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