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.
How it works
FAQ
What if fewer images remain than the requested sample size?
The node samples every remaining image without failing.
What happens when every image has already been sampled?
The node stops the flow, returns no LAST_RUN dataset, and shows a badge count of zero. The existing history dataset remains available.
What happens to the sample dataset on a rerun?
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.
How do I sample images again that were drawn before?
The sampling history belongs to this node and has no reset. A newly added Random sample node starts with an empty history.
Can this node sample videos?
No. This version samples image assets only.
Inputs
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 the sampled assets are added to. Leave empty to use the node’s own output dataset. Key: DST_DATASET.
Number of assets to draw. Fewer are returned when the source has no unseen assets left. Minimum: 1. Step: 1. Key: SAMPLE_SIZE.
Outputs
Dataset with the images drawn by the latest run. A rerun writes a new version of it. Shown as an artifact. Key: LAST_RUN.
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.
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.