Downloads · 30 days
0
Skepsun/manga-translator-ui-onnx
manga-translator-ui-onnx is a object detection model from Skepsun. Use it when you need objects located in an image. The card lists the license as gpl-3.0.
ONNX 格式的漫画翻译模型集合,从 manga-translator-ui 和 manga-image-translator 的 PyTorch 权重转换而来。
Downloads · 30 days
0
Access
Public
Updated Jul 10, 2026
Repo size
737 MB
Likes
0
Public
Click a slice to open those files.
.onnx573 MB · 100%
From the Hugging Face model README
ONNX 格式的漫画翻译模型集合,从 manga-translator-ui 和 manga-image-translator 的 PyTorch 权重转换而来。
| 模型 | 文件 | 大小 | 架构 | 输入 | 输出 |
|---|---|---|---|---|---|
| Default Detector | detect-20241225.onnx | 292 MB | DBNet ResNet34 | (B, 3, H, W) [-1, 1] | db_map (B, 2, H/4, W/4) + mask (B, 1, H/8, W/8) |
| 模型 | 文件 | 大小 | 架构 | 输入 | 输出 |
|---|---|---|---|---|---|
| 48px CTC | ocr-48px-ctc.onnx | 157 MB | ResNet + Transformer + CTC | (B, 3, 48, W) [0, 255] | logits (B, seq_len, 19264) |
| 48px Encoder | ocr-48px-encoder.onnx | 97 MB | ConvNeXt + 4×Transformer Enc | (B, 3, 48, W) [0, 255] | memory (B, seq_len, 320) |
| 文件 | 用途 |
|---|---|
alphabet-all-v7.txt | 48px/48px_encoder 字典(46272 字符) |
alphabet-all-v5.txt | 48px_ctc 字典(95997 字符) |
import onnxruntime as ort
import numpy as np
session = ort.InferenceSession("detect-20241225.onnx", providers=["CPUExecutionProvider"])
input_data = np.random.randn(1, 3, 1536, 1536).astype(np.float32) # [-1, 1]
db_map, mask = session.run(None, {"input": input_data})
import onnxruntime as ort
import numpy as np
session = ort.InferenceSession("ocr-48px-ctc.onnx", providers=["CPUExecutionProvider"])
# 输入: 48px 高的文字行图片 (batch, 3, 48, width)
img = np.random.randn(1, 3, 48, 256).astype(np.float32)
logits = session.run(None, {"img": img})[0] # (1, seq_len, 19264)
# CTC greedy decode
with open("alphabet-all-v5.txt") as f:
dictionary = [line.rstrip('\n') for line in f]
pred = np.argmax(logits[0], axis=1) # (seq_len,)
result = []
blank = 0
last = blank
for p in pred:
if p != blank and p != last:
result.append(dictionary[p])
last = p
text = ''.join(result)
session = ort.InferenceSession("ocr-48px-encoder.onnx", providers=["CPUExecutionProvider"])
img = np.random.randn(1, 3, 48, 256).astype(np.float32)
memory = session.run(None, {"img": img})[0] # (1, seq_len, 320)
# memory 供 decoder 做自回归解码使用
| 原始权重 | 来源 |
|---|---|
detect-20241225.ckpt | zyddnys/manga-image-translator beta-0.3 |
ocr_ar_48px.ckpt | zyddnys/manga-image-translator beta-0.3 |
ocr-ctc.ckpt | zyddnys/manga-image-translator beta-0.3 |
convert_detect_to_onnx.py — 将 detect-20241225.ckpt 转为 ONNXconvert_ocr_to_onnx_v6.py — 将 ocr_ar_48px.ckpt 和 ocr-ctc.ckpt 转为 ONNXfix_48px_ctc.py — 修复 48px_ctc 的 wrapper,确保精度detect-20241225-onnx-usage.md — Detection 模型完整使用文档ocr-usage.md — OCR 模型完整使用文档(含预处理、解码、批量推理)原始权重来自 manga-image-translator(GPL-3.0),本仓库继承 GPL-3.0 许可证。