Skip to content

Commit

Permalink
multiple improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dendenxu committed Apr 5, 2024
1 parent b87b102 commit d89f2f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ def carve_using_bytes(H, W, K, R, T, latent_index):
log(magenta(f'Accumulated vhull bound of frames: {self.frame_sample}: '),
line(torch.stack([self.vhull_bounds.min(dim=0)[0][0],
self.vhull_bounds.max(dim=0)[0][1]])))
log(self.vhull_only)
if self.vhull_only:
exit(0)

Expand Down
12 changes: 11 additions & 1 deletion easyvolcap/utils/loss_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class ImgLossType(Enum):
L1 = auto()
L2 = auto()
SSIM = auto()

MSSSIM = auto()
WL1 = auto()

class DptLossType(Enum):
SMOOTHL1 = auto()
Expand Down Expand Up @@ -413,6 +414,10 @@ def l1(x: torch.Tensor, y: torch.Tensor):
return l1_reg(x - y)


def wl1(x: torch.Tensor, y: torch.Tensor, w: torch.Tensor):
return l1_reg(w * (x - y))


def l2(x: torch.Tensor, y: torch.Tensor):
return l2_reg(x - y)

Expand Down Expand Up @@ -638,6 +643,11 @@ def compute_ssim(x: torch.Tensor, y: torch.Tensor):
return ssim(x, y, data_range=1.0, win_size=11, win_sigma=1.5, K=(0.01, 0.03))


def compute_msssim(x: torch.Tensor, y: torch.Tensor):
from pytorch_msssim import ms_ssim
return ms_ssim(x, y, data_range=1.0, win_size=11, win_sigma=1.5, K=(0.01, 0.03))


# from MonoSDF
def compute_scale_and_shift(prediction, target, mask):
# System matrix: A = [[a_00, a_01], [a_10, a_11]]
Expand Down

0 comments on commit d89f2f3

Please sign in to comment.