This repository provides the DPText-DETR text detection experiments from the
MonkeyOCRv2 paper. The visual encoder from
MonkeyOCRv2-AS (ViTAEv2-S,
21M parameters) is integrated into
DPText-DETR as a drop-in detectron2
backbone. The last three ViTAEv2 stages (strides 8/16/32) are exposed as
res3–res5 and feed the standard deformable-DETR input projections, so the
transformer encoder/decoder and the detection head are unchanged.
Training and evaluation follow the official DPText-DETR protocols on
Total-Text, CTW1500, ICDAR19-ArT, Rotated Total-Text and Inverse-Text.
Models and Results
For each benchmark, three visual backbones are compared under identical
settings: the original ImageNet-pretrained ResNet-50, the text-specific
oCLIP ResNet-50, and MonkeyOCRv2.
MonkeyOCRv2 consistently improves F-score across all five benchmarks.
All models are trained directly on the target dataset (no SynthText/MLT
pre-training), for 200k iterations with a total batch size of 8, using the
positional label form and the rotated training images released with
DPText-DETR (*_poly_train_rotate_pos).
Total-Text
Method
P
R
F
DPText-DETR (ResNet-50)
89.6
82.8
86.1
DPText-DETR + oCLIP
87.1
84.5
85.7
DPText-DETR + MonkeyOCRv2
90.9
86.7
88.8
CTW1500
Method
P
R
F
DPText-DETR (ResNet-50)
89.7
82.1
85.7
DPText-DETR + oCLIP
86.3
82.7
84.5
DPText-DETR + MonkeyOCRv2
89.6
88.1
88.9
ICDAR19-ArT
Method
P
R
F
DPText-DETR (ResNet-50)
84.3
67.5
75.0
DPText-DETR + oCLIP
75.1
62.0
67.9
DPText-DETR + MonkeyOCRv2
85.8
71.7
78.1
Rotated Total-Text
Method
P
R
F
DPText-DETR (ResNet-50)
89.4
79.8
84.3
DPText-DETR + oCLIP
87.2
80.8
83.9
DPText-DETR + MonkeyOCRv2
89.7
84.4
86.9
Inverse-Text
Method
P
R
F
DPText-DETR (ResNet-50)
92.1
81.3
86.4
DPText-DETR + oCLIP
90.2
82.1
85.9
DPText-DETR + MonkeyOCRv2
91.8
85.4
88.5
Rotated Total-Text and Inverse-Text are test-only benchmarks: they reuse
the Total-Text model above and only change DATASETS.TEST.
1# run from this add-on directory; ./DPText-DETR is the repository root created2# by install.sh3# HuggingFace4hf download HB16888/MonkeyOCRv2_det_dptext --include "*.pth" --local-dir ./DPText-DETR/model_weight
5# ModelScope6modelscope download --model WangXinhan/MonkeyOCRv2_det_dptext --local_dir ./DPText-DETR/model_weight
Environment
The reproduced environment uses Python 3.11, PyTorch 2.9.0, CUDA 12.8,
torchvision 0.24.0, detectron2 0.6, NumPy 2.4.4, Transformers 4.57.1 and
safetensors 0.7.0. The oCLIP baseline additionally needs MMOCR 1.0.1
(MMEngine 0.10.7, MMCV 2.0.1, MMDet 3.1.0). All models were trained on 8 GPUs
(NVIDIA GeForce RTX 3090) with SOLVER.IMS_PER_BATCH: 8 for 200k iterations.
Installation
The code for these checkpoints is the detection/DPText-DETR add-on of
MonkeyOCRv2, which sits on top of
the official DPText-DETR release. Run it from that add-on directory
(MonkeyOCRv2/detection/DPText-DETR):
bash install.sh # clones DPText-DETR into ./DPText-DETR and patches it
install.sh creates a nested checkout, ./DPText-DETR, which is the
DPText-DETR root referred to throughout this README:
text
1MonkeyOCRv2/detection/DPText-DETR/ # this add-on directory
2├── install.sh
3├── configs/ patch/ tools/ # the add-on files, copied into ./DPText-DETR
4└── DPText-DETR/ # <- DPText-DETR root, created by install.sh
5 ├── adet/ configs/ tools/
6 ├── pretrained/monkeyocrv2_as/ # MonkeyOCRv2-AS visual encoder
7 ├── ckpts/ # ResNet-50 / oCLIP init weights
8 ├── model_weight/ # released checkpoints
9 ├── datasets/ # the benchmarks
10 └── output/ # training / evaluation output
Pretrained Backbones
bash
1cd DPText-DETR # the DPText-DETR root created by install.sh23# MonkeyOCRv2-AS visual encoder (for the MonkeyOCRv2 rows)4hf download zenosai/MonkeyOCRv2-AS --local-dir ./pretrained/monkeyocrv2_as
56# ImageNet ResNet-50 (for the baseline rows) - from the official DPText-DETR /7# AdelaiDet instructions8mkdir -p ckpts
9wget -O ckpts/R-50.pkl https://dl.fbaipublicfiles.com/detectron2/ImageNetPretrained/MSRA/R-50.pkl
1011# oCLIP ResNet-50 (for the oCLIP rows)12wget -O ckpts/resnet50-oclip-7ba0c533.pth \13 https://download.openmmlab.com/mmocr/backbone/resnet50-oclip-7ba0c533.pth
Datasets
Download Total-Text (including rotated images), CTW1500 (including rotated
images), ICDAR19-ArT (including rotated images), Inverse-Text, the polygon
json files and the evaluation ground-truths from the official
DPText-DETR data preparation
links, and organize them under the DPText-DETR root as:
Each config already carries the MODEL.TRANSFORMER.INFERENCE_TH_TEST value
that reproduces the corresponding row of the tables above, so evaluating on
the dataset a model was trained on needs no extra flags:
ArT has no public test ground-truth. Evaluating an ArT config writes
<OUTPUT_DIR>/inference/art_submit.json, which has to be uploaded to the
ICDAR19-ArT evaluation server to obtain the
P / R / F numbers reported above:
The DPText-DETR / AdelaiDet sources this add-on patches are released for
non-commercial use only (see the
DPText-DETR license);
the same restriction applies to the add-on and to the released checkpoints.