evaluating-identity-preservation

Scores whether a transformed image preserves subject identity against a reference image.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/ShinyGua/ComfyUI-Agent --skill evaluating-identity-preservation-shinygua
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: evaluating-identity-preservation
Source: https://github.com/ShinyGua/ComfyUI-Agent/tree/main/.claude/skills/evaluating-identity-preservation
Command: npx skills add https://github.com/ShinyGua/ComfyUI-Agent --skill evaluating-identity-preservation-shinygua

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? After style transfer, inpainting, or background replacement, a subject's face or pose can drift away from the original. This Skill provides a deterministic pass/fail check that compares a candidate image's metadata against a reference so identity drift is caught before a workflow step is marked done. ## Core Features & Use Cases - Heuristic identity scoring: Combines face bounding-box IoU, subject token overlap, and goal-aware denoise checks into a 0-1 score with a 0.6 pass threshold. - Structured JSON contract: Reads {reference_meta, candidate_meta, constraints} on stdin and emits {pass, score, reasons[], evaluator} on stdout, making it easy to swap in a real face-embedding comparator later. - Fail-safe behavior: Returns pass: false when required structure is missing instead of guessing, so callers can escalate or trigger a repair loop. - Use Case: After running a style-transfer step on a portrait, pipe the reference and candidate metadata into the evaluator to confirm the face region and subject tokens still match before accepting the result. ## Quick Start Run the identity preservation evaluator on the reference and candidate metadata from my last style-transfer step and tell me whether the subject's identity was preserved.

Frequently Asked Questions about evaluating-identity-preservation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if an AI image edit preserved the subject's face?▼

Compare the reference and candidate image metadata with an identity-preservation evaluator. It scores face bounding-box IoU, subject token overlap, and denoise level, then returns a pass/fail verdict with a numeric score and reasons.

How to evaluate identity drift after style transfer in ComfyUI?▼

Run the evaluator after any style-transfer, inpaint, or background-replacement step by piping reference_meta, candidate_meta, and constraints as JSON to the script's stdin. A score of 0.6 or higher means identity is considered preserved.

What inputs does the identity preservation evaluator require?▼

It requires reference_meta and candidate_meta objects containing face_bbox and subject_tokens, plus optional constraints such as preserve: ["face"]. If required structure is missing, it returns pass: false instead of guessing.

Does the identity evaluator use real face recognition models?▼

No, the current version is a deterministic stub using heuristics like bounding-box IoU and token overlap. The interface is designed so a real comparator such as InsightFace embeddings or pose keypoints can replace it later.

Why does the identity check fail even when the images look similar?▼

The evaluator fails when face bounding-box IoU falls below 0.7, subject token overlap drops under 0.5, or denoise exceeds 0.5 while face preservation is requested. Missing metadata fields also cause an automatic fail.