DIGIT Drift Gate
Automated QC that rejects an AI render when it drifts from the reference plate
- reference
- generated
- passed
- confidence
- drift_report
- qc_json
- qc_filepath
- gated_image
- qc_sheet
- diff_heatmap
- edge_diff
- reference_aligned
- generated_aligned
This is the node that production people will quietly love and hobbyists will find baffling, so here's the pitch: DIGIT Drift Gate compares a reference image to a generated image and tells you, numerically, whether the generated one "drifted" - and it can reject it if it did. It's built for the workflow where you have a locked reference plate (a car in a fixed position, a product shot, a logo layout) and you're generating variants that must stay faithful to it. The classic use case is automotive and VFX: badge, logo, and typography drift - the parts an AI model loves to wreck even when the overall image looks fine.
Most QC in ComfyUI is done by eye. This node is for when eye-checking doesn't scale - you're generating dozens of variants and want the bad ones filtered before a human even looks.
How it works
It takes reference and generated IMAGE tensors, resize-aligns them so they're actually comparable, and scores confidence using two SSIM passes: pixel SSIM (overall structure and lighting) plus edge SSIM computed on an edge map, which is what catches badge, logo, and text drift. detail_weight (default 0.65) decides how much the edge signal counts toward the final confidence. Below confidence_threshold (default 75), it fails.
Inputs that matter:
reference,generated- the two images. There are also optionalreference_path/generated_pathfile inputs if you'd rather point at files.resize_mode-fit_reference,fit_generated,fit_largest, orcustom(withcompare_width/compare_height).fit_method- how mis-matched ratios are handled:stretch,letterbox, orcrop_center.grid_size(default 6) - divides the image into a grid for the hotspot drift report, so you can see where it drifted, not just that it did.diff_threshold(30) - pixel delta treated as visible drift.reject_mode-passthrough(always forward the generated image, usepassedto branch) orblackout(gated image goes black on reject).save_qc+qc_output_dir+qc_filename- write a burn-in QC PNG and JSON sidecar to disk for the record.
Outputs: passed (BOOLEAN - wire this into a branch), confidence, drift_report, qc_json, plus the visual artifacts: qc_sheet, diff_heatmap, edge_diff, reference_aligned, generated_aligned, and the gated_image that downstream nodes actually consume. The full stack feeds the DIGIT Drift QC Preview node for interactive review.
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/thedepartmentofexternalservices/comfyui-digit.git
cd comfyui-digit
pip install -r requirements.txt
Or ComfyUI Manager → search comfyui-digit → install → restart. Fully local - this is pure OpenCV/Pillow math, no API calls, which is fitting for a QC gate that's supposed to be trustworthy.
Setting it up honestly
The tuning reality: confidence_threshold is the knob you'll actually adjust, and it's workflow-specific. Start at 75, run it on a set of renders you've already judged by eye, and calibrate until its pass/fail matches yours. detail_weight matters most when your reference has fine detail (badges, text) - that's the whole reason it's a separate knob. And remember the branch pattern: with reject_mode: passthrough, the gate doesn't delete anything - you use passed to decide which path the image takes. Set save_qc on when the result needs to be defensible later, because the burn-in sheet is exactly the artifact a client or supervisor wants to see.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| reference | IMAGE | — | |
| generated | IMAGE | — | |
| resize_mode | COMBO | fit_reference | 4 options: fit_reference, fit_generated, fit_largest, custom |
| fit_method | COMBO | stretch | 3 options: stretch, letterbox, crop_center |
| compare_width | INT | 00–16384 | Used when resize_mode is custom. 0 = ignored. |
| compare_height | INT | 00–16384 | Used when resize_mode is custom. 0 = ignored. |
| grid_size | INT | 62–24 | Grid resolution for hotspot drift report. |
| detail_weight | FLOAT | 0.650–1 | How much edge/detail SSIM affects confidence (badge/logo sensitivity). |
| confidence_threshold | FLOAT | 75.00–100 | Pass when confidence >= threshold. |
| diff_threshold | INT | 301–255 | Pixel delta treated as visible drift. |
| reject_mode | COMBO | passthrough | blackout = gated_image goes black on reject. passthrough = gated_image always forwards generated. Use the passed output for branching. |
| save_qc | BOOLEAN | false | Write burn-in QC PNG + JSON sidecar to qc_output_dir. |
| qc_output_dir | STRING | Folder for QC artifacts. Example: .../shots/dev_0010/qc | |
| qc_filename | STRING | Optional base name (no extension, no _qc). Auto-derived from generated_path. Output is always <name>_qc.png/.json. | |
| show_qc_preview | BOOLEAN | true | Show the burn-in QC sheet in ComfyUI's preview panel after run. |
| reference_pathopt | STRING | Optional filesystem path instead of reference IMAGE input. | |
| generated_pathopt | STRING | Optional filesystem path instead of generated IMAGE input. |
Outputs (11)
| Name | Type | Description |
|---|---|---|
| passed | BOOLEAN | — |
| confidence | FLOAT | — |
| drift_report | STRING | — |
| qc_json | STRING | — |
| qc_filepath | STRING | — |
| gated_image | IMAGE | — |
| qc_sheet | IMAGE | — |
| diff_heatmap | IMAGE | — |
| edge_diff | IMAGE | — |
| reference_aligned | IMAGE | — |
| generated_aligned | IMAGE | — |