Nodes/DIGIT Nodes/DIGIT Drift Gate
ComfyUI Node

DIGIT Drift Gate

Automated QC that rejects an AI render when it drifts from the reference plate

By thedepartmentofexternalservices·Created 7 months ago·Updated 2 months ago· 0
DIGIT Drift Gate
  • reference
  • generated
  • passed
  • confidence
  • drift_report
  • qc_json
  • qc_filepath
  • gated_image
  • qc_sheet
  • diff_heatmap
  • edge_diff
  • reference_aligned
  • generated_aligned
◄resize_modefit_reference►
◄fit_methodstretch►
◄compare_width0►
◄compare_height0►
◄grid_size6►
◄detail_weight0.65►
◄confidence_threshold75.0►
◄diff_threshold30►
◄reject_modepassthrough►
◄save_qcfalse►
◄qc_output_dir►
◄qc_filename►
◄show_qc_previewtrue►
◄reference_path►
◄generated_path►

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 optional reference_path/generated_path file inputs if you'd rather point at files.
  • resize_mode - fit_reference, fit_generated, fit_largest, or custom (with compare_width/compare_height).
  • fit_method - how mis-matched ratios are handled: stretch, letterbox, or crop_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, use passed to branch) or blackout (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.

CategoryDIGIT

Inputs (17)

NameTypeDefaultDescription
referenceIMAGE—
generatedIMAGE—
resize_modeCOMBOfit_reference4 options: fit_reference, fit_generated, fit_largest, custom
fit_methodCOMBOstretch3 options: stretch, letterbox, crop_center
compare_widthINT00–16384Used when resize_mode is custom. 0 = ignored.
compare_heightINT00–16384Used when resize_mode is custom. 0 = ignored.
grid_sizeINT62–24Grid resolution for hotspot drift report.
detail_weightFLOAT0.650–1How much edge/detail SSIM affects confidence (badge/logo sensitivity).
confidence_thresholdFLOAT75.00–100Pass when confidence >= threshold.
diff_thresholdINT301–255Pixel delta treated as visible drift.
reject_modeCOMBOpassthroughblackout = gated_image goes black on reject. passthrough = gated_image always forwards generated. Use the passed output for branching.
save_qcBOOLEANfalseWrite burn-in QC PNG + JSON sidecar to qc_output_dir.
qc_output_dirSTRINGFolder for QC artifacts. Example: .../shots/dev_0010/qc
qc_filenameSTRINGOptional base name (no extension, no _qc). Auto-derived from generated_path. Output is always <name>_qc.png/.json.
show_qc_previewBOOLEANtrueShow the burn-in QC sheet in ComfyUI's preview panel after run.
reference_pathoptSTRINGOptional filesystem path instead of reference IMAGE input.
generated_pathoptSTRINGOptional filesystem path instead of generated IMAGE input.

Outputs (11)

NameTypeDescription
passedBOOLEAN—
confidenceFLOAT—
drift_reportSTRING—
qc_jsonSTRING—
qc_filepathSTRING—
gated_imageIMAGE—
qc_sheetIMAGE—
diff_heatmapIMAGE—
edge_diffIMAGE—
reference_alignedIMAGE—
generated_alignedIMAGE—