fixes weird issue of CAS and bicubic interpolation
This commit is contained in:
+3
-3
@@ -296,13 +296,13 @@ def min_(tensor_list):
|
||||
# return the element-wise min of the tensor list.
|
||||
x = torch.stack(tensor_list)
|
||||
mn = x.min(axis=0)[0]
|
||||
return mn
|
||||
return torch.clamp(mn, min=0)
|
||||
|
||||
def max_(tensor_list):
|
||||
# return the element-wise max of the tensor list.
|
||||
x = torch.stack(tensor_list)
|
||||
mx = x.max(axis=0)[0]
|
||||
return mx
|
||||
return torch.clamp(mx, max=1)
|
||||
|
||||
# From https://github.com/Jamy-L/Pytorch-Contrast-Adaptive-Sharpening/
|
||||
class ImageCAS:
|
||||
@@ -354,7 +354,7 @@ class ImageCAS:
|
||||
|
||||
output = ((b + d + f + h)*w + e) * div
|
||||
output = output.clamp(0, 1)
|
||||
#output = torch.nan_to_num(output) # what am I doing?!
|
||||
#output = torch.nan_to_num(output) # this seems the only way to ensure there are no NaNs
|
||||
|
||||
output = pb(output)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user