vulus98 commited on
Commit
fad77c8
·
1 Parent(s): 3e6dc6c

rename io_classifier → scene_classifier

Browse files

The "IO" name was a Places365 carry-over (their IO_places365.txt label
file marks each category as Indoor/Outdoor). In Python "IO" reads as
input/output by default and obscures what the module actually does.
``scene_classifier`` matches the existing ``--scene_mode`` flag and
the ``_resolve_scene`` helper in app.py. The internal references to the
upstream IO_places365.txt resource are kept intact.

app.py CHANGED
@@ -46,7 +46,7 @@ from src.utils.geometry_utils import (
46
  erp_to_pointcloud,
47
  remove_isolated_clusters_3d,
48
  )
49
- from src.utils.io_classifier import get_classifier
50
  from src.utils.utils import (
51
  prepare_depth_for_logging,
52
  prepare_normals_for_logging,
@@ -109,7 +109,7 @@ def _resolve_scene(mode: str, input_rgb: np.ndarray) -> tuple[str, str]:
109
  classifier to pick a head; otherwise echoes the explicit choice."""
110
  if mode in (MODE_INDOOR, MODE_OUTDOOR):
111
  return mode, f"**Scale head:** {mode}"
112
- label, _ = io_classifier.classify(input_rgb)
113
  scene = MODE_OUTDOOR if label == "outdoor" else MODE_INDOOR
114
  return scene, f"**Scale head:** Auto → {scene}"
115
 
@@ -369,7 +369,7 @@ pager.model.eval()
369
 
370
  # Eager-init the classifier so the first ``Auto`` click doesn't pay the (~1 s)
371
  # weight load + the (~10 s on first run) download.
372
- io_classifier = get_classifier(device=device)
373
 
374
 
375
  _CUSTOM_CSS = """
 
46
  erp_to_pointcloud,
47
  remove_isolated_clusters_3d,
48
  )
49
+ from src.utils.scene_classifier import get_classifier
50
  from src.utils.utils import (
51
  prepare_depth_for_logging,
52
  prepare_normals_for_logging,
 
109
  classifier to pick a head; otherwise echoes the explicit choice."""
110
  if mode in (MODE_INDOOR, MODE_OUTDOOR):
111
  return mode, f"**Scale head:** {mode}"
112
+ label, _ = scene_classifier.classify(input_rgb)
113
  scene = MODE_OUTDOOR if label == "outdoor" else MODE_INDOOR
114
  return scene, f"**Scale head:** Auto → {scene}"
115
 
 
369
 
370
  # Eager-init the classifier so the first ``Auto`` click doesn't pay the (~1 s)
371
  # weight load + the (~10 s on first run) download.
372
+ scene_classifier = get_classifier(device=device)
373
 
374
 
375
  _CUSTOM_CSS = """
src/utils/{io_classifier.py → scene_classifier.py} RENAMED
@@ -117,7 +117,7 @@ class IndoorOutdoorClassifier:
117
  io_path = cache_dir / "IO_places365.txt"
118
  for url, dst in [(_WEIGHTS_URL, weights_path), (_IO_URL, io_path)]:
119
  if not dst.exists():
120
- print(f"[io_classifier] downloading {url}", file=sys.stderr)
121
  urllib.request.urlretrieve(url, dst)
122
 
123
  is_outdoor = []
 
117
  io_path = cache_dir / "IO_places365.txt"
118
  for url, dst in [(_WEIGHTS_URL, weights_path), (_IO_URL, io_path)]:
119
  if not dst.exists():
120
+ print(f"[scene_classifier] downloading {url}", file=sys.stderr)
121
  urllib.request.urlretrieve(url, dst)
122
 
123
  is_outdoor = []