Segmentation Masks

The Celantur container can generate two different segmentation mask files per processed image:

  • Binary Segmentation
  • Instance Segmentation

It's activated with the --save-mask {all, instance, binary} parameter. The segmentation is saved as a PNG file.

Anonymization, binary segmentation and instance segmentation applied to an image by Celantur.
Anonymization, binary segmentation and instance segmentation applied to an image by Celantur.

Binary Segmentation

The binary segmentation mask consist of two colors:

  • Background is black
  • Anonymized segments are white

The file will be saved as image-name_bin_mask.png.

Instance Segmentation

The instance segmentation mask consists of multiple colors. The RGB color values are used to differentiate to individual instances/objects.

  • The R (red) channel encodes the object type:

    • License plate: 64
    • Person: 128
    • Face: 192
    • Vehicle: 255
  • The G (green) channel encodes individual instances/objects.
  • The B (blue) channel is 0.

E.g. [192, 85, 0] is a face.

The file will be saved as image-name_ins_maks.png.

Scale Down Mask Files

By adding the optional --mask-scale {0-100} (CLI) or /v1/file/1/instance-mask?mask-scale={0-100} (Container API) parameter, mask files will be scaled down by the specified ratio.

Metadata

Metadata about detected instances/objects are stored in the corresponding image-name.json file:

{
  "id": "image-name.jpg",
  "detections": [
    {
      "id": 0,
      "parent_image": "image-name.jpg",
      "offset": [1586, 776],
      "bbox": [1586, 776, 3094, 3453],
      "type": 102,
      "score": 0.9994864463806152,
      "is_anonymised": true,
      "type_label": "person",
      "color": [128, 85, 0]
    },
    {
      "id": 0,
      "parent_image": "image-name.jpg",
      "offset": [3691, 674],
      "bbox": [3691, 674, 5180, 3431],
      "type": 102,
      "score": 0.9987647533416748,
      "is_anonymised": true,
      "type_label": "person",
      "color": [128, 170, 0]
    },
    ...