Nodes/HommageTools for ComfyUI/HT Detection Batch Processor
ComfyUI Node

HT Detection Batch Processor

Detect the face, upscale just the face, paste it back

By ArtHommage·Created 2 years ago·Updated about a year ago· 4
HT Detection Batch Processor
  • image
  • model
  • positive
  • negative
  • vae
  • upscale_model
  • detection_model
  • segs
  • detection_upscale_model
  • upscaled_image
  • cropped_batch
  • scale_info
console_labelDetection Batch Processing
seed0
steps20
cfg8.00
sampler_name
scheduler
denoise0.20
mode_type
tile_width512
tile_height512
mask_blur8
tile_padding32
seam_fix_mode
seam_fix_denoise1.00
seam_fix_width64
seam_fix_mask_blur8
seam_fix_padding16
detection_threshold0.50
detection_dilation4
crop_factor3.0
drop_size10
scale_modemax
short_edge_divDIV_BY_8
mask_dilation1.00
use_bucketstrue
force_uniform_tilestrue
tiled_decodefalse
bucket_scale_factor1.0
use_provided_segsfalse
segs_upscale_separatelytrue

If you've ever upscaled a whole 2K image just to fix a face that's 200 pixels wide, this node is aimed squarely at you. HT Detection Batch Processor automates the loop that FaceDetailer made famous in ComfyUI - detect regions, crop them, run a proper sampling pass, and paste the results back - except it's built for arbitrary detections and batch upscaling, not just faces. It's the heaviest node in HommageTools, and it's the one that most obviously needs a plan before you wire it up.

What it does

Feed it an image, a detection_model (a BBOX_DETECTOR, which is an Impact Pack type), and a full diffusion setup - model, positive, negative, vae plus the usual steps, cfg, sampler_name, scheduler, denoise - and it:

  1. Runs detection to get a set of regions (SEGS).
  2. Bucket-sizes each region so it fits a standard resolution (use_buckets, default on).
  3. Optionally upscales each region with an upscale_model first.
  4. Samples each crop with the model you gave it, tiled so you don't blow your VRAM.
  5. Pastes everything back into the full frame.

The output is three things: upscaled_image (the full frame with processed regions composited), cropped_batch (all the processed regions as a batch, handy for inspection or chaining), and scale_info, a string that tells you what the bucketing did - wire it into a text preview node while you're tuning.

The inputs that matter

The detections are the thing most people fumble. detection_threshold (0.5) controls how confident the detector has to be, crop_factor (3.0) expands each box - that's a big multiplier, so smaller is tighter - and detection_dilation grows the mask around the detected object. If you'd rather skip detection entirely, you can feed an existing segs and flip use_provided_segs on; that's how you'd reuse detections from an earlier node instead of re-running the detector.

The tiling side is the classic Ultimate SD Upscale machinery: tile_width/tile_height of 512 with tile_padding 32 are sane starting points, and seam_fix_mode (None / Band Pass / Half Tile) cleans up the boundaries between tiles. Start with seam_fix_mode off, see if you actually get seams, then turn it on - it's a real time cost.

Installing it

Same as the rest of the pack: ComfyUI Manager → search "HommageTools for ComfyUI", or

cd ComfyUI/custom_nodes
git clone https://github.com/ArtHommage/HommageTools.git
cd HommageTools && pip install -r requirements.txt

then restart ComfyUI. But this node needs more than the pack. The BBOX_DETECTOR and SEGS types come from Impact Pack, so install that too, and you'll want a detection model (an ONNX or Ultralytics bbox detector from Impact Pack's detector menu) plus an upscale_model for the region pass.

Gotchas

  • No detections is a handled case, not an error. The source returns a 1×1 black placeholder as upscaled_image, the original image, and scale_info = "No regions detected". The one time you will see a red pixel is on an actual detection error (it sets the placeholder's first channel to red on exception). Either way, check the console - it logs [USDU] lines as it goes - and if you're getting nothing detected, your detection_threshold is probably too high or the detector model isn't loading.
  • It's slow. Every detected region is a fresh sampling run. A batch of 20 faces is 20 passes. Use it where you'd use FaceDetailer - targeted regions that actually need the work - not as a blanket pass over everything.
  • The pack is flagged "perpetually in alpha" by its author, and this node is the most experimental thing in it. Don't build a production pipeline on it; do keep it for the jobs nothing else does in one node.

If you're new to the detect-crop-refine idea, the KB's upscaling essay is worth a read - tiled diffusion upscaling is where the whole family of nodes comes from, and this one just front-loads the detection step.

Categoryimage/upscaling

Inputs (39)

NameTypeDefaultDescription
console_labelSTRINGDetection Batch Processing
imageIMAGE
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.000–100
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
denoiseFLOAT0.200–1
upscale_modelUPSCALE_MODEL
mode_typeCOMBO3 options: Linear, Chess, None
tile_widthINT51264–8192
tile_heightINT51264–8192
mask_blurINT80–64
tile_paddingINT320–8192
seam_fix_modeCOMBO4 options: None, Band Pass, Half Tile, Half Tile + Intersections
seam_fix_denoiseFLOAT1.000–1
seam_fix_widthINT640–8192
seam_fix_mask_blurINT80–64
seam_fix_paddingINT160–8192
detection_modelBBOX_DETECTOR
detection_thresholdFLOAT0.500–1
detection_dilationINT4-512–512
crop_factorFLOAT3.01–100
drop_sizeINT101–8192
scale_modeCOMBOmax4 options: max, up, down, closest
short_edge_divCOMBODIV_BY_82 options: DIV_BY_8, DIV_BY_64
mask_dilationFLOAT1.001–2
use_bucketsBOOLEANtrue
force_uniform_tilesBOOLEANtrue
tiled_decodeBOOLEANfalse
bucket_scale_factorFLOAT1.00.1–4
segsoptSEGS
use_provided_segsoptBOOLEANfalse
segs_upscale_separatelyoptBOOLEANtrue
detection_upscale_modeloptUPSCALE_MODEL

Outputs (3)

NameTypeDescription
upscaled_imageIMAGE
cropped_batchIMAGE
scale_infoSTRING