MCPcopy Create free account
hub / github.com/IceClear/StableSR / wavelet_decomposition

Function wavelet_decomposition

scripts/wavelet_color_fix.py:94–106  ·  view source on GitHub ↗

Apply wavelet decomposition to the input tensor. This function only returns the low frequency & the high frequency.

(image: Tensor, levels=5)

Source from the content-addressed store, hash-verified

92 return output
93
94def wavelet_decomposition(image: Tensor, levels=5):
95 """
96 Apply wavelet decomposition to the input tensor.
97 This function only returns the low frequency & the high frequency.
98 """
99 high_freq = torch.zeros_like(image)
100 for i in range(levels):
101 radius = 2 ** i
102 low_freq = wavelet_blur(image, radius)
103 high_freq += (image - low_freq)
104 image = low_freq
105
106 return high_freq, low_freq
107
108def wavelet_reconstruction(content_feat:Tensor, style_feat:Tensor):
109 """

Callers 1

wavelet_reconstructionFunction · 0.85

Calls 1

wavelet_blurFunction · 0.85

Tested by

no test coverage detected