mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-22 14:24:40 -07:00
Fix scale to use float32
Using float32 instead of unit8, scale 0..1 instead of 0..255
This commit is contained in:
parent
90ae878b78
commit
01c64dadf3
1 changed files with 2 additions and 2 deletions
|
@ -154,11 +154,11 @@ def lab_image_stats(image, mask=None):
|
|||
|
||||
def _scale_array(arr, clip=True):
|
||||
if clip:
|
||||
return np.clip(arr, 0, 255)
|
||||
return np.clip(arr, 0, 1)
|
||||
|
||||
mn = arr.min()
|
||||
mx = arr.max()
|
||||
scale_range = (max([mn, 0]), min([mx, 255]))
|
||||
scale_range = (max([mn, 0]), min([mx, 1]))
|
||||
|
||||
if mn < scale_range[0] or mx > scale_range[1]:
|
||||
return (scale_range[1] - scale_range[0]) * (arr - mn) / (mx - mn) + scale_range[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue