DocLayout-YOLO: Enhancing Document Layout Analysis through Diverse Synthetic Data and Global-to-Local Adaptive Perception
Paper • 2410.12628 • Published • 42
How to use anyformat/doclayout-yolo-docstructbench with ultralytics:
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
# pick the weights file from this repo's "Files and versions" tab
weights = hf_hub_download("anyformat/doclayout-yolo-docstructbench", "<weights>.pt")
model = YOLO(weights)
source = 'http://images.cocodataset.org/val2017/000000039769.jpg'
model.predict(source=source, save=True)Document layout detection model. Paper: DocLayout-YOLO
titleplain_textabandonfigurefigure_captiontabletable_captiontable_footnoteisolate_formulaformula_captionpip install anyformat-doclayout
from anyformat.doclayout import DocLayoutModel, download_converted
# Download weights from this repo
weights = download_converted("docstructbench")
# Run inference
model = DocLayoutModel(weights)
results = model.predict("document.png")
for det in results:
print(f"{det['class_name']}: {det['confidence']:.2f}")
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("anyformat/doclayout-yolo-docstructbench", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True)