Downloads · 30 days
0
nakamura196/yolov8-ndl-layout
yolov8-ndl-layout is a object detection model from nakamura196. Use it when you need objects located in an image. It is set up for ultralyticsplus. The card lists the license as agpl-3.0.
YOLOv8x fine-tuned for layout analysis of Japanese pre-modern printed and manuscript books (古典籍), trained on nakamura196/ndl-layout-dataset. It detects five region types per page: the overall text block, handwritten r…
Downloads · 30 days
0
Access
Public
Updated Sep 17, 2026
Repo size
137 MB
Likes
1
Public
Click a slice to open those files.
.pt137 MB · 100%
From the Hugging Face model README
YOLOv8x fine-tuned for layout analysis of Japanese pre-modern printed and manuscript books
(古典籍), trained on nakamura196/ndl-layout-dataset.
It detects five region types per page: the overall text block, handwritten regions, typographic
(printed) regions, illustrations, and seals/stamps.
⚠️ Read the Evaluation section before citing any number from this model. The evaluation split used during training leaks at the document level: the same digitised item (PID) appears in both training and evaluation. The reported scores are therefore optimistic and are not a valid estimate of generalisation to unseen documents. An earlier version of this card reported "mAP 85.4% / IoU 78.2%". Those figures have been removed: 85.4% corresponds to no measurement of this model, and "IoU 78.2%" was the mAP@50-95 value (0.781) under the wrong name.
yolov8x.pt (Ultralytics COCO weights)| id | name | rectangles in dataset | share |
|---|---|---|---|
| 0 | 1_overall | 1,219 | 4.7% |
| 1 | 2_handwritten | 13,851 | 53.6% |
| 2 | 3_typography | 9,262 | 35.9% |
| 3 | 4_illustration | 1,119 | 4.3% |
| 4 | 5_stamp | 369 | 1.4% |
5_stamp occurs on only 194 of 1,219 pages; treat its scores as noisy.
2_handwritten / 3_typography regions to a line or character recogniser)5_stamp is 1.4% of all rectangles.from ultralyticsplus import YOLO, render_result
import os
# load model
model = YOLO('nakamura196/yolov8-ndl-layout')
# set model parameters
conf_threshold = 0.25 # NMS confidence threshold
iou_threshold = 0.45 # NMS IoU threshold
# set image
img = 'https://dl.ndl.go.jp/api/iiif/2534020/T0000001/full/full/0/default.jpg'
# perform inference
results = model.predict(img, conf=conf_threshold, iou=iou_threshold, device="cpu")
render = render_result(model=model, image=img, result=results[0])
os.makedirs('results', exist_ok=True)
render.save('results/1.jpg')
nakamura196/ndl-layout-dataset
— 1,219 page images with 25,820 annotated rectangles, derived from the NDL-DocL dataset
(古典籍 subset only). Images are downscaled to a 640 px long side.
Training used the dataset's original data/data.yaml split: 853 / 244 / 122 images
(train / val / test), assigned randomly by page.
Started from COCO-pretrained yolov8x.pt; no layers frozen.
| epochs | 100 (completed; no early stopping, patience=100) |
| image size | 640 |
| batch size | 31 |
| optimizer | auto (Ultralytics default selection), lr0=0.01 |
| seed | 0 |
| mixed precision | AMP (fp16) enabled |
| augmentation | fliplr=0.5, scale=0.5, erasing=0.4, hsv_h=0.015, mosaic=0.0, degrees=0.0, flipud=0.0 |
| Ultralytics version | 8.2.18 |
The dataset's original split was drawn randomly over pages, not over documents. The 1,219 pages come from only 89 items (PIDs), so the same item lands in several splits:
train, 34 also appear in val and 32 also appear in testPages from the same item share paper, typeface, block layout, ruling and seals, so the model can score highly by recognising the item rather than by generalising. Every number below is inflated by that leakage.
Scores stored inside the released checkpoint, measured on the 244-page val split at the final
(100th) epoch:
| metric | value |
|---|---|
| precision | 0.951 |
| recall | 0.899 |
| mAP@50 | 0.935 |
| mAP@50-95 | 0.781 |
Measured here on the 122-page test split (Ultralytics 8.4.7, imgsz=640, CPU):
| class | P | R | mAP@50 | mAP@50-95 |
|---|---|---|---|---|
| all | 0.943 | 0.938 | 0.964 | 0.794 |
1_overall | 0.997 | 1.000 | 0.995 | 0.995 |
2_handwritten | 0.994 | 0.954 | 0.992 | 0.807 |
3_typography | 0.964 | 0.933 | 0.971 | 0.756 |
4_illustration | 0.942 | 0.934 | 0.954 | 0.775 |
5_stamp | 0.820 | 0.868 | 0.907 | 0.636 |
Note that the test scores come out higher than the val scores above. With 122 pages drawn
from items the model was trained on, that is what leakage plus a small sample looks like — not
evidence that the model is stronger than reported. 1_overall is near-perfect because it is the
single page-sized block on every page, which is a trivial detection target.
The dataset now ships a document-disjoint split (data/data_pid.yaml, 848 / 248 / 123 images over
67 / 12 / 10 PIDs) so that future models can be measured honestly. It cannot rescue this
checkpoint. Only 5 of the 1,219 pages belong to items entirely absent from this model's
training and validation data — too few to measure anything. There is no held-out, document-disjoint
data for these weights.
To obtain a trustworthy figure, the model has to be retrained on data_pid.yaml and evaluated
on its test split. Until that is done, treat this model as a working tool and not as a benchmarked
result.
Satoru Nakamura — [email protected]