Downloads · 30 days
29
14% of all-time downloads
nakamura196/yolov11x-komonjo-char
yolov11x-komonjo-char is a object detection model from nakamura196. Use it when you need objects located in an image. It is set up for ultralytics. The card lists the license as other.
古文書(中近世の手書き文書)のくずし字を 1文字ずつの矩形 (単一クラス char) で検出する YOLOv11x。 東京大学史料編纂所「電子くずし字字典データベース」由来の古文書文字データで学習。
Downloads · 30 days
29
14% of all-time downloads
All-time downloads
214
Public
Repo size
912 MB
Likes
0
Public
Click a slice to open those files.
.pt456 MB · 67%
From the Hugging Face model README
古文書(中近世の手書き文書)のくずし字を 1文字ずつの矩形 (単一クラス char) で検出する YOLOv11x。
東京大学史料編纂所「電子くずし字字典データベース」由来の古文書文字データで学習。
姉妹モデル yolov11x-codh-char(CODH 日本古典籍くずし字で学習)
の 古文書版 にあたる。御内書など連綿草書の古文書で codh 版を大きく上回る。
🚀 デモ / Demo: kuzushiji-char-segmentation — インストール不要でブラウザから試せます(高解像度画像は SAHI タイル推論を自動選択)。
Try the model in your browser — no installation required (SAHI tiling is selected automatically for high-resolution images).
English: YOLOv11x detector that localizes individual kuzushiji (cursive) characters in pre-modern Japanese handwritten documents (komonjo) as single-class (char) bounding boxes. Trained on character data derived from the Electronic Kuzushiji Dictionary Database of the Historiographical Institute, the University of Tokyo. It is the komonjo counterpart of yolov11x-codh-char (trained on classical books), and substantially outperforms it on cursive documents such as gonaisho letters. Detection only — no character recognition or reading-order estimation.
⚠️ 学習データは東京大学史料編纂所「電子くずし字字典データベース」由来で、元データセットは非公開・権利留保です。 本モデル重みは
other (kuzushiji-db-derived-rights-reserved)扱いです。
- 非営利の学術研究・教育目的での利用(推論・評価・ファインチューニング)は、出典明記の上で可能です。
- 商用利用・重みの再配布は事前に確認してください(本リポジトリの Community タブ へ)。
- 詳細は LICENSE を参照してください。
English: Trained on data derived from the rights-reserved kuzushiji dictionary database of the Historiographical Institute. Non-commercial academic research and educational use is permitted with attribution. For commercial use or weight redistribution, please ask first via the Community tab. See LICENSE for details.
| ファイル | 内容 |
|---|---|
best.pt | Ultralytics 重み (YOLOv11x, single class char)。from ultralytics import YOLO; YOLO("best.pt") |
best.onnx | ONNX 版 (opset 12)。入力 images [batch,3,H,W] (batch/H/W すべて dynamic) / 出力 output0 [batch,5,N] (cx,cy,w,h,score の生出力 — NMS 必須)。imgsz=1280 で学習だが dynamic のため 1024 タイル(SAHI)等にも対応。ブラウザ/onnxruntime 推論用 |
推論パラメタ目安 / Suggested parameters: conf=0.25, iou=0.45, imgsz=1280(高解像度では SAHI タイル推論推奨 / use SAHI tiling for high-resolution images)。
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
weights = hf_hub_download("nakamura196/yolov11x-komonjo-char", "best.pt")
model = YOLO(weights)
results = model.predict("page.jpg", conf=0.25, iou=0.45, imgsz=1280)
print(results[0].boxes.xyxy) # character boxes (x1, y1, x2, y2) in original image coords
results[0].save("page_pred.jpg")
長辺 2000px を超えるような画像は、縮小で文字が潰れる前にタイル推論する方が recall が出ます。 For large scans, tiled inference preserves small characters that plain resizing would destroy.
from sahi import AutoDetectionModel
from sahi.predict import get_sliced_prediction
det = AutoDetectionModel.from_pretrained(
model_type="ultralytics", model_path=weights,
confidence_threshold=0.25, device="cpu") # or "cuda:0"
result = get_sliced_prediction(
"large_page.jpg", det,
slice_height=1024, slice_width=1024,
overlap_height_ratio=0.2, overlap_width_ratio=0.2)
result.export_visuals(export_dir="out/")
output0 は NMS 前の生出力です。letterbox → 推論 → 閾値 → NMS → 座標復元まで含めた完全な例:
output0 is raw (pre-NMS). Complete example including letterbox, thresholding, NMS, and coordinate restoration:
import cv2
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
CONF, IOU, SIZE = 0.25, 0.45, 1280
def letterbox(im, size=SIZE):
h, w = im.shape[:2]
r = min(size / h, size / w)
nh, nw = round(h * r), round(w * r)
canvas = np.full((size, size, 3), 114, np.uint8)
top, left = (size - nh) // 2, (size - nw) // 2
canvas[top:top + nh, left:left + nw] = cv2.resize(im, (nw, nh))
return canvas, r, left, top
img = cv2.imread("page.jpg")
inp, r, dx, dy = letterbox(img)
x = inp[:, :, ::-1].transpose(2, 0, 1)[None].astype(np.float32) / 255.0 # BGR→RGB, NCHW, 0–1
onnx_path = hf_hub_download("nakamura196/yolov11x-komonjo-char", "best.onnx")
sess = ort.InferenceSession(onnx_path)
cx, cy, w, h, score = sess.run(None, {"images": x})[0][0] # (5, N)
keep = score > CONF
boxes = np.stack([cx - w / 2, cy - h / 2, w, h], 1)[keep] # x,y,w,h (letterbox coords)
idx = cv2.dnn.NMSBoxes(boxes.tolist(), score[keep].tolist(), CONF, IOU)
H, W = img.shape[:2]
for i in np.asarray(idx).flatten():
bx, by, bw, bh = boxes[i]
x1, y1 = (bx - dx) / r, (by - dy) / r # back to original image coords
x2, y2 = (bx + bw - dx) / r, (by + bh - dy) / r
x1, y1 = max(0, x1), max(0, y1) # clip to image bounds
x2, y2 = min(W, x2), min(H, y2)
print(round(x1), round(y1), round(x2), round(y2))
ブラウザ (onnxruntime-web / WebGPU) でも同じ前処理・後処理で動作します。 The same pre/post-processing works in the browser with onnxruntime-web (WebGPU/WASM).
yolo11x.pt (Ultralytics 8.4.62) / 単一クラス char / imgsz=1280 / epochs=100(採用 best = epoch 73)。NVIDIA A100。dataset_masked: train 877 / val 115 / test 115、未注釈領域はマスク)。yolo export model=best.pt format=onnx opset=12 dynamic=True imgsz=1280Base yolo11x.pt, single class, imgsz 1280, 100 epochs (best at epoch 73) on an A100, using a detection dataset derived from the database above (877/115/115 train/val/test; unannotated regions masked).
| モデル | mAP50 | mAP50-95 | Precision | Recall |
|---|---|---|---|---|
| yolov11x-komonjo (本モデル) | 0.703 | 0.527 | 0.956 | 0.712 |
| yolov12x-komonjo (比較用) | 0.695 | 0.505 | 0.945 | 0.704 |
| yolov11x-codh (典籍, baseline) | 0.541 | 0.243 | 0.817 | 0.565 |
→ 古文書学習により mAP50-95 が 典籍 0.243 → 0.527 (2.2倍)。 注: この test split は同一文書が train/test に跨るため数値はやや楽観的。 Note: documents can span train/test in this split, so these numbers are somewhat optimistic.
このほか、学習外の自筆書状(連綿草書)に対する人手GTでの評価や、学習データと無関係な所蔵の古文書群での定性確認でも、典籍モデルに対する明確な優位を確認している。 The advantage over the codh baseline has also been confirmed on held-out autograph cursive letters evaluated against hand-made ground truth, and qualitatively on document collections unrelated to the training data.
conf を下げると recall は上がるが誤検出も増える。English: Detection only (no recognition / reading order). Trained on handwritten komonjo; unverified on printed books or modern documents. Recall ≈ 0.71 — expect misses and keep a human in the loop. Seals, kaō monograms, wormholes, and rulers in the frame can cause false positives/negatives. Use SAHI tiling for high-resolution scans.
@misc{nakamura2026yolov11xkomonjochar,
author = {Nakamura, Satoru},
title = {yolov11x-komonjo-char: YOLOv11x kuzushiji character detection
for pre-modern Japanese documents (komonjo)},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/nakamura196/yolov11x-komonjo-char}}
}
学習データ原典として「東京大学史料編纂所 電子くずし字字典データベース」も併せて言及してください。 Please also acknowledge the source database (Historiographical Institute, the University of Tokyo) when citing.