mirror of
https://github.com/huggingface/diffusers.git
synced 2026-01-27 17:22:53 +03:00
[IF super res] correctly normalize PIL input (#3536)
* [IF super res] correctl normalize PIL input * 175 -> 127.5
This commit is contained in:
@@ -759,7 +759,7 @@ class IFImg2ImgSuperResolutionPipeline(DiffusionPipeline):
|
||||
image = [image]
|
||||
|
||||
if isinstance(image[0], PIL.Image.Image):
|
||||
image = [np.array(i).astype(np.float32) / 255.0 for i in image]
|
||||
image = [np.array(i).astype(np.float32) / 127.5 - 1.0 for i in image]
|
||||
|
||||
image = np.stack(image, axis=0) # to np
|
||||
image = torch.from_numpy(image.transpose(0, 3, 1, 2))
|
||||
|
||||
@@ -795,7 +795,7 @@ class IFInpaintingSuperResolutionPipeline(DiffusionPipeline):
|
||||
image = [image]
|
||||
|
||||
if isinstance(image[0], PIL.Image.Image):
|
||||
image = [np.array(i).astype(np.float32) / 255.0 for i in image]
|
||||
image = [np.array(i).astype(np.float32) / 127.5 - 1.0 for i in image]
|
||||
|
||||
image = np.stack(image, axis=0) # to np
|
||||
image = torch.from_numpy(image.transpose(0, 3, 1, 2))
|
||||
|
||||
@@ -664,7 +664,7 @@ class IFSuperResolutionPipeline(DiffusionPipeline):
|
||||
image = [image]
|
||||
|
||||
if isinstance(image[0], PIL.Image.Image):
|
||||
image = [np.array(i).astype(np.float32) / 255.0 for i in image]
|
||||
image = [np.array(i).astype(np.float32) / 127.5 - 1.0 for i in image]
|
||||
|
||||
image = np.stack(image, axis=0) # to np
|
||||
image = torch.from_numpy(image.transpose(0, 3, 1, 2))
|
||||
|
||||
Reference in New Issue
Block a user