chrisgoringe / cg-image-picker

258 stars 16 forks source link

Clean up latent multipick and document it with fabric #7

Closed chrisgoringe closed 1 year ago

chrisgoringe commented 1 year ago

With some good Fabric workflows....

EricRollei commented 1 year ago

I'm working on adding the latent multi chooser into my regular comfy workflow and am running into an error with selecting more than one image. Works when I select just one positive, but if I take two or more then I get the following error: Error occurred when executing BboxDetectorSEGS:

Cannot handle this data type: (1, 1, 1024, 3), |u1

File "A:\Comfy_Aug\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\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 "A:\Comfy_Aug\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\detectors.py", line 83, in doit segs = bbox_detector.detect(image, threshold, dilation, crop_factor, drop_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\impact_subpack\impact\subcore.py", line 98, in detect detected_results = inference_bbox(self.bbox_model, core.tensor2pil(image), threshold) ^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\utils.py", line 18, in tensor2pil return Image.fromarray(np.clip(255. image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\python_embeded\Lib\site-packages\PIL\Image.py", line 3092, in fromarray raise TypeError(msg) from e

chrisgoringe commented 1 year ago

Does BboxDetectorSEGS normally work if you feed it a batch? The line of code that is generating the error doesn't look like it expects a batch of images (Image.fromArray()), and I can't see anywhere in the call stack that seems to deal with batches.

EricRollei commented 1 year ago

Yeah, I thought the error was strange also since I can run a batch of images through this workflow straight from the beginning. Also the error isn't shown at the bbox, but at the multi-select. I dunno what the difference is exactly. I will bypass those parts of the workflow and try anyhow to see if that helps.
btw - I got a similar error when I set the Multi-select to accumulate and try only one image in the positive.

update: disabling the detailing parts of my workflow does allow it to continue, but that's not ideal.

chrisgoringe commented 1 year ago

done in 2.6