room-visualizer-v2 / config /runtime.py
github-actions[bot]
Automated Deploy: 493daa301f7f4360c6f8a09b665c70b6c12463cd
790d9ba
Raw History Blame Contribute Delete
4.05 kB
from config.loader import config_bool, config_value
ENABLE_MOGE_GEOMETRY = config_bool("ENABLE_MOGE_GEOMETRY", "runtime", "enable_moge_geometry", "0")
ENABLE_SAM_REFINEMENT = config_bool("ENABLE_SAM_REFINEMENT", "runtime", "enable_sam_refinement", "0")
ENABLE_FLOOR_MASK_CLEANUP = config_bool("ENABLE_FLOOR_MASK_CLEANUP", "runtime", "enable_floor_mask_cleanup", "1")
ENABLE_DEPTH_ESTIMATION = config_bool("ENABLE_DEPTH_ESTIMATION", "runtime", "enable_depth_estimation", "1")
ENABLE_PLANE_FIT = config_bool("ENABLE_PLANE_FIT", "runtime", "enable_plane_fit", "1")
ENABLE_MULTI_PLANE_SURFACES = config_bool("ENABLE_MULTI_PLANE_SURFACES", "runtime", "enable_multi_plane_surfaces", "1")
ENABLE_WALL_SEGMENTS = config_bool("ENABLE_WALL_SEGMENTS", "runtime", "enable_wall_segments", "1")
ENABLE_INTRINSIC_SHADING = config_bool("ENABLE_INTRINSIC_SHADING", "runtime", "enable_intrinsic_shading", "0")
ENABLE_SHADING_TRANSFER = config_bool("ENABLE_SHADING_TRANSFER", "runtime", "enable_shading_transfer", "1")
ENABLE_FAST_SHADOW_TRANSFER = config_bool(
"ENABLE_FAST_SHADOW_TRANSFER", "runtime", "enable_fast_shadow_transfer", "0",
)
WARM_START_MODELS = config_bool("WARM_START_MODELS", "runtime", "warm_start_models", "1")
ENABLE_ONNX_INFERENCE = config_bool("ENABLE_ONNX_INFERENCE", "runtime", "enable_onnx_inference", "0")
ONNX_MODEL_DIR = str(config_value(
"ONNX_MODEL_DIR", "runtime", "onnx_model_dir", "onnx_models",
))
BUNDLE_IMAGE_FORMAT = str(config_value(
"BUNDLE_IMAGE_FORMAT", "runtime", "bundle_image_format", "jpeg",
)).lower()
BUNDLE_IMAGE_QUALITY = int(config_value(
"BUNDLE_IMAGE_QUALITY", "runtime", "bundle_image_quality", "92",
))
# Deflate level for the .vizbundle zip. Its payload is raw float/uint surface
# arrays, which are highly compressible: on a 1200x1600 room, level 6 takes the
# bundle from 12.7 MB to 1.0 MB for about 170 ms of CPU. That matters because a
# 12.7 MB body is exactly what fails to reach a browser through a dev tunnel.
# 0 stores uncompressed (the old behaviour); 1 is ~6x for 37 ms; 9 buys almost
# nothing over 6 and costs 5x the time.
BUNDLE_COMPRESSION_LEVEL = max(0, min(9, int(config_value(
"BUNDLE_COMPRESSION_LEVEL", "runtime", "bundle_compression_level", "6",
))))
ROOM_UPLOAD_MAX_DIMENSION = max(720, int(config_value(
"ROOM_UPLOAD_MAX_DIMENSION", "runtime", "room_upload_max_dimension", "1920",
)))
INFERENCE_MAX_DIMENSION = max(512, int(config_value(
"INFERENCE_MAX_DIMENSION", "runtime", "inference_max_dimension", "1024",
)))
FAST_SHADOW_MAX_DIMENSION = max(256, min(1024, int(config_value(
"FAST_SHADOW_MAX_DIMENSION", "runtime", "fast_shadow_max_dimension", "640",
))))
ROOM_UPLOAD_JPEG_QUALITY = min(95, max(50, int(config_value(
"ROOM_UPLOAD_JPEG_QUALITY", "runtime", "room_upload_jpeg_quality", "85",
))))
DEBUG_ARTIFACTS_ENABLED = config_bool(
"DEBUG_ARTIFACTS_ENABLED", "runtime", "debug_artifacts_enabled", "1",
)
CONVERSION_TARGET_MS = max(5_000, int(config_value(
"CONVERSION_TARGET_MS", "runtime", "conversion_target_ms", "30000",
)))
DEBUG_ARTIFACTS_MAX_DIMENSION = max(320, int(config_value(
"DEBUG_ARTIFACTS_MAX_DIMENSION", "runtime", "debug_artifacts_max_dimension", "1600",
)))
DEBUG_ARTIFACTS_PREVIEW_DIMENSION = max(320, int(config_value(
"DEBUG_ARTIFACTS_PREVIEW_DIMENSION", "runtime", "debug_artifacts_preview_dimension", "720",
)))
VISUALIZER_DATA_DIR = str(config_value(
"VISUALIZER_DATA_DIR", "runtime", "data_dir", "data",
))
# Soft, photo-guided alpha on segment boundaries.
#
# Without it the renderer composites through a 1-bit mask, which aliases every
# boundary that is not axis-aligned and inherits OneFormer's approximate edge
# placement. Costs about a second per conversion. Set to 0 to ship bitsets
# only; the frontend falls back to the hard mask when no alpha is present.
ENABLE_MASK_ALPHA = config_bool("ENABLE_MASK_ALPHA", "runtime", "enable_mask_alpha", "1")
MASK_ALPHA_BAND_RADIUS = max(1, int(config_value(
"MASK_ALPHA_BAND_RADIUS", "runtime", "mask_alpha_band_radius", "4")))