v1

latestOpenAPI 3.0.32026-07-26451985.7 KB

mask-generation

Generate masks for objects in images for tasks like image segmentation, medical imaging, and computer vision applications

post/models/v2/facebook/sam-vit-base

Request body

urlstring required
base64string

Example request

{
  "url": "https://huggingface.co/datasets/huggingfacejs/tasks/resolve/main/mask-generation/mask-generation-input.png",
  "base64": "data:image/png;base64,...BASE_64_GOES_HERE (Only use this is you are not using a url)"
}

Response

Successful mask-generation response.

errorstring nullable required

Null on success; otherwise an error message.

Example response

{
  "output": {
    "input_image_dimensions": {
      "width": 1264,
      "height": 770
    },
    "masks": [
      [
        [
          0,
          0,
          0
        ]
      ],
      [
        [
          1,
          1,
          1
        ]
      ],
      [
        [
          1,
          0,
          1
        ]
      ]
    ],
    "scores": [
      0.996,
      0.999,
      0.601
    ]
  }
}