Download config/surface.py from modventures/floor-visualizer-gpu: direct link, hf CLI and curl.
- Browser
- Download file 4.66 kB
-
https://huggingface.co/spaces/modventures/floor-visualizer-gpu/resolve/main/config/surface.py
- Command line
-
hf download hf://spaces/modventures/floor-visualizer-gpu/config/surface.py
-
curl -L -o surface.py https://huggingface.co/spaces/modventures/floor-visualizer-gpu/resolve/main/config/surface.py
4.66 kB
| from config.loader import config_bool, config_value | |
| SURFACE_RANSAC_DISTANCE = float(config_value( | |
| "SURFACE_RANSAC_DISTANCE", "surface_mapping", "ransac_distance_threshold", "0.04", | |
| )) | |
| SURFACE_MAX_PLANES = int(config_value( | |
| "SURFACE_MAX_PLANES", "surface_mapping", "max_planes", "5", | |
| )) | |
| SURFACE_NORMAL_ANGLE_DEGREES = float(config_value( | |
| "SURFACE_NORMAL_ANGLE_DEGREES", "surface_mapping", "normal_angle_threshold_degrees", "35", | |
| )) | |
| SURFACE_NORMAL_SMOOTHING_KERNEL = int(config_value( | |
| "SURFACE_NORMAL_SMOOTHING_KERNEL", "surface_mapping", "normal_smoothing_kernel", "5", | |
| )) | |
| SURFACE_MIN_PLANE_PIXELS = int(config_value( | |
| "SURFACE_MIN_PLANE_PIXELS", "surface_mapping", "min_plane_pixels", "1500", | |
| )) | |
| SURFACE_EDGE_CLOSE_RATIO = float(config_value( | |
| "SURFACE_EDGE_CLOSE_RATIO", "surface_mapping", "edge_close_ratio", "0.009", | |
| )) | |
| SURFACE_EDGE_KERNEL_RATIO = float(config_value( | |
| "SURFACE_EDGE_KERNEL_RATIO", "surface_mapping", "edge_kernel_ratio", "0.006", | |
| )) | |
| SURFACE_EDGE_DILATION_ITERATIONS = int(config_value( | |
| "SURFACE_EDGE_DILATION_ITERATIONS", "surface_mapping", "edge_dilation_iterations", "2", | |
| )) | |
| ENABLE_SOFT_FLOOR_COVERING_EXPANSION = config_bool( | |
| "ENABLE_SOFT_FLOOR_COVERING_EXPANSION", "surface_mapping", | |
| "soft_floor_covering_expansion_enabled", "1", | |
| ) | |
| SOFT_FLOOR_COVERING_KERNEL_RATIO = float(config_value( | |
| "SOFT_FLOOR_COVERING_KERNEL_RATIO", "surface_mapping", | |
| "soft_floor_covering_kernel_ratio", "0.008", | |
| )) | |
| SOFT_FLOOR_COVERING_DILATION_ITERATIONS = int(config_value( | |
| "SOFT_FLOOR_COVERING_DILATION_ITERATIONS", "surface_mapping", | |
| "soft_floor_covering_dilation_iterations", "2", | |
| )) | |
| SURFACE_UV_MIN_COVERAGE = float(config_value( | |
| "SURFACE_UV_MIN_COVERAGE", "surface_mapping", "uv_min_coverage", "0.995", | |
| )) | |
| SURFACE_UV_MAX_BAD_NEIGHBOR_RATIO = float(config_value( | |
| "SURFACE_UV_MAX_BAD_NEIGHBOR_RATIO", "surface_mapping", "uv_max_bad_neighbor_ratio", "0.035", | |
| )) | |
| SURFACE_UV_MAX_JUMP_RATIO = float(config_value( | |
| "SURFACE_UV_MAX_JUMP_RATIO", "surface_mapping", "uv_max_jump_ratio", "8.0", | |
| )) | |
| SURFACE_UV_ABSOLUTE_JUMP_METERS = float(config_value( | |
| "SURFACE_UV_ABSOLUTE_JUMP_METERS", "surface_mapping", "uv_absolute_jump_meters", "0.35", | |
| )) | |
| ENABLE_GEOMETRY_SURFACE_FILTER = config_bool( | |
| "ENABLE_GEOMETRY_SURFACE_FILTER", "surface_mapping", "enable_geometry_surface_filter", "1", | |
| ) | |
| SURFACE_PLANE_DISTANCE_METERS = float(config_value( | |
| "SURFACE_PLANE_DISTANCE_METERS", "surface_mapping", "plane_distance_threshold_meters", "0.12", | |
| )) | |
| SURFACE_PLANE_NORMAL_MIN_COS = float(config_value( | |
| "SURFACE_PLANE_NORMAL_MIN_COS", "surface_mapping", "plane_normal_min_cos", "0.45", | |
| )) | |
| SURFACE_PLANE_FILTER_MIN_KEEP_RATIO = float(config_value( | |
| "SURFACE_PLANE_FILTER_MIN_KEEP_RATIO", "surface_mapping", "plane_filter_min_keep_ratio", "0.45", | |
| )) | |
| # --- Walls ----------------------------------------------------------------- | |
| # Walls use their own plane budget so the floor keeps `max_planes` (1 on GPU) | |
| # no matter how many walls a room has. | |
| WALL_MAX_PLANES = max(1, int(config_value( | |
| "WALL_MAX_PLANES", "surface_mapping", "wall_max_planes", "4", | |
| ))) | |
| WALL_MAX_SEGMENTS = max(1, int(config_value( | |
| "WALL_MAX_SEGMENTS", "surface_mapping", "max_walls", "6", | |
| ))) | |
| # Long-side resolution wall discovery and plane fitting run at. Only the final | |
| # per-wall masks and UVs are produced at full resolution. | |
| WALL_WORK_MAX_DIMENSION = max(256, int(config_value( | |
| "WALL_WORK_MAX_DIMENSION", "surface_mapping", "wall_work_max_dimension", "768", | |
| ))) | |
| # A plane counts as a wall when |normal.y| (camera up component) is at most this. | |
| WALL_MAX_NORMAL_Y = float(config_value( | |
| "WALL_MAX_NORMAL_Y", "surface_mapping", "wall_max_normal_y", "0.45", | |
| )) | |
| # Planes closer than both limits are merged so one flat wall is never split. | |
| WALL_COPLANAR_ANGLE_DEGREES = float(config_value( | |
| "WALL_COPLANAR_ANGLE_DEGREES", "surface_mapping", "wall_coplanar_angle_degrees", "10", | |
| )) | |
| WALL_COPLANAR_OFFSET_METERS = float(config_value( | |
| "WALL_COPLANAR_OFFSET_METERS", "surface_mapping", "wall_coplanar_offset_meters", "0.15", | |
| )) | |
| # Wall outlines are redrawn with straight edges; zig-zag within this tolerance | |
| # (fraction of the short image side, ~6px at 1440) becomes one line. 0 disables. | |
| WALL_EDGE_STRAIGHTEN_RATIO = max(0.0, float(config_value( | |
| "WALL_EDGE_STRAIGHTEN_RATIO", "surface_mapping", "wall_edge_straighten_ratio", "0.004", | |
| ))) | |
| # Minimum share of a wall's pixels that must get a ray/plane UV; below this the | |
| # wall falls back to its contour homography. | |
| WALL_UV_MIN_COVERAGE = float(config_value( | |
| "WALL_UV_MIN_COVERAGE", "surface_mapping", "wall_uv_min_coverage", "0.9", | |
| )) | |