Giter VIP home page Giter VIP logo

comfyui-yoloworld-efficientsam's Introduction

ywes_

ComfyUI YoloWorld-EfficientSAM

Unofficial implementation of YOLO-World + EfficientSAM & YOLO-World for ComfyUI

Dingtalk_20240220201311

项目介绍 | Info

  • YOLO-World + EfficientSAM的非官方实现

  • 利用全新的 YOLO-WorldEfficientSAM 实现高效的对象检测 + 分割

  • 版本:V2.0 新增蒙版分离 + 提取功能,支持选择指定蒙版单独输出,同时支持图像和视频(V1.0工作流已弃用)

视频演示

V2.0

2.24.2.1.mp4

V1.0

2.20.3.mp4

节点说明 | Features

  • YOLO-World 模型加载 | 🔎Yoloworld Model Loader

    • 支持 3 种官方模型:yolo_world/l, yolo_world/m, yolo_world/s,会自动下载并加载
  • EfficientSAM 模型加载 | 🔎ESAM Model Loader

    • 支持 CUDA 或 CPU
  • 🆕检测 + 分割 | 🔎Yoloworld ESAM

    • yolo_world_model:接入 YOLO-World 模型
    • esam_model:接入 EfficientSAM 模型
    • image:接入图像
    • categories:检测 + 分割内容
    • confidence_threshold:置信度阈值,降低可减少误检,增强模型对所需对象的敏感性。增加可最小化误报,防止模型识别不应识别的对象
    • iou_threshold:IoU 阈值,降低数值可减少边界框的重叠,使检测过程更严格。增加数值将会允许更多的边界框重叠,适应更广泛的检测范围
    • box_thickness:检测框厚度
    • text_thickness:文字厚度
    • text_scale:文字缩放
    • with_confidence:是否显示检测对象的置信度
    • with_class_agnostic_nms:是否抑制类别之间的重叠边界框
    • with_segmentation:是否开启 EfficientSAM 进行实例分割
    • mask_combined:是否合并(叠加)蒙版 mask,"是"则将所有 mask 叠加在一张图上输出,"否"则会将所有的蒙版单独输出
    • mask_extracted:是否提取选定蒙版 mask,"是"则会将按照 mask_extracted_index 将所选序号的蒙版单独输出
    • mask_extracted_index:选择蒙版 mask 序号

Dingtalk_20240224154535

  • 🆕检测 + 分割 | 🔎Yoloworld ESAM Detector Provider (由 ltdrdata 提供,感谢!)
    • 可配合 Impact-Pack 一起使用
    • yolo_world_model:接入 YOLO-World 模型
    • esam_model:接入 EfficientSAM 模型
    • categories:检测 + 分割内容
    • iou_threshold:IoU 阈值
    • with_class_agnostic_nms:是否抑制类别之间的重叠边界框

306523112-ea37dfd0-7019-4207-af2a-aa3c9355b63e

安装 | Install

  • 推荐使用管理器 ComfyUI Manager 安装(On the Way)

  • 手动安装:

    1. cd custom_nodes
    2. git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-YoloWorld-EfficientSAM
    3. cd custom_nodes/ComfyUI-YoloWorld-EfficientSAM
    4. pip install -r requirements.txt
    5. 重启 ComfyUI
  • 模型下载:将 EfficientSAM 中的 efficient_sam_s_cpu.jit 和 efficient_sam_s_gpu.jit 下载到 custom_nodes/ComfyUI-YoloWorld-EfficientSAM 中

工作流 | Workflows

V2.0

V1.0

更新日志

  • 20240224

    V2.0 新增蒙版分离 + 提取功能,支持选择指定蒙版单独输出,同时支持图像和视频

  • 20240221

    合并了由 ltdrdata 提供的 🔎Yoloworld ESAM Detector Provider 节点

  • 20240220

    创建项目

    V1.0 同时支持图像与视频的检测与分割,还支持输出 mask 蒙版

Stars

Star History Chart

关于我 | About me

📬 联系我

🔗 社交媒体

💡 支持我

Credits

YOLO-World + EfficientSAM

YOLO-World

EfficientSAM

代码还参考了 @camenduru 感谢!

ltdrdata 提供了 🔎Yoloworld ESAM Detector Provider 节点,感谢!

comfyui-yoloworld-efficientsam's People

Contributors

ltdrdata avatar zho-zho-zho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

comfyui-yoloworld-efficientsam's Issues

模型权重哪里下啊

报了以下的错

Error occurred when executing ESAM_ModelLoader_Zho:

The provided filename /ssd2/ws/ComfyUI/custom_nodes/ComfyUI-YoloWorld-EfficientSAM/efficient_sam_s_gpu.jit does not exist

File "/ssd2/ws/ComfyUI/execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/ssd2/ws/ComfyUI/execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/ssd2/ws/ComfyUI/execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/ssd2/ws/ComfyUI/custom_nodes/ComfyUI-YoloWorld-EfficientSAM/YOLO_WORLD_EfficientSAM.py", line 98, in load_esam_model
EFFICIENT_SAM_MODEL = torch.jit.load(model_path)
File "/home/nc/miniconda3/envs/comfyui/lib/python3.10/site-packages/torch/jit/_serialization.py", line 152, in load
raise ValueError("The provided filename {} does not exist".format(f)) # type: ignore[str-bytes-safe]

efficient_sam_s_gpu.jit does not exist

How to solve the following problem when loading:

The provided filename D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\efficient_sam_s_gpu.jit does not exist

AttributeError: 'WorldModel' object has no attribute 'clip_model'

Error occurred when executing Yoloworld_ESAM_Zho:

'WorldModel' object has no attribute 'clip_model'

File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 139, in yoloworld_esam_image
YOLO_WORLD_MODEL.set_classes(categories)
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\inference\models\yolo_world\yolo_world.py", line 133, in set_classes
self.model.set_classes(text)
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\ultralytics\models\yolo\model.py", line 96, in set_classes
self.model.set_classes(classes)
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\ultralytics\nn\tasks.py", line 575, in set_classes
if not self.clip_model:
^^^^^^^^^^^^^^^
File "E:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1695, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")

[REQUEST] Allow loading of YOLOv8 models from file instead of via YOLOWorld

Judging by the issues in this repo, the Yoloworld ESAM node should probably allow loading of yolo models from disk rather than via roboflow. There's really no reason to use a third party service when the relevant models are freely available on hugginface.co.

Should probably also add a warning on the readme to stop peeps from installing both onnxruntime and onnxruntime-gpu (which somehow isn't blocked while installing inference).

Compatibility Issue: onnxruntime-gpu Installation Fails on macOS with M2 Chip

I encountered a compatibility issue when trying to install onnxruntime-gpu on a macOS 14.3 environment using an M2 chip with

  • Python 3.9.18
  • Python 3.10.13

The installation fails due to the unavailability of a suitable onnxruntime-gpu version for this setup.

pip install -r requirements.txt

ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu<=1.15.1 (from inference-gpu) (from versions: none)
ERROR: No matching distribution found for onnxruntime-gpu<=1.15.1

onnxruntime-gpu should be the CUDA version which makes sense that it doesn't work on mac but shouldn't it still work with CPU only version?

Could we consider integrating an alternative like onnxruntime-silicon for better compatibility with macOS M2 chip environments?

Inference

How to do inference?

I just want to do inference on an image with both segmentation and detection by giving needed classes. There is no inference code in the repo. Can anyone provide it or give me hints to write it myself?

File not found

File "D:\Data\Packages\ComfyUI\nodes.py", line 1887, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "D:\Data\Packages\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM_init
.py", line 1, in
from .YOLO_WORLD_EfficientSAM import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "D:\Data\Packages\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 6, in
import supervision as sv
ModuleNotFoundError: No module named 'supervision'

Cannot import D:\Data\Packages\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM module for custom nodes: No module named 'supervision'

克隆并安装依赖后启动COMFYUI依然无法正常加载节点。

看管理器的提示是和新版本的comfyui不兼容?能不能辛苦作者更新下节点去兼容COMFYUI新的版本呢?
When installing or updating this custom node, many installation packages may be downgraded due to the installation of requirements.
在安装或更新此自定义节点时,许多安装包可能会因安装要求而降级。

!! python3.12 is incompatible.
!! python3.12不兼容。

求助 T_T,找不到supervision导致Improt失败

Traceback (most recent call last):
File "H:\ComfyUI-qiuye\ComfyUI\nodes.py", line 1888, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "H:\ComfyUI-qiuye\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM_init
.py", line 1, in
from . import YOLO_WORLD_EfficientSAM
File "H:\ComfyUI-qiuye\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 6, in
import supervision as sv
ModuleNotFoundError: No module named 'supervision'

Cannot import H:\ComfyUI-qiuye\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM module for custom nodes: No module named 'supervision'

小白如何解决这个问题,求回答

Inference 0.9.16 Breaks Detection

This is awesome. Thank you.

Roboflow Inference was updated to version 0.9.16. This breaks the mask detection in the node.

It cannot detect say "person".

But when trying to detect "person, car" it works.

Downgrading to inference 0.9.15 works.

Can you please check so the node works with the latest version of inference?

Fail to download the yolo_world models on macOS

According to #4, I manually pip install inference and succeded to import this custom node suite. However, when I runt the workflow, the node fails to auto-download yolo_world models and return this error:

File "/ComfyUI/execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/custom_nodes/ComfyUI-YoloWorld-EfficientSAM/YOLO_WORLD_EfficientSAM.py", line 70, in load_yolo_world_model
YOLO_WORLD_MODEL = YOLOWorld(model_id=yolo_world_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/inference/models/yolo_world/yolo_world.py", line 36, in init
self.model = YOLO(self.cache_file("yolo-world.pt"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/ultralytics/engine/model.py", line 94, in init
self._load(model, task)
File "/ComfyUI/venv/lib/python3.11/site-packages/ultralytics/engine/model.py", line 146, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/ultralytics/nn/tasks.py", line 628, in attempt_load_one_weight
ckpt, weight = torch_safe_load(weight) # load ckpt
^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/ultralytics/nn/tasks.py", line 567, in torch_safe_load
return torch.load(file, map_location='cpu'), file # load
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/torch/serialization.py", line 1025, in load
return _load(opened_zipfile,
^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/torch/serialization.py", line 1437, in _load
result = unpickler.load()
^^^^^^^^^^^^^^^^
File "/ComfyUI/venv/lib/python3.11/site-packages/torch/serialization.py", line 1430, in find_class
return super().find_class(mod_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Can't get attribute 'WorldModel' on <module 'ultralytics.nn.tasks' from '/ComfyUI/venv/lib/python3.11/site-packages/ultralytics/nn/tasks.py'>

Also, how do yolo_world/l, yolo_world/m, yolo_world/m map to the model files in this directory?

If there's a chance to download and use the extra-large model, I'd love to do that.

Error occurred when executing Yoloworld_ESAM_Zho:

I got this error message when running your workflow. I installed everything correctly as described in your instruction.

Error occurred when executing Yoloworld_ESAM_Zho:

Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at C:\actions-runner_work\vision\vision\pytorch\vision\torchvision\csrc\ops\cpu\nms_kernel.cpp:112 [kernel]
QuantizedCPU: registered at C:\actions-runner_work\vision\vision\pytorch\vision\torchvision\csrc\ops\quantized\cpu\qnms_kernel.cpp:124 [kernel]
BackendSelect: fallthrough registered at ..\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:153 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:498 [backend fallback]
Functionalize: registered at ..\aten\src\ATen\FunctionalizeFallbackKernel.cpp:290 [backend fallback]
Named: registered at ..\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at ..\aten\src\ATen\ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at ..\aten\src\ATen\native\NegateFallback.cpp:19 [backend fallback]
ZeroTensor: registered at ..\aten\src\ATen\ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at ..\torch\csrc\autograd\TraceTypeManual.cpp:296 [backend fallback]
AutocastCPU: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:382 [backend fallback]
AutocastCUDA: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:249 [backend fallback]
FuncTorchBatched: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:710 [backend fallback]
FuncTorchVmapMode: fallthrough registered at ..\aten\src\ATen\functorch\VmapModeRegistrations.cpp:28 [backend fallback]
Batched: registered at ..\aten\src\ATen\LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at ..\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at ..\aten\src\ATen\functorch\TensorWrapper.cpp:203 [backend fallback]
PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:161 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:494 [backend fallback]
PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:165 [backend fallback]
PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:157 [backend fallback]

File "K:\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 140, in yoloworld_esam_image
results = YOLO_WORLD_MODEL.infer(img, confidence=confidence_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\inference\models\yolo_world\yolo_world.py", line 88, in infer
results = self.model.predict(
^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\ultralytics\engine\model.py", line 429, in predict
return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\ultralytics\engine\predictor.py", line 204, in call
return list(self.stream_inference(source, model, *args, **kwargs)) # merge list of Result into one
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\torch\utils_contextlib.py", line 35, in generator_context
response = gen.send(None)
^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\ultralytics\engine\predictor.py", line 290, in stream_inference
self.results = self.postprocess(preds, im, im0s)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\ultralytics\models\yolo\detect\predict.py", line 25, in postprocess
preds = ops.non_max_suppression(
^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\ultralytics\utils\ops.py", line 282, in non_max_suppression
i = torchvision.ops.nms(boxes, scores, iou_thres) # NMS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\torchvision\ops\boxes.py", line 41, in nms
return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "K:\ComfyUI\ComfyUI\venv\Lib\site-packages\torch_ops.py", line 692, in call
return self._op(*args, **kwargs or {})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Could you please provide regional crop and paste functions?

There is a facial crop and paste function in WAS node suit, which can extract the facial area, redraw it and paste it back to the original image. But it only works on faces, and it doesn't work in many cases, such as this picture of a toy.

It would be very practical if the powerful recognition ability of ComfyUI-YoloWorld-EfficientSAM could be used to create a general crop and paste function.

Thanks a lot.

微信截图_20240228110539

Error when nothing is found

When the mask is empty, the workflow generates the following error:

Error occurred when executing MaskToImage:

cannot reshape tensor of 0 elements into shape [-1, 1, 1, 0] because the unspecified dimension size -1 can be any value and is ambiguous
in mask_to_image
result = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)

yoloworld AttributeError: type object 'Detections' has no attribute 'from_inference'

!!! Exception during processing !!!
Traceback (most recent call last):
File "C:\Users\moloc\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "C:\Users\moloc\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "C:\Users\moloc\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "C:\Users\moloc\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 141, in yoloworld_esam_image
detections = sv.Detections.from_inference(results)
AttributeError: type object 'Detections' has no attribute 'from_inference'

first time running and i encountered this. some package issus? how should i fix the code?

What's the correct version of pydantic?

2024-05-08 19:40:57,132- root:1894- WARNING- Traceback (most recent call last):
File "F:\ComfyUI\ComfyUI\nodes.py", line 1876, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "F:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM_init
.py", line 1, in
from . import YOLO_WORLD_EfficientSAM
File "F:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 9, in
from inference.models import YOLOWorld
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference_init_.py", line 1, in
from inference.core.interfaces.stream.stream import Stream # isort:skip
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\interfaces\stream\stream.py", line 13, in
from inference.core.active_learning.middlewares import (
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\active_learning\middlewares.py", line 7, in
from inference.core.active_learning.accounting import image_can_be_submitted_to_batch
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\active_learning\accounting.py", line 4, in
from inference.core.roboflow_api import (
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\roboflow_api.py", line 11, in
from inference.core.cache import cache
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\cache_init_.py", line 5, in
from inference.core.cache.redis import RedisCache
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\cache\redis.py", line 15, in
from inference.core.entities.responses.inference import InferenceResponseImage
File "F:\ComfyUI\python_embeded\Lib\site-packages\inference\core\entities\responses\inference.py", line 5, in
from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_serializer
ImportError: cannot import name 'field_serializer' from 'pydantic' (F:\ComfyUI\python_embeded\Lib\site-packages\pydantic_init_.cp311-win_amd64.pyd)

error

Error occurred when executing MaskToImage:

cannot reshape tensor of 0 elements into shape [-1, 1, 1, 0] because the unspecified dimension size -1 can be any value and is ambiguous

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_mask.py", line 109, in mask_to_image
result = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from /tmp/cache\clip/ViT-B-32\visual.onnx failed:Protobuf parsing failed.

Error occurred when executing Yoloworld_ModelLoader_Zho:

[ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from /tmp/cache\clip/ViT-B-32\visual.onnx failed:Protobuf parsing failed.

File "D:\comfyui\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\comfyui\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\comfyui\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\comfyui\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 70, in load_yolo_world_model
YOLO_WORLD_MODEL = YOLOWorld(model_id=yolo_world_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\envs\comfyui\Lib\site-packages\inference\models\yolo_world\yolo_world.py", line 54, in init
) -> ObjectDetectionInferenceResponse:
^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\envs\comfyui\Lib\site-packages\inference\models\clip\clip_model.py", line 65, in init
self.cache_file("visual.onnx"),
^^^^^^^^
File "C:\ProgramData\anaconda3\envs\comfyui\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\ProgramData\anaconda3\envs\comfyui\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 424, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Yoloworld does not detect

When you use the settings at 0.00, it detects the prompt, but it also detects unnecessary places.

Ekran görüntüsü 2024-04-14 030425

It doesn't detect when you set it to 0.01 or higher. What is the problem?

Ekran görüntüsü 2024-04-14 030812

and 0.1

Ekran görüntüsü 2024-04-14 030731

macOS,安装到ComfyUI时出错

image

Start installing ComfyUI YoloWorld-EfficientSAMStart
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-YoloWorld-EfficientSAM to install正克隆到 'ComfyUI-YoloWorld-EfficientSAM'...
正克隆到 'ComfyUI-YoloWorld-EfficientSAM'...Install: pip packagesCollecting inference-gpu==0.9.13 (from inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached inference_gpu-0.9.13-py3-none-any.whl.metadata (18 kB)
Collecting APScheduler<=3.10.1 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached APScheduler-3.10.1-py3-none-any.whl.metadata (5.7 kB)
Collecting cython<=3.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached Cython-3.0.0-cp310-cp310-macosx_10_9_x86_64.whl.metadata (3.1 kB)
Collecting python-dotenv<=2.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Collecting fastapi<1.0,>=0.100 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached fastapi-0.110.0-py3-none-any.whl.metadata (25 kB)
Requirement already satisfied: numpy<=1.25.2 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (1.24.4)
Collecting opencv-python<=4.8.0.76 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached opencv_python-4.8.0.76-cp37-abi3-macosx_10_16_x86_64.whl.metadata (19 kB)
Requirement already satisfied: piexif<=1.1.3 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (1.1.3)
Requirement already satisfied: pillow<11.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (9.5.0)
Collecting prometheus-fastapi-instrumentator<=6.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached prometheus_fastapi_instrumentator-6.0.0-py3-none-any.whl.metadata (13 kB)
Collecting redis<6.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached redis-5.0.3-py3-none-any.whl.metadata (9.3 kB)
Requirement already satisfied: requests>=2.26.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (2.31.0)
Collecting rich<=13.5.2 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached rich-13.5.2-py3-none-any.whl.metadata (18 kB)
Collecting shapely<=2.0.1 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached shapely-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl.metadata (7.0 kB)
Collecting supervision<1.0.0,>0.16.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached supervision-0.19.0-py3-none-any.whl.metadata (13 kB)
Collecting pybase64<2.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached pybase64-1.3.2-cp310-cp310-macosx_10_9_x86_64.whl.metadata (7.9 kB)
Requirement already satisfied: scikit-image>=0.19.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (0.22.0)
Collecting requests-toolbelt>=1.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl.metadata (14 kB)
Requirement already satisfied: wheel>=0.38.1 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (0.41.2)
Requirement already satisfied: setuptools>=65.5.1 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (68.0.0)
Collecting pytest-asyncio<=0.21.1 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached pytest_asyncio-0.21.1-py3-none-any.whl.metadata (4.0 kB)
Requirement already satisfied: networkx>=3.1 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (3.2.1)
Requirement already satisfied: pydantic>=2.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (2.6.3)
INFO: pip is looking at multiple versions of inference-gpu to determine which version is compatible with other requirements. This could take a while.

👇
ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu<=1.15.1 (from inference-gpu) (from versions: none)
ERROR: No matching distribution found for onnxruntime-gpu<=1.15.1
Install extension ComfyUI YoloWorld-EfficientSAM failed: Install(git-clone) error: https://github.com/ZHO-ZHO-ZHO/ComfyUI-YoloWorld-EfficientSAM / Error: Command failed with exit code 1: ~/miniconda3/envs/comflowy/bin/pip install -r requirements.txt
ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu<=1.15.1 (from inference-gpu) (from versions: none)
ERROR: No matching distribution found for onnxruntime-gpu<=1.15.1
👆

Collecting inference-gpu==0.9.13 (from inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached inference_gpu-0.9.13-py3-none-any.whl.metadata (18 kB)
Collecting APScheduler<=3.10.1 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached APScheduler-3.10.1-py3-none-any.whl.metadata (5.7 kB)
Collecting cython<=3.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached Cython-3.0.0-cp310-cp310-macosx_10_9_x86_64.whl.metadata (3.1 kB)
Collecting python-dotenv<=2.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Collecting fastapi<1.0,>=0.100 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached fastapi-0.110.0-py3-none-any.whl.metadata (25 kB)
Requirement already satisfied: numpy<=1.25.2 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (1.24.4)
Collecting opencv-python<=4.8.0.76 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached opencv_python-4.8.0.76-cp37-abi3-macosx_10_16_x86_64.whl.metadata (19 kB)
Requirement already satisfied: piexif<=1.1.3 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (1.1.3)
Requirement already satisfied: pillow<11.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (9.5.0)
Collecting prometheus-fastapi-instrumentator<=6.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached prometheus_fastapi_instrumentator-6.0.0-py3-none-any.whl.metadata (13 kB)
Collecting redis<6.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached redis-5.0.3-py3-none-any.whl.metadata (9.3 kB)
Requirement already satisfied: requests>=2.26.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (2.31.0)
Collecting rich<=13.5.2 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached rich-13.5.2-py3-none-any.whl.metadata (18 kB)
Collecting shapely<=2.0.1 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached shapely-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl.metadata (7.0 kB)
Collecting supervision<1.0.0,>0.16.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached supervision-0.19.0-py3-none-any.whl.metadata (13 kB)
Collecting pybase64<2.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached pybase64-1.3.2-cp310-cp310-macosx_10_9_x86_64.whl.metadata (7.9 kB)
Requirement already satisfied: scikit-image>=0.19.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (0.22.0)
Collecting requests-toolbelt>=1.0.0 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl.metadata (14 kB)
Requirement already satisfied: wheel>=0.38.1 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (0.41.2)
Requirement already satisfied: setuptools>=65.5.1 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (68.0.0)
Collecting pytest-asyncio<=0.21.1 (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1))
Using cached pytest_asyncio-0.21.1-py3-none-any.whl.metadata (4.0 kB)
Requirement already satisfied: networkx>=3.1 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (3.2.1)
Requirement already satisfied: pydantic>=2.0 in ~/miniconda3/envs/comflowy/lib/python3.10/site-packages (from inference-gpu==0.9.13->inference-gpu[yolo-world]==0.9.13->-r requirements.txt (line 1)) (2.6.3)
INFO: pip is looking at multiple versions of inference-gpu to determine which version is compatible with other requirements. This could take a while.^C
Stopped server

Failed to validate prompt for output 391: ApplyInstantID 336

image
image

i stuck at apply instantID node.

terminal:

got prompt

Failed to validate prompt for output 391:

  • ApplyInstantID 336:
  • Required input is missing: image_features

Output will be ignored

Failed to validate prompt for output 378:

Output will be ignored

[rgthree] Using rgthree's optimized recursive execution.

Prompt executed in 0.01 seconds

Optimize and add detection functionality for the YOLO-World-Seg model.

Issue 1

If there is no comma at the end of the word entered in the input box, it may fail to detect, especially with local detection.
PixPin_2024-02-26_21-00-33

PixPin_2024-02-26_21-01-10

Issue 2

In the Linux system, the yolo-world.pt file will be automatically downloaded to /tmp/cache/yolo_world instead of ComfyUI/models/yolo_world. It is unknown if this issue will occur under Windows system.

Issue 3

Will there be an addition of YOLO-World-Seg detection function in the future? This should improve detection efficiency.

YoloWorld-EfficientSAM doesn't seem to work after installation

I did two ways of installation, manual install and manager install:

  1. during manual install, I see this error but I chose to ignore it and I don't know if it is related to the problem.
    ===
    ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
    mediapipe 0.10.9 requires protobuf<4,>=3.11, but you have protobuf 4.25.2 which is incompatible.
    ===

  2. I then run the sample workflow provide for image, and the node "Convert mask to image" throws the following error (see also attached screenshot):

image

===
Error occurred when executing MaskToImage:

cannot reshape tensor of 0 elements into shape [-1, 1, 1, 0] because the unspecified dimension size -1 can be any value and is ambiguous

File "C:\Apps\ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Apps\ComfyUI\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Apps\ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Apps\ComfyUI\ComfyUI\comfy_extras\nodes_mask.py", line 109, in mask_to_image
result = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  1. I then removed the "Convert mask to image" node, and nothing ( of detection) seems to happen, see screen shot below:
    image

  2. btw, any idea which directory is yolo-world/l model auto-downloaded to ?

  3. I then manually deleted the above installation and installed again via manager this time. I don't notice any error (such as the above mentioned incompatible protobuf error), but the exception thrown by "Convert mask to image" node persists and the detection of yolo-world still doesn't happen.

Pls help and thanks a bunch in advance (so eager to try out the excellent YOLO-WORLD + ESAM!!!)

Sean

Can't get attribute 'WorldModel' on <module 'ultralytics.nn.tasks' from 'E:\\ComfyUI-aki-v1.3\\python\\lib\\site-packages\\ultralytics\\nn\\tasks.py'>

!!! Exception during processing!!! Can't get attribute 'WorldModel' on <module 'ultralytics.nn.tasks' from 'E:\ComfyUI-aki-v1.3\python\lib\site-packages\ultralytics\nn\tasks.py'>
Traceback (most recent call last):
File "E:\ComfyUI-aki-v1.3\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "E:\ComfyUI-aki-v1.3\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "E:\ComfyUI-aki-v1.3\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "E:\ComfyUI-aki-v1.3\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 70, in load_yolo_world_model
YOLO_WORLD_MODEL = YOLOWorld(model_id=yolo_world_model)
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\inference\models\yolo_world\yolo_world.py", line 36, in init
self.model = YOLO(self.cache_file("yolo-world.pt"))
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\ultralytics\engine\model.py", line 95, in init
self._load(model, task)
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\ultralytics\engine\model.py", line 161, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\ultralytics\nn\tasks.py", line 700, in attempt_load_one_weight
ckpt, weight = torch_safe_load(weight) # load ckpt
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\ultralytics\nn\tasks.py", line 634, in torch_safe_load
return torch.load(file, map_location="cpu"), file # load
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\torch\serialization.py", line 1014, in load
return _load(opened_zipfile,
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\torch\serialization.py", line 1422, in _load
result = unpickler.load()
File "E:\ComfyUI-aki-v1.3\python\lib\site-packages\torch\serialization.py", line 1415, in find_class
return super().find_class(mod_name, name)
AttributeError: Can't get attribute 'WorldModel' on <module 'ultralytics.nn.tasks' from 'E:\ComfyUI-aki-v1.3\python\lib\site-packages\ultralytics\nn\tasks.py'>
微信截图_20240510113313
image

ComfyUI-YoloWorld-EfficientSAM node vision is 0416,when run yolo world model loader occur this error,anyone knows how fix it?thx so much!

failed finding central directory

At first was getting an error saying it couldnt find efficientsam_s_gpu.jit but then I downloaded the model and adjusted the naming to match what was being searched for and now getting the following error:

PytorchStreamReader failed reading zip archive: failed finding central directory

File "C:\Users\trist\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trist\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trist\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trist\Downloads\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 98, in load_esam_model
EFFICIENT_SAM_MODEL = torch.jit.load(model_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trist\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit_serialization.py", line 159, in load
cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files, _restore_shapes) # type: ignore[call-arg]

Installation problem

I have followed the install proceadure on every point and downloaded the models form huggingface, but it present the error:

**When loading the graph, the following node types were not found:

  • Yoloworld_ESAM_Zho
  • ESAM_ModelLoader_Zho
  • Yoloworld_ModelLoader_Zho

Nodes that have failed to load will show as red on the graph.**

I looked at the YOLO_WORLD_EfficientSAM.py and it does seem to have these nodes.
Thanks for your work and your help.

No module named 'inference' when installing on macOS

Hi. Thanks for this new great custom node!

The node suite, installed it via ComfyUI Manager, fails to import due to the following error:

File "/ComfyUI/nodes.py", line 1887, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/ComfyUI/custom_nodes/ComfyUI-YoloWorld-EfficientSAM/init.py", line 1, in
from . import YOLO_WORLD_EfficientSAM
File "/ComfyUI/custom_nodes/ComfyUI-YoloWorld-EfficientSAM/YOLO_WORLD_EfficientSAM.py", line 9, in
from inference.models import YOLOWorld
ModuleNotFoundError: No module named 'inference'

Cannot import /ComfyUI/custom_nodes/ComfyUI-YoloWorld-EfficientSAM module for custom nodes: No module named 'inference'

I believe this is because I am on Apple M2 and the requirement.txt is looking for an inference-gpu package that is not available for macOS.

As I read on PyPI, perhaps the requirement can be modified to also install the inference package?

Thank you

‌‌After running Comfyui, there are a bunch of error messages and the workflow cannot be loaded.

Hi, ZHO-ZHO-SHO:

This is a very good tool. But I met a lot of error:

Mixlab Nodes: Loaded

LaMaInpainting.available True
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json

clip_interrogator_model not found: D:\AI\ComfyUI_windows_portable\ComfyUI\models\clip_interrogator/Salesforce/blip-image-captioning-base, pls download from https://huggingface.co/Salesforce/blip-image-captioning-base

ClipInterrogator.available True

text_generator_model not found: D:\AI\ComfyUI_windows_portable\ComfyUI\models\prompt_generator/text2image-prompt-generator, pls download from https://huggingface.co/succinctly/text2image-prompt-generator/tree/main

zh_en_model not found: D:\AI\ComfyUI_windows_portable\ComfyUI\models\prompt_generator/opus-mt-zh-en, pls download from https://huggingface.co/Helsinki-NLP/opus-mt-zh-en/tree/main

PromptGenerate.available True
ChinesePrompt.available True
RembgNode_.available True

Traceback (most recent call last):
File "D:\AI\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1887, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM_init
.py", line 1, in
from . import YOLO_WORLD_EfficientSAM
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 6, in
import supervision as sv
ModuleNotFoundError: No module named 'supervision'

Cannot import D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM module for custom nodes: No module named 'supervision'
[comfyui_controlnet_aux] | INFO -> Using ckpts path: D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\ckpts
[comfyui_controlnet_aux] | INFO -> Using symlinks: False
[comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider']
D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\node_wrappers\dwpose.py:26: UserWarning: DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly
warnings.warn("DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly")

[START] ComfyUI AlekPet Nodes

Node -> ArgosTranslateNode [Loading]
Node -> ExtrasNode [Loading]
Node -> PainterNode [Loading]
Node -> PoseNode [Loading]
Node -> TranslateNode [Loading]

[END] ComfyUI AlekPet Nodes

Efficiency Nodes: Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...Success!
WAS Node Suite: OpenCV Python FFMPEG support is enabled
WAS Node Suite Warning: ffmpeg_bin_path is not set in D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui\was_suite_config.json config file. Will attempt to use system ffmpeg binaries if available.
WAS Node Suite: Finished. Loaded 211 nodes successfully.

Cannot import

Cannot import C:\Users\65283\comflowy\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Yolo�[0KW

安装后乱码

'WorldModel' object has no attribute 'clip_model'

Error occurred when executing Yoloworld_ESAM_Zho:

'WorldModel' object has no attribute 'clip_model'

File "C:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 139, in yoloworld_esam_image
YOLO_WORLD_MODEL.set_classes(categories)
File "C:\anaconda3\envs\ComfyUI\Lib\site-packages\inference\models\yolo_world\yolo_world.py", line 133, in set_classes
self.model.set_classes(text)
File "C:\anaconda3\envs\ComfyUI\Lib\site-packages\ultralytics\models\yolo\model.py", line 96, in set_classes
self.model.set_classes(classes)
File "C:\anaconda3\envs\ComfyUI\Lib\site-packages\ultralytics\nn\tasks.py", line 575, in set_classes
if not self.clip_model:
^^^^^^^^^^^^^^^
File "C:\anaconda3\envs\ComfyUI\Lib\site-packages\torch\nn\modules\module.py", line 1695, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")

Any plan for grounded-dino and grounded-sam

Yolo performance bad for open-volcabulary, which means a specific style cannot be recoginzed for yolo(well it just trained for human and other realworld object detection, so of course)
Any plan for dino? It's quick enough I guess.

关于inference-gpu

inference-gpu必须使用0.9.13版本吗?可以更新他吗? 不能和onnxruntime-gpu 1.17.1版本兼容。

安装后在comfyUI中仍提示节点缺失

环境:Python 3.10.9 Windows 11 23H2 22631.3447

When loading the graph, the following node types were not found:
ESAM_ModelLoader_Zho
Yoloworld_ESAM_Zho
Yoloworld_ModelLoader_Zho

查看启动器的log,有:
Torch version: 2.0.1+cu118
Traceback (most recent call last):
File "D:\ComfyUI_Full\ComfyUI\nodes.py", line 1864, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "D:\ComfyUI_Full\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM_init
.py", line 1, in
from . import YOLO_WORLD_EfficientSAM
File "D:\ComfyUI_Full\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM\YOLO_WORLD_EfficientSAM.py", line 6, in
import supervision as sv
ModuleNotFoundError: No module named 'supervision'

Cannot import D:\ComfyUI_Full\ComfyUI\custom_nodes\ComfyUI-YoloWorld-EfficientSAM module for custom nodes: No module named 'supervision'

'supervision' 模块,我使用pip list查看已经安装上了:
supervision 0.19.0

文件目录:
D:.
│ .gitignore
│ efficient_sam_s_cpu.jit
│ efficient_sam_s_gpu.jit
│ LICENSE
│ README.md
│ requirements.txt
│ YOLO_WORLD_EfficientSAM.py
│ YOLO_WORLD_SEGS.py
init.py

├─utils
│ efficient_sam.py
│ video.py
init.py

├─YOLO_World_EfficientSAM_WORKFLOWS
│ YoloWorld-EfficientSAM V1.0 IMG 【Zho】.json
│ YoloWorld-EfficientSAM V1.0 VIDEO 【Zho】.json
│ YoloWorld-EfficientSAM V2.0 IMG 【Zho】.json
│ YoloWorld-EfficientSAM V2.0 VIDEO 【Zho】.json

└─__pycache__
YOLO_WORLD_EfficientSAM.cpython-310.pyc
init.cpython-310.pyc

cannot reshape tensor of 0 elements into shape [-1, 1, 1, 0] because the unspecified dimension size -1 can be any value and is ambiguous

got prompt
[rgthree] Using rgthree's optimized recursive execution.
[rgthree] First run patching recursive_output_delete_if_changed and recursive_will_execute.
[rgthree] Note: If execution seems broken due to forward ComfyUI changes, you can disable the optimization from rgthree settings in ComfyUI.
C:\Users\zg261.conda\envs\ootd\lib\site-packages\torch\nn\functional.py:5476: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:263.)
attn_output = scaled_dot_product_attention(q, k, v, attn_mask, dropout_p, is_causal)
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
File "D:\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "D:\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\ComfyUI\comfy_extras\nodes_mask.py", line 109, in mask_to_image
result = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
RuntimeError: cannot reshape tensor of 0 elements into shape [-1, 1, 1, 0] because the unspecified dimension size -1 can be any value and is ambiguous


What is the issue here, and how can it be resolved?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.