* Reworked SAG, removed unnecessary patch
* Reworked anisotropic filters for faster compute.
* Replaced with guided anisotropic filter for less distribution.
This commit is contained in:
lllyasviel
2023-09-02 06:00:20 -07:00
committed by GitHub
parent 7538b4d17b
commit 09e0d1cb3a
6 changed files with 61 additions and 345 deletions
+15
View File
@@ -126,6 +126,21 @@ def bilateral_blur(
return _bilateral_blur(input, None, kernel_size, sigma_color, sigma_space, border_type, color_distance_type)
def adaptive_anisotropic_filter(x, g=None):
if g is None:
g = x
s, m = torch.std_mean(g, dim=(1, 2, 3), keepdim=True)
s = s + 1e-5
guidance = (g - m) / s
y = _bilateral_blur(x, guidance,
kernel_size=(13, 13),
sigma_color=3.0,
sigma_space=3.0,
border_type='reflect',
color_distance_type='l1')
return y
def joint_bilateral_blur(
input: Tensor,
guidance: Tensor,