manga-textseg
A text detector for manga, manhua and manhwa pages. It predicts a per-pixel text probability map, which is decoded into text-region boxes. Built for the manga-translator browser extension, where it runs through onnxruntime-web.
Model
- MobileNetV3 backbone (timm, ImageNet weights) with an FPN neck and one text-probability head, trained with a DBNet-style loss (masked OHEM BCE + dice) on shrunk text regions.
- Training data: about 3,000 labelled pages plus 301 hard-negative pages (confirmed text-free windows over art, marks and texture).
- 40 epochs with an EMA of the weights (decay 0.999). This export is the EMA at the validation-F1 peak (epoch 20, seed 2).
Input and output
| name | shape | notes | |
|---|---|---|---|
| input | images | float32 [1, 3, 1280, 1280] | RGB, CHW, scaled to 0..1, letterboxed with grey (114, 114, 114) padding |
| output | prob | float32 [1, 1, 320, 320] | text probability, one cell per 4 input pixels |
The export has dynamic height and width; all evaluation was done at 1280.
Decoding
- Binarise the map at 0.3.
- Take each 4-connected component of at least 3 cells as one region, scored by its mean probability.
- Grow the component's bounding box back out by the offset the training shrink removed (shrink ratio 0.4, DBNet's closed form), then undo the letterbox.
The region score is the confidence to threshold. It is a mean probability, not a box confidence, so thresholds are not interchangeable with YOLO-style detectors.
Evaluation
Scored on a held-out set of 57 pages (540 hand-reviewed regions in Japanese, Korean and Chinese). No evaluation page was used in training. Recall is coverage-based. The table shows the best recall at a fixed false-positive rate (spurious boxes per detection).
| spurious rate | threshold | sfx recall | dark-background recall | all recall |
|---|---|---|---|---|
| 0.9% | 0.70 | 0.408 | 0.506 | 0.713 |
| 1.9% | 0.61 | 0.592 | 0.667 | 0.822 |
| 4.3% | 0.45 | 0.717 | 0.782 | 0.898 |
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support