Skip to content

Commit

Permalink
Fixed grayscale guide images (#1616)
Browse files Browse the repository at this point in the history
Fixed grayscale source images
  • Loading branch information
RunDevelopment authored Mar 1, 2023
1 parent 0190455 commit 7c9275e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/src/nodes/impl/pytorch/pix_transform/auto_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def split(self, tile_size: Size) -> Size:
return size, size


def _as_3d(img: np.ndarray) -> np.ndarray:
if img.ndim == 3:
return img
return np.expand_dims(img, axis=2)


def pix_transform_auto_split(
source: np.ndarray,
guide: np.ndarray,
Expand Down Expand Up @@ -63,7 +69,7 @@ def upscale(tile: np.ndarray, region: Region):
try:
tile_guide = region.scale(scale).read_from(guide)
pix_op = to_op(PixTransform)(
guide_img=np.transpose(tile_guide, (2, 0, 1)),
guide_img=np.transpose(_as_3d(tile_guide), (2, 0, 1)),
device=device,
params=params,
)
Expand Down

0 comments on commit 7c9275e

Please sign in to comment.