Verify — AI Frame Quality Gate
Runs CLIP analysis against configurable thresholds to verify generated frames meet quality standards.
Quick Reference
Verify a specific item
python3 "${CLAUDE_SKILL_DIR}/scripts/verify-scene.py" <ITEM_ID>
Verify an arbitrary image against a prompt
python3 "${CLAUDE_SKILL_DIR}/scripts/verify-scene.py" \
--image /path/to/frame.png \
--prompt "descriptive prompt" \
--scene_id <ITEM_ID>
Batch verify all items
python3 "${CLAUDE_SKILL_DIR}/scripts/verify-scene.py" --batch
Get JSON output (for piping to other tools)
python3 "${CLAUDE_SKILL_DIR}/scripts/verify-scene.py" <ITEM_ID> --json
Workflow: Generate → Verify → Iterate
- Generate a frame (via any generator — NB2, Flow, Seedance, etc.)
- Run verification:
python3 scripts/verify-scene.py <ITEM_ID> - Read the verdict:
- GOOD — all metrics above "good" thresholds → approve and move on
- PASS — above fail thresholds but not all good → acceptable, iterate if time permits
- FAIL — any metric below fail threshold → must iterate
- If FAIL or iterating, check which metric failed, adjust prompt:
- Low character score → strengthen character descriptors, add reference images
- Low palette score → reinforce world palette keywords
- Low prompt match → simplify prompt, front-load key descriptors
Thresholds
Thresholds are configured in reference/thresholds.md. Default suggestions:
| Metric | FAIL < | GOOD ≥ |
|---|---|---|
| prompt_match | 0.27 | 0.30 |
| character | 0.50 | 0.65 |
| palette | 0.55 | 0.70 |
| composite | 0.40 | 0.50 |
Derive your own thresholds by running a baseline pass on known-good frames, then setting FAIL at ~mean−1σ and GOOD at ~mean.
Dependencies
pip install transformers torch pillow
Expected directory layout (configurable):
- Character refs in
references/approved/characters/ - Palette refs in
references/approved/palettes/ - Item prompts in
runs/prompts.json
Gotchas
- CLIP model loads ~500MB on first run. Subsequent calls in the same process are instant.
- CLIP text tokenizer truncates at 77 tokens (~300 chars). Front-load important descriptors in prompts.
- Scores are relative, not absolute. A 0.30 prompt match is genuinely good for this model. Don't expect 0.90+.
- Grid images score lower than cropped single frames. Always verify on cropped hero frames, not raw grids.
- Items with no expected character return N/A for the character metric — composite uses palette + prompt only.