# How to Adjust LingBot-Map Visualization Options: conf_threshold, point_size, and downsample_factor

> Easily adjust LingBot-Map visualization options conf_threshold, point size, and downsample factor using command line, GUI sliders, or programmatic control. Customize your map display now.

- Repository: [Robbyant/lingbot-map](https://github.com/Robbyant/lingbot-map)
- Tags: how-to-guide
- Published: 2026-07-30

---

**Adjust LingBot-Map visualization options like `conf_threshold`, `point_size`, and `downsample_factor` either via command-line arguments in [`demo.py`](https://github.com/Robbyant/lingbot-map/blob/main/demo.py), through interactive GUI sliders at runtime, or programmatically when instantiating the `PointCloudViewer` class.**

LingBot-Map provides flexible control over 3D point cloud rendering through the `PointCloudViewer` class located in [`lingbot_map/vis/point_cloud_viewer.py`](https://github.com/Robbyant/lingbot-map/blob/main/lingbot_map/vis/point_cloud_viewer.py). These visualization parameters allow you to filter low-confidence points, adjust the apparent size of rendered points, and control spatial downsampling density to balance visual detail against GPU performance. Whether you are running the interactive demo or embedding the viewer in your own pipeline, you can configure these settings statically or change them dynamically without restarting the application.

## Command-Line Configuration for Static Settings

When launching the interactive demo via [`demo.py`](https://github.com/Robbyant/lingbot-map/blob/main/demo.py), you can set initial values for all three visualization options using CLI flags. The parser accepts `--conf_threshold`, `--point_size`, and `--downsample_factor` at lines 406–408, forwarding them to the `PointCloudViewer` constructor.

The available flags and their default values are:

- `--conf_threshold` (default: `1.5`): Sets the minimum confidence score (`vis_threshold`) required for a point to be displayed.
- `--point_size` (default: `0.00001`): Controls the base radius of each rendered point in the 3D scene.
- `--downsample_factor` (default: `10`): Determines the spatial downsampling rate applied before rendering; lower values preserve more points and increase detail.

Example launch command with custom visualization settings:

```bash
python demo.py \
    --model_path /path/to/lingbot-map.pt \
    --image_folder example/courthouse \
    --conf_threshold 2.0 \
    --point_size 0.00005 \
    --downsample_factor 5

```

## Interactive GUI Adjustment at Runtime

The `PointCloudViewer` exposes interactive sliders that map directly to these parameters, allowing real-time tweaking without restarting the server. These controls are initialized in the `_setup_gui()` method around line 400 in [`lingbot_map/vis/point_cloud_viewer.py`](https://github.com/Robbyant/lingbot-map/blob/main/lingbot_map/vis/point_cloud_viewer.py).

To adjust settings dynamically:

1. Launch the viewer and navigate to `http://localhost:8080`.
2. Locate the **GUI panel** containing three sliders:
   - **Visibility Threshold**: Adjusts the confidence cutoff (`vis_threshold`). Slide right to filter out low-confidence points.
   - **Point Size**: Modifies the render size (`point_size`). Slide right to increase point diameter.
   - **Downsample Factor**: Controls sampling density (`downsample_factor`). Slide left to reduce downsampling and increase point density.

When you move a slider, its `on_update` callback triggers `_regenerate_point_clouds()` (around line 730), which immediately re-filters and re-renders the point cloud using the new values.

## Programmatic Configuration in Python Scripts

For custom applications, instantiate `PointCloudViewer` directly and pass the desired values to its constructor. This bypasses the CLI parser in [`demo.py`](https://github.com/Robbyant/lingbot-map/blob/main/demo.py) and allows hardcoded or dynamically computed settings.

```python
from lingbot_map.vis import PointCloudViewer

viewer = PointCloudViewer(
    pred_dict=predictions,
    port=8080,
    vis_threshold=2.0,      # Maps to conf_threshold

    point_size=0.00005,     # Point radius

    downsample_factor=5,    # Lower values retain more points

)
viewer.run()

```

In [`demo.py`](https://github.com/Robbyant/lingbot-map/blob/main/demo.py) (lines 84–90), this is precisely how the viewer is initialized, mapping `args.conf_threshold` to the `vis_threshold` parameter, `args.downsample_factor` to `downsample_factor`, and `args.point_size` to `point_size`.

## Internal Implementation and Data Flow

Understanding the internal pipeline helps optimize these settings for your specific hardware and data quality.

The visualization pipeline operates in three stages inside [`point_cloud_viewer.py`](https://github.com/Robbyant/lingbot-map/blob/main/point_cloud_viewer.py):

1. **Initialization**: The constructor stores `vis_threshold`, `point_size`, and `downsample_factor` as instance attributes.

2. **Data Parsing**: The `parse_pc_data()` method (around line 660) applies the filters:
   - Removes points with confidence scores below `self.vis_threshold`.
   - Applies voxel downsampling using `self.downsample_factor`.
   - Passes the resulting point cloud to the renderer with `point_size=self.psize_slider.value`.

3. **Regeneration**: When sliders change, `_regenerate_point_clouds()` re-executes the parsing logic and updates the scene handles instantly.

This architecture ensures that heavy computation occurs only when parameters change, maintaining interactive frame rates during camera manipulation.

## Summary

- **Command-line flags** (`--conf_threshold`, `--point_size`, `--downsample_factor`) in [`demo.py`](https://github.com/Robbyant/lingbot-map/blob/main/demo.py) set static initial values parsed at lines 406–408.
- **Interactive sliders** in the web GUI provide real-time control over confidence filtering, point size, and downsampling density without restarting the server.
- **Programmatic access** allows direct instantiation of `PointCloudViewer` with custom `vis_threshold`, `point_size`, and `downsample_factor` arguments.
- All changes trigger `_regenerate_point_clouds()` in [`lingbot_map/vis/point_cloud_viewer.py`](https://github.com/Robbyant/lingbot-map/blob/main/lingbot_map/vis/point_cloud_viewer.py) to update the rendered output immediately.

## Frequently Asked Questions

### What is the default conf_threshold in LingBot-Map?

The default confidence threshold is `1.5`, set in [`demo.py`](https://github.com/Robbyant/lingbot-map/blob/main/demo.py) and passed to the `PointCloudViewer` as `vis_threshold`. Points with confidence scores below this value are filtered out during the initial render and remain hidden until the threshold is lowered via the CLI or the "Visibility Threshold" slider.

### How does downsample_factor affect performance and quality?

The `downsample_factor` controls spatial voxel downsampling before rendering. A value of `10` (the default) means aggressive downsampling for higher performance, while setting it to `1` retains nearly all points for maximum detail at the cost of GPU memory and frame rate. Adjust this based on your point cloud density and graphics hardware capabilities.

### Can I change visualization settings without restarting the viewer?

Yes. The `PointCloudViewer` provides interactive sliders for Visibility Threshold, Point Size, and Downsample Factor in the browser interface. These sliders update the underlying attributes and call `_regenerate_point_clouds()` immediately, allowing you to tune the visualization in real-time without reloading the application or reprocessing the source images.

### Where are the GUI sliders defined in the source code?

The sliders are created in the `_setup_gui()` method of [`lingbot_map/vis/point_cloud_viewer.py`](https://github.com/Robbyant/lingbot-map/blob/main/lingbot_map/vis/point_cloud_viewer.py) around line 400. Each slider (`self.vis_threshold_slider`, `self.psize_slider`, `self.downsample_slider`) registers an `on_update` callback that synchronizes the GUI state with the renderer and triggers point cloud regeneration.