Upload image_processing_vqmodel.py
Browse files
image_processing_vqmodel.py
CHANGED
@@ -51,7 +51,8 @@ class VQModelImageProcessor(BaseImageProcessor): # type: ignore
|
|
51 |
width: int | None = None,
|
52 |
height: int | None = None,
|
53 |
) -> Image.Image:
|
54 |
-
x_np = x.
|
|
|
55 |
x_np = (x_np + 1.0) * 127.5
|
56 |
x_np = np.clip(x_np, 0, 255).astype(np.uint8)
|
57 |
image = Image.fromarray(x_np)
|
|
|
51 |
width: int | None = None,
|
52 |
height: int | None = None,
|
53 |
) -> Image.Image:
|
54 |
+
x_np = x.detach().cpu().numpy()
|
55 |
+
x_np = x_np.transpose(1, 2, 0)
|
56 |
x_np = (x_np + 1.0) * 127.5
|
57 |
x_np = np.clip(x_np, 0, 255).astype(np.uint8)
|
58 |
image = Image.fromarray(x_np)
|