From ca24c2c0eedd9bf665f49a946a16c625a56a845e Mon Sep 17 00:00:00 2001 From: abrahamezzeddine Date: Mon, 3 Mar 2025 20:26:37 +0100 Subject: [PATCH 1/3] Clamp values to prevent overshooting --- nerfstudio/process_data/equirect_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nerfstudio/process_data/equirect_utils.py b/nerfstudio/process_data/equirect_utils.py index 9414ebba27..f159f15dc1 100644 --- a/nerfstudio/process_data/equirect_utils.py +++ b/nerfstudio/process_data/equirect_utils.py @@ -80,7 +80,10 @@ def remap_cubic( grid = torch.stack((grid_x, grid_y), dim=-1).unsqueeze(0).expand(batch_size, -1, -1, -1) - return torch.nn.functional.grid_sample(img, grid, mode="bicubic", padding_mode="zeros") + result = torch.nn.functional.grid_sample(img, grid, mode="bicubic", padding_mode="zeros") + + # Clamp the output to the valid range [0, 1] to prevent artifacts due to overshooting + return torch.clamp(result, 0.0, 1.0) def equirect2persp(img: torch.Tensor, fov: int, theta: int, phi: int, hd: int, wd: int) -> torch.Tensor: From f8e2d13e50d9afb7794f9fe8e877560c8144cd65 Mon Sep 17 00:00:00 2001 From: abrahamezzeddine <142085947+abrahamezzeddine@users.noreply.github.com> Date: Mon, 17 Mar 2025 00:40:29 +0100 Subject: [PATCH 2/3] --- .github/workflows/core_code_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/core_code_checks.yml b/.github/workflows/core_code_checks.yml index 35ed0f1ca5..1eb0612702 100644 --- a/.github/workflows/core_code_checks.yml +++ b/.github/workflows/core_code_checks.yml @@ -19,7 +19,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.8.13' - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: ${{ env.pythonLocation }} key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} From 0318e5008c005f35369c303747e2e309ee0ae0dc Mon Sep 17 00:00:00 2001 From: abrahamezzeddine <142085947+abrahamezzeddine@users.noreply.github.com> Date: Mon, 17 Mar 2025 00:55:35 +0100 Subject: [PATCH 3/3] --- nerfstudio/process_data/equirect_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nerfstudio/process_data/equirect_utils.py b/nerfstudio/process_data/equirect_utils.py index f159f15dc1..acf088c37d 100644 --- a/nerfstudio/process_data/equirect_utils.py +++ b/nerfstudio/process_data/equirect_utils.py @@ -81,7 +81,6 @@ def remap_cubic( grid = torch.stack((grid_x, grid_y), dim=-1).unsqueeze(0).expand(batch_size, -1, -1, -1) result = torch.nn.functional.grid_sample(img, grid, mode="bicubic", padding_mode="zeros") - # Clamp the output to the valid range [0, 1] to prevent artifacts due to overshooting return torch.clamp(result, 0.0, 1.0)