Nodes/ComfyDL/DataLoader Preview (Output)
ComfyUI Node

DataLoader Preview (Output)

The same preview grid, but it shows up in your UI automatically

By Cynthia-lxx·Created 2 months ago·Updated 10 days ago· 6
DataLoader Preview (Output)
  • dataloader
  • image
◄num_rows2►
◄num_cols4►
◄max_samples32►

ComfyDL ships two DataLoader preview nodes that look almost identical, and the difference is one flag that changes everything about how you use them. CdlDataLoaderPreview (Output) is the convenience version: it's registered as an output node, which means ComfyUI displays its rendered grid directly in the UI and always executes it - you don't have to remember to route its IMAGE into a separate preview node. For quick inspection - "let me just see what this dataset looks like" - this is the one you want.

The plain DataLoader Preview node next to it does the same rendering but behaves like any other node: it emits an IMAGE you must wire somewhere yourself. This variant exists so the grid just appears, which is what a beginner reaching for "preview" almost certainly means.

How it works

Under the hood it's a thin wrapper: the node's execution is literally delegated to the plain preview's logic, then the result is returned with the output-node flag set. So the mechanism is identical - pull one batch with next(iter(dataloader)), figure out whether the batch carries labels, adapt to the tensor layout (RGB permute, normalization to [0, 1], grayscale for single-channel), render a num_rows × num_cols matplotlib grid capped at max_samples, and rasterize it back to an IMAGE.

The rendering uses matplotlib with the headless Agg backend, so it works fine on a server without a display. The one behavioral difference worth internalizing: as an output node it runs even when nothing downstream is consuming it - which is exactly what you want for a "show me the data" node, and slightly wasteful if you wire it into a big graph and forget it's there.

Inputs and outputs that matter

  • dataloader - any cdlDataloader (Fashion-MNIST, Bananas Detection, Load Array output, …).
  • num_rows (default 2), num_cols (default 4) - grid dimensions.
  • max_samples (optional, default 32) - cap on how many samples render.

The image output is still a real IMAGE tensor, so you can both let it display in the UI and wire it onward into a save or image-processing node if you want a copy.

Installing ComfyDL

cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL ./ComfyDL
pip install -r ./ComfyDL/requirements.txt

Restart ComfyUI and look under Datasets. ComfyDL's dependencies are light (matplotlib, IPython, matplotlib-inline), no downloads here. If ComfyUI Manager can't find "ComfyDL", clone - the pack is young.

Gotchas

Same first-batch caveat as its sibling: it previews batch zero only, so a non-shuffled dataset can show you an unrepresentative slice. And know that as an output node it executes on every run whether you're looking at it or not - leave one of these in a graph you're iterating on heavily and it's a small amount of matplotlib work happening every queue. For a one-off "show me the data" check, though, this is the friendlier half of the pair.

Categoryd2l/Datasets

Inputs (4)

NameTypeDefaultDescription
dataloadercdlDataloader—
num_rowsINT21–16—
num_colsINT41–16—
max_samplesoptINT321–256—

Outputs (1)

NameTypeDescription
imageIMAGE—