Florence2 → SAM2 → grow → blur
Segmentation finds people and related classes, turns bbox / points into a SAM2 mask, expands the edge and softens it before crop and composite.
Detection, refinement and a softened edge
Florence2 searches for more than “person”
Node 550 runs caption_to_phrase_grounding at size 1024. The saved class list contains people, human, face, hand, feet, shoe, leg, bag, backpack, pet, dog, cat, gun, animal.
The broad list can help capture figure details and carried objects, but it can also pull an unrelated nearby object into the mask.
Edge-processing sequence
| Node | Operation | Current value / output |
|---|---|---|
| 550 | Florence2Run | Detection result + data |
| 114 | Florence2toCoordinates | Coordinates for SAM2 |
| 115 | Sam2Segmentation | Mask output |
| 144 | GrowMask | 5 px, tapered = true |
| 146 | MaskBlur+ | 10, auto |
| 420 | easy imageCropFromMask | Person-region crop |
| 500 → 499 | MaskToImage → Separate Mask Components | Independent components for inpaint |
One canvas + individual_objects = ON produces the full group mask
A runtime check on 2026-09-07 confirmed the full Florence2 → BBOX → SAM2 route on a 1280 × 720 test image containing six people. Florence2 and SAM2 must receive the same image: coordinates computed on another size or frame produce displaced or false masks.
In the installed ComfyUI-segment-anything-2 version, BBOX indices 0,1,2,3,4,5 produced the full group mask only with individual_objects = ON. With OFF, the node returned one silhouette even though Florence2 showed boxes for all people.
Six-person mask
The test produced a combined foreground mask for all six people and a correct inverted protect mask.
Final scene composite
The test confirms detection/segmentation but does not yet prove the cutout through positioning, selector and final output.
| Check | Confirmed value | Failure symptom |
|---|---|---|
| Image contract | Florence2 image = SAM2 image = 1280 × 720 | Mask lands on a building, corner or empty area |
| Florence generation | num_beams 3 · do_sample OFF | Unstable boxes and changing indices |
| BBOX selection | index 0,1,2,3,4,5 | Only one object or the wrong object is selected |
| SAM2 multi-object | individual_objects ON | OFF leaves only one silhouette |
| Mask cleanup | Threshold 0.30 in the test | Threshold is refined against clothing/limb edges |
What counts as a usable mask
- The white silhouette covers the whole figure, including feet and small objects that must remain.
- There are no large holes inside the body or isolated islands far from the figure.
- The edge does not cut off arms, feet or headwear.
- Grow 5 and blur 10 do not create an obvious halo against a high-contrast background.
No active InvertMask
No separate explicit InvertMask node is present in this branch.
Hidden inversion
Internal polarity behavior of third-party nodes cannot be established from the workflow JSON alone.