Upload README.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263# Docling Model for Layout
This is the **Docling model for layout detection**, designed to facilitate easy importing and usage like any other Hugging Face model.
This model is part of the [Docling repository](https://huggingface.co/ds4sd/docling-models), which provides document layout analysis tools.
## **Usage Example**Here's how you can load and use the model:
```pythonimport torchfrom PIL import Imagefrom transformers import RTDetrForObjectDetection, RTDetrImageProcessor
# Load the model and processorimage_processor = RTDetrImageProcessor.from_pretrained("your-username/your-model-name")model = RTDetrForObjectDetection.from_pretrained("your-username/your-model-name")
# Load an imageimage = Image.open("your-image.png")
# Preprocess the imageinputs = image_processor(images=image, return_tensors="pt")
# Perform inferencewith torch.no_grad(): outputs = model(**inputs)
# Post-process resultsresults = image_processor.post_process_object_detection( outputs, target_sizes=torch.tensor([(image.height, image.width)]), threshold=0.3)
# Print detected objectsfor result in results: for score, label_id, box in zip(result["scores"], result["labels"], result["boxes"]): score, label = score.item(), label_id.item() box = [round(i, 2) for i in box.tolist()] print(f"{model.config.id2label[label]}: {score:.2f} {box}")```
## **Model Information**- **Base Model:** RT-DETR (Robust Transformer-based Object Detector)- **Intended Use:** Layout detection for documents- **Framework:** [Hugging Face Transformers](https://huggingface.co/docs/transformers/index)- **Dataset Used:** Internal dataset for document structure recognition- **License:** Apache 2.0
## **Citing This Model**If you use this model in your work, please cite the main **Docling repository**:
```@misc{docling2024, title={Docling Models for Document Layout Analysis}, author={DS4SD Team}, year={2024}, howpublished={Hugging Face Repository}, url={https://huggingface.co/ds4sd/docling-models} }```
For more details, visit the main repo: [ds4sd/docling-models](https://huggingface.co/ds4sd/docling-models).
## **Contact**For questions or issues, please open a discussion on Hugging Face or contact [pandahd7u5@gmail.com].
README.mdAdded+63