facebookresearch / facebookresearch/sam2

how to segment the objects without background

Open
#82 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
19.9k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

In my images, there're mobile and others. I just want to segment the mobile from the image.

`

> mask_generator = SamAutomaticMaskGenerator(
> model=sam,
> points_per_side=32,
> pred_iou_thresh=0.86,
> stability_score_thresh=0.92,
> crop_n_layers=1,
> crop_n_points_downscale_factor=2,
> min_mask_region_area=100, # Requires open-cv to run post-processing
> )

> masks = mask_generator.generate(image)

`
but some masks only includes the background, such as Mask 1, Mask 2,Mask 5 in blow picture, and some masks includes mobile with background, Mask 6 in below picture.
how the only generate the masks with mobile?

![10097](https://github.com/user-attachments/assets/adadcb8f-b62b-4e65-b37f-122cd6fe6bc7)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.