Train/validation split

Overview

Splits a dataset’s images, with their annotations, into train and validation datasets, plus a test dataset when you select one. Operation mode decides whether the images stay in the source (Copy) or leave it (Move).

The train and validation datasets don’t need to exist beforehand. Left empty, each is the node’s own output dataset, Train split or Val split, and a rerun writes a new version of each instead of creating another set. The test split exists only when you select a test dataset.

Use it to split the data before training.

Dataset Train/validation split Train Dataset Val Dataset

Prerequisites

RequirementWhat you need
Source datasetExisting Dataset with at least one image.
Separate datasetsA different dataset for the source and for each destination.
Available imagesEnough unassigned images for every enabled split to receive at least one after rounding.

How it works

1

Uses the destination datasets you select. For a train or validation split not given, it takes its own output dataset for that split — created on the first run, a new empty version of it on a rerun.

2

Skips images already found in any selected destination. Only unassigned source images enter the new split.

3

Shuffle data randomizes those images by default. Without a test set, training gets 80% by default and validation gets the rest. With a test set, the default is 70/15/15 for train, validation, and test. All three values must be positive integers that add up to 100.

4

Rounds train and validation counts down, then sends the remainder to the final split. For example, 10 images at 70/15/15 produce 7/1/2. Each enabled split must get at least one image.

5

Copy keeps the image and annotation memberships in the source. Move removes those memberships from the source, but the assets and files stay in OvalBee. Both modes add the images and their source annotations to the destinations.

FAQ

It splits images only. Videos stay in the source, and the node does not balance the split by class. There is no setting for a random seed, so separate shuffled runs can produce different splits.

The ratio format or total is invalid, or too few unassigned images remain after rounding. Use valid percentages and make sure every enabled split gets at least one image.

Ratios apply only to images handled in the current run. The node skips images already found in any destination you selected, and it does not duplicate or rebalance earlier assignments when you change the ratios or Shuffle data. If no unassigned images remain, a rerun returns the selected datasets unchanged. To split the full set again, start with a source that contains all images and use fresh destination datasets.

Each rerun starts a new, empty version of every split dataset the node created, so nothing counts as already split and every image in the source is split again. Earlier splits stay in the version history. With Move, the images an earlier run moved out are no longer in the source, so the new versions receive only the images added to the source since then, and the run fails when the source is empty. Select your own destination datasets when later runs should only add new images to an existing split.

Each destination receives the source class list without losing its existing classes. A split dataset the node created is pinned to the source’s ontology, while a destination you selected keeps its own ontology, widened with the source’s classes.

Inputs

From dataset
datasetRequired

Dataset whose images are split. Images that already sit in a split dataset you selected are left where they are, so a rerun into it only handles what is new. Key: SRC_DATASET.

Train dataset
dataset

Where the train images go. Leave empty to use the node’s own train output dataset. Key: TRAIN_DATASET.

Validation dataset
dataset

Where the validation images go. Leave empty to use the node’s own validation output dataset. Key: VAL_DATASET.

Test dataset
dataset

Name a dataset here to add a third, test split. Leave empty to split into train and validation only. Key: TEST_DATASET.

Train split ratio (%)
integerDefaults to 80

Percentage of new images for the train split. The remaining new images go to validation. Minimum: 1. Maximum: 100. Step: 1. Visible when TEST_DATASET is empty. Key: TRAIN_SPLIT_RATIO.

Split ratios (%)
stringDefaults to 70/15/15

Three slash-separated percentages for train, validation, and test, for example 70/15/15. Split values must sum to 100. Visible when TEST_DATASET is not empty. Key: SPLIT_RATIOS.

Shuffle data
booleanDefaults to true

Mix the images up before cutting them into splits. Turn this off to split them in the order they come in. Key: RANDOM.

Operation mode
selectDefaults to copy

Copy leaves the images in the source dataset as well. Move takes them out of it. Key: OPERATION_MODE.

Options:

  • Move (move)
  • Copy (copy)

Outputs

Train Dataset
dataset

ID of the train dataset. Shown as an artifact. Key: TRAIN_DATASET.

Val Dataset
dataset

ID of the validation dataset. Shown as an artifact. Key: VAL_DATASET.

Test Dataset
dataset

ID of the test dataset. Shown as an artifact. Key: TEST_DATASET.

JSON config

Machine-readable node interface for automation and advanced usage.

{
"name": "Train/validation split",
"description": "Splits a dataset's images, with their annotations, into train and validation datasets and an optional test dataset, either copying them or moving them out of the source.",
"category": "Sample",
"namespace": "ovalbee",
"templateKey": "sample/train_validation_split",
"version": "v1",
"inputs": [
{
"key": "SRC_DATASET",
"label": "From dataset",
"type": "dataset",
"description": "Dataset whose images are split. Images that already sit in a split dataset you selected are left where they are, so a rerun into it only handles what is new.",
"required": true,
"default": null,
"visibleWhen": null,
"options": {
"creatable": false
}
},
{
"key": "TRAIN_DATASET",
"label": "Train dataset",
"type": "dataset",
"description": "Where the train images go. Leave empty to use the node's own train output dataset.",
"required": false,
"default": null,
"visibleWhen": null
},
{
"key": "VAL_DATASET",
"label": "Validation dataset",
"type": "dataset",
"description": "Where the validation images go. Leave empty to use the node's own validation output dataset.",
"required": false,
"default": null,
"visibleWhen": null
},
{
"key": "TEST_DATASET",
"label": "Test dataset",
"type": "dataset",
"description": "Name a dataset here to add a third, test split. Leave empty to split into train and validation only.",
"required": false,
"default": null,
"visibleWhen": null
},
{
"key": "TRAIN_SPLIT_RATIO",
"label": "Train split ratio (%)",
"type": "number",
"description": "Percentage of new images for the train split. The remaining new images go to validation.",
"required": false,
"default": 80,
"visibleWhen": {
"key": "TEST_DATASET",
"operator": "equals",
"value": null
},
"options": {
"min": 1,
"max": 100,
"step": 1,
"type": "integer"
}
},
{
"key": "SPLIT_RATIOS",
"label": "Split ratios (%)",
"type": "string",
"description": "Three slash-separated percentages for train, validation, and test, for example 70/15/15. Split values must sum to 100.",
"required": false,
"default": "70/15/15",
"visibleWhen": {
"key": "TEST_DATASET",
"operator": "notEquals",
"value": null
}
},
{
"key": "RANDOM",
"label": "Shuffle data",
"type": "boolean",
"description": "Mix the images up before cutting them into splits. Turn this off to split them in the order they come in.",
"required": false,
"default": true,
"visibleWhen": null
},
{
"key": "OPERATION_MODE",
"label": "Operation mode",
"type": "select",
"description": "Copy leaves the images in the source dataset as well. Move takes them out of it.",
"required": false,
"default": "copy",
"visibleWhen": null,
"options": {
"options": [
{
"label": "Move",
"value": "move"
},
{
"label": "Copy",
"value": "copy"
}
]
}
}
],
"outputs": [
{
"key": "TRAIN_DATASET",
"label": "Train Dataset",
"type": "dataset",
"description": "ID of the train dataset.",
"artifact": true,
"badge": false,
"badgeOpens": null,
"hidden": false
},
{
"key": "VAL_DATASET",
"label": "Val Dataset",
"type": "dataset",
"description": "ID of the validation dataset.",
"artifact": true,
"badge": false,
"badgeOpens": null,
"hidden": false
},
{
"key": "TEST_DATASET",
"label": "Test Dataset",
"type": "dataset",
"description": "ID of the test dataset.",
"artifact": true,
"badge": false,
"badgeOpens": null,
"hidden": false
}
]
}