Sam3 Image Rle
Playground
Try it on WavespeedAI!SAM 3 RLE is a unified foundation model for promptable image segmentation using text, points, or boxes to detect and segment objects. Returns RLE (Run-Length Encoding) encoded masks for efficient storage and processing. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
Features
SAM3 Image Segmentation RLE
SAM3 Image Segmentation RLE is an advanced image segmentation model based on Meta’s Segment Anything Model 3. It returns segmentation masks in RLE (Run-Length Encoding) format — a compact, program-friendly output ideal for API integration, automated pipelines, and machine learning workflows.
Why Choose This?
-
RLE output format Returns compact Run-Length Encoded mask data instead of image files — smaller payload, faster transfer.
-
Multiple prompt types Segment objects using text prompts, point prompts, box prompts, or any combination.
-
API-optimized Designed for programmatic use, batch processing, and automated workflows.
-
COCO-compatible RLE format is directly compatible with COCO dataset tools and annotation pipelines.
-
Prompt Enhancer Built-in tool to automatically improve your text prompts for better results.
-
Ultra-affordable Just $0.005 per image for professional-quality segmentation.
Parameters
| Parameter | Required | Description |
|---|---|---|
| image | Yes | Source image to segment (upload or URL) |
| prompt | No* | Text description of the object to segment |
| point_prompts | No* | Point coordinates to identify the target object |
| box_prompts | No* | Bounding box coordinates to identify the target object |
| apply_mask | No | Overlay the segmentation mask on the original image |
*At least one prompt type (text, boxes, or points) must be provided.
How to Use
- Upload your image — drag and drop or paste a URL.
- Add prompts — provide at least one of the following:
- Text prompt — describe the object to segment (e.g., “the man”, “the dog”).
- Point prompts — click ”+ Add Item” to add point coordinates.
- Box prompts — click ”+ Add Item” to add bounding box coordinates.
- Enable apply_mask (optional) — check to include mask overlay data.
- Run — submit and receive RLE-encoded segmentation data.
Output Format
The model returns RLE (Run-Length Encoding) data in JSON format:
{
"rle": "146301 3 147834 11 149368 14 150903 16 ..."
}Decoding RLE in Python
from pycocotools import mask as mask_utils
rle_data = {"counts": "146301 3 147834 11 ...", "size": [height, width]}
binary_mask = mask_utils.decode(rle_data) # Returns numpy arrayPricing
| Item | Cost |
|---|---|
| Per image | $0.005 |
Simple flat-rate pricing regardless of image size or prompt complexity.
Best Use Cases
- ML Data Annotation — Generate segmentation masks for training datasets in COCO format.
- Automated Pipelines — Integrate segmentation into batch processing workflows.
- API Integration — Compact output for efficient API responses.
- Computer Vision — Programmatic mask processing for CV applications.
- Background Removal at Scale — Extract masks for automated image processing.
Pro Tips
- Use this model when you need programmatic access to mask data.
- Use SAM3 Image if you need direct image output.
- RLE format is compatible with pycocotools for easy decoding.
- Combine multiple prompt types for more accurate segmentation.
- Text prompts work best for common objects with clear descriptions.
Notes
- At least one prompt type must be provided (text, points, or boxes).
- Output is RLE-encoded JSON, not an image file.
- Use pycocotools or similar libraries to decode RLE data.
- Ideal for automated and batch processing workflows.
Related Models
- SAM3 Image — Same segmentation with direct image output.
- Bria RMBG — Background removal model.
Authentication
For authentication details, please refer to the Authentication Guide.
API Endpoints
Submit Task & Query Result
# Submit the task
curl --location --request POST "https://api.wavespeed.ai/api/v3/wavespeed-ai/sam3-image-rle" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"point_prompts": [],
"box_prompts": [],
"apply_mask": true,
"enable_sync_mode": false
}'
# Get the result
curl --location --request GET "https://api.wavespeed.ai/api/v3/predictions/${requestId}/result" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}"
Parameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| image | string | Yes | - | URL of the image to segment and analyze | |
| prompt | string | No | - | Text description to guide which objects or regions to segment | |
| point_prompts | array | No | [] | - | List of point coordinates to mark specific locations for segmentation (foreground or background) |
| box_prompts | array | No | [] | - | List of bounding boxes to define rectangular regions for segmentation |
| apply_mask | boolean | No | true | - | Whether to overlay the segmentation mask on the original image |
| enable_sync_mode | boolean | No | false | - | If set to true, the function will wait for the result to be generated and uploaded before returning the response. It allows you to get the result directly in the response. This property is only available through the API. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Array of URLs to the generated content (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.urls.get | string | URL to retrieve the prediction result |
| data.has_nsfw_contents | array | Array of boolean values indicating NSFW detection for each output |
| data.status | string | Status of the task: created, processing, completed, or failed |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction, the ID of the prediction to get |
| data.model | string | Model ID used for the prediction |
| data.outputs | object | Array of outputs containing RLE encoded masks (empty when status is not completed). |
| data.urls | object | Object containing related API endpoints |
| data.urls.get | string | URL to retrieve the prediction result |
| data.status | string | Status of the task: created, processing, completed, or failed |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |