From 1eaa4d0a0c06c657a25b26cc6dc6558db3ee3bef Mon Sep 17 00:00:00 2001 From: NitishTRI3D Date: Wed, 26 Jun 2024 11:31:01 +0000 Subject: [PATCH 1/2] facer node; flexible color extract node --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 0ccb2f8..c4d853e 100644 --- a/__init__.py +++ b/__init__.py @@ -3724,7 +3724,7 @@ NODE_CLASS_MAPPINGS = { } -VERSION = "3.8" +VERSION = "4.0" # A dictionary that contains the friendly/humanly readable titles for the nodes NODE_DISPLAY_NAME_MAPPINGS = { "tri3d-photoroom-bgremove-api": "Photoroom BG Remove" + " v" + VERSION, From f061a43fcb69c8eacb5c612fa1eb464d019f0ef4 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 27 Jun 2024 14:46:04 +0000 Subject: [PATCH 2/2] v4.1 , to_run and bug fix of older numpy --- __init__.py | 2 +- segment_face.py | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index c4d853e..15b20ef 100644 --- a/__init__.py +++ b/__init__.py @@ -3724,7 +3724,7 @@ NODE_CLASS_MAPPINGS = { } -VERSION = "4.0" +VERSION = "4.1" # A dictionary that contains the friendly/humanly readable titles for the nodes NODE_DISPLAY_NAME_MAPPINGS = { "tri3d-photoroom-bgremove-api": "Photoroom BG Remove" + " v" + VERSION, diff --git a/segment_face.py b/segment_face.py index 6685283..913a476 100644 --- a/segment_face.py +++ b/segment_face.py @@ -51,7 +51,12 @@ def detect_face_from_tensor(image): return (vis_seg_probs, n_classes) -def full_work_wrapper(image): +def full_work_wrapper(image,to_run): + if not to_run: + res = torch.zeros((image.shape[0], image.shape[1]), dtype=torch.int64) + n_classes = 11 + return do_recolor(res, n_classes) + try: res, n_classes = detect_face_from_tensor(image) except: @@ -59,16 +64,15 @@ def full_work_wrapper(image): n_classes = 11 print('Warning: Failed to find any face in the image...') - tup = do_recolor(res, n_classes) - tup = torch.from_numpy(tup).to(device=image.device, dtype=image.dtype) - - return tup - - res, n_classes = detect_face_from_tensor(image) tup = do_recolor(res, n_classes) # tup = torch.from_numpy(tup).to(device=image.device, dtype=image.dtype) return tup + # res, n_classes = detect_face_from_tensor(image) + # tup = do_recolor(res, n_classes) + # # tup = torch.from_numpy(tup).to(device=image.device, dtype=image.dtype) + # return tup + class main_face_segment(): @@ -80,6 +84,7 @@ class main_face_segment(): return { "required": { "image": ("IMAGE", ), + "to_run": ("BOOLEAN",) }, } @@ -87,11 +92,11 @@ class main_face_segment(): RETURN_TYPES = ("IMAGE", ) CATEGORY = "TRI3D" - def run(self, image): + def run(self, image,to_run): batch_size = image.shape[0] ret = [] for i in range(batch_size): - ret.append(full_work_wrapper(image[i].clone())) + ret.append(full_work_wrapper(image[i].clone(),to_run)) ret = np.array(ret) ret = torch.from_numpy(ret).to(dtype=image.dtype, device=image.device)