Datapoint Creator

The datapoint creator is an interface to programmatically upload datapoint data (just images or images with labels) to the RedBrick AI Data Warehouse.

Overview

redbrick.dataset.DatapointCreator(
org_id: str,
data_set_name: str,
storage_id: str,
label_set_name: str = None
)
Parameters
Methods
Parameters

Parameter

Description

org_id

Your organization id, can be found in the url https://app.redbrickai.com/<org_id>/

data_set_name

The name of the dataset to store this datapoint to.

storage_id

Storage method id. Can be found on Data Warehouse -> Storage

label_set_name

Optional. The name of the labelset to store this datapoint to. If set, then a list of labels must be passed when calling create_datapoint method.

Methods
create_datapoint(
name: str,
items: List[str],
labels: List[Dict] = None
)

Parameter

Description

name

Name of current datapoint. This needs to be a unique string for each datapoint in a dataset.

items

List of strings containing URLs to image data. Single URL if image data; multiple URLs (corresponding to video frames) if video data.

labels

Optional. List of label dictionaries in redbrick format. If a label_set_name was passed to DatapointCreator object, then this parameter must be specified.

Usage

Creating a DatapointCreator reference

To create a DatapointCreator object, you need to do the following.

import redbrick
from redbrick.dataset import DatapointCreator
redbrick.init(api_key="<your_api_key>")
dp_creator = DatapointCreator(
org_id="<org_id>",
data_set_name="<data_set_name>",
storage_id="<storage_id>",
label_set_name="<label_set_name>"
)

The organization id is available from the URL when you're logged into the platform - https://app.redbrickai.com/<org_id>/

The storage id can be found on:https://app.redbrickai.com/<org_id>/warehouse#storage

Creating a datapoint

To create a datapoint you can use the following code, please note that the used variables are only for demonstration purposes:

_name = "chevrolet"
_items = [
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Chevrolet_Onix_20150814-DSC05650.JPG/320px-Chevrolet_Onix_20150814-DSC05650.JPG"
]
_labels = [
{
"attributes": [],
"category": [["object", "car"]],
"labelid": "2",
"bbox2d": {"xnorm": 0.1, "ynorm": 0.2, "wnorm": 0.8, "hnorm": 0.7},
}
]
dp_creator.create_datapoint(
name=_name,
items=_items,
labels=_labels
)