prevent crash on empty segs on FaceDetailer

This commit is contained in:
Dr.Lt.Data
2023-07-06 02:06:24 +09:00
parent eef38128d6
commit 5e35ebee7c
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import configparser
import os
version = "V2.21"
version = "V2.21.1"
dependency_version = 1
+12
View File
@@ -789,6 +789,12 @@ class FaceDetailer:
# Mask Generator
mask = core.segs_to_combined_mask(segs)
if len(cropped_enhanced) == 0:
image = Image.new("RGB", (64, 64))
draw = ImageDraw.Draw(image)
draw.rectangle((0, 0, 63, 63), fill=(0, 0, 0))
cropped_enhanced = [pil2tensor(image)]
return enhanced_img, cropped_enhanced, mask
def doit(self, image, model, clip, vae, guide_size, guide_size_for, max_size, seed, steps, cfg, sampler_name, scheduler,
@@ -1324,6 +1330,12 @@ class FaceDetailerPipe:
sam_detection_hint, sam_dilation, sam_threshold, sam_bbox_expansion, sam_mask_hint_threshold,
sam_mask_hint_use_negative, drop_size, bbox_detector, wildcard, sam_model_opt)
if len(cropped_enhanced) == 0:
image = Image.new("RGB", (64, 64))
draw = ImageDraw.Draw(image)
draw.rectangle((0, 0, 63, 63), fill=(0, 0, 0))
cropped_enhanced = [pil2tensor(image)]
return enhanced_img, cropped_enhanced, mask, detailer_pipe