Kaloscope-onnx / README.md
DraconicDragon's picture
Update README.md
451f336
|
Raw
History Blame
5.33 kB
metadata
license: apache-2.0
base_model:
  - heathcliff01/Kaloscope

onnx conversion of kaloscope model.
also extra pytorch ema only version (best_checkpoint_ema.pth) of the model which is roughly 4 times smaller and outputs same results

conversion script and implementation script soon:tm: if i dont forget it after testing if the models actually work (onnx model might be broken or my impl is wrong not sure)
The ""issue"" with the onnx models is that even when using timm+lsnet impl like the pytorch inference code does im getting correct results but with rather large confidence differences which might be expected but 19%->27.8% seems a bit large

onnx model name info because im still testing around (optimization/constant folding) enabled for all of them)

  • lsnet_xl_artist-opset13: first onnx export, dynamo=False, dynamic_axes=dynamic_axes={ "input": {0: "batch_size", 2: "height", 3: "width"}, "output": {0: "batch_size"}, }, opset_version=13
  • lsnet_xl_artist-dynamo-opset18_merged.onnx: dynamo=True, dynamic_axes=None, opset_version=None (torch 2.8.0 used here defaults to 18 when None)
    • 'merged' in name because torch.onnx.export gave me 2 files - .onnx.data and a small .onnx file - i used onnx_merge.py (todo: add link and upload file) to merge them
  • lsnet_xl_artist-dynamo-opset20_merged.onnx: dynamo=True, dynamic_axes=None, opset_version=None (torch 2.9.0 used here defaults to 20 when None)
  • lsnet_xl_artist-dynamo-opset23_merged.onnx: dynamo=True, dynamic_axes=None, opset_version=23 (torch 2.9.0 used)

Note that newer opset versions might not work with older tooling. I haven't tested this.
Using opset 18 is probably the best choice - I don't see any score difference between the different opset except opset 13 but that one also didn't have dynamo enabled during export and 18 gives more backward compatibility.


LSNet 艺术家风格分类模型 Model Card

模型概述

模型名称: Kaloscope Artist Style Classification Model
模型版本: v1.0
发布日期: 2025年10月
模型类型: 图像分类 (艺术家风格识别)
架构: LSNet (See Large, Focus Small)

模型描述

本模型基于LSNet架构构建,专门用于识别和分类不同艺术家的绘画风格。LSNet是一个轻量级视觉模型,灵感来源于人类视觉系统的动态异尺度能力,即"看大局,聚焦细节"的特性。

架构特点

  • 设计理念: 基于人类视觉系统的"See Large, Focus Small"原理
  • 模型系列: 支持LSNet-T、LSNet-S、LSNet-B三种规模
  • 参数量: 约100M参数
  • 优化目标: 在保持高精度的同时实现高效推理

训练数据

数据来源

  • 数据集: Danbooru数据集 (截止到2024年10月)
  • 数据筛选: 选取图像数量在50张以上的艺术家
  • 总分类数: 31,770个艺术家类别
  • 数据采样策略:
    • 图像数量超过100张的艺术家:选取ID最靠后的100张图像
    • 图像数量50-100张的艺术家:使用全部图像

数据预处理

  • 图像尺寸: 224×224像素
  • 数据增强: 标准ImageNet预处理流程
  • 验证集划分: 5%的数据用于验证

训练配置

硬件环境

  • GPU配置: 8×H20 GPU
  • 训练时长: 80个epoch
  • 批次大小: 256 (每GPU)

训练参数

  • 优化器: AdamW
  • 学习率调度: Cosine Annealing
  • 数据并行: 分布式训练 (8卡)
  • 模型参数量: ~100M

性能指标

  • 最终准确率: 84.2%
  • 验证方式: Top-1准确率
  • 评估数据: 验证集 (5%的数据)

模型性能

分类性能

指标 数值
Top-1 准确率 84.2%
总类别数 31,770
参数量 ~100M
训练轮数 80 epochs

推理性能

  • 输入格式: RGB图像,224×224像素
  • 输出格式: 31,770维概率分布
  • 推理速度: 高效推理 (具体数值取决于硬件)

使用方法

环境要求

pip install torch torchvision timm

基本使用

import torch
from timm.models import create_model

# 加载模型
model = create_model('lsnet_t_artist', pretrained=True, num_classes=31770)
model.eval()

# 推理
with torch.no_grad():
    output = model(input_tensor)
    probabilities = torch.softmax(output, dim=1)

Comfyui内使用

安装comfyui节点:https://github.com/spawner1145/comfyui-lsnet 下载本仓库模型即可使用

相关资源

引用信息

@misc{wang2025lsnetlargefocussmall,
      title={LSNet: See Large, Focus Small}, 
      author={Ao Wang and Hui Chen and Zijia Lin and Jungong Han and Guiguang Ding},
      year={2025},
      eprint={2503.23135},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2503.23135}, 
}

更新日志

v1.0 (2025年10月)

  • 初始版本发布
  • 基于Danbooru数据集训练
  • 支持31,770个艺术家类别
  • 达到84.2%的分类准确率

免责声明: 本模型仅供研究和教育用途。在商业应用中使用时,请确保遵守相关法律法规和伦理准则。