Importing Brush Traces
You may import PNG masks as pre-labels for the Brush labeling tool in Ango Hub.
How to Import Masks as Brush Annotations
1. Verify Brush Tool Classes
Navigate to Settings > Category Schema in your project to ensure that the necessary Brush tool classes are available in the project.
2. Assign Colors
For instance segmentation tasks, randomly assign a unique RGB color value to each instance in your mask.
For semantic segmentation tasks, randomly assign a unique RGB color value to each class in your mask.
3. Prepare Masks
Prepare the masks you intend to import. Ensure the masks meet the following criteria:
The imported mask must be a 4-channel RGBA image
The width and height of the mask image must match the image asset's dimensions
The background value of the mask must be solid white and transparent
Example:
(RGBA: 255, 255, 255, 0)
Use randomly assigned unique colors in the previous step, with fully opaque (255) alpha channel. Make sure that the mask’s foreground brush content must match the exact color values of the "brush" field in the JSON file.
Example:
Mask Image:
(RGBA: 244, 67, 54, 255)
,JSON File:
"brush": [244, 67, 54]
The following would be a valid PNG mask:
You can use the following Python script to convert an RGB mask with a solid black background into the required RGBA format:
4. Prepare JSON File
Prepare the JSON to import to Hub, in the following format:
Where externalId
is the external ID of the asset to pre-annotate, brushDataUrl
is a link to your publicly accessible PNG mask, and tools
is the list of instances available in the mask with randomly assigned unique RGB color information ("brush"
) and the "schemaId"
of each class.
For Brush Traces with Publicly Accessible URLs
If your masks are stored in a cloud storage service, ensure the bucket's CORS settings are set properly, or your masks will not be visible on Hub.
Here is a guide on how to set up CORS in such a way that your masks will be visible.
For Brush Traces in Private Buckets
Integrate your private bucket with Ango Hub by following the instructions on the Storages docs page.
Navigate to your organization's Organization page, then navigate to the Storages tab.
Copy the ID of the storage where your brush traces are stored.
Prepare a JSON with the following format:
5. Import Annotations
In your project, navigate to the Assets tab and ensure that the assets you wish to prelabel are in the Start stage, then click on Import. Drag and drop the JSON file you have just prepared. Your assets will be pre-labeled.
To programmatically import brush traces, you can use the import_labels function available in our SDK.
Last updated