Adding default alpha when splitting RGB images

This commit is contained in:
MoonRide303 2023-09-23 13:19:42 +02:00
parent ece69bf28c
commit 585fb0475b
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ class SplitImageWithAlpha:
def split_image_with_alpha(self, image: torch.Tensor): def split_image_with_alpha(self, image: torch.Tensor):
out_images = [i[:,:,:3] for i in image] out_images = [i[:,:,:3] for i in image]
out_alphas = [i[:,:,3] for i in image] out_alphas = [i[:,:,3] if i.shape[2] > 3 else torch.ones_like(i[:,:,0]) for i in image]
result = (torch.stack(out_images), torch.stack(out_alphas)) result = (torch.stack(out_images), torch.stack(out_alphas))
return result return result