(window_size, channel, sigma=1.5)
| 19 | |
| 20 | |
| 21 | def create_window(window_size, channel, sigma=1.5): |
| 22 | _1D_window = gaussian(window_size, sigma).unsqueeze(1) |
| 23 | _2D_window = _1D_window.mm(_1D_window.t()).float().unsqueeze(0).unsqueeze(0) |
| 24 | window = Variable( |
| 25 | _2D_window.expand(channel, 1, window_size, window_size).contiguous() |
| 26 | ) |
| 27 | return window |
| 28 | |
| 29 | |
| 30 | def _ssim(img1, img2, window, window_size, channel, size_average=True): |