https://github.com/shallowmanica/doc-layout-parser
A layout analysis pipeline using Detectron2 + Label Studio for extracting based on Fast R-CNN and annotating sections like abstract, table, figure, and references from academic PDFs
https://github.com/shallowmanica/doc-layout-parser
detectron2 fastrcnn labelstudio layoutparser parameter-tuning parsing pytorch
Last synced: 5 months ago
JSON representation
A layout analysis pipeline using Detectron2 + Label Studio for extracting based on Fast R-CNN and annotating sections like abstract, table, figure, and references from academic PDFs
- Host: GitHub
- URL: https://github.com/shallowmanica/doc-layout-parser
- Owner: shallowManica
- Created: 2025-05-08T07:09:22.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-11T13:16:11.000Z (about 1 year ago)
- Last Synced: 2025-06-15T05:36:05.336Z (about 1 year ago)
- Topics: detectron2, fastrcnn, labelstudio, layoutparser, parameter-tuning, parsing, pytorch
- Language: Jupyter Notebook
- Homepage:
- Size: 2.03 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# doc-layout-parser
This project develops a layout parsing pipeline to extract key components (e.g., abstract, context, table, reference) from academic PDFs using a Detectron2-based model trained on annotations from Label Studio.
## 🔍 Purpose
To identify and segment document elements like titles, authors, abstracts, tables, figures, and references using object detection techniques, improving downstream analysis and semantic classification with LLMs.
## ⚙️ Features
- Fast R-CNN architecture (Detectron2) for layout detection
- Layout categories: Abstract, Author, Context, Header, Image, Reference, Sub-title, Table, Title
- Integration-ready with LLMs for content-based filtering or labeling
- Configuration through `config.yaml`
## 🗃 File Structure
- `config.yaml` - Detectron2 configuration for the layout model
- `result.json` - Output annotations from model inference
- `parsing.ipynb` - Sample notebook to run detection and visualize results
## 📦 Dependencies
Install via pip:
```bash
!pip install pycocotools
!pip install layoutparser
!pip install "layoutparser[effdet]"
!pip install layoutparser torchvision
!python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
!pip install layoutparser torchvision && pip install "git+https://github.com/facebookresearch/detectron2.git@v0.5#egg=detectron2"
!pip install "layoutparser[paddledetection]"
!pip install "layoutparser[ocr]"
```
Install via Conda:
```bash
conda install detectron2 pytorch opencv omegaconf hydra-core -c conda-forge
```
🚀 How to Run
```bash
# Inside parsing.ipynb
from layoutparser.models import Detectron2LayoutModel
model = Detectron2LayoutModel(
config_path='config.yaml',
extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8],
label_map={0: "Abstract", 1: "Author", ...}
)
```
```bash
📄 Annotation Categories
• Abstract
• Author
• Context
• Header
• Image
• Reference
• Sub-title
• Table
• Title
```