diff --git a/docs/hyperdatasets/dataset.md b/docs/hyperdatasets/dataset.md index b7595802..4a66064f 100644 --- a/docs/hyperdatasets/dataset.md +++ b/docs/hyperdatasets/dataset.md @@ -17,6 +17,8 @@ metadata and data. These parent-child version relationships can be represented as version trees with a root-level parent. A Dataset can contain one or more trees. +Mask-labels can be defined globally, for a DatasetVersion, which will be applied to all masks in that version. + ## Dataset Version State Dataset versions can have either **Draft** or **Published** status. @@ -130,7 +132,7 @@ version at the root level), or the last child in the Dataset versions tree is *P Creating a version in a simple version structure may convert it to an advanced structure. This happens when creating a Dataset version that yields a parent with two children, or when publishing the last child version. -## Versioning Usage +## DatasetVersion Usage Manage Dataset versioning using the DatasetVersion class in the ClearML Enterprise SDK. @@ -303,3 +305,45 @@ myVersion = DatasetVersion.get_version(dataset_name='MyDataset', myVersion.publish_version() ``` +### Managing Version Mask-labels + +#### Setting Version Mask-label Mapping + +In order to visualize masks in a dataset version, the mask values need to be mapped to their labels. Mask-label +mapping is stored in a version's metadata. + +To define the DatasetVersion level mask-label mapping, use the `set_masks_labels` method of the [DatasetVersion](dataset.md#dataset-versioning) +class, and input a dictionary of RGB-value tuple keys and label-list values. + +```python +from allegroai import DatasetVersion + +# Getting a version +myDatasetversion = DatasetVersion.get_version(dataset_name='MyDataset', + version_name='VersionName') + +# Mapping out colors and labels of masks +myDatasetversion.set_masks_labels( + { + (0, 0, 0): ["background"], + (1, 1, 1): ["person", "sitting"], + (2, 2, 2): ["cat"], + } +) +``` + +#### Accessing Version Mask-label Mapping + +The mask values and labels are stored as a property in a dataset version's metadata. + +```python +mappping = myDatasetversion.get_metadata()['mask_labels'] + +print(mapping) +``` + +This should return a dictionary of the version's masks and labels, which should look something like this: + +```python +{'_all_': [{'value': [0, 0, 0], 'labels': ['background']}, {'value': [1, 1, 1], 'labels': ['person', 'sitting']}, {'value': [2, 2, 2], 'labels': ['cat']}]} +``` diff --git a/docs/hyperdatasets/masks.md b/docs/hyperdatasets/masks.md index 774ea2ab..ad74975f 100644 --- a/docs/hyperdatasets/masks.md +++ b/docs/hyperdatasets/masks.md @@ -239,3 +239,19 @@ This example shows two masks for video from a camera. The masks label cars and t * Each ROI has a label of `right_lane` indicating the ROI object. * Each `mask` has an `id` (`car`, `person`) and a unique RGB `value` (color-coding). +## Usage + +### Adding mask annotations + +To add a mask annotation to a frame, use the `add_annotation` method of the [SingleFrame](single_frames.md) class. This +method is generally used to add ROI annotations, but it can also be used to add frame specific mask labels. Input the +mask value as a list with the RGB values in the `mask_rgb` parameter, and a list of labels in the `labels` parameter. + +```python +frame = SingleFrame( + source='/home/user/woof_meow.jpg', + preview_uri='https://storage.googleapis.com/kaggle-competitions/kaggle/3362/media/woof_meow.jpg', + +frame.add_annotation(mask_rgb=[0, 0, 0], labels=['cat']) +``` + diff --git a/docs/img/webapp_models_01.png b/docs/img/webapp_models_01.png index 01077720..462864ac 100644 Binary files a/docs/img/webapp_models_01.png and b/docs/img/webapp_models_01.png differ diff --git a/docs/img/webapp_models_table_batch_operations.png b/docs/img/webapp_models_table_batch_operations.png index e56f982b..c89b98e5 100644 Binary files a/docs/img/webapp_models_table_batch_operations.png and b/docs/img/webapp_models_table_batch_operations.png differ diff --git a/docs/webapp/webapp_model_table.md b/docs/webapp/webapp_model_table.md index 5ac56343..e9d31271 100644 --- a/docs/webapp/webapp_model_table.md +++ b/docs/webapp/webapp_model_table.md @@ -20,7 +20,7 @@ The models table contains the following columns: | **PROJECT** | The project with which the model is associated.| Default | | **USER** | The user who ran the experiment that created the model, or the user who imported the model.| Default | | **TASK** | The experiment (Task) name that created the model. | Default | -| **CREATED** | Elapsed time since the model creation. Hover over the elapsed time to view the date and time.| Default | +| **UPDATED** | Elapsed time since the model was updated. Hover over the elapsed time to view the date and time.| Default | | **DESCRIPTION** | The model description. | Default (hidden) |