mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
fix error when run_grounded_sam find no boxes
This commit is contained in:
@@ -29,6 +29,7 @@ def generate_mask_from_image(image, mask_model, extras):
|
|||||||
|
|
||||||
if mask_model == 'sam':
|
if mask_model == 'sam':
|
||||||
boxes = run_grounded_sam(Image.fromarray(image), extras['sam_prompt_text'], box_threshold=extras['box_threshold'], text_threshold=extras['text_threshold'])
|
boxes = run_grounded_sam(Image.fromarray(image), extras['sam_prompt_text'], box_threshold=extras['box_threshold'], text_threshold=extras['text_threshold'])
|
||||||
|
boxes = np.array([[0, 0, image.shape[1], image.shape[0]]]) if len(boxes) == 0 else boxes
|
||||||
extras['sam_prompt'] = []
|
extras['sam_prompt'] = []
|
||||||
for idx, box in enumerate(boxes):
|
for idx, box in enumerate(boxes):
|
||||||
extras['sam_prompt'] += [{"type": "rectangle", "data": box.tolist()}]
|
extras['sam_prompt'] += [{"type": "rectangle", "data": box.tolist()}]
|
||||||
|
|||||||
Reference in New Issue
Block a user