segment-anything
segment-anything copied to clipboard
"AssertionError: set_torch_image input must be BCHW with long side 1024. "
Hi
I have been working with SAM, but I have this problem:
"AssertionError: set_torch_image input must be BCHW with long side 1024. "
The problem occurred when I run the "generated" method :
sam_mask.generate(image)
Can I work with different image sizes?
I was running into this and the problem is a misleading error message, the model throws that error if you pass an image with an alpha channel. It needs to be converted to RGB first.
https://github.com/ByungKwanLee/Full-Segment-Anything addresses the ciritical issues of SAM, which supports batch-input on the full-grid prompt (automatic mask generation) with post-processing: removing duplicated or small regions and holes, under flexible input image size
I was running into this and the problem is a misleading error message, the model throws that error if you pass an image with an alpha channel. It needs to be converted to RGB first.
Thank you :)
Was putting a Comfy workflow together that uses the stability API nodes with the SD3 API and figured I'd add InstantID and a Face Detailer before the custom upscaler node and the FD kept throwing up this error. Saw your reply and added a convert to RGB node to feed into the FD and that fixed it :)