Python Script for Facebook Research's Segment Anything Model
This script uses command line argument to show Automatically generating object masks with SAM with mask generation options support using arguments
And with arguments support for generating masks
mask_generator_2 = 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
)
With support for viewing individual Predicted IOU, Stability score with the segmenation
You can use it on command line with
python segment.py --image ./<image path>