We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code that I find in a website,but i dont know the principle。the code use this bilinear interpolation kernel to deconvolute。
code: def bilinear_kernel(in_channels, out_channels, kernel_size): """Define a bilinear kernel according to in channels and out channels. Returns: return a bilinear filter tensor """ factor = (kernel_size + 1) // 2 # if kernel_size % 2 == 1: center = factor - 1 else: center = factor - 0.5 og = np.ogrid[:kernel_size, :kernel_size] bilinear_filter = (1 - abs(og[0] - center) / factor) * (1 - abs(og[1] - center) / factor) weight = np.zeros((in_channels, out_channels, kernel_size, kernel_size), dtype=np.float32) weight[range(in_channels), range(out_channels), :, :] = bilinear_filter return torch.from_numpy(weight)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The code that I find in a website,but i dont know the principle。the code use this bilinear interpolation kernel to deconvolute。
code:
def bilinear_kernel(in_channels, out_channels, kernel_size):
"""Define a bilinear kernel according to in channels and out channels.
Returns:
return a bilinear filter tensor
"""
factor = (kernel_size + 1) // 2 #
if kernel_size % 2 == 1:
center = factor - 1
else:
center = factor - 0.5
og = np.ogrid[:kernel_size, :kernel_size]
bilinear_filter = (1 - abs(og[0] - center) / factor) * (1 - abs(og[1] - center) / factor)
weight = np.zeros((in_channels, out_channels, kernel_size, kernel_size), dtype=np.float32)
weight[range(in_channels), range(out_channels), :, :] = bilinear_filter
return torch.from_numpy(weight)
The text was updated successfully, but these errors were encountered: