feat(fam-edge): 闭集人物识别新增奶奶(成年女性按年龄段区分媳妇/奶奶)
家里从 4 人变成 5 人后,"媳妇=唯一成年女性"这条免费规则的前提被打破—— 人物管理页面已经能看到一条 label="奶奶" 但从未稳定命中的记录(只出现过 1 次,特征都没落库),说明现在系统大概率把奶奶也误判成了媳妇。 先用免费的年龄段字段区分(老年=奶奶,其余=媳妇),不引入额外的模型调用 (区别于爷爷/爸爸那种"两个成年男性区分不开必须靠视觉比对参考图"的方案) ——如果后续观察发现年龄段判断不稳定导致误判,再考虑改成视觉比对。 新增 3 个单元测试覆盖(中年→媳妇/老年→奶奶/年龄段缺失默认媳妇),fam-edge 全量 142/142 通过。已部署 Oracle 并重启验证。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,6 +111,34 @@ def test_shirtless_child_still_resolves_to_child_not_dad():
|
||||
assert resolved == {"人物A": ("汤圆", "rule")}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# 闭集人物识别:成年女性按年龄段区分媳妇/奶奶(2026-08-29 新增,家里从 4 人
|
||||
# 变成 5 人后,"媳妇=唯一成年女性"这条规则的前提被打破)
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
def test_middle_aged_female_resolves_to_wife_without_vlm_call():
|
||||
vp = _bare_processor(_RaisingPersonIdentifier())
|
||||
resolved = vp._resolve_closed_set_identities(
|
||||
1, {"人物A": {"gender": "女", "age_band": "中年", "clothing": "粉色上衣"}}, [])
|
||||
assert resolved == {"人物A": ("媳妇", "rule")}
|
||||
|
||||
|
||||
def test_elderly_female_resolves_to_grandma_without_vlm_call():
|
||||
vp = _bare_processor(_RaisingPersonIdentifier())
|
||||
resolved = vp._resolve_closed_set_identities(
|
||||
1, {"人物A": {"gender": "女", "age_band": "老年", "clothing": "红色上衣"}}, [])
|
||||
assert resolved == {"人物A": ("奶奶", "rule")}
|
||||
|
||||
|
||||
def test_female_with_unknown_age_band_defaults_to_wife():
|
||||
"""核心诉求: age_band 缺失/模型没给出明确判断时,不能因为不确定就放弃
|
||||
识别——默认归到媳妇(原有行为),只有明确判断为"老年"才算奶奶。"""
|
||||
vp = _bare_processor(_RaisingPersonIdentifier())
|
||||
resolved = vp._resolve_closed_set_identities(
|
||||
1, {"人物A": {"gender": "女", "age_band": "unknown", "clothing": ""}}, [])
|
||||
assert resolved == {"人物A": ("媳妇", "rule")}
|
||||
|
||||
|
||||
def test_clothed_adult_male_still_falls_through_to_vlm(monkeypatch):
|
||||
"""核心诉求: 没有赤膊关键词的正常穿戴场景,行为不变——照常走视觉大模型
|
||||
比对(这里用假的 _best_crop_for_uid 避免真的需要 norm_events 数据)。"""
|
||||
|
||||
Reference in New Issue
Block a user