Upload Bitmask Labels 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 shows how to read a bitmask from a file, and upload it:Upload a Bitmask from an image file
Decode Bitmask Labels
Bitmask labels exported from Encord are encoded in anrleString. 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 therleString, and converts it into an image.
Bitmask JSON export to images
Creating a Binary Array
TherleStringcan also be converted into an array of 1’s and 0’s using the script below.
Bitmask JSON export to binary arrays
Creating Bitmask Images from COCO Export
Use the COCO API to decode Bitmasks when using the COCO export format.Bitmask COCO export to images

