Instructions to use Armaggheddon/yolo11-document-layout with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use Armaggheddon/yolo11-document-layout with ultralytics:
from ultralytics import YOLOvv11 model = YOLOvv11.from_pretrained("Armaggheddon/yolo11-document-layout") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Provided google colab notebook is not working
#2
by PracePartap - opened
Hi @PracePartap , thank you for the interest in the model! I don't recall having a shared notebook in the project and cannot seem to be able to find it, maybe was an old version committed. You can however either access tha hf space that provides an intuitive interface to interact with the different models, or alternatively use the code below to use the model in the notebook, from the github repository:
from pathlib import Path
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
# Define the local directory to save models
DOWNLOAD_PATH = Path("./models")
DOWNLOAD_PATH.mkdir(exist_ok=True)
# Choose which model to use
# 0: nano, 1: small, 2: medium
model_files = [
"yolo11n_doc_layout.pt",
"yolo11s_doc_layout.pt",
"yolo11m_doc_layout.pt",
]
selected_model_file = model_files[0] # Using the recommended nano model
# Download the model from the Hugging Face Hub
model_path = hf_hub_download(
repo_id="Armaggheddon/yolo11-document-layout",
filename=selected_model_file,
repo_type="model",
local_dir=DOWNLOAD_PATH,
)
# Initialize the YOLO model
model = YOLO(model_path)
# Run inference on an image
# Replace 'path/to/your/document.jpg' with your file
results = model('path/to/your/document.jpg')
# Save the results
results[0].save(filename="result.jpg")
and edit it as you prefer.
