Callback Format

The response field, which is part of the callback POST request and permanently stored as part of the task object, will contain a labelMapping and an annotations field.

labelMapping is a dictionary where the keys are each label name, and the value is an object with the index and color used to represent each label in the response images. In the case of instance_labels, the value will be an array of such objects with index and color keys, representing each instance. Note: colors are not guaranteed to be unique, so multiple instances/labels may have the same color.

annotations is an object that contains URLs of PNG images describing the segmentation result in different ways:

  • combined: an object containing the URLs of two PNG images describing the segmentation response:
    • image: a 4-channel PNG image URL where each non-transparent colored pixel represents a pixel annotated with a given label, and each transparent pixel represents an unlabeled one. The color values in the labelMapping object are used. Since colors are not guaranteed to be unique, you should not use the pixel values of image to generate masks.
    • indexedImage: a 1-channel PNG image URL where each positive integer value represents a pixel annotated with a given label, and each 0 value represents an unlabeled pixel. The index values in the labelMapping object are used. indexes are guaranteed to be unique, so you can use the pixel values of indexedImage to generate masks.
  • labeled: a dictionary where the keys are each label name, and the values are either:
    • a 4-channel PNG image URL where each non-transparent colored pixel (using the label's color) represents a pixel annotated with that label in the segmentation response, or
    • null, if there is no pixel in the image annotated with that label in the segmentation response
    • In the case of an instance_label, an array of 4-channel PNG image URLs where each non-transparent colored pixel (using the label's color) represents a pixel annotated with that label in the segmentation response. Each element of the array will represent a different instance of the label.
  • unlabeled:
    • a 4-channel PNG image URL where each non-transparent black (#000000) pixel represents a pixel left unlabeled in the segmentation response, or
    • null, if there is no pixel left unlabeled in the segmentation response
{
  "task": {
    // task inlined for convenience
    ...
  },
  "response": {
    "annotations": {
      "unlabeled": null,
      "labeled": {
        "lane marking": "https://scaleapi-attachments.s3.amazonaws.com/3f184900-6809-11e7-bb22-c346fd2b0658",
        "vehicle": [
          "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b7566ef0-8119-11e7-ac39-7d56f40a5f60",
          "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b7566ef0-8119-11e7-ac39-7d56f40a5120"
        ],
        "pedestrian": [
          "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b7566ef0-8119-11e7-ac39-7d56f40a5550",
          "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b7566ef0-8119-11e7-ac39-7d56f40b5230"
        ],
        "road": "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b756bd10-8119-11e7-ac39-7d56f40a5f60",
        "vegetation": "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b756bd11-8119-11e7-ac39-7d56f40a5f60",
        "background": "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b7573240-8119-11e7-ac39-7d56f40a5f60"
      },
      "combined": {
        "image": "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/b7573241-8119-11e7-ac39-7d56f40a5f60",
        "indexedImage": "https://scaleapi-attachments.s3-ap-northeast-1.amazonaws.com/ba9a9d70-8119-11e7-ac39-7d56f40a5f60"
      }
    },
    "labelMapping": {
      "lane marking": {
        "color": "#9e3fff",
        "index": 6
      },
      "vehicle": [
          {
            "color": "#8000ff",
            "index": 5
          },
          {
            "color": "#ff0080",
            "index": 4
          }
      ],
      "pedestrian": [
          {
            "color": "#80ffff",
            "index": 7
          },
          {
            "color": "#ff8888",
            "index": 8
          }
      ],
      "background": {
        "color": "#00ffff",
        "index": 3
      },
      "road": {
        "color": "#80ff00",
        "index": 2
      },
      "vegetation": {
        "color": "#ff0000",
        "index": 1
      }
    },
    "instances": {}
  },
  "task_id": "598e0da3e8068e06002d9407"
}

📘

See the Callback section for more details about callbacks.