Random sample
Overview
Draws a random sample of images from a dataset, with their annotations. An image drawn once is never drawn again by the same node, so each run returns new images.
LAST_RUN opens the latest sample, with or without a destination. A destination dataset collects every 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?
The node writes each sample into its own output dataset, named after the source, such as Random sample (Cats): created on the first run, a new empty version of it on every rerun, so LAST_RUN holds only the latest sample. Switching to a source with another name starts a new dataset, and switching back continues the old one. A destination you select is not versioned: each run adds its images to it, so it collects every sample.
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.
Dataset that collects every sample - each run adds its images to it. Leave empty to keep only the Sample output. 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, named after the source dataset. A rerun writes a new version of it, and a new source starts a new dataset. Shown as an artifact. Key: LAST_RUN.
Short badge with the number of images the latest run sampled, such as 10 images sampled. 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.