Dataset Visualization
How to connect Hub datasets to Activeloop Platform
Activeloop Platform is web-based tool for visualizing, versioning, querying, and operating on datasets. It utilizes the Hub format under-the-hood, and it makes assumptions about relationships between tensors in order to display the data. Understanding these assumption is necessary in order to effectively use the visualizer.

Hub htype

The primary concept for understanding how data should be visualized is the Hub type htype. It is a holistic description of the underlying data, such as video, image, bbox, and many others.
Activeloop Platform can only visualize tensors that have a specified htype.

Indexing

Hub datasets and their tensors are indexed like ds[index] or ds.tensor_name[index], and data at the same index are assumed to be related. For example, a bounding_box at index 100 is assumed to apply to the image at index 100.

Relationships Between Tensors

For datasets with multiple tensors, the relationship between the data may be ambiguous. It is important to follow the conventions below in order for the visualizer to correctly infer how tensors are related.
By default, in the absence of groups, the visualizer assumes that all tensors are related to each other.
This works well for simple use cases. For example, it is correct to assume that the images, labels, and boxes tensors are related in the dataset below:
1
ds
2
-> images (htype = image)
3
-> labels (htype = class_label)
4
-> boxes (htype = bbox)
Copied!
However, if datasets are highly complex, assuming that all tensor are related may lead to visualization errors, because every tensor may not be related to ever other tensor:
1
ds
2
-> images (htype = image)
3
-> vehicle_labels (htype = class_label)
4
-> vehicle_boxes (htype = bbox)
5
-> people_labels (htype = class_label)
6
-> people_masks (htype = binary_mask)
Copied!
In the example above, only some of the annotation tensors are related to each other:
  • vehicle_labels -> vehicle_boxes: Boxes and labels describing cars, trucks, etc.
  • people_labels -> people_masks: Binary masks and labels describing adults, toddlers, etc.
The best method for disambiguating the relationships between tensors is to place them in groups, because the visualizer assumes that annotation tensors in different groups are not related.
In the example above, the following groups could be used to disambiguate the annotations:
1
ds
2
-> images (htype = image)
3
-> vehicles (group)
4
-> vehicle_labels (htype = class_label)
5
-> vehicle_boxes (htype = bbox)
6
-> people (group)
7
-> people_labels (htype = class_label)
8
-> people_masks (htype = binary_mask)
Copied!

Visualizing Class Labels

Class labels are stored as numerical values in tensors, but they are mapped by the visualizer to the list ds.tensor_name.info.class_names. This object must be a list of strings, where the numerical labels in the tensor correspond to the index position in the above list. The class_names list can be specified during tensor creation and can be updated later:
ds.create_tensor('tensor_name', htype = 'class_label', class_names = [...])
ds.tensor_name.info.update(class_names = [...])

Visualizing Bounding Boxes

Bounding boxes have a variety of formats such as YOLO, COCO, Pascal-VOC, and others. In order for the bounding boxes to be correctly displayed by the visualizer, the format of the bounding box must be specified in the coords key in the tensor meta information:
ds.boxes.info.update(coords = {'type': '...', 'mode': '...'})
  • type specifies the units of the bounding box coordinates
    • 'pixel' is in units of pixels
    • 'fractional' is in units relative to the width and height, such as in YOLO format
  • mode specifies the convention for the 4 bounding box coordinates from along the coordinate axis
    • 'LTRB' - left_x, top_y, right_x, bottom_y
    • 'LTWH' - left_x, top_y, width, height
    • 'CCWH' - center_x, center_y, width, height
If the bounding box format is not specified, the
If the bounding box format is not specified, the visualizer will assume a YOLO format (fractional + CCWH) if the bounding box coordinates are < 1 on average. Otherwise, it will assume the COCO format (pixel + LTHW).
Last modified 2d ago