看图识象 Kantu Shixiang v2
看图识象是一个小型「看图认物象」模型:给一张照片或一幅画,认出其中的山水花鸟人物等 121 类诗词常见物象,判断画种(照片/油画/版画/素描/水彩/国画),并指出物象大致落在整图/左上/右上/左下/右下哪一格。全部训练材料来自公有领域、开放授权或明示授权的来源,不含任何网络抓取或 AI 生成的图文。
Kantu Shixiang ("look at the picture, recognise the imagery") is a small multi-label tagger for 121 kinds of imagery common in classical Chinese poetry (mountains, rivers, boats, egrets, orchids, peonies, herd boys, thatched cottages…), with a 6-way medium classifier (photo / oil / print / drawing / watercolour / Chinese ink painting) and a coarse position (whole / four quadrants). Every piece of training material is public-domain or openly licensed; nothing is web-scraped or AI-generated.
v2 相对 v1 What changed in v2
| v1 (2026-11-02) | v2 (2026-11-03) | |
|---|---|---|
| 物象类 Classes | 99 | 121(新增 22 类,见下) |
| 训练图 Training images | 2,071,107(PD12M 第 005–046 包) | 5,870,638(PD12M 全部 125 包) |
| 其中带物象正例 With ≥1 imagery label | 445,952 | 1,263,183 |
| 意象结构 Label structure | 单层 flat | 两层:子类正例同时记为大类正例(鸳鸯→鸭→鸟、梅→花、峰→山…) |
| 国画 mAP(369 幅画框画) Paintings mAP | 0.629 | 0.633 |
| 画上召回(准确率约 0.7) Painting recall @ precision ≈ 0.7 | 屋舍楼阁 54%、鸟 64%、花 84% | 屋舍楼阁 **69%**、鸟 **68%**、花 86% |
| 运行件体积 Runtime size | 0.17 GB (fp16) | 0.17 GB (fp16) |
新增 22 类 New classes:兰 菊 牡丹 樱 梧桐 藤 苔 芦苇(草木);鸥 雀 鹅(飞禽);龟 蟹 蛙(水族);抚琴 垂钓 隐士(人物);扇 笠 网 井(器物);霜(天象)。其中垂钓低可信。人眼抽查准确率 95.6%(见「评测」)。
老类的门槛:v1 已有的类,v2 一律按「在全库判为『有』的比例与 v1 相同」定门槛,保住 v1 经人眼抽查认可的松紧。在两版意见不一致的图上做了盲测(10 个分歧最大的类,189 张,不标版本由人判对错):v1 独有的判断对 88/95(92.6%),v2 独有的对 87/94(92.6%),打平;因此 v1 的人眼抽查结论可沿用到 v2 的老类。盲测中发现 v2 把作家乔治·桑(George Sand)作品集的插图页学成了「沙」(文件名含 Sand),已在词表中排除并重训。
For classes already in v1, v2 thresholds are set so that the share of images tagged positive across the library equals v1's, preserving the human-calibrated operating points of v1. A blind test on the images where v1 and v2 disagree (the 10 most-disagreeing classes, 189 images, version hidden) gave 92.6% for both, so v1's human spot-check results carry over to v2's existing classes. The blind test also exposed that v2 had learned the novelist George Sand's illustrated works as "sand"; this was excluded in the lexicon and the model retrained.
结构 Architecture
| 部件 Part | 来源 Source | 参数 Params | 文件 File |
|---|---|---|---|
| 图像编码器 Image encoder (ViT-B/16 + projection) | Mitsua Japanese CLIP ViT-B/16, ELAN MITSUA Project / Abstract Engine, CC BY-SA 4.0, 未改动 unmodified | 86.4 M | encoder.safetensors (fp16, 173 MB) |
| 物象分类头 Imagery head (121 classes, multi-instance over 5 views) | 本项目训练 trained here | 1.00 M | head.pt (2.0 MB) |
| 画种分类头 Medium head (6 classes) | 本项目训练 trained here | 4.6 K | in head.pt |
| 零样本文字向量 Zero-shot text vectors (19 words, used for 塔 and as a second opinion) | Mitsua text encoder, precomputed | – | zs_text.npz |
| 门槛表 Thresholds (photo / painting) | 人眼校准 human-calibrated | – | thresholds.json, paint_thresholds.json |
| 零样本补标规则 Zero-shot rules | 人眼抽查定 set by human spot-check | – | zs_rules.json |
合计约 8,740 万参数,其中本项目训练的只有分类头约 100 万。一张图切成 5 个视角(整图拉伸到 224×224,再把 448×448 的整图四等分),各自过编码器得到 5 个 768 维特征;分类头给每个视角打 121 类分数,取最大值作整图分数,最大值所在视角即位置。
About 87.4 M parameters in total, of which only the ~1.0 M of the heads were trained here. Each image is encoded as 5 views (the whole image at 224×224, plus the four quadrants of a 448×448 resize). The head scores all 121 classes per view; the per-class maximum is the image score and the arg-max view is the position.
支持的物象 Supported imagery (121)
| 组 Group | 类 Classes |
|---|---|
| 人物 People (15) | 人 童子 仕女 僧 农夫 渔翁 牧童 骑者 行人 读书 饮酒 茶 抚琴 隐士 垂钓* |
| 山水 Landscape (22) | 山 峰 崖 谷 江 湖 海 溪* 瀑 浪 岸 沙 石 原 田 路 云 雾 烟 雨 雪 虹 |
| 天象 Sky (5) | 日 夕阳 夜 星* 霜 |
| 草木 Plants (19) | 树 松 柳 枫 梧桐 竹 花 荷 兰 菊 牡丹 樱 草 芦苇 藤 苔 叶 果 篱 |
| 飞禽 Birds (14) | 鸟 鹭 雁 鸭 鹅 鸡 鸽 鸦 天鹅 鹰 鹦鹉 孔雀 鸥 雀 |
| 走兽与虫鱼 Animals (14) | 马 牛 羊 犬 猫 鹿 驴 虎 猿 蝶 鱼 龟 蟹 蛙 |
| 建筑 Buildings (13) | 屋 茅屋 楼 亭 寺 塔† 城 村 门 窗 墙 桥 井 |
| 器物 Objects (13) | 舟船 帆 桨 车 风车 灯 钟 琴 伞 酒 扇 笠 网 |
| 泉* | 泉 |
| 书 | 书(画上多为题款,应用中可作「有题款」) |
| 不发布为可用 Not usable (2) | 月 火 |
* 低可信 low confidence;† 塔 只用零样本第二意见 (zero-shot only)。舟与船合并输出为「舟船」。月、火两类分数不可信,门槛表里标为不可用,默认不输出。两层意象中,鸳鸯、鹅归「鸭」,「鸭」归「鸟」。
零样本第二意见 Zero-shot second opinion:规则与 v1 相同,写在 zs_rules.json 里。The zero-shot rules are unchanged from v1 and published in zs_rules.json.
非国画画作上的「人」:画种判为油画、版画、素描、水彩时,「人」要求把握至少 0.4(paint_thresholds.json 的 _other_art_min);照片照常用照片门槛,国画用画上门槛。起因:郎世宁《十骏图》这类西洋画法的宫廷画会被判为油画,用照片门槛时「人」以 0.35 误报。画上的「书」多半是题款、题字,应用中宜显示为「题字」(诗韵中心的识图页即如此)。On oil paintings, prints, drawings and watercolours, 人 (person) requires a score of at least 0.4 (_other_art_min). On paintings, 书 mostly means an inscription.
用法 Usage
pip install torch safetensors transformers pillow numpy
python3 shixiang.py your_picture.jpg
from PIL import Image
from shixiang import Shixiang
m = Shixiang('.') # 目录里有 encoder.safetensors / head.pt / *.json / zs_text.npz
r = m.tag(Image.open('pic.jpg')) # painting=None → 按画种自动选门槛
print(r['kind'], r['tags'])
ONNX
shixiang_fp16.onnx(175 MB)输入 views float32 [B,5,3,224,224](像素 /255 后减 0.5 除 0.5),输出 scores [B,121](sigmoid)、view [B,121]、kind [B,6](softmax)、zs [B,19]、feat [B,768]。门槛与合并规则见 shixiang.py 的 decide()。单张 5 视角在 4 线程 CPU 上约 0.45 秒,手机可跑。fp16 与 fp32 的标签集合在 400 张上一致 389 张(400 个标签中漏 6、多 5);int8 误差过大,不发布。
shixiang_fp16.onnx (175 MB): same interface as v1 with 121 classes. About 0.45 s per image on 4 CPU threads. fp16 agrees with fp32 on 389/400 tag sets.
训练材料与来源 Training data & lineage
- 图像编码器:Mitsua Japanese CLIP ViT-B/16 原样使用,其训练材料见该模型卡。The encoder is used as released.
- 物象与画种分类头:PD12M 全部 125 包里能按 sha1 对上 Wikimedia Commons 原图的公有领域图;标签只用人写文字(Commons 文件名与分类,CC BY-SA 4.0),不用 PD12M 自带的 AI 生成说明。地图、标本、器物、书页、钱币、图解、印章整类剔除。进入训练 5,870,638 张,其中 1,263,183 张含至少一个物象正例;5% 按 id 哈希留作验证。词表到标签的对应规则(英文正则,含专名与歧义排除)见
lexicon_v22.json。PD12M 中没有人写标签的图(iNaturalist、来源空白、外文馆藏说明等,约 650 万张)未进训练。 - 画种分类头另加 25,037 幅公有领域/CC BY 4.0 中国画(台北故宫、大都会、克利夫兰、芝加哥艺术博物馆、史密森尼等开放资源)作「国画」正例。
- 门槛:见上文「老类的门槛」;新类以验证集 F1 起步,再按人眼抽查调整(扇 0.79、蟹 0.77 提高门槛,垂钓标低可信)。画上门槛用 369 幅人工画框的画重新校准(准确率 ≥ 0.7 下取召回最高),只在画种判为国画时启用(
paint_thresholds.json的_kinds)。 training_index.parquet(412 MB)列出全部 5,870,638 张训练图的 PD12M id、Commons sha1、文件名、画种与物象标签(含两层意象补出的大类),供核查。- 博物馆品名作国画训练材料的试验(品名经人眼抽查准确率 90.4%)未纳入本版:三种用法在画框画上都没有超过只用照片的版本。
The heads were trained on Mitsua CLIP features of public-domain images from all 125 parts of PD12M that could be matched back to Wikimedia Commons by sha1. Labels come only from human-written text (Commons file names and categories, CC BY-SA 4.0); PD12M's synthetic captions were not used. 5,870,638 images were used (1,263,183 with at least one positive imagery label). The medium head additionally saw 25,037 public-domain Chinese paintings. training_index.parquet lists every training image for audit.
评测 Evaluation
新类,人眼抽查 Human spot-check on the new classes(每类随机抽 20 张模型判为「有」的图,由人判对错,共 440 张):抽查时的模型 91.8% 准确。修正「沙」标签重训后,最终模型在这批抽查图中仍判为「有」的 338 张(不含低可信的垂钓)准确 **95.6%**,各类不低于 78%(网 11/14、蛙 16/20 最低);最终模型新判为「有」而抽查时未判的图,不在这次抽查范围内。Human spot-check of the new classes: 20 random positives per class, 440 images. On the 338 of them that the final (retrained) model still tags positive (excluding the low-confidence 垂钓), 95.6% are correct; images newly tagged by the final model were not part of this check.
老类 Existing classes:v1 的人眼抽查为 93.9%(80 类 1,484 张);v2 与 v1 在分歧图上的盲测打平(各 92.6%),见上文。
画,与零样本模型对照 Paintings, vs. zero-shot models(标准答案=369 幅人工画框的公有领域画,8 个画框类;每类分数取类内各词最高;AP):
| 类 Category | 正例 | Mitsua CLIP 零样本 | SigLIP 2 Giant(中文提示) | SigLIP 2 Giant(英文提示) | 看图识象 v1 | 看图识象 v2 |
|---|---|---|---|---|---|---|
| 人物 | 130 | 0.584 | 0.581 | 0.775 | 0.798 | 0.774 |
| 屋舍楼阁 | 92 | 0.633 | 0.741 | 0.681 | 0.645 | 0.703 |
| 花 | 50 | 0.602 | 0.113 | 0.685 | 0.842 | 0.845 |
| 走兽 | 41 | 0.619 | 0.826 | 0.851 | 0.765 | 0.744 |
| 舟船 | 32 | 0.420 | 0.771 | 0.849 | 0.528 | 0.538 |
| 鸟 | 22 | 0.548 | 0.562 | 0.536 | 0.656 | 0.715 |
| 月 | 16 | 0.362 | 0.036 | 0.335 | 0.432 | 0.441 |
| 桥 | 14 | 0.063 | 0.396 | 0.364 | 0.368 | 0.307 |
| mAP | 0.479 | 0.503 | 0.635 | 0.629 | 0.633 |
v2 与 v1 相比高 0.004(按图重抽样 5,000 次的 95% 置信区间 −0.019 到 +0.027);与系列最大的 SigLIP 2 Giant 英文提示结果相比低 0.002(95% 置信区间 −0.056 到 +0.052):三者统计上都分不出高下,基本持平。Giant 的体积是本模型的 44 倍;中文提示下 SigLIP 2 明显落后。分项看,鸟、屋舍楼阁 v2 比 v1 好,桥、人物、走兽略降。SigLIP 2 的训练材料是网络抓取的 WebLI,不符合本项目的来源要求,这里只作能力对照。
v2 is 0.004 above v1 (95% bootstrap interval −0.019 to +0.027) and 0.002 below SigLIP 2 Giant with English prompts (−0.056 to +0.052): statistically indistinguishable, roughly on par, while Giant is 44 times larger. v2 improves on birds and buildings and is slightly lower on bridges, people and animals.
画种 Medium(留出验证):国画召回 96.6%;照片 94.0%、油画 90.8%、版画 90.1%、素描 74.4%、水彩 61.6%。
已知弱项 Known limitations
- 月、火不可用;星、溪、泉、垂钓低可信。Moon and fire are unusable; stars, brooks, springs and fishing are low-confidence.
- 画上召回仍偏低:舟船 31%、桥 14%、月 6%(准确率 ≥ 0.7 时)。物象头只用照片训练,画上表现靠画种补强与门槛校准。
- 新类的人眼抽查在照片上做;在国画上,抚琴、隐士、鸥、梧桐等几乎不触发,牡丹、兰等在画上的准确率未单独验证。
- 「仕女」在照片上实际学成了「画面里有女性」,照片结果中的仕女不宜照字面理解。
- 英文标签歧义与专名(如乔治·桑)曾造成误学,已按抽查逐条排除,仍可能有漏网。
- 词表限于山水花鸟人物,不认现代物品、文字、人脸身份。
许可与署名 License & attribution
整包按 CC BY-SA 4.0 发布(图像编码器为 CC BY-SA 4.0,整体须同许可)。使用时请署名:
看图识象 Kantu Shixiang v2 (SVOIC, CC BY-SA 4.0), built on Mitsua Japanese CLIP ViT-B/16 by ELAN MITSUA Project / Abstract Engine (CC BY-SA 4.0). Labels from Wikimedia Commons contributors (CC BY-SA 4.0). Images from PD12M (public domain) and museum open-access collections.
This package is released under CC BY-SA 4.0. The image encoder is the unmodified Mitsua Japanese CLIP ViT-B/16 (CC BY-SA 4.0). Our additions (heads, thresholds, lexicon, training index) are CC BY-SA 4.0 as well. The model is provided as is; recognition can be wrong, and it is not suitable for any use requiring high accuracy.
本模型属 SVOIC「开放文化授权」系列:训练材料来源可查、可追溯、可核对。v1 仍在本仓库的历史版本中可取用。
Model tree for svoic/kantu-shixiang
Base model
Mitsua/mitsua-japanese-clip-vit-b-16