fix: better compatibility with other nodes.

https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/547
This commit is contained in:
Dr.Lt.Data
2024-04-09 21:16:29 +09:00
parent 4c44a8ab75
commit 8ffc4efcd6
3 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version_code = [4, 87, 4]
version_code = [4, 87, 5]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
dependency_version = 20
+4 -3
View File
@@ -515,9 +515,10 @@ class ESAMWrapper:
return [detected_masks.squeeze(0)]
def make_sam_mask(sam_obj, segs, image, detection_hint, dilation,
def make_sam_mask(sam, segs, image, detection_hint, dilation,
threshold, bbox_expansion, mask_hint_threshold, mask_hint_use_negative):
sam_obj = sam.sam_wrapper
sam_obj.prepare_device()
try:
@@ -775,9 +776,9 @@ def every_three_pick_last(stacked_masks):
return selected_masks
def make_sam_mask_segmented(sam_obj, segs, image, detection_hint, dilation,
def make_sam_mask_segmented(sam, segs, image, detection_hint, dilation,
threshold, bbox_expansion, mask_hint_threshold, mask_hint_use_negative):
sam_obj = sam.sam_wrapper
sam_obj.prepare_device()
try:
+5 -2
View File
@@ -111,8 +111,10 @@ class SAMLoader:
esam = esam_loader.load_esam_model('CUDA')[0]
sam_obj = core.ESAMWrapper(esam, device_mode)
esam.sam_wrapper = sam_obj
print(f"Loads EfficientSAM model: (device:{device_mode})")
return (sam_obj, )
return (esam, )
modelname = folder_paths.get_full_path("sams", model_name)
@@ -136,9 +138,10 @@ class SAMLoader:
is_auto_mode = device_mode == "AUTO"
sam_obj = core.SAMWrapper(sam, is_auto_mode=is_auto_mode, safe_to_gpu=safe_to)
sam.sam_wrapper = sam_obj
print(f"Loads SAM model: {modelname} (device:{device_mode})")
return (sam_obj, )
return (sam, )
class ONNXDetectorForEach: