Graphite Scholar is a native macOS research workflow app for paper retrieval, PDF figure extraction, figure classification, and chart digitization.
FigureClassifying abstraction with a rule-based fallback..xls workbooks: table OCR reconstruction, bar coordinate extraction, scatter point extraction with legend OCR, and line/curve sampling.swift run
swift test
On this machine's Command Line Tools install, XCTest is not available, so the test file is guarded with canImport(XCTest). Open the package in a full Xcode toolchain to execute the included unit tests.
chmod +x scripts/package_app.sh
./scripts/package_app.sh
The packaged app is written to dist/Graphite Scholar.app.
Recommended detector for paper figure/table region detection: DocLayout-YOLO with the DocStructBench weights (doclayout_yolo_docstructbench_imgsz1024.pt). It is a document-layout detector trained for scientific/document regions and usually gives better figure/table boxes than generic rectangle detection or PubLayNet-only models, while still returning captions, formulas, text, headers, and footers that Graphite Scholar can use to reject body-text false positives.
The app calls scripts/layout_detect_doclayout.py automatically when the script is present. The Python ML stack is optional and no large model is downloaded unless you explicitly opt in.
Install optional dependencies in your own environment:
python3 -m pip install doclayout-yolo huggingface_hub
export GRAPHITE_DOCLAYOUT_MODEL="/absolute/path/to/doclayout_yolo_docstructbench_imgsz1024.pt"
Runtime knobs:
export GRAPHITE_DOCLAYOUT_SCRIPT="/absolute/path/to/layout_detect_doclayout.py" # optional override
export GRAPHITE_DOCLAYOUT_CONF="0.25"
export GRAPHITE_DOCLAYOUT_IMGSZ="1024"
To allow a one-time Hugging Face download instead of providing a local model path:
export GRAPHITE_DOCLAYOUT_AUTO_DOWNLOAD="1"
export GRAPHITE_DOCLAYOUT_REPO="juliozhao/DocLayout-YOLO-DocStructBench"
export GRAPHITE_DOCLAYOUT_FILENAME="doclayout_yolo_docstructbench_imgsz1024.pt"
The detector writes a unified PageLayoutResult JSON shape:
{
"backend": "DocLayout-YOLO",
"regions": [
{
"label": "Figure",
"kind": "Figure",
"score": 0.91,
"bbox": { "x": 120, "y": 240, "width": 640, "height": 360 },
"backend": "DocLayout-YOLO",
"sourceBackend": "DocLayout-YOLO"
}
]
}
label/kind, bbox, score, and per-region backend are preserved by Swift. If DocLayout-YOLO is unavailable, the script emits an empty result and the app continues to the next detector. A Hugging Face DETR fallback can be enabled separately with GRAPHITE_LAYOUT_ENABLE_DETR=1, but DocLayout-YOLO is the preferred backend.
Graphite Scholar now integrates a PubLayNet-style layout detector through scripts/publaynet_layout.py. PubLayNet is used for page region detection and layout classification (Text, Title, List, Table, Figure), then the Swift app crops detected Figure and Table regions from rendered PDF pages.
Install the optional Python backend in your own environment:
python3 -m pip install "layoutparser[layoutmodels]" opencv-python pillow
# install detectron2 following the official Detectron2 instructions for your macOS/Python/PyTorch version
Runtime knobs:
export GRAPHITE_PUBLAYNET_SCRIPT="/absolute/path/to/publaynet_layout.py"
export GRAPHITE_PUBLAYNET_CONFIG="lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config"
export GRAPHITE_PUBLAYNET_THRESHOLD="0.55"
export GRAPHITE_PUBLAYNET_DEVICE="cpu"
If the Python ML stack is not installed, the app automatically falls back to the next available detector.
The project also includes an adapter for AllenAI pdffigures2, which is often a better fit for scholarly PDFs because it extracts figures, tables, captions, and bounding boxes directly from PDFs. To use it, generate pdffigures2 JSON separately and point Graphite Scholar at it:
export GRAPHITE_PDFFIGURES2_JSON="/absolute/path/to/pdffigures2-output.json"
deepfigures-open is also relevant for neural figure extraction, but it is research code and depends on pdffigures2, so it is best treated as a future backend rather than the default app dependency.
This v1 intentionally follows the public WebPlotDigitizer-style workflow conceptually without copying AGPL code. The classifier is swappable: replace RuleBasedFigureClassifier with a Core ML or ONNX-backed implementation when a trained model is available.
Graphite Scholar is a native macOS research workflow app for paper retrieval, PDF figure extraction, figure classification, and chart digitization.
FigureClassifying abstraction with a rule-based fallback..xls workbooks: table OCR reconstruction, bar coordinate extraction, scatter point extraction with legend OCR, and line/curve sampling.swift run
swift test
On this machine's Command Line Tools install, XCTest is not available, so the test file is guarded with canImport(XCTest). Open the package in a full Xcode toolchain to execute the included unit tests.
chmod +x scripts/package_app.sh
./scripts/package_app.sh
The packaged app is written to dist/Graphite Scholar.app.
Recommended detector for paper figure/table region detection: DocLayout-YOLO with the DocStructBench weights (doclayout_yolo_docstructbench_imgsz1024.pt). It is a document-layout detector trained for scientific/document regions and usually gives better figure/table boxes than generic rectangle detection or PubLayNet-only models, while still returning captions, formulas, text, headers, and footers that Graphite Scholar can use to reject body-text false positives.
The app calls scripts/layout_detect_doclayout.py automatically when the script is present. The Python ML stack is optional and no large model is downloaded unless you explicitly opt in.
Install optional dependencies in your own environment:
python3 -m pip install doclayout-yolo huggingface_hub
export GRAPHITE_DOCLAYOUT_MODEL="/absolute/path/to/doclayout_yolo_docstructbench_imgsz1024.pt"
Runtime knobs:
export GRAPHITE_DOCLAYOUT_SCRIPT="/absolute/path/to/layout_detect_doclayout.py" # optional override
export GRAPHITE_DOCLAYOUT_CONF="0.25"
export GRAPHITE_DOCLAYOUT_IMGSZ="1024"
To allow a one-time Hugging Face download instead of providing a local model path:
export GRAPHITE_DOCLAYOUT_AUTO_DOWNLOAD="1"
export GRAPHITE_DOCLAYOUT_REPO="juliozhao/DocLayout-YOLO-DocStructBench"
export GRAPHITE_DOCLAYOUT_FILENAME="doclayout_yolo_docstructbench_imgsz1024.pt"
The detector writes a unified PageLayoutResult JSON shape:
{
"backend": "DocLayout-YOLO",
"regions": [
{
"label": "Figure",
"kind": "Figure",
"score": 0.91,
"bbox": { "x": 120, "y": 240, "width": 640, "height": 360 },
"backend": "DocLayout-YOLO",
"sourceBackend": "DocLayout-YOLO"
}
]
}
label/kind, bbox, score, and per-region backend are preserved by Swift. If DocLayout-YOLO is unavailable, the script emits an empty result and the app continues to the next detector. A Hugging Face DETR fallback can be enabled separately with GRAPHITE_LAYOUT_ENABLE_DETR=1, but DocLayout-YOLO is the preferred backend.
Graphite Scholar now integrates a PubLayNet-style layout detector through scripts/publaynet_layout.py. PubLayNet is used for page region detection and layout classification (Text, Title, List, Table, Figure), then the Swift app crops detected Figure and Table regions from rendered PDF pages.
Install the optional Python backend in your own environment:
python3 -m pip install "layoutparser[layoutmodels]" opencv-python pillow
# install detectron2 following the official Detectron2 instructions for your macOS/Python/PyTorch version
Runtime knobs:
export GRAPHITE_PUBLAYNET_SCRIPT="/absolute/path/to/publaynet_layout.py"
export GRAPHITE_PUBLAYNET_CONFIG="lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config"
export GRAPHITE_PUBLAYNET_THRESHOLD="0.55"
export GRAPHITE_PUBLAYNET_DEVICE="cpu"
If the Python ML stack is not installed, the app automatically falls back to the next available detector.
The project also includes an adapter for AllenAI pdffigures2, which is often a better fit for scholarly PDFs because it extracts figures, tables, captions, and bounding boxes directly from PDFs. To use it, generate pdffigures2 JSON separately and point Graphite Scholar at it:
export GRAPHITE_PDFFIGURES2_JSON="/absolute/path/to/pdffigures2-output.json"
deepfigures-open is also relevant for neural figure extraction, but it is research code and depends on pdffigures2, so it is best treated as a future backend rather than the default app dependency.
This v1 intentionally follows the public WebPlotDigitizer-style workflow conceptually without copying AGPL code. The classifier is swappable: replace RuleBasedFigureClassifier with a Core ML or ONNX-backed implementation when a trained model is available.