{"id":23073,"library":"doclayout-yolo","title":"DocLayout-YOLO","description":"DocLayout-YOLO is an efficient and robust document layout analysis method based on YOLO, optimized for detecting document elements like text, tables, figures, and titles. Current version 0.0.4, pre-release stage with irregular cadence.","status":"active","version":"0.0.4","language":"python","source_language":"en","source_url":"https://github.com/opendatalab/DocLayout-YOLO","tags":["document layout analysis","YOLO","OCR","document understanding","deep learning"],"install":[{"cmd":"pip install doclayout-yolo","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Core inference engine; YOLO models are loaded via ultralytics.YOLO.","package":"ultralytics","optional":false},{"reason":"PyTorch is required by ultralytics for model computation.","package":"torch","optional":false}],"imports":[{"note":"Main entry point for document layout detection.","symbol":"detect_layout","correct":"from doclayout_yolo import detect_layout"},{"note":"Wrong: Direct import of class is correct; avoid unnecessary alias that might confuse users.","wrong":"from doclayout_yolo import DocLayoutYOLO as DLY","symbol":"DocLayoutYOLO","correct":"from doclayout_yolo import DocLayoutYOLO"}],"quickstart":{"code":"from doclayout_yolo import detect_layout\n# Replace with your image path\nimage_path = 'document.jpg'\nresults = detect_layout(image_path)\nprint(results)","lang":"python","description":"Detect document layout elements (e.g., text, table, figure) in an image. The function returns a list of detected objects with bounding boxes and labels."},"warnings":[{"fix":"Run offline: download model file manually and specify model path via `detect_layout(image, model_path='path/to/model.pt')`.","message":"Model weights are downloaded automatically on first use. Ensure internet access or pre-download the weights to avoid runtime errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `pip install doclayout-yolo==0.0.4` and check release notes before upgrading.","message":"The library is in early stage (v0.0.4); the API may change without notice. Pin the exact version in requirements.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Upgrade to >=0.0.2 and use `from doclayout_yolo import detect_layout`.","message":"The function `detect_layout` was introduced in v0.0.2; older versions required direct import of `DocLayoutYOLO` class and manual inference.","severity":"deprecated","affected_versions":"<0.0.2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install ultralytics` in your environment.","cause":"Ultralytics is a required dependency not installed automatically in some environments.","error":"ModuleNotFoundError: No module named 'ultralytics'"},{"fix":"Ensure internet connectivity on first run, or manually download the model and set `model_path` argument.","cause":"Model weights are missing because automatic download failed (e.g., no internet) or custom path is incorrect.","error":"FileNotFoundError: [Errno 2] No such file or directory: '.../doclayout_yolo/model/doclayout_yolo.pt'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}