from __future__ import annotations def last_frame_prompt(row: dict) -> str: return ( "You are evaluating an image-to-video generation result.\n" f"Task: {row['task_group_name']}.\n" "Compare the supplied final frame with the expected final state below.\n" f"Expected final state: {row['last_frame_goal']}\n" "Use an integer score from 1 to 5, where 1 is wholly inconsistent and " "5 fully satisfies the expected state. Judge only visible evidence.\n" "Return one JSON object with exactly these fields:\n" '{"last_frame_goal_score": 1, ' '"reason_for_last_frame_goal_score": "brief evidence-based reason"}' ) def _progress_consistency_criteria(row: dict) -> str: criteria = [ value for value in (row.get("foreground_rule"), row.get("background_rule")) if value ] return " ".join(criteria) if criteria else ( "Unprompted objects and background regions should remain stable, and " "intended changes should evolve coherently." ) def video_prompt(row: dict) -> tuple[str, list[str]]: sections = [ ( "video_quality", "Evaluate visual and temporal coherence: continuity, stability, " "flicker, jitter, warping, identity drift, frame repetition, abrupt " "cuts, motion discontinuity, blur changes, and background deformation.", ), ( "progress_consistency", "Evaluate consistency with these foreground/background constraints: " + _progress_consistency_criteria(row), ), ] if row.get("implicit_rule"): sections.append( ( "implicit_rule", "Evaluate adherence to this implicit physical or logical rule: " + row["implicit_rule"], ) ) if row.get("progress_goal"): sections.append( ( "progress_goal", "Evaluate whether the visible process realizes this expected " "intermediate progression: " + row["progress_goal"], ) ) keys = [name for name, _ in sections] lines = [ "You are evaluating an image-to-video generation result.", f"Task: {row['task_group_name']}.", f"Generation prompt: {row['user_prompt']}", "Judge only visible evidence in the supplied frames.", "For every requested metric, use an integer score from 1 to 5.", "1 means severe failure; 3 means partial success with clear issues; " "5 means fully successful.", ] for index, (name, criterion) in enumerate(sections, start=1): lines.append(f"{index}. {name}: {criterion}") fields = [] for name in keys: fields.append(f'"{name}_score": 1') fields.append(f'"reason_for_{name}_score": "brief evidence-based reason"') lines.append("Return one JSON object with exactly these fields:") lines.append("{" + ", ".join(fields) + "}") return "\n".join(lines), keys def mme_cof_prompt(user_prompt: str) -> str: return ( "Evaluate whether the supplied video faithfully and coherently visualizes " f'this image-to-video instruction: "{user_prompt}".\n' "Judge only visible evidence. Rate each aspect on a 0–4 integer scale " "(0 poor, 4 excellent): instruction alignment, temporal consistency, " "visual stability, content fidelity, and focus relevance.\n" "Return one JSON object with exactly these numeric fields:\n" '{"instruction_alignment": 0, "temporal_consistency": 0, ' '"visual_stability": 0, "content_fidelity": 0, "focus_relevance": 0}' )