Synchronize pair camera metadata
This commit is contained in:
@@ -141,6 +141,29 @@ def synchronize_pair_side_metadata(pair: dict[str, Any]) -> dict[str, Any]:
|
|||||||
return pair
|
return pair
|
||||||
|
|
||||||
|
|
||||||
|
def synchronize_pair_camera_metadata(pair: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
mapping = {
|
||||||
|
"softcore_row": (
|
||||||
|
("softcore_camera_config", "camera_config"),
|
||||||
|
("softcore_camera_directive", "camera_directive"),
|
||||||
|
("softcore_camera_scene_directive", "camera_scene_directive"),
|
||||||
|
),
|
||||||
|
"hardcore_row": (
|
||||||
|
("hardcore_camera_config", "camera_config"),
|
||||||
|
("hardcore_camera_directive", "camera_directive"),
|
||||||
|
("hardcore_camera_scene_directive", "camera_scene_directive"),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
for row_key, keys in mapping.items():
|
||||||
|
row = pair.get(row_key)
|
||||||
|
if not isinstance(row, dict):
|
||||||
|
continue
|
||||||
|
for source_key, target_key in keys:
|
||||||
|
if source_key in pair:
|
||||||
|
row[target_key] = pair.get(source_key)
|
||||||
|
return pair
|
||||||
|
|
||||||
|
|
||||||
def synchronize_pair_cast_metadata(pair: dict[str, Any]) -> dict[str, Any]:
|
def synchronize_pair_cast_metadata(pair: dict[str, Any]) -> dict[str, Any]:
|
||||||
descriptors = pair.get("shared_cast_descriptors")
|
descriptors = pair.get("shared_cast_descriptors")
|
||||||
if isinstance(descriptors, list):
|
if isinstance(descriptors, list):
|
||||||
@@ -170,6 +193,7 @@ def normalize_pair_metadata(pair: dict[str, Any], *, active_trigger: str = "") -
|
|||||||
triggers = _trigger_tuple(trigger)
|
triggers = _trigger_tuple(trigger)
|
||||||
synchronize_pair_row_outputs(pair)
|
synchronize_pair_row_outputs(pair)
|
||||||
synchronize_pair_side_metadata(pair)
|
synchronize_pair_side_metadata(pair)
|
||||||
|
synchronize_pair_camera_metadata(pair)
|
||||||
synchronize_pair_cast_metadata(pair)
|
synchronize_pair_cast_metadata(pair)
|
||||||
for key in ("softcore_prompt", "hardcore_prompt"):
|
for key in ("softcore_prompt", "hardcore_prompt"):
|
||||||
if key in pair:
|
if key in pair:
|
||||||
|
|||||||
@@ -2372,15 +2372,23 @@ def smoke_row_normalization_policy() -> None:
|
|||||||
"default_man_hardcore_clothing": ["Man A default hard clothing"],
|
"default_man_hardcore_clothing": ["Man A default hard clothing"],
|
||||||
"hardcore_detail_density": "dense",
|
"hardcore_detail_density": "dense",
|
||||||
"hardcore_position_config": {"family": "oral"},
|
"hardcore_position_config": {"family": "oral"},
|
||||||
|
"softcore_camera_config": {"camera_mode": "standard", "camera_detail": "compact"},
|
||||||
|
"hardcore_camera_config": {"camera_mode": "pov", "camera_detail": "dense"},
|
||||||
|
"softcore_camera_directive": "Camera: soft front view.",
|
||||||
|
"hardcore_camera_directive": "Camera: hard side view.",
|
||||||
|
"softcore_camera_scene_directive": "Soft camera-aware scene layout.",
|
||||||
|
"hardcore_camera_scene_directive": "Hard camera-aware scene layout.",
|
||||||
"softcore_row": {
|
"softcore_row": {
|
||||||
"prompt": f"{Trigger}, {Trigger}, embedded soft.",
|
"prompt": f"{Trigger}, {Trigger}, embedded soft.",
|
||||||
"caption": f"{Trigger}, {Trigger}, embedded soft caption.",
|
"caption": f"{Trigger}, {Trigger}, embedded soft caption.",
|
||||||
"negative_prompt": "bad anatomy, bad anatomy",
|
"negative_prompt": "bad anatomy, bad anatomy",
|
||||||
|
"camera_directive": "stale soft camera",
|
||||||
},
|
},
|
||||||
"hardcore_row": {
|
"hardcore_row": {
|
||||||
"prompt": f"{Trigger}, {Trigger}, embedded hard.",
|
"prompt": f"{Trigger}, {Trigger}, embedded hard.",
|
||||||
"caption": f"{Trigger}, {Trigger}, embedded hard caption.",
|
"caption": f"{Trigger}, {Trigger}, embedded hard caption.",
|
||||||
"negative_prompt": "low quality, bad anatomy, low quality",
|
"negative_prompt": "low quality, bad anatomy, low quality",
|
||||||
|
"camera_scene_directive": "stale hard camera scene",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
active_trigger=Trigger,
|
active_trigger=Trigger,
|
||||||
@@ -2409,6 +2417,22 @@ def smoke_row_normalization_policy() -> None:
|
|||||||
pair["hardcore_row"].get("default_man_hardcore_clothing") == pair.get("default_man_hardcore_clothing"),
|
pair["hardcore_row"].get("default_man_hardcore_clothing") == pair.get("default_man_hardcore_clothing"),
|
||||||
"Pair normalization left stale hard default clothing metadata",
|
"Pair normalization left stale hard default clothing metadata",
|
||||||
)
|
)
|
||||||
|
_expect(
|
||||||
|
pair["softcore_row"].get("camera_config") == pair.get("softcore_camera_config"),
|
||||||
|
"Pair normalization left stale soft camera config",
|
||||||
|
)
|
||||||
|
_expect(
|
||||||
|
pair["hardcore_row"].get("camera_config") == pair.get("hardcore_camera_config"),
|
||||||
|
"Pair normalization left stale hard camera config",
|
||||||
|
)
|
||||||
|
_expect(
|
||||||
|
pair["softcore_row"].get("camera_directive") == pair.get("softcore_camera_directive"),
|
||||||
|
"Pair normalization left stale soft camera directive",
|
||||||
|
)
|
||||||
|
_expect(
|
||||||
|
pair["hardcore_row"].get("camera_scene_directive") == pair.get("hardcore_camera_scene_directive"),
|
||||||
|
"Pair normalization left stale hard camera scene directive",
|
||||||
|
)
|
||||||
_expect_no_duplicate_comma_items("row_normalization.pair.soft_negative", pair.get("softcore_negative_prompt"))
|
_expect_no_duplicate_comma_items("row_normalization.pair.soft_negative", pair.get("softcore_negative_prompt"))
|
||||||
_expect_no_duplicate_comma_items("row_normalization.pair.hard_row_negative", pair["hardcore_row"].get("negative_prompt"))
|
_expect_no_duplicate_comma_items("row_normalization.pair.hard_row_negative", pair["hardcore_row"].get("negative_prompt"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user