A TensorRT-accelerated Nuke plugin for CorridorKey — the AI green screen keyer by Niko Pueringer / Corridor Digital that produces physically accurate unmixed foreground color and alpha.
This plugin runs the CorridorKey neural network directly inside Nuke as a native node (TRTCorridorKey), powered by NVIDIA TensorRT for real-time inference on the GPU.
CorridorKey takes a green screen plate and a coarse alpha hint, and produces a clean straight foreground color and linear alpha matte — preserving hair, motion blur, and semi-transparent edges that traditional keyers destroy.
This plugin wraps that model into a two-input Nuke node:
- Input 0 (plate): RGB green screen footage
- Input 1 (mask): Coarse alpha hint (rough chroma key or AI roto)
- Output: RGBA — unmixed FG color (sRGB) in RGB + linear alpha in A
The TensorRT engine runs at ~300ms per frame at 2048×2048 FP16 on an RTX A5000 (24 GB).
- Linux x86_64
- NVIDIA GPU with 24+ GB VRAM (tested on RTX A5000)
- CUDA 13.1 (or 12.9)
- TensorRT 10.15.1
- Nuke 17.0 (NDK)
- ~128 GB+ system RAM for the ONNX export step
The full pipeline is: .pth → ONNX → TensorRT engine → Nuke plugin. Each step only needs to be done once.
Clone the original CorridorKey repo and set up its environment:
git clone https://github.com/nikopueringer/CorridorKey.git
cd CorridorKey
uv sync
uv pip install onnx onnxruntime onnxscriptDownload the model weights (~300 MB) into the weights/ folder:
mkdir -p weights
wget -O weights/CorridorKey_v1.0.pth \
https://huggingface.co/nikopueringer/CorridorKey_v1.0/resolve/main/CorridorKey_v1.0.pthCopy export_corridorkey_onnx.py from this repo into the CorridorKey directory, then export:
source .venv/bin/activate
uv run python export_corridorkey_onnx.py --img-size 2048 --no-verifyRAM note: The ONNX trace at 2048×2048 requires ~140 GB of memory. If you have 128 GB RAM, add temporary swap:
sudo fallocate -l 64G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile sync && sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' uv run python export_corridorkey_onnx.py --img-size 2048 --no-verify sudo swapoff /swapfile sudo rm /swapfileAlternatively, export at 1024 (
--img-size 1024) which needs much less RAM. The model still works well — the Nuke plugin resizes the input to model resolution anyway.
This produces weights/CorridorKey_v1.0.onnx.
Download the pre-built TensorRT 10.15.1 and extract it to /opt/TensorRT-10.15.1.29 (or wherever you prefer).
export LD_LIBRARY_PATH=/opt/TensorRT-10.15.1.29/lib:/usr/local/cuda-13.1/lib64:$LD_LIBRARY_PATH
/opt/TensorRT-10.15.1.29/bin/trtexec \
--onnx=weights/CorridorKey_v1.0.onnx \
--saveEngine=weights/CorridorKey_v1.0_fp16.engine \
--fp16 \
--memPoolSize=workspace:2GFP16 is recommended — CorridorKey already uses float16 autocast during inference. This takes about 5 minutes and produces a ~198 MB engine file.
export PATH=/usr/local/cuda-13.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-13.1/lib64:$LD_LIBRARY_PATH
rm -rf build && mkdir build && cd build
cmake .. \
-DNUKE_ROOT=/opt/Nuke17.0v1 \
-DTENSORRT_ROOT=/opt/TensorRT-10.15.1.29
make -j8Copy TRTCorridorKey.so to your Nuke plugin path (e.g. ~/.nuke/).
- Create a
TRTCorridorKeynode (found under AI menu) - Connect your green screen plate to the plate input
- Connect a coarse alpha hint to the mask input (a rough Keylight/Primatte key or AI roto works. Shuffle to Alpha to RGBA)
- Point the Engine File knob to your
.enginefile - Set Resolution to match your engine (2048×2048 or 1024×1024)
| Knob | Description |
|---|---|
| Engine File | Path to the TensorRT .engine file |
| Resolution | Must match the ONNX export resolution |
| Output | RGBA (FG + Alpha), Alpha Only, or FG Only |
| Invert Matte | Inverts the predicted alpha |
| GPU Device | GPU index for multi-GPU systems |
- RGB channels: Straight (unpremultiplied) foreground color in sRGB
- Alpha channel: Linear alpha matte
To composite properly in Nuke, convert the FG from sRGB to linear, then premultiply:
TRTCorridorKey → Colorspace (sRGB to linear) → Premult → Merge (over)
The CorridorKey engine uses:
- Input:
[1, 4, 2048, 2048]— ImageNet-normalized RGB concatenated with the raw alpha hint - Outputs:
alpha[1, 1, 2048, 2048]andfg[1, 3, 2048, 2048], both post-sigmoid - Architecture: Hiera Base Plus backbone (from timm) with dual decoder heads and a CNN refiner
- Native resolution: 2048×2048 (positional embeddings are baked at export resolution)
├── TRTCorridorKey.cpp # Nuke plugin source
├── CMakeLists.txt # Build configuration
├── export_corridorkey_onnx.py # PyTorch → ONNX export script
├── test_trt_engine.py # Standalone TRT engine test
├── LICENSE # License
└── README.md # This file
- CorridorKey model by Niko Pueringer / Corridor Digital — CC BY-NC-SA 4.0
- TRTCorridorKey Nuke plugin by Peter Mercell
- Built with TensorRT and the Nuke NDK
This plugin code is released under the MIT License. See LICENSE for details.
The CorridorKey model weights and architecture are licensed under CC BY-NC-SA 4.0 by Corridor Digital. You must comply with their license when using the model. See the CorridorKey repository for full terms.