Spaces:
Paused
Paused
Dev Deploy: 78b7d61
Browse files- app.py +3 -190
- visualizer.gpu.toml +0 -9
- visualizer.hf.toml +0 -11
- visualizer.local.toml +0 -7
- visualizer.segformer.toml +0 -7
app.py
CHANGED
|
@@ -106,22 +106,6 @@ SEGFORMER_MODEL_NAME = str(config_value(
|
|
| 106 |
"segformer_model_name",
|
| 107 |
"nvidia/segformer-b2-finetuned-ade-512-512",
|
| 108 |
))
|
| 109 |
-
# Resolution the segmenter runs at. The model's default (~640px shortest edge) decides the
|
| 110 |
-
# floor-mask boundary at low res and upscales it, which is the root cause of the coarse
|
| 111 |
-
# "pale rim" around objects. Raising this sharpens silhouettes at the cost of GPU VRAM /
|
| 112 |
-
# latency. Set 0 to keep the model default. Only applied to the OneFormer backend.
|
| 113 |
-
SEGMENTATION_SHORTEST_EDGE = int(config_value(
|
| 114 |
-
"SEGMENTATION_SHORTEST_EDGE",
|
| 115 |
-
"models",
|
| 116 |
-
"segmentation_shortest_edge",
|
| 117 |
-
"1024",
|
| 118 |
-
))
|
| 119 |
-
SEGMENTATION_LONGEST_EDGE = int(config_value(
|
| 120 |
-
"SEGMENTATION_LONGEST_EDGE",
|
| 121 |
-
"models",
|
| 122 |
-
"segmentation_longest_edge",
|
| 123 |
-
"2048",
|
| 124 |
-
))
|
| 125 |
DEPTH_MODEL_NAME = str(config_value(
|
| 126 |
"DEPTH_MODEL_NAME",
|
| 127 |
"models",
|
|
@@ -236,56 +220,6 @@ SURFACE_EDGE_DILATION_ITERATIONS = int(config_value(
|
|
| 236 |
"edge_dilation_iterations",
|
| 237 |
"1",
|
| 238 |
))
|
| 239 |
-
# Occluder/wall protection ring removed from the floor surface. Smaller = the tile
|
| 240 |
-
# hugs objects more tightly (less original-floor halo), larger = safer against bleed.
|
| 241 |
-
SURFACE_OCCLUDER_DILATION_ITERATIONS = int(config_value(
|
| 242 |
-
"SURFACE_OCCLUDER_DILATION_ITERATIONS",
|
| 243 |
-
"surface_mapping",
|
| 244 |
-
"occluder_dilation_iterations",
|
| 245 |
-
"1",
|
| 246 |
-
))
|
| 247 |
-
# Image-guided refinement that snaps the surface-mask boundary to true image edges,
|
| 248 |
-
# so the tile reaches the object silhouette instead of leaving a visible halo.
|
| 249 |
-
SURFACE_EDGE_REFINE_ENABLED = str(config_value(
|
| 250 |
-
"SURFACE_EDGE_REFINE_ENABLED",
|
| 251 |
-
"surface_mapping",
|
| 252 |
-
"edge_refine_enabled",
|
| 253 |
-
"1",
|
| 254 |
-
)).lower() not in ("0", "false", "no", "off", "")
|
| 255 |
-
# How far the surface may grow to fill the original-floor halo around objects.
|
| 256 |
-
SURFACE_EDGE_REFINE_FILL_RATIO = float(config_value(
|
| 257 |
-
"SURFACE_EDGE_REFINE_FILL_RATIO",
|
| 258 |
-
"surface_mapping",
|
| 259 |
-
"edge_refine_fill_ratio",
|
| 260 |
-
"0.010",
|
| 261 |
-
))
|
| 262 |
-
# Colour-gradient strength (0..1, normalised) above which the edge-aware grow stops.
|
| 263 |
-
# Higher = grow crosses weaker edges (fills more, risks bleed); lower = stops sooner.
|
| 264 |
-
SURFACE_EDGE_REFINE_GRAD_THRESHOLD = float(config_value(
|
| 265 |
-
"SURFACE_EDGE_REFINE_GRAD_THRESHOLD",
|
| 266 |
-
"surface_mapping",
|
| 267 |
-
"edge_refine_grad_threshold",
|
| 268 |
-
"0.10",
|
| 269 |
-
))
|
| 270 |
-
# Guided-filter window used to snap the grown boundary back onto real image edges.
|
| 271 |
-
SURFACE_EDGE_REFINE_RADIUS_RATIO = float(config_value(
|
| 272 |
-
"SURFACE_EDGE_REFINE_RADIUS_RATIO",
|
| 273 |
-
"surface_mapping",
|
| 274 |
-
"edge_refine_radius_ratio",
|
| 275 |
-
"0.006",
|
| 276 |
-
))
|
| 277 |
-
SURFACE_EDGE_REFINE_EPS = float(config_value(
|
| 278 |
-
"SURFACE_EDGE_REFINE_EPS",
|
| 279 |
-
"surface_mapping",
|
| 280 |
-
"edge_refine_eps",
|
| 281 |
-
"0.0001",
|
| 282 |
-
))
|
| 283 |
-
SURFACE_EDGE_REFINE_THRESHOLD = float(config_value(
|
| 284 |
-
"SURFACE_EDGE_REFINE_THRESHOLD",
|
| 285 |
-
"surface_mapping",
|
| 286 |
-
"edge_refine_threshold",
|
| 287 |
-
"0.5",
|
| 288 |
-
))
|
| 289 |
SURFACE_UV_MIN_COVERAGE = float(config_value(
|
| 290 |
"SURFACE_UV_MIN_COVERAGE",
|
| 291 |
"surface_mapping",
|
|
@@ -325,27 +259,6 @@ def hf_offline() -> bool:
|
|
| 325 |
return os.getenv("HF_HUB_OFFLINE") == "1" or os.getenv("TRANSFORMERS_OFFLINE") == "1"
|
| 326 |
|
| 327 |
|
| 328 |
-
def _apply_segmentation_input_size(processor) -> dict | None:
|
| 329 |
-
"""Raise the segmenter's input resolution so the floor-mask boundary is decided at
|
| 330 |
-
higher resolution (sharper object silhouettes) instead of the model's low ~640px
|
| 331 |
-
default. Returns the applied size dict, or None if disabled/unsupported."""
|
| 332 |
-
if SEGMENTATION_SHORTEST_EDGE <= 0:
|
| 333 |
-
return None
|
| 334 |
-
image_processor = getattr(processor, "image_processor", processor)
|
| 335 |
-
try:
|
| 336 |
-
size = dict(getattr(image_processor, "size", {}) or {})
|
| 337 |
-
size["shortest_edge"] = SEGMENTATION_SHORTEST_EDGE
|
| 338 |
-
size["longest_edge"] = max(SEGMENTATION_LONGEST_EDGE, SEGMENTATION_SHORTEST_EDGE)
|
| 339 |
-
size.pop("height", None)
|
| 340 |
-
size.pop("width", None)
|
| 341 |
-
image_processor.size = size
|
| 342 |
-
print(f"Segmentation input size -> {size}", flush=True)
|
| 343 |
-
return size
|
| 344 |
-
except Exception as exc:
|
| 345 |
-
print(f"Could not override segmentation input size: {exc}", flush=True)
|
| 346 |
-
return None
|
| 347 |
-
|
| 348 |
-
|
| 349 |
def _load_segmentation_model():
|
| 350 |
global seg_processor, seg_model, segmentation_backend
|
| 351 |
|
|
@@ -356,7 +269,6 @@ def _load_segmentation_model():
|
|
| 356 |
ONEFORMER_MODEL_NAME,
|
| 357 |
local_files_only=hf_offline(),
|
| 358 |
)
|
| 359 |
-
_apply_segmentation_input_size(seg_processor)
|
| 360 |
seg_model = OneFormerForUniversalSegmentation.from_pretrained(
|
| 361 |
ONEFORMER_MODEL_NAME,
|
| 362 |
local_files_only=hf_offline(),
|
|
@@ -788,100 +700,6 @@ def improve_surface_edge_coverage(
|
|
| 788 |
}
|
| 789 |
|
| 790 |
|
| 791 |
-
def _guided_filter(guide: np.ndarray, src: np.ndarray, radius: int, eps: float) -> np.ndarray:
|
| 792 |
-
"""He et al. guided filter implemented with box filters (base OpenCV only).
|
| 793 |
-
|
| 794 |
-
`guide` is the grayscale image (0..1), `src` is the soft mask (0..1). The output
|
| 795 |
-
follows the guide's edges, which lets a binary mask snap onto real image boundaries.
|
| 796 |
-
"""
|
| 797 |
-
ksize = (radius, radius)
|
| 798 |
-
mean_g = cv2.boxFilter(guide, cv2.CV_32F, ksize)
|
| 799 |
-
mean_s = cv2.boxFilter(src, cv2.CV_32F, ksize)
|
| 800 |
-
corr_g = cv2.boxFilter(guide * guide, cv2.CV_32F, ksize)
|
| 801 |
-
corr_gs = cv2.boxFilter(guide * src, cv2.CV_32F, ksize)
|
| 802 |
-
var_g = corr_g - mean_g * mean_g
|
| 803 |
-
cov_gs = corr_gs - mean_g * mean_s
|
| 804 |
-
a = cov_gs / (var_g + eps)
|
| 805 |
-
b = mean_s - a * mean_g
|
| 806 |
-
mean_a = cv2.boxFilter(a, cv2.CV_32F, ksize)
|
| 807 |
-
mean_b = cv2.boxFilter(b, cv2.CV_32F, ksize)
|
| 808 |
-
return mean_a * guide + mean_b
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
def refine_surface_edges(
|
| 812 |
-
surface: np.ndarray,
|
| 813 |
-
img_np: np.ndarray,
|
| 814 |
-
protected_mask: np.ndarray,
|
| 815 |
-
) -> tuple[np.ndarray, dict]:
|
| 816 |
-
"""Close the original-floor halo around objects and snap the edge to the photo.
|
| 817 |
-
|
| 818 |
-
The coarse segmentation (plus the occluder protection ring) leaves a band of the
|
| 819 |
-
original, often bright, floor around objects — the visible "halo". A guided filter
|
| 820 |
-
alone cannot fix it because that band is the same colour as the floor, so there is no
|
| 821 |
-
edge to snap to. Two steps instead:
|
| 822 |
-
|
| 823 |
-
1. Grow the surface into the surrounding non-protected pixels to fill the halo so the
|
| 824 |
-
tile reaches the object.
|
| 825 |
-
2. Run a guided filter with the photo as guide and re-decide a band around the new
|
| 826 |
-
boundary: growth that spilled onto an under-segmented object sits on a real image
|
| 827 |
-
edge and gets carved back, while growth across uniform floor is kept.
|
| 828 |
-
|
| 829 |
-
Protected occluder/wall pixels are always cleared at the end.
|
| 830 |
-
"""
|
| 831 |
-
h, w = surface.shape[:2]
|
| 832 |
-
if not SURFACE_EDGE_REFINE_ENABLED or not surface.any():
|
| 833 |
-
return surface, {"surfaceEdgeRefineEnabled": False}
|
| 834 |
-
|
| 835 |
-
protected = protected_mask.astype(bool)
|
| 836 |
-
before = int(surface.sum())
|
| 837 |
-
|
| 838 |
-
# 1. fill the halo with an edge-aware (geodesic) grow: expand the surface one step at
|
| 839 |
-
# a time only into non-protected, low-gradient pixels, so it spreads across the uniform
|
| 840 |
-
# original-floor halo but stops at real object/wall edges instead of rounding corners
|
| 841 |
-
# into bumps (the scalloping a blind ellipse dilation produces). A colour gradient is
|
| 842 |
-
# used so hue edges (e.g. a blue cabinet on a cream floor) are caught, not just luma.
|
| 843 |
-
fill_radius = scaled_odd_kernel_size(h, w, SURFACE_EDGE_REFINE_FILL_RATIO, minimum=3)
|
| 844 |
-
blurred = cv2.GaussianBlur(img_np, (0, 0), 1.2).astype(np.float32)
|
| 845 |
-
gx = cv2.Sobel(blurred, cv2.CV_32F, 1, 0, ksize=3)
|
| 846 |
-
gy = cv2.Sobel(blurred, cv2.CV_32F, 0, 1, ksize=3)
|
| 847 |
-
grad = np.sqrt((gx * gx + gy * gy).sum(axis=2))
|
| 848 |
-
grad /= float(grad.max()) + 1e-6
|
| 849 |
-
allowed = (((~protected) & (grad < SURFACE_EDGE_REFINE_GRAD_THRESHOLD)) | (surface > 0)).astype(np.uint8)
|
| 850 |
-
step = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
|
| 851 |
-
grown = surface.copy()
|
| 852 |
-
for _ in range(int(fill_radius)):
|
| 853 |
-
nxt = (((cv2.dilate(grown, step) & allowed) | grown) > 0).astype(np.uint8)
|
| 854 |
-
if int(nxt.sum()) == int(grown.sum()):
|
| 855 |
-
break
|
| 856 |
-
grown = nxt
|
| 857 |
-
grown[protected] = 0
|
| 858 |
-
grown = ((grown | surface) > 0).astype(np.uint8)
|
| 859 |
-
|
| 860 |
-
# 2. snap the grown boundary back onto real image edges
|
| 861 |
-
snap_radius = scaled_odd_kernel_size(h, w, SURFACE_EDGE_REFINE_RADIUS_RATIO, minimum=3)
|
| 862 |
-
guide = cv2.cvtColor(img_np, cv2.COLOR_RGB2GRAY).astype(np.float32) / 255.0
|
| 863 |
-
smoothed = _guided_filter(guide, grown.astype(np.float32), snap_radius, SURFACE_EDGE_REFINE_EPS)
|
| 864 |
-
snapped = (smoothed >= SURFACE_EDGE_REFINE_THRESHOLD).astype(np.uint8)
|
| 865 |
-
|
| 866 |
-
band_kern = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (snap_radius, snap_radius))
|
| 867 |
-
boundary_band = (cv2.dilate(grown, band_kern) > 0) & (cv2.erode(grown, band_kern) == 0)
|
| 868 |
-
|
| 869 |
-
refined = grown.copy()
|
| 870 |
-
refined[boundary_band] = snapped[boundary_band]
|
| 871 |
-
refined[protected] = 0
|
| 872 |
-
refined = (refined > 0).astype(np.uint8)
|
| 873 |
-
|
| 874 |
-
return refined, {
|
| 875 |
-
"surfaceEdgeRefineEnabled": True,
|
| 876 |
-
"surfaceEdgeRefineMode": "edge-aware",
|
| 877 |
-
"surfaceEdgeRefineFillRadius": int(fill_radius),
|
| 878 |
-
"surfaceEdgeRefineSnapRadius": int(snap_radius),
|
| 879 |
-
"surfaceEdgeRefineGradThreshold": SURFACE_EDGE_REFINE_GRAD_THRESHOLD,
|
| 880 |
-
"surfaceEdgeRefinePixelsBefore": before,
|
| 881 |
-
"surfaceEdgeRefinePixelsAfter": int(refined.sum()),
|
| 882 |
-
}
|
| 883 |
-
|
| 884 |
-
|
| 885 |
def fit_floor_edges(mask: np.ndarray):
|
| 886 |
h, w = mask.shape[:2]
|
| 887 |
row_ys, lefts, rights = [], [], []
|
|
@@ -1892,15 +1710,14 @@ def build_floor_surface_mask(
|
|
| 1892 |
seg_map: np.ndarray,
|
| 1893 |
quad: np.ndarray | None,
|
| 1894 |
depth: np.ndarray | None,
|
| 1895 |
-
img_np: np.ndarray | None = None,
|
| 1896 |
):
|
| 1897 |
h, w = floor_mask.shape[:2]
|
| 1898 |
kern_size = max(5, min(h, w) // 160) | 1
|
| 1899 |
kern = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kern_size, kern_size))
|
| 1900 |
occluder_mask = np.isin(seg_map, class_ids(OCCLUDER_CLASSES)).astype(np.uint8)
|
| 1901 |
-
occ_dilated = cv2.dilate(occluder_mask, kern, iterations=
|
| 1902 |
reject_mask = np.isin(seg_map, class_ids(REJECT_SURFACE_CLASSES)).astype(np.uint8)
|
| 1903 |
-
reject_dilated = cv2.dilate(reject_mask, kern, iterations=
|
| 1904 |
|
| 1905 |
surface = floor_mask.copy()
|
| 1906 |
surface[reject_dilated > 0] = 0
|
|
@@ -1943,9 +1760,6 @@ def build_floor_surface_mask(
|
|
| 1943 |
|
| 1944 |
protected_mask = (occ_dilated > 0) | (reject_dilated > 0)
|
| 1945 |
surface, edge_metadata = improve_surface_edge_coverage(surface, protected_mask)
|
| 1946 |
-
if img_np is not None:
|
| 1947 |
-
surface, refine_metadata = refine_surface_edges(surface, img_np, protected_mask)
|
| 1948 |
-
edge_metadata.update(refine_metadata)
|
| 1949 |
return surface, edge_metadata
|
| 1950 |
|
| 1951 |
|
|
@@ -2089,7 +1903,7 @@ def build_segmentation_bundle(contents: bytes):
|
|
| 2089 |
|
| 2090 |
t0 = time.perf_counter()
|
| 2091 |
quad = np.asarray(plane["quad"], dtype=np.float32).reshape(4, 2) if plane and plane.get("quad") else None
|
| 2092 |
-
surface_mask, edge_metadata = build_floor_surface_mask(floor_mask, seg_map, quad, depth
|
| 2093 |
surface_indices = np.flatnonzero(surface_mask.ravel()).astype(np.uint32)
|
| 2094 |
print(f"[TIMING] Surface masking took {time.perf_counter() - t0:.3f} seconds", flush=True)
|
| 2095 |
|
|
@@ -2154,7 +1968,6 @@ def build_segmentation_bundle(contents: bytes):
|
|
| 2154 |
"metadata": {
|
| 2155 |
"segmenter": segmenter_metadata_name(),
|
| 2156 |
"segmentationModel": models["segmentation"]["name"],
|
| 2157 |
-
"segmentationShortestEdge": SEGMENTATION_SHORTEST_EDGE,
|
| 2158 |
"floorPixels": int(floor_mask.sum()),
|
| 2159 |
"surfacePixels": int(surface_mask.sum()),
|
| 2160 |
**edge_metadata,
|
|
|
|
| 106 |
"segformer_model_name",
|
| 107 |
"nvidia/segformer-b2-finetuned-ade-512-512",
|
| 108 |
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
DEPTH_MODEL_NAME = str(config_value(
|
| 110 |
"DEPTH_MODEL_NAME",
|
| 111 |
"models",
|
|
|
|
| 220 |
"edge_dilation_iterations",
|
| 221 |
"1",
|
| 222 |
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
SURFACE_UV_MIN_COVERAGE = float(config_value(
|
| 224 |
"SURFACE_UV_MIN_COVERAGE",
|
| 225 |
"surface_mapping",
|
|
|
|
| 259 |
return os.getenv("HF_HUB_OFFLINE") == "1" or os.getenv("TRANSFORMERS_OFFLINE") == "1"
|
| 260 |
|
| 261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
def _load_segmentation_model():
|
| 263 |
global seg_processor, seg_model, segmentation_backend
|
| 264 |
|
|
|
|
| 269 |
ONEFORMER_MODEL_NAME,
|
| 270 |
local_files_only=hf_offline(),
|
| 271 |
)
|
|
|
|
| 272 |
seg_model = OneFormerForUniversalSegmentation.from_pretrained(
|
| 273 |
ONEFORMER_MODEL_NAME,
|
| 274 |
local_files_only=hf_offline(),
|
|
|
|
| 700 |
}
|
| 701 |
|
| 702 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
def fit_floor_edges(mask: np.ndarray):
|
| 704 |
h, w = mask.shape[:2]
|
| 705 |
row_ys, lefts, rights = [], [], []
|
|
|
|
| 1710 |
seg_map: np.ndarray,
|
| 1711 |
quad: np.ndarray | None,
|
| 1712 |
depth: np.ndarray | None,
|
|
|
|
| 1713 |
):
|
| 1714 |
h, w = floor_mask.shape[:2]
|
| 1715 |
kern_size = max(5, min(h, w) // 160) | 1
|
| 1716 |
kern = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kern_size, kern_size))
|
| 1717 |
occluder_mask = np.isin(seg_map, class_ids(OCCLUDER_CLASSES)).astype(np.uint8)
|
| 1718 |
+
occ_dilated = cv2.dilate(occluder_mask, kern, iterations=2)
|
| 1719 |
reject_mask = np.isin(seg_map, class_ids(REJECT_SURFACE_CLASSES)).astype(np.uint8)
|
| 1720 |
+
reject_dilated = cv2.dilate(reject_mask, kern, iterations=2)
|
| 1721 |
|
| 1722 |
surface = floor_mask.copy()
|
| 1723 |
surface[reject_dilated > 0] = 0
|
|
|
|
| 1760 |
|
| 1761 |
protected_mask = (occ_dilated > 0) | (reject_dilated > 0)
|
| 1762 |
surface, edge_metadata = improve_surface_edge_coverage(surface, protected_mask)
|
|
|
|
|
|
|
|
|
|
| 1763 |
return surface, edge_metadata
|
| 1764 |
|
| 1765 |
|
|
|
|
| 1903 |
|
| 1904 |
t0 = time.perf_counter()
|
| 1905 |
quad = np.asarray(plane["quad"], dtype=np.float32).reshape(4, 2) if plane and plane.get("quad") else None
|
| 1906 |
+
surface_mask, edge_metadata = build_floor_surface_mask(floor_mask, seg_map, quad, depth)
|
| 1907 |
surface_indices = np.flatnonzero(surface_mask.ravel()).astype(np.uint32)
|
| 1908 |
print(f"[TIMING] Surface masking took {time.perf_counter() - t0:.3f} seconds", flush=True)
|
| 1909 |
|
|
|
|
| 1968 |
"metadata": {
|
| 1969 |
"segmenter": segmenter_metadata_name(),
|
| 1970 |
"segmentationModel": models["segmentation"]["name"],
|
|
|
|
| 1971 |
"floorPixels": int(floor_mask.sum()),
|
| 1972 |
"surfacePixels": int(surface_mask.sum()),
|
| 1973 |
**edge_metadata,
|
visualizer.gpu.toml
CHANGED
|
@@ -9,8 +9,6 @@ moge_model_name = "Ruicheng/moge-2-vitl-normal"
|
|
| 9 |
oneformer_model_name = "shi-labs/oneformer_ade20k_swin_large"
|
| 10 |
mask2former_model_name = "facebook/mask2former-swin-small-ade-semantic"
|
| 11 |
segformer_model_name = "nvidia/segformer-b2-finetuned-ade-512-512"
|
| 12 |
-
segmentation_shortest_edge = 1024
|
| 13 |
-
segmentation_longest_edge = 2048
|
| 14 |
depth_model_name = "depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf"
|
| 15 |
intrinsic_model_version = "v2"
|
| 16 |
|
|
@@ -32,13 +30,6 @@ min_plane_pixels = 1500
|
|
| 32 |
edge_close_ratio = 0.006
|
| 33 |
edge_kernel_ratio = 0.004
|
| 34 |
edge_dilation_iterations = 1
|
| 35 |
-
occluder_dilation_iterations = 1
|
| 36 |
-
edge_refine_enabled = 1
|
| 37 |
-
edge_refine_fill_ratio = 0.010
|
| 38 |
-
edge_refine_grad_threshold = 0.10
|
| 39 |
-
edge_refine_radius_ratio = 0.006
|
| 40 |
-
edge_refine_eps = 0.0001
|
| 41 |
-
edge_refine_threshold = 0.5
|
| 42 |
uv_min_coverage = 0.995
|
| 43 |
uv_max_bad_neighbor_ratio = 0.035
|
| 44 |
uv_max_jump_ratio = 8.0
|
|
|
|
| 9 |
oneformer_model_name = "shi-labs/oneformer_ade20k_swin_large"
|
| 10 |
mask2former_model_name = "facebook/mask2former-swin-small-ade-semantic"
|
| 11 |
segformer_model_name = "nvidia/segformer-b2-finetuned-ade-512-512"
|
|
|
|
|
|
|
| 12 |
depth_model_name = "depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf"
|
| 13 |
intrinsic_model_version = "v2"
|
| 14 |
|
|
|
|
| 30 |
edge_close_ratio = 0.006
|
| 31 |
edge_kernel_ratio = 0.004
|
| 32 |
edge_dilation_iterations = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
uv_min_coverage = 0.995
|
| 34 |
uv_max_bad_neighbor_ratio = 0.035
|
| 35 |
uv_max_jump_ratio = 8.0
|
visualizer.hf.toml
CHANGED
|
@@ -9,8 +9,6 @@ moge_model_name = "Ruicheng/moge-2-vitl-normal"
|
|
| 9 |
oneformer_model_name = "shi-labs/oneformer_ade20k_swin_large"
|
| 10 |
mask2former_model_name = "facebook/mask2former-swin-small-ade-semantic"
|
| 11 |
segformer_model_name = "nvidia/segformer-b2-finetuned-ade-512-512"
|
| 12 |
-
segmentation_shortest_edge = 1024
|
| 13 |
-
segmentation_longest_edge = 2048
|
| 14 |
depth_model_name = "depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf"
|
| 15 |
intrinsic_model_version = "v2"
|
| 16 |
|
|
@@ -32,16 +30,7 @@ min_plane_pixels = 1500
|
|
| 32 |
edge_close_ratio = 0.006
|
| 33 |
edge_kernel_ratio = 0.004
|
| 34 |
edge_dilation_iterations = 1
|
| 35 |
-
occluder_dilation_iterations = 1
|
| 36 |
-
edge_refine_enabled = 1
|
| 37 |
-
edge_refine_fill_ratio = 0.010
|
| 38 |
-
edge_refine_grad_threshold = 0.10
|
| 39 |
-
edge_refine_radius_ratio = 0.006
|
| 40 |
-
edge_refine_eps = 0.0001
|
| 41 |
-
edge_refine_threshold = 0.5
|
| 42 |
uv_min_coverage = 0.995
|
| 43 |
uv_max_bad_neighbor_ratio = 0.035
|
| 44 |
uv_max_jump_ratio = 8.0
|
| 45 |
uv_absolute_jump_meters = 0.35
|
| 46 |
-
|
| 47 |
-
# redeploy trigger: SAM reverted, restore 1024 baseline
|
|
|
|
| 9 |
oneformer_model_name = "shi-labs/oneformer_ade20k_swin_large"
|
| 10 |
mask2former_model_name = "facebook/mask2former-swin-small-ade-semantic"
|
| 11 |
segformer_model_name = "nvidia/segformer-b2-finetuned-ade-512-512"
|
|
|
|
|
|
|
| 12 |
depth_model_name = "depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf"
|
| 13 |
intrinsic_model_version = "v2"
|
| 14 |
|
|
|
|
| 30 |
edge_close_ratio = 0.006
|
| 31 |
edge_kernel_ratio = 0.004
|
| 32 |
edge_dilation_iterations = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
uv_min_coverage = 0.995
|
| 34 |
uv_max_bad_neighbor_ratio = 0.035
|
| 35 |
uv_max_jump_ratio = 8.0
|
| 36 |
uv_absolute_jump_meters = 0.35
|
|
|
|
|
|
visualizer.local.toml
CHANGED
|
@@ -24,13 +24,6 @@ min_plane_pixels = 1500
|
|
| 24 |
edge_close_ratio = 0.006
|
| 25 |
edge_kernel_ratio = 0.004
|
| 26 |
edge_dilation_iterations = 1
|
| 27 |
-
occluder_dilation_iterations = 1
|
| 28 |
-
edge_refine_enabled = 1
|
| 29 |
-
edge_refine_fill_ratio = 0.010
|
| 30 |
-
edge_refine_grad_threshold = 0.10
|
| 31 |
-
edge_refine_radius_ratio = 0.006
|
| 32 |
-
edge_refine_eps = 0.0001
|
| 33 |
-
edge_refine_threshold = 0.5
|
| 34 |
uv_min_coverage = 0.995
|
| 35 |
uv_max_bad_neighbor_ratio = 0.035
|
| 36 |
uv_max_jump_ratio = 8.0
|
|
|
|
| 24 |
edge_close_ratio = 0.006
|
| 25 |
edge_kernel_ratio = 0.004
|
| 26 |
edge_dilation_iterations = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
uv_min_coverage = 0.995
|
| 28 |
uv_max_bad_neighbor_ratio = 0.035
|
| 29 |
uv_max_jump_ratio = 8.0
|
visualizer.segformer.toml
CHANGED
|
@@ -25,13 +25,6 @@ min_plane_pixels = 1500
|
|
| 25 |
edge_close_ratio = 0.006
|
| 26 |
edge_kernel_ratio = 0.004
|
| 27 |
edge_dilation_iterations = 1
|
| 28 |
-
occluder_dilation_iterations = 1
|
| 29 |
-
edge_refine_enabled = 1
|
| 30 |
-
edge_refine_fill_ratio = 0.010
|
| 31 |
-
edge_refine_grad_threshold = 0.10
|
| 32 |
-
edge_refine_radius_ratio = 0.006
|
| 33 |
-
edge_refine_eps = 0.0001
|
| 34 |
-
edge_refine_threshold = 0.5
|
| 35 |
uv_min_coverage = 0.995
|
| 36 |
uv_max_bad_neighbor_ratio = 0.035
|
| 37 |
uv_max_jump_ratio = 8.0
|
|
|
|
| 25 |
edge_close_ratio = 0.006
|
| 26 |
edge_kernel_ratio = 0.004
|
| 27 |
edge_dilation_iterations = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
uv_min_coverage = 0.995
|
| 29 |
uv_max_bad_neighbor_ratio = 0.035
|
| 30 |
uv_max_jump_ratio = 8.0
|