Nodes/ComfyUI CV/cv2.getCPUFeaturesLine
ComfyUI Node

cv2.getCPUFeaturesLine

\"Why is this node fast for them and slow for me?\" — one string that answers it

By bmad4ever·Created 4 months ago·Updated 15 days ago· 1
cv2.getCPUFeaturesLine
    • string

    No inputs. One STRING output. And it's the single most useful thing to ask an OpenCV install when a filter node runs three times faster on someone else's machine.

    cv2.getCPUFeaturesLine() returns what the CPU advertises and what this OpenCV build actually dispatches to. On a typical modern desktop it looks like this:

    SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?
    

    Read the punctuation, it's the whole point:

    • No marker - the CPU has the feature, but this build isn't using it.
    • * - this build's dispatch chose that code path. These are your hot loops.
    • ? at the end - the CPU reports it but the build won't use it (AVX-512 on consumer silicon is the usual example).

    So *AVX2 present means OpenCV is running its vectorised kernels; a line that's just SSE SSE2 SSE3 with no asterisks means every blur, warp and resize in your graph is on the slow path. That's the difference between a filter playground being snappy and being unusable, and it is not something you can guess from the CPU model name - virtualised instances routinely mask AVX2, and so do some container/VM setups.

    Wiring it

    It's a leaf node with a STRING output, so wire it to any text display node. Everything it emits is fixed for the lifetime of the process, which means ComfyUI will happily cache it and never run it twice - a non-issue here, because the answer never changes, but worth knowing if you were expecting it to update.

    The output only has one argument per caller, so a screenshot of this string plus your cv2.__version__ is basically a complete bug report for "this pack is slow for me". If you need the fuller picture, the pack ships CV Build Information, which serves cv2.getBuildInformation() with the build machine's filesystem paths redacted. That redaction is deliberate: the raw getBuildInformation text bakes in the compiler, Python and library paths of whatever machine built the wheel, and on a self-built OpenCV that's somebody's home directory. The pack blacklists the raw wrapper for it and ships the curated node instead - a nice bit of care that most node packs don't have.

    Together with getDefaultAlgorithmHint, this node belongs to a small family in the pack that has nothing to do with pixels: it answers "what am I actually running".

    Install

    Manager → search ComfyUI CV, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_cv
    pip install "opencv-contrib-python-headless~=5.0.0.93"
    

    Restart. Python ≥ 3.12, recent ComfyUI on the V3 node API. The same function has been in OpenCV for years, so this node is present on essentially any build - it's the wheel's dispatch, not the API, that varies.

    Where people get burned

    • Same wheel, different line. Two people, same cv2 version, one has *AVX2 and one doesn't. Nothing is broken; one is just doing 4–8× the arithmetic per cycle. Don't debug a workflow's speed without this line.
    • It's about OpenCV's dispatch, not your CPU's rated speed. A newer chip with AVX2 disabled in the VM will lose to an older one that has it.
    • Don't read it as a benchmark. It tells you which paths are available, not what your graph is spending time in. For that, the pack's timing nodes (cv2.getTickCount plus getTickFrequency) bracket the operation you care about.
    Categoryimage/CV/low-level/cv2 G

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    stringSTRING—