Bitmasks
A Bitmask is a type of annotation on the Encord platform that allows for pixel-wise segmentation of an image, which can be useful when bounding boxes and polygons don’t provide enough precision, or when topologically separate regions belonging to the same class need to be labeled.
Downloading Bitmask annotations from Encord
The Encord platform allows the creation of Bitmask annotations. After labelling is complete, it is possible to download these annotations using the SDK. The following code example illustrates how to download / export and save Bitmask labels:
Uploading Bitmask annotations to Encord
If there are pre-existing Bitmask annotations, previously created in Encord or any other software, they can be uploaded to Encord using the SDK. The following code example illustrates how to read a bitmask from a file, and upload it:
Decoding Bitmask labels
Bitmask labels exported from Encord are encoded in an rleString
. This rleString
can be converted to an image or a binary array.
Creating Bitmask images from JSON export
The following script takes your exported JSON file, finds the rleString
, and converts it into an image.
Creating a binary array
The rleString
can also be converted into an array of 1’s and 0’s using the script below.
Creating Bitmask images from COCO export
Use the COCO API to decode Bitmasks when using the COCO export format.
Was this page helpful?