Skip to main content

RedBrick platform Python SDK!

Project description

Introduction

This is an SDK to make integration with the RedBrick platform as easy as possible. This includes uploading and downloading data as well as making your datasets easily available for training. Use this SDK to access your data and labels anywhere you run your code, whether that is on the cloud or locally with a Jupyter Notebook.

Please feel free to submit issues on github or at support@redbrickai.com if you run into any problems or have suggestions.

Quickstart

After creating an account on app.redbrickai.com,

pip install --upgrade redbrick-sdk

You'll need to get your API key before you can utilize the SDK.

"""redbrick quickstart."""
import redbrick

api_key = "<>"
url = "https://api.redbrickai.com"
org_id = "<>"
project_id = "<>"
project = redbrick.get_project(api_key, url, org_id, project_id)

Importing data

There is a single way to import data into your project through the sdk. This is done using the create datapoint api.

An example using a "Public" storage method is given below

# default public storage method
storage_id = "11111111-1111-1111-1111-111111111111"

datapoints = [
    {
        "name": "my first upload",
        "items": [
            "http://datasets.redbrickai.com/car-vids/car-1/frame20.png"
        ]
    }
]
failed_to_create = project.upload.create_datapoints(storage_id, datapoints)


# Datapoint object definition
{
    # REQUIRED: must be unique within a project
    "name": "my first upload",
    # List of urls or item paths, depending on your storage method
    "items": [
        "http://datasets.redbrickai.com/car-vids/car-1/frame20.png"
    ],
    # List of RedBrick Label objects
    "labels":  [<Label object>]

}

Exporting data from your project

import json

result = project.export.redbrick_format()

with open("export.json", "w+") as file_:
    json.dump(file_, result, indent=2)

COCO Format

Coco format is supported for bounding box and polygon image projects. All other label types will be ignored.

To export into this format, use the following code snippet:

coco_data = project.export.coco_format()

Image masks

In order export into image masks for image segmentation projects, use the following:

import os

project.export.png_masks(os.path("."))

This will produce a directory named "redbrick_masks" inside of the directory you specified.

Active Learning

Each cycle of active learning involves three steps:

  1. Data Export:

    • Get the unlabeled data, the labeled data, and the categories
  2. Training, inference, and prioritization:

    • Using the labeled and unlabeled data, perform an algorithmic process to generate a score for each unlabeled datapoint float[0, 1].
    • Optionally generate labels to use as prelabels in the labeling process.
  3. Upload results to RedBrick

    • Send the scores and optional labels to update your project
# 1. Get data
data = project.learning.get_learning_info()
# 2. perform your processing
training(data["labeled"], data["taxonomy"])

results = inference_and_sort(data["unlabeled"], data["taxonomy"])
# 3. Update your project
project.learning.update_tasks(results)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redbrick-sdk-0.4.9.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redbrick_sdk-0.4.9-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file redbrick-sdk-0.4.9.tar.gz.

File metadata

  • Download URL: redbrick-sdk-0.4.9.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for redbrick-sdk-0.4.9.tar.gz
Algorithm Hash digest
SHA256 1850ad33c7836f40ac624abad6eb891ebefbc02a0a133c1c1278782261137586
MD5 a8a60d01db1b5bf620ea7539f3c34fac
BLAKE2b-256 e2935b7b4de6369e950a5d998a1cc868790d07268c03948b6679d5a818e9f37e

See more details on using hashes here.

File details

Details for the file redbrick_sdk-0.4.9-py3-none-any.whl.

File metadata

  • Download URL: redbrick_sdk-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for redbrick_sdk-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9e8a1683d6857c089ff516e577e485a0849a2e1c8a6e2330c930b89ad718e055
MD5 2f7390954672973fa1949fe02b85f9df
BLAKE2b-256 5d84a05a9cf1ebd9d6e187353689e37714e8ba0420f97a4d9cd6fb259a49965e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page