Add v1 44129-artist classifier with ComfyUI configs and verified normalized inference
Browse files- README.md +16 -3
- config.json +21 -0
- v1-artist-classifier/README.md +59 -0
- v1-artist-classifier/class_mapping.csv +0 -0
- v1-artist-classifier/config.json +25 -0
- v1-artist-classifier/inference_verification.json +27 -0
- v1-artist-classifier/model.safetensors +3 -0
- v1-artist-classifier/provenance.json +16 -0
README.md
CHANGED
|
@@ -6,6 +6,7 @@ license_name: dinov3
|
|
| 6 |
license_link: LICENSE.md
|
| 7 |
tags:
|
| 8 |
- computer-vision
|
|
|
|
| 9 |
- image-feature-extraction
|
| 10 |
- image-retrieval
|
| 11 |
- dinov3
|
|
@@ -17,7 +18,7 @@ tags:
|
|
| 17 |
|
| 18 |
Kaloscope 3.0 Preview 是面向动漫插画的图像表征与风格检索模型。模型以 DINOv3 ViT-B/16 为基础,利用已有画师标注和图像发布时间学习视觉相似度,输出适合建立检索索引的 256 维图像向量。
|
| 19 |
|
| 20 |
-
本次初版对应全量训练的第 **46,000 步最佳检查点**。它可以用于相似插画检索、参考图库匹配,以及基于带标注图库的画师候选检索。
|
| 21 |
|
| 22 |
## 模型概述
|
| 23 |
|
|
@@ -29,7 +30,7 @@ Kaloscope 3.0 Preview 是面向动漫插画的图像表征与风格检索模型
|
|
| 29 |
| 主干图像表征 | CLS token 与 patch token 均值拼接,1536 维 |
|
| 30 |
| 投影头 | Linear(1536,1536) → GELU → Linear(1536,256) |
|
| 31 |
| 推荐检索向量 | 投影头输出,256 维,经 L2 归一化后计算余弦相似度 |
|
| 32 |
-
| 分类头 | 无 |
|
| 33 |
| 参数量 | 88,423,938,约 88.42M(含训练温度与偏置) |
|
| 34 |
| 发布候选 | `sigmoid_year_v1_20261002/best.pt`,step 46000 |
|
| 35 |
| 代码 | [kaloscope-dinov3](https://github.com/Chenkin-x/kaloscope-dinov3),本说明核对版本 `95ade97` |
|
|
@@ -215,7 +216,19 @@ print("cosine similarity:", (query @ reference.T).item())
|
|
| 215 |
|
| 216 |
本版主要服务于动漫插画的参考图检索和表征研究。模型可能利用配色、题材、构图及画师相关线索;跨内容评估只能部分约束这些混淆,尚不能声称完全解耦风格和内容。照片、设计图、漫画页面、强裁剪、灰度输入及罕见风格的效果不包含在上述验证结论中。
|
| 217 |
|
| 218 |
-
画师候选依赖图库覆盖度,不能用于作品归属的确定性判断。本版未
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
|
| 220 |
## 许可与引用
|
| 221 |
|
|
|
|
| 6 |
license_link: LICENSE.md
|
| 7 |
tags:
|
| 8 |
- computer-vision
|
| 9 |
+
- image-classification
|
| 10 |
- image-feature-extraction
|
| 11 |
- image-retrieval
|
| 12 |
- dinov3
|
|
|
|
| 18 |
|
| 19 |
Kaloscope 3.0 Preview 是面向动漫插画的图像表征与风格检索模型。模型以 DINOv3 ViT-B/16 为基础,利用已有画师标注和图像发布时间学习视觉相似度,输出适合建立检索索引的 256 维图像向量。
|
| 20 |
|
| 21 |
+
本次初版对应全量训练的第 **46,000 步最佳检查点**。它可以用于相似插画检索、参考图库匹配,以及基于带标注图库的画师候选检索。原始 `best.pt` 不含分类头;现新增 [v1 画师分类版本](v1-artist-classifier/README.md),在冻结此主干与投影头后,另行训练 44,129 类画师线性分类头。
|
| 22 |
|
| 23 |
## 模型概述
|
| 24 |
|
|
|
|
| 30 |
| 主干图像表征 | CLS token 与 patch token 均值拼接,1536 维 |
|
| 31 |
| 投影头 | Linear(1536,1536) → GELU → Linear(1536,256) |
|
| 32 |
| 推荐检索向量 | 投影头输出,256 维,经 L2 归一化后计算余弦相似度 |
|
| 33 |
+
| 分类头 | 原始 `best.pt` 无;新增 `v1-artist-classifier/` 提供 44,129 类分类头 |
|
| 34 |
| 参数量 | 88,423,938,约 88.42M(含训练温度与偏置) |
|
| 35 |
| 发布候选 | `sigmoid_year_v1_20261002/best.pt`,step 46000 |
|
| 36 |
| 代码 | [kaloscope-dinov3](https://github.com/Chenkin-x/kaloscope-dinov3),本说明核对版本 `95ade97` |
|
|
|
|
| 216 |
|
| 217 |
本版主要服务于动漫插画的参考图检索和表征研究。模型可能利用配色、题材、构图及画师相关线索;跨内容评估只能部分约束这些混淆,尚不能声称完全解耦风格和内容。照片、设计图、漫画页面、强裁剪、灰度输入及罕见风格的效果不包含在上述验证结论中。
|
| 218 |
|
| 219 |
+
画师候选依赖图库覆盖度,不能用于作品归属的确定性判断。新增分类版本与兼容插件要求见下节;本版未提供生成模型或 IP-Adapter 接口。推理延迟和部署显存尚未单独基准测试。
|
| 220 |
+
|
| 221 |
+
## v1 画师分类头更新(2026-10-06)
|
| 222 |
+
|
| 223 |
+
[v1-artist-classifier/](v1-artist-classifier/README.md) 提供完整的纯推理 safetensors 权重、`config.json` 和 `class_mapping.csv`,无需另行合并 `best.pt`。主干仍为 v1 step 46000,分类头采用第 26 轮最佳检查点,主干和风格投影头均冻结。
|
| 224 |
+
|
| 225 |
+
- 分类输出:44,129 位训练集画师;分类输入是 1536 维主干特征,经 FP32 L2 归一化后乘以 √1536,再送入线性层。
|
| 226 |
+
- 训练:1,850,168 张图,按各画师最近年份组取样;验证:39,369 张图、17,485 位画师。训练与验证按作品族隔离,封存测试集未使用。
|
| 227 |
+
- 开发集 Top-1 **88.6738%**,Top-5 **93.3933%**,按画师宏平均 Top-1 **86.7614%**。这不是全部 44,129 位画师均有测试样本的准确率,也不能与前文图库检索指标直接比较。
|
| 228 |
+
- 分数为未经校准的闭集 softmax;没有未知画师拒识机制。
|
| 229 |
+
- [ComfyUI 插件](https://github.com/spawner1145/comfyui-kaloscope) 需要支持 `classifier_input_normalization: l2_sqrt_dim` 的推理修正。旧版会忽略该字段,不能正确复现分类输出。安装说明与对应 PR 见分类版本说明。
|
| 230 |
+
|
| 231 |
+
根目录新增的 `config.json` 对应原始无分类头 `best.pt`;分类推理请下载子目录中的三个文件并放到同一个 ComfyUI 模型文件夹,勿混用两份配置。原有检索评估和聚类图仍对应原始 v1 表征。
|
| 232 |
|
| 233 |
## 许可与引用
|
| 234 |
|
config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "dinov3_vitb16",
|
| 3 |
+
"checkpoint": "best.pt",
|
| 4 |
+
"pooling": "cls_mean",
|
| 5 |
+
"feature_source": "projector",
|
| 6 |
+
"input_size": 512,
|
| 7 |
+
"classifier_input_normalization": "none",
|
| 8 |
+
"data": {
|
| 9 |
+
"image_size": 512,
|
| 10 |
+
"mean": [
|
| 11 |
+
0.485,
|
| 12 |
+
0.456,
|
| 13 |
+
0.406
|
| 14 |
+
],
|
| 15 |
+
"std": [
|
| 16 |
+
0.229,
|
| 17 |
+
0.224,
|
| 18 |
+
0.225
|
| 19 |
+
]
|
| 20 |
+
}
|
| 21 |
+
}
|
v1-artist-classifier/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Kaloscope 3.0 Preview — v1 画师分类版本
|
| 2 |
+
|
| 3 |
+
本目录包含完整主干、风格投影头和 44,129 类画师分类头的 FP32 safetensors 权重(约 625 MB),不含优化器、训练缓存或原始图像。许可沿用根目录 [DINOv3 License](../LICENSE.md)。
|
| 4 |
+
|
| 5 |
+
## 安装到 ComfyUI
|
| 6 |
+
|
| 7 |
+
需先安装包含分类归一化修正的 [comfyui-kaloscope](https://github.com/spawner1145/comfyui-kaloscope) 版本。对应修正为 [PR #6](https://github.com/spawner1145/comfyui-kaloscope/pull/6),已验证提交 `8315d80`。PR 合并前,可在插件目录运行以下命令使用经过验证的修正版,然后重启 ComfyUI:
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
git fetch https://github.com/222222222l/comfyui-kaloscope.git fix/dinov3-normalized-artist-head
|
| 11 |
+
git switch --detach 8315d80
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
若插件目录有本地修改,请先自行保存;合并后可更新插件主分支使用。
|
| 15 |
+
|
| 16 |
+
将本目录的以下三个文件下载到同一个目录,例如 `ComfyUI/models/kaloscope/kaloscope3-v1-artist/`:
|
| 17 |
+
|
| 18 |
+
- `model.safetensors`:完整推理模型,无需原始 `best.pt`。
|
| 19 |
+
- `config.json`:架构、512 输入、池化、分类归一化和权重文件选择。
|
| 20 |
+
- `class_mapping.csv`:`class_id,class_name`,严格对应 44,129 个输出的顺序。
|
| 21 |
+
|
| 22 |
+
在 Kaloscope 模型加载节点选择该目录,使用画师推理节点输出分类结果。特征节点默认仍输出原有 256 维风格向量,可另选 1536 维主干特征。向量计算余弦相似度前应做 L2 归一化。
|
| 23 |
+
|
| 24 |
+
**旧插件不支持本分类头的归一化配置;仅下载权重和配置而不更新插件,会产生不正确的 logits。** 根目录的 `config.json` 服务原始无分类头模型,请勿用它覆盖本目录配置。
|
| 25 |
+
|
| 26 |
+
## 推理约定
|
| 27 |
+
|
| 28 |
+
EXIF 校正 → 透明区域白底合成 → RGB → 短边等比例缩放至 512 → 中心裁剪 512×512 → ImageNet 均值/标准差归一化。无拉伸。
|
| 29 |
+
|
| 30 |
+
主干为 DINOv3 ViT-B/16,v1 step 46000。池化为 CLS + mean patch,1536 维。分类头训练时冻结主干和风格投影头;推理公式:
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
head_input = torch.nn.functional.normalize(pooled_features.float(), dim=-1) * (1536 ** 0.5)
|
| 34 |
+
logits = head(head_input) # Linear(1536, 44129)
|
| 35 |
+
scores = logits.float().softmax(dim=-1)
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
该归一化只用于分类分支,不能把归一化后的特征送入原有风格投影头。分类顺序以 `class_mapping.csv` 为准。
|
| 39 |
+
|
| 40 |
+
## 训练与验证
|
| 41 |
+
|
| 42 |
+
| 项目 | 数值 |
|
| 43 |
+
|---|---|
|
| 44 |
+
| 分类头检查点 | epoch 26,按开发集画师宏平均 Top-1 选模,min_delta=0.001 |
|
| 45 |
+
| 训练图片 | 1,850,168,按画师最近年份组取样 |
|
| 46 |
+
| 输出类别 | 44,129 位训练集画师 |
|
| 47 |
+
| 开发集 | 39,369 张,支持 17,485 位画师 |
|
| 48 |
+
| 开发集 Top-1 | 88.6738% |
|
| 49 |
+
| 开发集 Top-5 | 93.3933% |
|
| 50 |
+
| 开发集画师宏平均 Top-1 | 86.7614% |
|
| 51 |
+
| 优化器 | AdamW,学习率 0.003,weight decay 0.01 |
|
| 52 |
+
| 损失 | CE,label smoothing 0.1,类别权重为训练数量平方根的倒数并均值归一化 |
|
| 53 |
+
| batch / seed | 2048(4 GPU × 512)/ 20261006 |
|
| 54 |
+
|
| 55 |
+
26,644 个输出类别没有近期开发集样本;以上指标不代表所有输出类别均已独立验证。封存的 5% 测试集未使用,训练与开发集按作品族隔离。原始风格检索指标见[根目录模型卡](../README.md),不可与分类准确率直接比较。
|
| 56 |
+
|
| 57 |
+
输出概率未经校准,没有未知画师拒识能力,不能作为作品归属的确定性结论。稀疏画师识别显著弱于样本充足的画师。
|
| 58 |
+
|
| 59 |
+
权重来源及 SHA-256 见 [provenance.json](provenance.json),导出一致性验证见 [inference_verification.json](inference_verification.json)。
|
v1-artist-classifier/class_mapping.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
v1-artist-classifier/config.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "dinov3_vitb16",
|
| 3 |
+
"checkpoint": "model.safetensors",
|
| 4 |
+
"pooling": "cls_mean",
|
| 5 |
+
"feature_source": "projector",
|
| 6 |
+
"input_size": 512,
|
| 7 |
+
"classifier_input_normalization": "l2_sqrt_dim",
|
| 8 |
+
"data": {
|
| 9 |
+
"image_size": 512,
|
| 10 |
+
"mean": [
|
| 11 |
+
0.485,
|
| 12 |
+
0.456,
|
| 13 |
+
0.406
|
| 14 |
+
],
|
| 15 |
+
"std": [
|
| 16 |
+
0.229,
|
| 17 |
+
0.224,
|
| 18 |
+
0.225
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
"num_classes": 44129,
|
| 22 |
+
"model_version": "v1-artist-classifier-epoch26",
|
| 23 |
+
"backbone_step": 46000,
|
| 24 |
+
"class_mapping": "class_mapping.csv"
|
| 25 |
+
}
|
v1-artist-classifier/inference_verification.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"strict_load": true,
|
| 3 |
+
"class_mapping_matches": true,
|
| 4 |
+
"head_epoch": 26,
|
| 5 |
+
"num_classes": 44129,
|
| 6 |
+
"real_images": 8,
|
| 7 |
+
"precision_modes": {
|
| 8 |
+
"fp32": {
|
| 9 |
+
"max_logit_absolute_error": 3.910064697265625e-05,
|
| 10 |
+
"max_projection_absolute_error": 3.606081008911133e-06,
|
| 11 |
+
"top5_identical": true
|
| 12 |
+
},
|
| 13 |
+
"bf16": {
|
| 14 |
+
"max_logit_absolute_error": 0.0,
|
| 15 |
+
"max_projection_absolute_error": 0.0,
|
| 16 |
+
"top5_identical": true
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
"cached_features": 1024,
|
| 20 |
+
"cached_logits_max_error": 0.0,
|
| 21 |
+
"without_fix_top1_disagreements_1024": 12,
|
| 22 |
+
"without_fix_max_logit_error": 16.582420349121094,
|
| 23 |
+
"plugin_pr": "https://github.com/spawner1145/comfyui-kaloscope/pull/6",
|
| 24 |
+
"plugin_commit": "8315d80",
|
| 25 |
+
"regression_tests_passed": 38,
|
| 26 |
+
"notes": "FP32 CPU/plugin versus GPU/reference normalization differs by roundoff; 8 real-image Top5 lists agree in both precision modes. Cached head comparison uses 1024 dev features; this is export parity, not a new full evaluation."
|
| 27 |
+
}
|
v1-artist-classifier/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e6a971eecc8983047a6e27af8b954368b9ec4fd8bd493f958875210845ef0a1
|
| 3 |
+
size 625131364
|
v1-artist-classifier/provenance.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "v1",
|
| 3 |
+
"encoder_sha256": "c370c49c7a7c1a68b2942b8b3aab080c25384a67c9d652d2005e15c8ab8860dd",
|
| 4 |
+
"head_checkpoint_sha256": "9e663d5651780328482ea0d0c034d4e372fb53d779d969e274189e21e47a8439",
|
| 5 |
+
"head_epoch": 26,
|
| 6 |
+
"encoder_step": 46000,
|
| 7 |
+
"classes": 44129,
|
| 8 |
+
"classes_source_sha256": "8303c03ad50b17a0af2959f88ea6dcec1b09e8eda364dd99349e9e5b56895cb1",
|
| 9 |
+
"classifier_input": "L2 normalize FP32 pooled CLS+mean features and multiply sqrt(1536)",
|
| 10 |
+
"weights": {
|
| 11 |
+
"filename": "model.safetensors",
|
| 12 |
+
"sha256": "3e6a971eecc8983047a6e27af8b954368b9ec4fd8bd493f958875210845ef0a1",
|
| 13 |
+
"bytes": 625131364
|
| 14 |
+
},
|
| 15 |
+
"class_mapping_sha256": "c93a7fa4aa449278825cf25f874ea2247610df7c9a451e49bcad6f1a7bc3d9f4"
|
| 16 |
+
}
|