Super Resolution
Upscale video frames in real-time using GPU acceleration.
Introduction
The Super Resolution node upscales video frames with pre-trained models. The process leverages GPU acceleration through OpenCV compiled with CUDA support, ensuring exceptional speed ideal for real-time applications. When using workflows with base Stable Diffusion models optimized for 512x512, higher resolutions can compromise efficiency and FPS. In these scenarios, a dedicated super-resolution node allows upscaling without significantly affecting performance or quality.
Setup Method
The node is optimized for high-speed upscaling and requires OpenCV with CUDA support. By running ComfyStream with the Docker setup, you get a precompiled package from ComfyUI-Stream-Pack/releases included in the Docker image. This eliminates the need for manual compilation.
The node is optimized for high-speed upscaling and requires OpenCV with CUDA support. By running ComfyStream with the Docker setup, you get a precompiled package from ComfyUI-Stream-Pack/releases included in the Docker image. This eliminates the need for manual compilation.
If you prefer to install OpenCV with CUDA support manually, follow the guide in article Installing OpenCV with CUDA Support.This guides you through the multiple steps and prerequisites needed to successfully compile OpenCV package.
You can use the following code block as a reference, modify the paths and variables to match your system.
After the compilation, you can verify that OpenCV is installed correctly by running:
This should output 1
or higher depending on the number of CUDA-enabled devices in your machine if installation was successful.
Adding the Node
An example upscaling workflow using the Super Resolution node is available here.
Install the StreamPack Nodes
Ensure the StreamPack custom nodes are installed in your ComfyUI setup. Follow the installation instructions for a step-by-step guide.
Open the ComfyUI Graph Editor
Right-click on an empty area of the canvas and choose Add Node.
Find the Super Resolution Nodes
Search for SuperResolution
under the StreamPack/
category.
Place it in the Workflow
There are two nodes under SuperResolution: SR Model Loader
and SR Upscale
. You need both to upscale, so place them on the canvas.
Connect Inputs and Configure Parameters
- In
SR Model Loader
, you’ll see widgets to select the upscaling model and scale factor. - Connect the output of
SR Model Loader
to the input ofSR Upscale
. - In the
SR Upscale
node, toggle theuse CUDA
widget totrue
to enable CUDA acceleration. - Connect an image to the input of
SR Upscale
and a preview node to the output.
Minimal Super Resolution Node Implementation
Parameters
The following parameters control how the Super Resolution models behave:
SR Model Loader Node
Model Type: Select the upscaling model to use. The quality and performance vary by model. Models are downloaded and loaded automatically when selected in the canvas. Below is a basic comparison of the models.
Model | Architecture | Features | Best For | Speed | Quality |
---|---|---|---|---|---|
FSRCNN-small | Lightweight CNN | Fast, minimal memory use | Real-time processing, mobile | ★★★★★ | ★★ |
FSRCNN | CNN with larger features | Good balance of speed/quality | General purpose | ★★★★ | ★★★ |
ESPCN | Sub-pixel convolutions | Efficient upscaling at end | Text/line drawings | ★★★★ | ★★★ |
VDSR | Very deep CNN | Better edge reconstruction | Detailed images with edges | ★★★ | ★★★★ |
LapSRN | Laplacian pyramid | Progressive upscaling | Sharp edges, details | ★★★ | ★★★★ |
EDSR | Deep residual network | Most parameters, best quality | Maximum detail | ★★ | ★★★★★ |
Scale Factor: Select the upscaling factor. The image will be upscaled by
this factor. For example, if the input image is 512x512
, the output will be
1024x1024
with a scale factor of 2
.
SR Upscale Node
Use CUDA: Toggle to true
to enable CUDA acceleration for upscaling.
Strengths and Limitations
While the Super Resolution node offers significant performance benefits compared to other upscaling methods, it also introduces a few trade-offs depending on your use case.
Strengths
- Wide suite of supported models – Option to choose from multiple models (FSRCNN, ESPCN, LapSRN, EDSR) with different quality/speed tradeoffs.
- Modular Design – Once a model is loaded, it can be reused across multiple upscaling operations.
- Fast performance via CUDA – Configurable CUDA acceleration for optimal performance.
- Multiple Scale Factors – Support for 2x, 3x, and 4x upscaling.
Limitations
- Setup Complexity – The node requires a version of OpenCV with CUDA support, which may require additional setup, since the CUDA is only available for NVIDIA GPUs, it will not work on other GPUs.