Peach: Local-first video metadata scraper and media manager.
fix(entity): 素人判定不认视觉模型标签
longmeidao936e1ba46d5f
diff --git a/README.en.md b/README.en.mdindex bf212748a..b468c09e3 100644--- a/README.en.md+++ b/README.en.md@@ -62,7 +62,7 @@ Want to look around before installing? The [live demo](https://demo.peach.video)## What it does- **Search**: type a few characters and performers, codes and videos show up together.-- **Identity categories**: performers are grouped by identity and release market into JAV performers, amateurs, Western performers, adult bloggers and animation authors. Amateurs are performers with trusted evidence of non-professional appearances, or whose every video is an amateur release (an FC2-PPV code or the 素人 tag); JAV and Western performers are never filed as amateurs, and other genres only filter videos. The roster has three side-by-side entries, Performers, Sellers and Online, and sellers are matched to their works by source account. The filter bar only shows categories that have entries, and profile pages show the category with an icon left of the video count.+- **Identity categories**: performers are grouped by identity and release market into JAV performers, amateurs, Western performers, adult bloggers and animation authors. Amateurs are performers with trusted evidence of non-professional appearances, or whose every video is an amateur release (an FC2-PPV code, or a 素人 tag that does not come from the vision model); JAV and Western performers are never filed as amateurs, and other genres only filter videos. The roster has three side-by-side entries, Performers, Sellers and Online, and sellers are matched to their works by source account. The filter bar only shows categories that have entries, and profile pages show the category with an icon left of the video count.- **Video counts**: clearly segmented parts of the same FC2 collection count as one video, while the part files and cast credits are kept in full. Identities confirmed as merged share their profile and videos, and old profile URLs lead to the canonical identity.- **Account identity**: the adult blogger category needs an identity or account source; unverified entries remain visible in the full roster. Account avatars prefer saved images, and video frames are used as an avatar only when the person's identity is backed by evidence. Aliases on profile pages carry identity names only; quality and bundle labels stay in the file details.- **Western image sources**: performers and adult bloggers can use a Babepedia gallery portrait. For Vixen network titles such as Tushy, official covers are matched by performer and release date and shared by cards, details and avatar cropping; titles without a unique match wait for review.diff --git a/README.md b/README.mdindex 6167db052..18bb87513 100644--- a/README.md+++ b/README.md@@ -62,7 +62,7 @@ https://github.com/user-attachments/assets/a5610874-e611-41bb-be22-7d99f0d64b62## 能做什么- **搜索**:输入几个字,女优、番号和影片一起出来。-- **身份分类**:艺人按身份与发行范围分为女优、素人、西方、网黄博主和动画作者。素人指有可信非职业出演证据,或全部出演作品都是素人发行(FC2-PPV 番号或带「素人」标签)的艺人,女优与西方出演者不归为素人;其他作品题材只用于作品筛选。名册使用「艺人、卖家、在线」三个并列入口,卖家按来源账号与作品对应。筛选条只显示有内容的分类,资料页在视频数量左侧显示分类与图标。+- **身份分类**:艺人按身份与发行范围分为女优、素人、西方、网黄博主和动画作者。素人指有可信非职业出演证据,或全部出演作品都是素人发行(FC2-PPV 番号,或带非视觉模型来源的「素人」标签)的艺人,女优与西方出演者不归为素人;其他作品题材只用于作品筛选。名册使用「艺人、卖家、在线」三个并列入口,卖家按来源账号与作品对应。筛选条只显示有内容的分类,资料页在视频数量左侧显示分类与图标。- **作品计数**:明确分段的同一 FC2 合集计为一个视频,分段文件和出演归属完整保留。已确认合并的身份共用资料与作品,旧资料页地址通往规范身份。- **账号身份**:网黄博主分类需要身份或账号来源;未核实的条目可在全部名册查看。账号头像优先使用保存的图片,作品画面只有在本人身份有依据时才用作头像。资料页中的别名只承载身份名称,画质和资源包规格保留在文件信息中。- **西方图片来源**:出演者与网黄博主可选 Babepedia 主图库人像;Tushy 等 Vixen 网络作品以出演者和发行日匹配官方封面,卡片、详情和头像框选共用原图,无法唯一匹配时留待核验。diff --git a/docs/adr/0095-entity-classification.md b/docs/adr/0095-entity-classification.mdindex dd753bba9..6db14d3b1 100644--- a/docs/adr/0095-entity-classification.md+++ b/docs/adr/0095-entity-classification.md@@ -6,7 +6,7 @@身份事实使用独立的多值来源断言:身份类型、职业、发行市场、账号角色。每条记录保留来源 URL、证据、置信度、核验时间与状态。状态按 ADR-0052 决策一划分:observed 只属于代码判据,即抓取器从来源页解析出的 `source:` 事实与 FC2 作品页快照解析出的卖家;目录推断、搜索命中与人或智能体读页面写成的研究清单都是 candidate;用户复核才能 approved。`write_claim` 拒绝其他来源写 observed,查询侧的可信口径(`trusted_sql`)与它一致。-浏览分类是查询时生成的显示投影:艺人页为女优、素人、西方,允许同一个人同时命中多类。女优复用 `entry_links.JAV_DIRECTORIES` 的已绑定 performer id 或可信日本 AV 市场断言;西方采用可信市场断言或作品发行地区;素人需要可信的 `amateur_performer` 断言,或至少有一部有效出演作品且全部有效出演作品都是素人发行(FC2-PPV 番号或带素人标签),两种情况都要求不命中女优、可信 `adult_performer` 断言与西方。素人表示作品类型,不断言职业经历,也不写入断言。MinnanoAV 的 production id、Stash 本机 id、Babepedia 的普通收录与候选不单独证明 JAV 身份。发布账号分为网黄博主、卖家、动画作者,后两类分别需要可信 seller、animator 断言。待核验是来源状态,不作为浏览分类。分类计数按搜索和有效作品计算,每类独立计数,筛选条隐藏空分类。+浏览分类是查询时生成的显示投影:艺人页为女优、素人、西方,允许同一个人同时命中多类。女优复用 `entry_links.JAV_DIRECTORIES` 的已绑定 performer id 或可信日本 AV 市场断言;西方采用可信市场断言或作品发行地区;素人需要可信的 `amateur_performer` 断言,或至少有一部有效出演作品且全部有效出演作品都是素人发行(FC2-PPV 番号,或带刮削、文件名、用户等非模型来源的素人标签;视觉模型标签不参与),两种情况都要求不命中女优、可信 `adult_performer` 断言与西方。素人表示作品类型,不断言职业经历,也不写入断言。MinnanoAV 的 production id、Stash 本机 id、Babepedia 的普通收录与候选不单独证明 JAV 身份。发布账号分为网黄博主、卖家、动画作者,后两类分别需要可信 seller、animator 断言。待核验是来源状态,不作为浏览分类。分类计数按搜索和有效作品计算,每类独立计数,筛选条隐藏空分类。跨角色身份使用可撤回的 same_person 或 operates_account 关系。姓名相同不能自动建立关联,也不能自动合并实体;既有 id、别名、作品关系和行为历史保留。用户执行实体合并时来源断言随实体迁移,同来源冲突拒绝合并。diff --git a/src/peach/entity_classification.py b/src/peach/entity_classification.pyindex ea1b80af1..0d7dcf31c 100644--- a/src/peach/entity_classification.py+++ b/src/peach/entity_classification.py@@ -19,6 +19,8 @@ CATEGORIES = {'japanese_av': '女优', 'amateur': '素人', 'western': '西方',#: observed 只属于代码判据(ADR-0052 决策一):`source:` 是抓取器从来源页解析出的事实,#: `script:fc2-seller@` 由 FC2 作品页快照的卖家字段解析。研究与检索结论只写 candidate。CODE_SOURCES = ('source:', 'script:fc2-seller@')+#: 视觉模型标签的来源前缀:`vision`、`vision_creator`、`vision_creator_review` 等。+MODEL_TAG_SOURCE_PREFIX = 'vision'def _code_source_sql(column: str) -> str:@@ -117,10 +119,14 @@ def category_predicates(column='e.id', kind_column='e.kind', connection=None):west_work = work("av.region='west'")western = f"{claim('market', 'western_adult')} OR {west_work}"# 素人发行:FC2-PPV 番号,或作品带「素人」标签(标签表与标签实体任一处)。+ # 视觉模型读画面得出的标签(`vision*` 来源,含复核页整批通过的创作者风格标签)只描述观感,+ # 不参与身份判定;刮削、文件名、用户与发行元数据来源照收。amateur_release = ("COALESCE(av.code,'') LIKE 'FC2-PPV-%' "- "OR EXISTS (SELECT 1 FROM asset_tag t WHERE t.asset_id=av.id AND t.tag='素人') "+ f"OR EXISTS (SELECT 1 FROM asset_tag t WHERE t.asset_id=av.id AND t.tag='素人' "+ f"AND t.source NOT LIKE '{MODEL_TAG_SOURCE_PREFIX}%') ""OR EXISTS (SELECT 1 FROM asset_entity ta JOIN entity te ON te.id=ta.entity_id "- "WHERE ta.asset_id=av.id AND te.kind='tag' AND te.canonical_name='素人')")+ "WHERE ta.asset_id=av.id AND te.kind='tag' AND te.canonical_name='素人' "+ f"AND ta.source NOT LIKE '{MODEL_TAG_SOURCE_PREFIX}%')")only_amateur_releases = f"{work('1')} AND NOT {work(f'NOT ({amateur_release})')}"amateur = (f"({claim('occupation', 'amateur_performer')} OR ({only_amateur_releases})) "f"AND NOT ({jav} OR {claim('occupation', 'adult_performer')} OR {western})")diff --git a/tests/test_entity_classification.py b/tests/test_entity_classification.pyindex 62aad9c4e..a432757f1 100644--- a/tests/test_entity_classification.py+++ b/tests/test_entity_classification.py@@ -214,6 +214,17 @@ class EntityClassificationTests(unittest.TestCase):self.connection.commit()self.assertEqual(q_index(contract,'performers',category='amateur')['items'],[])+ def test_amateur_tags_from_the_vision_model_do_not_classify_a_performer(self):+ asset_id, styled = self.entity('Styled Cast',kind='performer')+ self.connection.execute("INSERT INTO asset_tag(asset_id,tag,confidence,source) VALUES(?,'素人',0.6,'vision_creator')",(asset_id,))+ for source in ('vision_creator','vision_creator_review'):+ upsert_asset_entity(self.connection,kind='tag',name='素人',asset_id=asset_id,role='tag',source=source)+ self.connection.commit()+ self.assertEqual(classification.summaries(self.connection,[styled])[styled]['identity_categories'],[])+ upsert_asset_entity(self.connection,kind='tag',name='素人',asset_id=asset_id,role='tag',source='name')+ self.connection.commit()+ self.assertEqual(classification.summaries(self.connection,[styled])[styled]['identity_categories'],['amateur'])+def test_animation_author_appears_in_artist_directory_with_its_own_category(self):_, animator = self.entity('Animator')self.claim(animator,'occupation','animator')