RandomSplitsTable

Introduction

RandomSplitsTable widget in Supervisely allows users to create random splits of their data for training, validation, and testing purposes. The widget enables users to define the percentage of data they want to allocate to each split, and then randomly assigns images or annotations to each split. This widget is particularly useful for machine learning projects, as it allows users to easily manage their training, validation, and testing data without having to manually split the data themselves. RandomSplitsTable widget provides a flexible and convenient way for users to organize their data splits, and can be customized to match the requirements of their project. RandomSplitsTable widget is a valuable tool for improving the accuracy and efficiency of machine learning projects that require data splits.

Function signature

RandomSplitsTable(
    items_count,
    start_train_percent=80,
    disabled=False,
    widget_id=None,
)

Parameters

Parameters
Type
Description

items_count

int

Number of items to split

start_train_percent

int

Start % to split items

disabled

bool

Disable widget

widget_id

str

ID of the widget

items_count

Determine number of items to split.

type: int

start_train_percent

Determine start % to split items. If start_train_percent not in range [1; 99] raise ValueError.

type: int

default value: 80

disabled

Disable widget.

type: bool

default value: False

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

get_splits_counts()

Returns the result of separating items { "total": <int>, "train": <int>, "val": <int>}.

set_train_split_percent()

Set the percentage of objects that will be assigned to the training sample (train) in RandomSplitsTable.

get_train_split_percent()

Get training split percent.

set_val_split_percent()

Set the percentage of objects that will be assigned to the validation sample (val) in RandomSplitsTable.

get_val_split_percent()

Get validation split percent.

Mini App Example

You can find this example in our Github repository:

ui-widgets-demos/tables/005_random_splits_table/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Prepare items count

Initialize RandomSplitsTable widget

Create Button and Text widgets

Create app layout

Prepare a layout for app using Card widget with the content parameter and place widget that we've just created in the Container widget.

Create app using layout

Create an app object with layout parameter.

Add function to control widget from code

Last updated

Was this helpful?