2D Segmentation

2D semantic segmentation, also known as Raster annotation, is a type of workspace output which is used to deliver pixel-level precision results. The output will pull in an image and apply a mask over top, which associates each pixel with a specific result. The annotation tools in this output are oriented towards drawing and pixel fill capability often found within image editing platforms, while being augmented with advanced tooling including super-pixel or pre-annotations. Raster output is often used when pixel level detail is required with applications such as retail or small autonomous robotics.

Masks are applied as different layers of colored tagsMasks are applied as different layers of colored tags

Masks are applied as different layers of colored tags


Raster tools

There are three different raster tools, which each have different options in the secondary toolbar in the workspace:

  • Paintbrush (a)
  • Fill (b)
  • Superpixel (c)

The tools are used to assign a category to each pixel of the image. All pixels are assigned a "no label" category to start with, and the annotation process consists of assigning categories to the pixels of the different objects in the image.

The output of this type of annotation takes the form of a greyscale image, a raster mask, where the value of a pixel represents the category to which it has been assigned.

10381038

The location of the raster mask image is listed in the output JSON file under the mask_url key:

{
  "tasks": [
    {
      "id": "6125acb53928ed00e6fc55fa",
      "project_id": 8616,
      "priority": 0,
      "created_at": "2021-08-25T02:38:38.847Z",
      "state": "completed",
      "data": {
        "Image Raster Original file name": "dog.png",
        "Image Raster Size": "1414221",
        "Image Raster Height": "1152",
        "Image Raster Width": "1729",
        "Image Raster Original url": "https://assets.samasource.org/8616/dog.png?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9hc3NldHMuc2FtYXNvdXJjZS5vcmcvMjMvamVyb21lLXRlc3QvODYxNi9kb2cucG5nIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjI5ODY4NTAyfX19XX0_&Signature=IE2FAi7aWTedNtV7OPBNCVQsPnUGON1EcGJDX5LR0Py3HVHtrzo6QwUI1dk9qiEeZLReKRc0tE-sBB0JG-r2gVFhGUVy~V0qiLSfvKYc8KQ3gdNTjr0ZzxaevtuUHnJQvggcugFoZ490NLPEe99ggD0ACtaXDNdLUPqt~oLXpN~iDREovNe-TmFI~CGtuU4Dq6R6ktBJkdZ8~XijRtBLyYYly7nb01hCT~eE8Tf5oKRpaq30E1SFkjHbacRw4IBy4mrMkpjMVPtbc0Z034CLh1zufIK~btVu9zxNwFSWY3PbZNsKFSemZIu0mkZGk08j8xikqGlllnCWh4HWMxs-ag__&Key-Pair-Id=APKAI3VFKBKGZNMXJ2MQ",
        "image": "https://assets.samasource.org/8616/dog.png?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9hc3NldHMuc2FtYXNvdXJjZS5vcmcvMjMvamVyb21lLXRlc3QvODYxNi9kb2cucG5nIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjI5ODY4NTAyfX19XX0_&Signature=IE2FAi7aWTedNtV7OPBNCVQsPnUGON1EcGJDX5LR0Py3HVHtrzo6QwUI1dk9qiEeZLReKRc0tE-sBB0JG-r2gVFhGUVy~V0qiLSfvKYc8KQ3gdNTjr0ZzxaevtuUHnJQvggcugFoZ490NLPEe99ggD0ACtaXDNdLUPqt~oLXpN~iDREovNe-TmFI~CGtuU4Dq6R6ktBJkdZ8~XijRtBLyYYly7nb01hCT~eE8Tf5oKRpaq30E1SFkjHbacRw4IBy4mrMkpjMVPtbc0Z034CLh1zufIK~btVu9zxNwFSWY3PbZNsKFSemZIu0mkZGk08j8xikqGlllnCWh4HWMxs-ag__&Key-Pair-Id=APKAI3VFKBKGZNMXJ2MQ",
        "name": "task1"
      },
      "answers": {
        "Image Raster": {
          "layers": {
            "raster_coding": {
              "mask_url": "https://samahub3.s3.amazonaws.com/clients/23/external/projects/8616/tasks/6125acb53928ed00e6fc55fa/outputs/Image%20Raster/d1bdde4b-3d01-47d3-8536-4952eb871969.png"
            }
          }
        }
      },
      "submitter_ids_by_step": {
        "Step A": 15131
      },
      "batch_id": 70772,
      "task_url": "https://api.sama.com/projects/8616/tasks/6125acb53928ed00e6fc55fa"
    }
  ]
}

If you have been provided with the right credentials, you can download the mask using the AWS CLI.

aws s3api get-object --bucket samahub3 --key "clients/23/external/projects/8616/tasks/6125acb53928ed00e6fc55fa/outputs/Image Raster/d1bdde4b-3d01-47d3-8536-4952eb871969.png" raster-mask.png