Nodes/Content Aware Tiles/Reject Candidate Tiles
ComfyUI Node

Reject Candidate Tiles

Let a metric pick your winners

By samsartor·Created 2 years ago·Updated about a year ago· 23
Reject Candidate Tiles
  • tiles
  • tileset
  • source
  • IMAGE
  • TILESET
metric
keep1

Generating tiles blind is a lottery. Each boundary condition can be inpainted any number of ways, some great, some garbage, and you don't know which until you look. This node is the pack's answer: generate candidates versions of every tile, then let a scoring metric keep only the best keep. It's the quality gate between the sampler and the packing/tiling stages, and it's the difference between a tile set that looks curated and one that looks like a first draft.

What it does

For each tile position it takes your candidates variants, scores them, sorts, and keeps the top keep. Three metrics:

  • sifid - Single Image Fréchet Inception Distance against your source image. It compares feature statistics of each candidate to the source texture, so the kept tiles are the ones most stylistically consistent with where the boundaries came from. This is the default in the CLI tool, and it's a good first choice.
  • textile - a learned texture-quality model (Textile, loaded lazily on first use) that scores how "real-texture-like" a tile is, with no source comparison. Strong for abstract or non-photographic textures where matching the source isn't the goal.
  • random - no scoring at all, just keeps an arbitrary keep. Handy when you want the speed and don't care which ones survive.

Outputs are the reduced IMAGE batch and a TILESET with candidates updated to keep, so the rest of the pipeline knows the true count. If candidates == keep, it passes everything through untouched.

Inputs and outputs

  • tiles (IMAGE) - your candidate tile batch (candidates × tile-count)
  • tileset (TILESET, forceInput) - carries the candidate count
  • source (IMAGE) - the original texture, required for sifid
  • metric (enum) - sifid | textile | random
  • keep (INT, default 1) - survivors per tile position

Installing and the gotchas that matter

Standard pack install: git clone https://github.com/samsartor/content_aware_tiles into ComfyUI/custom_nodes (or ComfyUI Manager → "content_aware_tiles") and restart. But this node is the one that genuinely needs the extras: pytorch_fid (for sifid) and textile-metric (for textile) are in the pack's requirements.txt, and ComfyUI Manager won't necessarily install them for you. pip install pytorch_fid textile-metric einops in your ComfyUI environment if the node errors on import.

The bigger gotcha is in the code: for sifid and textile, the tensors are explicitly moved to CUDA. Not "prefer CUDA if available" - hard .cuda(). On an Apple Silicon or CPU-only setup, use random or skip this node, because the metric paths will crash. Also expect the Textile weights to download on first use, and note this is a research pack with zero community threads - the workflow JSON is your map, and both metrics were benchmarked in the paper if you want the theory.

Categorytiles

Inputs (5)

NameTypeDefaultDescription
tilesIMAGE
tilesetTILESET
sourceIMAGE
metricCOMBO3 options: sifid, textile, random
keepINT1

Outputs (2)

NameTypeDescription
IMAGEIMAGE
TILESETTILESET