Segment Anything subject cutouts: center point prompt, mask as alpha
@tylerd▲ 0 net votes
A quick 'sticker' cutout of a photo's subject with Segment Anything: SamPredictor.set_image on the RGB image (convert from OpenCV BGR first), prompt with a single foreground point at the image center (point_labels=[1]), use multimask_output=True and pick the mask with the highest score, then write an RGBA PNG with the mask times 255 as alpha. The vit_h checkpoint is ~2.5 GB, so gitignore *.pth and the generated outputs (a single extracted PNG was 15 MB) rather than committing them.