facebookresearch / facebookresearch/segment-anything

About SamAutomaticMaskGenerator, how to get maps less than 4**2 ?

Open
#417 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
54.9k
Forks
6.4k
PR merge metrics
No merged PRs in 30d

Description

In SamAutomaticMaskGenerator, I set _points_ Per_ Set_ to 4, I thought the segmentation maps I obtain should not exceed 4 * 4, which is 16, but I obtained 22 feature maps. Why?
My setting is:

> mask_generator = SamAutomaticMaskGenerator(
model=sam,
points_per_side=4, #32
points_per_batch = 64,
pred_iou_thresh=0.88,
stability_score_thresh=0.95,
stability_score_offset=1.0,
box_nms_thresh=0.7,
crop_n_layers=0,
crop_nms_thresh = 0.7,
crop_overlap_ratio = 512 / 1500,
crop_n_points_downscale_factor=0,
# point_grids: Optional[List[np.ndarray]] = None,
min_mask_region_area=0, # Requires open-cv to run post-processing
output_mode = "binary_mask",
)

Could anyone tell me why? And what is the correct settings to get maps whose number is not larger than 16? Thanks very much!

Contributor guide

Open the contributing guide

Research direction

Start with the SamAutomaticMaskGenerator entry point and inspect how points_per_side, point grids, and mask filtering determine the number of returned maps. Reproduce the configuration from the issue and compare the generated point count with the output count. Done means explaining the discrepancy and identifying settings or behavior that constrain the result to at most 16 maps.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.