MCPcopy Create free account
hub / github.com/microsoft/TRELLIS / ssim

Function ssim

trellis/utils/loss_utils.py:39–47  ·  view source on GitHub ↗
(img1, img2, window_size=11, size_average=True)

Source from the content-addressed store, hash-verified

37
38
39def ssim(img1, img2, window_size=11, size_average=True):
40 channel = img1.size(-3)
41 window = create_window(window_size, channel)
42
43 if img1.is_cuda:
44 window = window.cuda(img1.get_device())
45 window = window.type_as(img1)
46
47 return _ssim(img1, img2, window, window_size, channel, size_average)
48
49def _ssim(img1, img2, window, window_size, channel, size_average=True):
50 mu1 = F.conv2d(img1, window, padding=window_size // 2, groups=channel)

Callers 3

training_lossesMethod · 0.85
_perceptual_lossMethod · 0.85
training_lossesMethod · 0.85

Calls 3

create_windowFunction · 0.85
_ssimFunction · 0.85
cudaMethod · 0.45

Tested by

no test coverage detected