Nodes/ComfyDL/Fashion-MNIST
ComfyUI Node

Fashion-MNIST

Fashion-MNIST as a ComfyUI dataset

By Cynthia-lxx·Created 2 months ago·Updated about 16 hours ago· 6
Fashion-MNIST
    • train_loader
    • test_loader
    • class_names
    batch_size64
    resize28

    Original MNIST is the "hello world" of image classification, but it has a dirty secret: handwritten digits are so easy that even a weak model hits 99%, which teaches you nothing about whether your model is actually good. Fashion-MNIST was built to fix that - it swapped the digits for 28×28 grayscale photos of ten clothing categories that are genuinely harder to tell apart (a coat versus a shirt versus a pullover will humble your first CNN). ComfyDL's CdlFashionMNIST loads it into ready-to-train PyTorch DataLoaders.

    It's the pack's main "first model" dataset. Want to train a LeNet-style CNN or test an attention module end-to-end without hunting for data? This node is where you start.

    How it works

    The node calls the d2l load_data_fashion_mnist helper, which wraps torchvision.datasets.FashionMNIST. On first use it downloads the dataset (~30 MB, cached under the data folder), then builds two DataLoaders: a shuffled training iterator over 60,000 images and an unshuffled test iterator over 10,000. Your resize value, if nonzero, is inserted as a transforms.Resize step; otherwise images stay at their native 28×28. The labels are the ten class indices 0–9, which is why the node also hands you the class names.

    Inputs and outputs that matter

    • batch_size (default 64, up to 2048) - samples per batch.
    • resize (default 28) - resize images to (resize × resize). Set to 0 to keep the native 28×28. The slider goes to 512, but the real use is downscaling (some d2l workflows resize smaller to speed up LeNet demos) - upscaling 28×28 to 512 is just inventing work.

    Three outputs:

    • train_loader and test_loader (cdlDataloader) - wire these into ComfyDL's training/eval utilities, or into DataLoader Preview / Dataset Stats to eyeball the data first.
    • class_names (STRING) - the ten names, newline-separated (t-shirt, trouser, pullover, …). Handy for display or for feeding labels into a stats node (which wants them comma-separated - so replace the newlines if you pipe them there).

    Installing ComfyDL

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

    Restart ComfyUI, then double-click and search "Fashion-MNIST". ComfyDL's requirements are light (matplotlib, IPython, matplotlib-inline); the dataset itself downloads on first run. Note it relies on torchvision, which ships with ComfyUI, so you're not installing anything extra. If ComfyUI Manager doesn't list "ComfyDL" yet, the clone command is the reliable path.

    Gotchas

    First-run download is the usual moment of confusion: the node looks frozen while ~30 MB downloads into the data folder. Where exactly is that folder? The d2l helpers save to ../data relative to where ComfyUI was launched - so if you started ComfyUI from its install folder, data lands in a sibling folder above it, not inside ComfyUI/. It's harmless, just surprising. And a quiet performance note: the d2l helper spins up 4 loader worker processes, so a tiny demo may feel slower to start than you'd expect on first batch.

    CategoryComfyDL/Datasets

    Inputs (2)

    NameTypeDefaultDescription
    batch_sizeINT641–2048
    resizeINT280–512

    Outputs (3)

    NameTypeDescription
    train_loadercdlDataloader
    test_loadercdlDataloader
    class_namesSTRING