Home/Models/sam2-auto

SAM2 - Auto

tool
fal
image

Automatically segments an image with SAM 2, returning individual object masks or a single combined mask as PNG images.

Ready
Run the model to preview output.

README

# SAM 2 Auto Segmentation Advanced automated image segmentation and object masking. ## Overview SAM 2 Auto Segmentation is a state-of-the-art computer vision tool designed to identify and isolate objects within images with pixel-perfect precision. By leveraging the Segment Anything Model 2 (SAM 2) architecture, this tool automatically generates high-fidelity masks for every distinct element detected in a scene. Whether you need to isolate a specific product, remove a complex background, or create detailed selection maps for post-production, this model provides a robust, automated solution that eliminates the need for manual pen-tooling. The model outputs are highly versatile, offering both individual object masks and a combined mask layer. This flexibility allows marketing teams to integrate the results directly into creative workflows, such as Adobe Photoshop, compositing software, or automated image processing pipelines. By automating the segmentation process, SAM 2 enables rapid prototyping and high-volume content production, ensuring consistent quality across large-scale ad campaigns. ## Use Cases * **E-commerce Product Isolation:** Automatically extract products from lifestyle photos for clean, white-background catalog imagery. * **Dynamic Ad Compositing:** Isolate subjects to place them into new, contextually relevant backgrounds for A/B testing creative assets. * **Selective Image Editing:** Generate precise masks to apply color grading, filters, or effects to specific objects without affecting the entire image. * **Marketing Analytics:** Segment images to identify and count specific objects or features for visual data analysis and trend reporting. * **Social Media Content Creation:** Quickly generate transparent PNGs of subjects for use in interactive social media stories and promotional graphics. * **Background Replacement:** Seamlessly swap out distracting backgrounds in user-generated content to maintain brand aesthetic consistency. ## Parameters This model offers granular control over the segmentation process through several adjustable parameters. Users can fine-tune the density of point sampling, adjust confidence thresholds for mask generation, and filter results based on region size to ensure the output meets specific project requirements. Please refer to the input configuration panel for the full list of adjustable settings, including `points_per_side`, `pred_iou_thresh`, and `min_mask_region_area`. ## Tips for Best Results * **Optimize for Complexity:** If the model is missing small details, increase the `points_per_side` parameter to allow for a more exhaustive sampling of the image. * **Filter Noise:** Use the `min_mask_region_area` parameter to ignore small artifacts or "noise" in the background, ensuring you only receive masks for significant objects. * **Balance Precision:** Adjust the `pred_iou_thresh` to find the "sweet spot" between mask accuracy and the number of detected objects; lower values may capture more, but with less certainty. * **Stability Matters:** Increase the `stability_score_thresh` if you find the model is generating overlapping or redundant masks in high-contrast areas. * **Format Selection:** Always choose the output format (PNG) that best supports transparency for your downstream editing software to ensure seamless compositing. ## About SAM 2 Auto Segmentation is powered by the Segment Anything Model 2, a foundational computer vision model developed by Meta AI. Building upon the success of the original SAM architecture, SAM 2 offers significantly improved performance in object boundary detection and temporal consistency. As a leading-edge tool in the Pixloop ecosystem, it provides enterprise-grade segmentation capabilities, enabling marketing teams to leverage advanced AI research for high-impact visual storytelling and efficient creative production.

Parameters

Model input reference derived from preset schema.

NameTypeRequiredDefaultDescription
image_urlimageYesnullURL of the image to be automatically segmented
sync_modebooleanNofalseIf `True`, the media will be returned as a data URI and the output data won't be available in the request history.
output_formatselectNo"png"The format of the generated image.
points_per_sideintegerNo32Number of points to sample along each side of the image.
pred_iou_threshnumberNo0.88Threshold for predicted IOU score.
min_mask_region_areaintegerNo100Minimum area of a mask region.
stability_score_threshnumberNo0.95Threshold for stability score.