keep receieving this key error when i use the sam2segmentation node.
i basically use the florence2 node's phase grounding feature to get the bbox coordinates of an object in the image. and then pass it to the
sam2segmentation node to convert it to a mask.
but no matter what i set the index to in the "Florence2 Coordinates", it always returns an error saying key error to me.
and i looked at the info, the data structure of the Data seems not matching the way the node extract the bbox?
got prompt
head<loc_333><loc_156><loc_725><loc_664>
match index: 0 in mask_indexes: ['0']
Offloading model...
[{'bboxes': [[266.8000183105469, 125.20000457763672, 580.4000244140625, 531.6000366210938]], 'labels': ['head']}]
Type of data: <class 'list'>
Data: [{'bboxes': [[266.8000183105469, 125.20000457763672, 580.4000244140625, 531.6000366210938]], 'labels': ['head']}]
Indexes: [0, 1]
!!! Exception during processing !!! 0
Traceback (most recent call last):
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 327, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 202, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-segment-anything-2\nodes.py", line 164, in segment
bbox = data[0][idx]
~~~~~~~^^^^^
KeyError: 0
can anyone help?
keep receieving this key error when i use the sam2segmentation node.
i basically use the florence2 node's phase grounding feature to get the bbox coordinates of an object in the image. and then pass it to the
sam2segmentation node to convert it to a mask.
but no matter what i set the index to in the "Florence2 Coordinates", it always returns an error saying key error to me.
and i looked at the info, the data structure of the Data seems not matching the way the node extract the bbox?
got prompt
head<loc_333><loc_156><loc_725><loc_664>match index: 0 in mask_indexes: ['0']
Offloading model...
[{'bboxes': [[266.8000183105469, 125.20000457763672, 580.4000244140625, 531.6000366210938]], 'labels': ['head']}]
Type of data: <class 'list'>
Data: [{'bboxes': [[266.8000183105469, 125.20000457763672, 580.4000244140625, 531.6000366210938]], 'labels': ['head']}]
Indexes: [0, 1]
!!! Exception during processing !!! 0
Traceback (most recent call last):
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 327, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 202, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ai\ComfyUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-segment-anything-2\nodes.py", line 164, in segment
bbox = data[0][idx]
~~~~~~~^^^^^
KeyError: 0
can anyone help?