samlab.dashboard.backend.limbo module

Backends to integrate Limbo datasets with the dashboard.

class samlab.dashboard.backend.limbo.ImageCollection(*, name, dataset, readonly=True)[source]

Bases: ImageCollection

ImageCollection backend for visualizing a specification dataset in the Samlab Dashboard.

Parameters
  • name (str, required) – Unique identifier for this backend instance.

  • dataset (limbo.data.Dataset, required) – Limbo dataset to be visualized.

  • readonly (bool, optional) – If True, no changes to the dataset will be allowed. Includes changes to bounding boxes and tags.

bboxes(index)[source]

Return bounding box annotations applied to the image with the given index.

Parameters

index (int, required) – Index of the image.

Returns

bboxes – Sequence of bounding boxes. Each box is a dict containing “left”, “top”, “width”, “height”, “category”, and “color” values. The bounding box position and size values are measured in absolute pixels. The color value is a string containing a CSS-compatible color specification.

Return type

list of dict

get(index)[source]

Return the image with the given index.

Parameters

index (int, required) – Index of the image.

Returns

image – Absolute filesystem path of the image.

Return type

str

metadata(index)[source]

Return metadata for the image with the given index.

Parameters

index (int, required) – Index of the image.

Returns

metadata – JSON-compatible, arbitrarily-nested dict of metadata information.

Return type

dict

property name

Unique identifier for this instance.

put_bboxes(index, bboxes)[source]

Set bounding box annotations for the image with the given index.

Note that this overrides all bounding box annotations for the image.

Parameters
  • index (int, required) – Index of the image.

  • bboxes (list of dict, required) – List of bounding boxes. See bboxes for details.

Returns

updatedTrue if the changes were saved, otherwise False.

Return type

bool

put_tags(index, tags)[source]

Set tags for the image with the given index.

Note that this overrides all tag annotations for the image.

Parameters
  • index (int, required) – Index of the image.

  • tags (list of str, required) – List of categories that will apply to the image as a whole.

Returns

updatedTrue if the changes were saved, otherwise False.

Return type

bool

tags(index)[source]

Return tags for the image with the given index.

Parameters

index (int, required) – Index of the image.

Returns

tags – Sequence of categories that apply to the image as a whole.

Return type

list of str