Importing Brush Traces
Last updated
Last updated
You may import PNG masks as pre-labels for the in Ango Hub.
Navigate to Settings > Category Schema in your project to ensure that the necessary Brush tool classes are available in the project.
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.
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:
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.
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.
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:
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.
on how to set up CORS in such a way that your masks will be visible.
Integrate your private bucket with Ango Hub by following the instructions on the docs page.
To programmatically import brush traces, you can use the function available in our SDK.