yakvrz commited on
Commit
9c5a0eb
·
1 Parent(s): 42a8e2e

Add generated VISLOC examples for Space

Browse files
Files changed (5) hide show
  1. .gitignore +1 -0
  2. README.md +1 -0
  3. app/config.py +2 -0
  4. app/data_sources.py +15 -1
  5. app/example_assets.py +0 -0
.gitignore CHANGED
@@ -2,5 +2,6 @@ __pycache__/
2
  .DS_Store
3
  .python-version
4
  data/
 
5
  *.pyc
6
  scripts/
 
2
  .DS_Store
3
  .python-version
4
  data/
5
+ examples/
6
  *.pyc
7
  scripts/
README.md CHANGED
@@ -15,6 +15,7 @@ Analyze aerial RGB imagery to detect safe drone landing sites. Combines monocula
15
 
16
  ## What’s inside
17
  - **Main app (`app.py`)** — runs full inference with adjustable thresholds, overlays, and camera assumptions; requires >8GB VRAM (assuming default 1024 px processing resolution); runtime is ~2000 ms per image.
 
18
 
19
  ## References
20
  - UAV-VisLoc dataset: Xu et al., 2024 (https://arxiv.org/abs/2405.11936)
 
15
 
16
  ## What’s inside
17
  - **Main app (`app.py`)** — runs full inference with adjustable thresholds, overlays, and camera assumptions; requires >8GB VRAM (assuming default 1024 px processing resolution); runtime is ~2000 ms per image.
18
+ - **Sample data (`examples/visloc/`)** — 5 VISLOC frames bundled for quick testing in the Space.
19
 
20
  ## References
21
  - UAV-VisLoc dataset: Xu et al., 2024 (https://arxiv.org/abs/2405.11936)
app/config.py CHANGED
@@ -5,6 +5,7 @@ from pathlib import Path
5
 
6
  VISLOC_DIR = Path("data/Image/VISLOC")
7
  IMAGE_ROOT = Path("data/Image")
 
8
  IMAGE_EXTS = (".jpg", ".jpeg", ".png", ".JPG", ".JPEG", ".PNG")
9
  DEFAULT_ALTITUDE_M = 450.0
10
  ASSUMED_FOV_DEG = 90.0
@@ -51,6 +52,7 @@ DEFAULT_ANALYZER_SETTINGS = AnalyzerSettings()
51
  __all__ = [
52
  "VISLOC_DIR",
53
  "IMAGE_ROOT",
 
54
  "IMAGE_EXTS",
55
  "DEFAULT_ALTITUDE_M",
56
  "ASSUMED_FOV_DEG",
 
5
 
6
  VISLOC_DIR = Path("data/Image/VISLOC")
7
  IMAGE_ROOT = Path("data/Image")
8
+ EXAMPLES_ROOT = Path("examples")
9
  IMAGE_EXTS = (".jpg", ".jpeg", ".png", ".JPG", ".JPEG", ".PNG")
10
  DEFAULT_ALTITUDE_M = 450.0
11
  ASSUMED_FOV_DEG = 90.0
 
52
  __all__ = [
53
  "VISLOC_DIR",
54
  "IMAGE_ROOT",
55
+ "EXAMPLES_ROOT",
56
  "IMAGE_EXTS",
57
  "DEFAULT_ALTITUDE_M",
58
  "ASSUMED_FOV_DEG",
app/data_sources.py CHANGED
@@ -3,7 +3,8 @@ from __future__ import annotations
3
  from functools import lru_cache
4
  from pathlib import Path
5
 
6
- from .config import IMAGE_EXTS, IMAGE_ROOT, VISLOC_DIR
 
7
 
8
 
9
  @lru_cache(maxsize=1)
@@ -14,6 +15,16 @@ def list_visloc_images() -> list[Path]:
14
  return sorted(files)
15
 
16
 
 
 
 
 
 
 
 
 
 
 
17
  @lru_cache(maxsize=1)
18
  def list_all_data_inputs() -> list[str]:
19
  paths: list[Path] = []
@@ -24,6 +35,7 @@ def list_all_data_inputs() -> list[str]:
24
  paths.append(p)
25
 
26
  # Prefer structured datasets first
 
27
  _add(list_visloc_images())
28
 
29
  # Allow arbitrary images anywhere under data/Image/
@@ -38,11 +50,13 @@ def list_all_data_inputs() -> list[str]:
38
 
39
  def clear_caches() -> None:
40
  list_visloc_images.cache_clear()
 
41
  list_all_data_inputs.cache_clear()
42
 
43
 
44
  __all__ = [
45
  "list_visloc_images",
 
46
  "list_all_data_inputs",
47
  "clear_caches",
48
  ]
 
3
  from functools import lru_cache
4
  from pathlib import Path
5
 
6
+ from .config import EXAMPLES_ROOT, IMAGE_EXTS, IMAGE_ROOT, VISLOC_DIR
7
+ from .example_assets import ensure_example_images
8
 
9
 
10
  @lru_cache(maxsize=1)
 
15
  return sorted(files)
16
 
17
 
18
+ @lru_cache(maxsize=1)
19
+ def list_example_images() -> list[Path]:
20
+ examples_dir = EXAMPLES_ROOT / "visloc"
21
+ ensure_example_images(examples_dir)
22
+ if not examples_dir.exists():
23
+ return []
24
+ files = [p for p in examples_dir.rglob("*") if p.is_file() and p.suffix in IMAGE_EXTS]
25
+ return sorted(files)
26
+
27
+
28
  @lru_cache(maxsize=1)
29
  def list_all_data_inputs() -> list[str]:
30
  paths: list[Path] = []
 
35
  paths.append(p)
36
 
37
  # Prefer structured datasets first
38
+ _add(list_example_images())
39
  _add(list_visloc_images())
40
 
41
  # Allow arbitrary images anywhere under data/Image/
 
50
 
51
  def clear_caches() -> None:
52
  list_visloc_images.cache_clear()
53
+ list_example_images.cache_clear()
54
  list_all_data_inputs.cache_clear()
55
 
56
 
57
  __all__ = [
58
  "list_visloc_images",
59
+ "list_example_images",
60
  "list_all_data_inputs",
61
  "clear_caches",
62
  ]
app/example_assets.py ADDED
The diff for this file is too large to render. See raw diff