fix mask shape of LoadImageFromUrl and LoadMaskFromUrl

This commit is contained in:
刘雪峰
2024-03-26 16:39:49 +08:00
parent 18ec2fd0d6
commit acc855d61c
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -41,6 +41,8 @@ class LoadImageFromURL:
if not url.strip().isspace():
i = read_image_from_url(url.strip())
i = ImageOps.exif_transpose(i)
if i.mode == 'I':
i = i.point(lambda i: i * (1 / 255))
image = i.convert("RGB")
image = pil_to_tensor(image)
images.append(image)
@@ -49,8 +51,8 @@ class LoadImageFromURL:
mask = 1. - torch.from_numpy(mask)
else:
mask = torch.zeros((64, 64), dtype=torch.float32, device="cpu")
masks.append(mask.unsqueeze(0))
masks.append(mask)
return (images, masks, )
@@ -97,7 +99,7 @@ class LoadMaskFromURL:
mask = 1. - mask
else:
mask = torch.zeros((64, 64), dtype=torch.float32, device="cpu")
masks.append(mask)
masks.append(mask.unsqueeze(0))
return (masks,)
+2 -2
View File
@@ -186,7 +186,7 @@ app.registerExtension({
}
// add general type if filtering
if (options.show_general_after_typefiltered
/*if (options.show_general_after_typefiltered
&& (sIn.value || sOut.value)
){
let filtered_extra = [];
@@ -201,7 +201,7 @@ app.registerExtension({
break;
}
}
}
}*/
// check il filtering gave no results
if ((sIn.value || sOut.value) &&