Random sample

Overview

Draws a random sample of images from a dataset and adds them, with their annotations, to a destination dataset. An image drawn once is never drawn again by the same node, so each run returns new images.

LAST_RUN opens the latest sample. A hidden ALL_SAMPLED_ASSETS output points to the history dataset that prevents later runs of the same node from selecting those images again. The badge shows the latest sample size and opens LAST_RUN.

Dataset Random sample Dataset

How it works

1

Compares the source images with the node’s sampling history.

2

Chooses a random sample from the images that haven’t been drawn before.

3

Adds the images and their annotations to LAST_RUN and to the history dataset.

FAQ

The node samples every remaining image without failing.

The node stops the flow, returns no LAST_RUN dataset, and shows a badge count of zero. The existing history dataset remains available.

Without a destination, the node writes each sample into its own output dataset, named Random sample: created on the first run, a new empty version of it on every rerun, so LAST_RUN holds only the latest sample. A destination you select is never versioned, so it keeps collecting the samples of every run.

The sampling history belongs to this node and has no reset. A newly added Random sample node starts with an empty history.

No. This version samples image assets only.

Inputs

From dataset
datasetRequired

Source dataset the assets are drawn from. Assets drawn in earlier runs are skipped, so each run returns new ones. Key: SRC_DATASET.

Destination dataset
dataset

Destination dataset the sampled assets are added to. Leave empty to use the node’s own output dataset. Key: DST_DATASET.

Sample size
integerDefaults to 10Required

Number of assets to draw. Fewer are returned when the source has no unseen assets left. Minimum: 1. Step: 1. Key: SAMPLE_SIZE.

Outputs

Sample
dataset

Dataset with the images drawn by the latest run. A rerun writes a new version of it. Shown as an artifact. Key: LAST_RUN.

Last Sample Images Count
string

Short badge with the number of images added in the latest sample. Shown on the node as a badge. Selecting the badge opens LAST_RUN. Key: LAST_SAMPLE_IMAGES_COUNT.

All Sampled Assets
dataset

ID of the dataset containing all images sampled by this node across runs. Hidden from the flow editor. Key: ALL_SAMPLED_ASSETS.

JSON config

Machine-readable node interface for automation and advanced usage.

{
"name": "Random sample",
"description": "Draws a random sample of images from a source dataset and adds them, with their annotations, to a destination dataset. Images drawn in earlier runs are skipped, so each run returns new ones. Without a destination, the node's own output dataset holds only the latest sample.",
"category": "Sample",
"namespace": "ovalbee",
"templateKey": "sample/random_sample",
"version": "v1",
"inputs": [
{
"key": "SRC_DATASET",
"label": "From dataset",
"type": "dataset",
"description": "Source dataset the assets are drawn from. Assets drawn in earlier runs are skipped, so each run returns new ones.",
"required": true,
"default": null,
"visibleWhen": null,
"options": {
"creatable": false
}
},
{
"key": "DST_DATASET",
"label": "Destination dataset",
"type": "dataset",
"description": "Destination dataset the sampled assets are added to. Leave empty to use the node's own output dataset.",
"required": false,
"default": null,
"visibleWhen": null
},
{
"key": "SAMPLE_SIZE",
"label": "Sample size",
"type": "number",
"description": "Number of assets to draw. Fewer are returned when the source has no unseen assets left.",
"required": true,
"default": 10,
"visibleWhen": null,
"options": {
"type": "integer",
"min": 1,
"step": 1
}
}
],
"outputs": [
{
"key": "LAST_RUN",
"label": "Sample",
"type": "dataset",
"description": "Dataset with the images drawn by the latest run. A rerun writes a new version of it.",
"artifact": true,
"badge": false,
"badgeOpens": null,
"hidden": false
},
{
"key": "LAST_SAMPLE_IMAGES_COUNT",
"label": "Last Sample Images Count",
"type": "string",
"description": "Short badge with the number of images added in the latest sample.",
"artifact": false,
"badge": true,
"badgeOpens": "LAST_RUN",
"hidden": false
},
{
"key": "ALL_SAMPLED_ASSETS",
"label": "All Sampled Assets",
"type": "dataset",
"description": "ID of the dataset containing all images sampled by this node across runs.",
"artifact": false,
"badge": false,
"badgeOpens": null,
"hidden": true
}
]
}