MCPcopy Create free account
hub / github.com/Pixel-Talk/EHM-Tracker / _compute_binary_kernel

Function _compute_binary_kernel

src/modules/pixie/utils/util.py:323–331  ·  view source on GitHub ↗

r"""Creates a binary kernel to extract the patches. If the window size is HxW will create a (H*W)xHxW kernel.

(window_size)

Source from the content-addressed store, hash-verified

321 return F.conv2d(x, kernel, padding=padding, stride=1, groups=c)
322
323def _compute_binary_kernel(window_size):
324 r"""Creates a binary kernel to extract the patches. If the window size
325 is HxW will create a (H*W)xHxW kernel.
326 """
327 window_range = window_size[0] * window_size[1]
328 kernel: torch.Tensor = torch.zeros(window_range, window_range)
329 for i in range(window_range):
330 kernel[i, i] += 1.0
331 return kernel.view(window_range, 1, window_size[0], window_size[1])
332
333def median_blur(x, kernel_size=(3,3)):
334 b, c, h, w = x.shape

Callers 1

median_blurFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected