Nodes/ComfyUI-WJNodes/load torchvision model
ComfyUI Node

load torchvision model

A ResNet-family loader for image similarity, not generation

By 807502278·Created 2 years ago·Updated 11 months ago· 21
load torchvision model
    • Similarity
    model_nameresnet18
    downloadLocalOnly
    devicedefault

    Don't confuse this with a Stable Diffusion checkpoint loader - it's a completely different family of model, doing a completely different job. This node loads a classic torchvision classification backbone (ResNet and friends) purely to extract feature embeddings, and its whole purpose is feeding the companion node, Run_torchvision_model, which turns those embeddings into an image-similarity score.

    It ships in ComfyUI-WJNodes, a small personal utility pack - the kind of thing its author (a GitHub account with no name, just the handle 807502278) built to solve their own problems and shared as-is. There's essentially zero chatter about this pack anywhere online; it's not a name you'll find in tutorials or troubleshooting threads, so the README is genuinely the only documentation you'll get.

    What it's actually for

    Diffusion models generate; this node measures. The classic use for a feature-extractor backbone like ResNet is comparing two images numerically - not "does this look like a cat," but "how close are these two images in embedding space." That's the building block for things like deduplicating near-identical frames in a batch, checking whether a generated output drifted too far from a reference, or filtering a large image set down to visually-distinct examples. None of that is diffusion - it's classic computer-vision tooling, decades older than Stable Diffusion, repurposed here as a ComfyUI utility.

    Inputs that matter

    Three, all with sensible defaults:

    • model_name - which backbone to load. The pool is large (24 choices) and defaults to resnet18, the smallest and fastest of the bunch. Bigger variants (resnet50, resnet101, resnet152, the ResNeXt and Wide ResNet variants, DenseNet) trade speed for slightly better feature quality - for a similarity check, resnet18 or resnet50 is plenty; you're not fine-tuning a classifier, just extracting embeddings.
    • download - LocalOnly (default) or Download. torchvision weights aren't bundled with ComfyUI; if you haven't already got the .pth file cached, you need Download on the first run so it can fetch the weights, or place them manually per the README's layout (models/torchvision/resnet/resnet50-11ad3fa6.pth, etc.).
    • device - default or cpu. Leave it on default unless you're deliberately keeping this off the GPU.

    The single output is a Similarity object - not an image, not a tensor you'd look at directly, just the loaded model wrapped up for the next node to consume.

    Installing it

    ComfyUI Manager: search "ComfyUI-WJNodes." Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/807502278/ComfyUI-WJNodes.git
    

    Restart ComfyUI. The README notes most Python dependencies are already covered by a standard ComfyUI environment (torchvision ships alongside torch), with an optional pip install -r requirements.txt if something's still missing.

    Where this bites

    The most common snag is the weights themselves. LocalOnly means exactly what it says - if the model file isn't already sitting in models/torchvision/, the node has nothing to load and will error out rather than silently reaching for the internet. Flip download to Download for that first run so torchvision can pull the weights from its usual source, then you can switch back to LocalOnly for repeat runs if you want to guarantee no surprise network calls later.

    Second: this node only loads the model. It does nothing visible on its own - no preview, no useful output by itself - so if you wire it up and get "nothing happened," that's expected. It only does something once you connect its Similarity output into Run_torchvision_model, which is where the actual comparison happens.

    Beyond that, there's no community troubleshooting trail to lean on for this one - it's obscure enough that problems here get solved by reading the source or opening a GitHub issue, not by searching Reddit.

    CategoryWJNode/Other-plugins/Detection

    Inputs (3)

    NameTypeDefaultDescription
    model_nameCOMBOresnet1824 options: resnet18, resnet34, resnet50, resnet101, resnet152, resnext50_32x4d, +18
    downloadCOMBOLocalOnly2 options: LocalOnly, Download
    deviceCOMBOdefault2 options: default, cpu

    Outputs (1)

    NameTypeDescription
    SimilaritySimilarity