--- license: apache-2.0 language: - bn tags: - detectron2 - document-layout-analysis - badlad - mask-rcnn - instance-segmentation datasets: - bengaliAI/badlad pipeline_tag: object-detection --- # BaDLAD Mask R-CNN — Paper Baseline Mask R-CNN R-50-FPN trained on the BaDLAD training set for Bengali document layout analysis (instance segmentation track). Matches the paper’s Mask R-CNN / ImageNet setup used for mask mAP reporting. **Paper:** [BaDLAD (ICDAR 2023)](https://arxiv.org/abs/2303.05325) **Code:** [BengaliAI/BADLAD](https://github.com/BengaliAI/BADLAD) **Dataset:** [BaDLAD on Kaggle](https://www.kaggle.com/datasets/reasat/badlad-train) **Project page:** [bengaliai.github.io/badlad](https://bengaliai.github.io/badlad) ## Model Details | Field | Value | | --- | --- | | Architecture | Mask R-CNN R-50-FPN 3x | | Framework | Detectron2 | | Config | `COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml` | | Classes | paragraph, text_box, image, table (4) | | Training data | BaDLAD train (~20 365 images, 6 domains) | | Iterations | 10 000 | | Init | ImageNet | | Checkpoint | `model_final.pth` (~169 MB) | | sha256 | `d3b663446a3aeecfbf1d5f437110257948a2616eec5496504f9306d65460f497` | ## Usage ```python from detectron2 import model_zoo from detectron2.config import get_cfg from detectron2.engine import DefaultPredictor from huggingface_hub import hf_hub_download weights = hf_hub_download("bengaliAI/badlad-mrcnn-paper", "model_final.pth") cfg = get_cfg() cfg.merge_from_file( model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml") ) cfg.MODEL.ROI_HEADS.NUM_CLASSES = 4 cfg.MODEL.WEIGHTS = weights cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.05 predictor = DefaultPredictor(cfg) ``` ## Evaluation Re-run on the paper hidden test (13 328 images). Primary metric: COCO mask AP@[.5:.95], `score_thresh=0.05`. | Metric | Value | | --- | --- | | mask_mAP | 0.331 | | mask_mAP50 | 0.558 | | bbox_mAP | 0.343 | | bbox_mAP50 | 0.562 | **Per-class mask AP:** paragraph 0.609, text_box 0.231, image 0.411, table 0.075. **Domain-wise mask AP (×100) — this checkpoint / paper Table 3 (M-RCNN \| ImgNet \| Mask):** | Domain | n | P | Tx | I | Tb | | --- | ---: | --- | --- | --- | --- | | Historical Newspapers | 345 | 60.3 / 60.3 | 18.3 / 18.3 | 57.3 / 57.3 | 0.0 / 0.0 | | New Newspapers | 65 | 41.4 / 41.4 | 13.1 / 13.2 | 45.2 / 45.2 | 1.9 / 1.9 | | Magazine and Books | 11674 | 61.8 / 61.8 | 25.3 / 25.3 | 44.9 / 44.9 | 2.3 / 2.3 | | Liberation War Documents | 402 | 71.1 / 71.2 | 26.8 / 26.8 | 1.1 / 1.0 | 40.1 / 40.1 | | Government Documents | 514 | 49.4 / 39.1 | 23.7 / 18.7 | 26.1 / 19.4 | 5.1 / 3.7 | | Property Deeds | 328 | 38.0 / 0.6 | 14.2 / 0.7 | 13.3 / 2.1 | 3.2 / 0.6 | ## Related models | Repo | Role | | --- | --- | | [`bengaliAI/badlad-frcnn-paper`](https://huggingface.co/bengaliAI/badlad-frcnn-paper) | Faster R-CNN (bbox) | | [`bengaliAI/badlad-yolov8m-seg`](https://huggingface.co/bengaliAI/badlad-yolov8m-seg) | YOLOv8m-seg | ## Citation ```bibtex @inproceedings{shihab2023badlad, title = {{BaDLAD}: A Large Multi-Domain {Bengali} Document Layout Analysis Dataset}, author = {Shihab, Md. Istiak Hossain and Hasan, Md. Rakibul and Emon, Mahfuzur Rahman and Hossen, Syed Mobassir and Ansary, Md. Nazmuddoha and Ahmed, Intesur and Rakib, Fazle Rabbi and Dhruvo, Shahriar Elahi and Dip, Souhardya Saha and Pavel, Akib Hasan and Meghla, Marsia Haque and Haque, Md. Rezwanul and Chowdhury, Sayma Sultana and Sadeque, Farig and Reasat, Tahsin and Humayun, Ahmed Imtiaz and Sushmit, Asif Shahriyar}, booktitle = {Proceedings of the 17th International Conference on Document Analysis and Recognition (ICDAR)}, year = {2023}, url = {https://arxiv.org/abs/2303.05325}, } ```