P6 — Image→Persona Analyzer
> Feature flag: `features.enable_image2persona` (defaults **false**). Keep the flag off until the modder/QA lane verifies pipelines and hashes.
P6 — Image→Persona Analyzer
Feature flag:
features.enable_image2persona(defaults false). Keep the flag off until the modder/QA lane verifies pipelines and hashes.
Checker:python tools/check_current_system.py --profile p6_image2persona --base http://127.0.0.1:8001
Intent
Turn 1–N reference images into structured Persona hints: appearance tags, color palette, pose anchors, expression prototypes, and downstream style/LoRA suggestions. The analyzer is deterministic (hash-stable) so assets can be versioned, diffed, and merged with the Persona schema and provenance logs.
Pipeline Overview
- Normalization – Each image is EXIF-transposed and converted to RGB before hashing (
sha1(version + dims + bytes)) to guarantee stable digests and provenance sidecars. - Palette extraction – RGB median-cut quantization (5–8 swatches) produces normalized swatches (
hex,rgb,luma,ratio,name). Sorting favours coverage, then hex to keep output stable across runs. - Appearance tagging – Heuristics derive
species,fur_skin,colorways,accent_colors, andclothing_motifsfrom palette statistics (with optional contributor overrides via hooks). - Pose anchors – A grayscale percentile mask estimates a subject bounding box; anchors are emitted for face, hands, and feet with normalized coordinates and confidence scores.
- Expression prototypes – Brightness/contrast metrics seed a neutral baseline plus optional
smile,soft_smile, andangerprototypes. Each carries mood, trigger hints, and average confidence. - Style fusion – Appearance tags feed
StyleSuggestionRegistry, returning studio-friendly style hints plus optional LoRA names (names only, no URLs/downloads). - Merge – Multiple images merge through weighted averages. Conflicts (e.g., disagreeing
speciesorprimary_color) are surfaced for review.
The top-level summary lives under metadata.image2persona when merged into a Persona profile and includes:
{
"appearance": {...},
"palette": [...],
"pose_anchors": {...},
"expression_set": {...},
"style": {
"styles": [{"id": "studio-portrait-soft", "priority": 0.6}],
"lora": [{"name": "portraitplus-v15", "priority": 0.55}],
"applied_tags": ["species:human", "clothing:minimalist"]
},
"conflicts": [{"field": "appearance.species", "values": ["human", "unspecified"]}]
}
Python API
from comfyvn.persona.image2persona import (
analyze_images,
ImagePersonaAnalyzer,
PersonaImageOptions,
)
sources = ["./persona_refs/front.png", "./persona_refs/profile.png"]
options = PersonaImageOptions(debug=True)
suggestion = analyze_images(sources, persona_id="heroine-01", options=options)
print(suggestion.summary["appearance"]["colorways"])
# ['primary:warm:orange', 'secondary:neutral:stone', 'accent:cool:teal']
profile = {}
analyzer = ImagePersonaAnalyzer(options)
merged_profile = analyzer.merge_into_persona_profile(profile, suggestion)
PersonaImageOptions.hooksaccepts optional callables (appearance,palette,anchors,expressions,summary) for modder overrides. Each hook receives the current payload and can return replacements/patches.options.debug=Trueattachesmetrics, palette tokens, and anchor boxes to each per-image report for tooling dashboards.- Output is fully JSON serializable; call
suggestion.as_json(indent=2)to persist snapshots for reviews.
Style & LoRA Suggestions
comfyvn/persona/style_suggestions.py ships a baseline registry. Contributors can extend it:
from comfyvn.persona.style_suggestions import StyleSuggestionRegistry
registry = StyleSuggestionRegistry.default()
registry.register_style("species:android", "hard-light-cyberpunk", 0.7)
registry.register_lora("colorway:accent:cool:teal", "cyan-rim-v12", 0.5)
options = PersonaImageOptions(style_registry=registry)
The analyzer only surfaces names; downstream fetchers are intentionally out-of-scope.
Debugging & Determinism
- Hashes include the analyzer version string (
p6.image2persona.v1). Bumping the algorithm requires updatingANALYZER_VERSIONand documenting changes in the changelog. conflictsenumerate mismatched attributes so producers can reconcile persona packs manually.- Enable
LOG_LEVEL=DEBUGand wrap extractor calls to logsuggestion.provenancefor QA pipelines. - Smoke tests: feed the same image set twice and assert identical
summary_digestvalues. Mix formats (PNG/JPEG/WebP) to confirm EXIF normalization.
Integration Notes
- Persona Manager consumers should treat
metadata.image2personaas advisory data. Leave canonical persona fields (name,expression,poses) unchanged unless the user confirms merges. - GUI/CLI panels can surface the palette and anchor previews by reading
PersonaSuggestion.per_image[*].debugwhen debug mode is enabled. - Feature flag stays off until
p6_image2personachecker passes (docs, files, flag defaults, API surface).
Related Documents
Dota 2 Analysis Persona
You are a senior Dota 2 analyst providing written analysis of match replays. Your background includes professional play experience (TI qualifiers, 11k peak MMR) and extensive coaching. You deliver insights through structured analysis, not live dialogue.
AI_persona
You are a deep-thinking CodeNavigator, an elite AI coding assistant specializing in comprehensive codebase management, systematic debugging, and strategic code improvement. Your core purpose is helping developers maintain and enhance complex codebases with surgical precision and architectural foresight. You may use an extremely long chain of thoughts to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct or most optimal solution b
CTO Persona
You are a senior CTO with 20+ years of experience building and shipping quality software.
System Persona: The Awareness Engine
**Instructions for the User:**