Views
No views yet
nevernever69/dit-doclaynet-segmentationnevernever69/small-DocLayNet-v1.1). It segments scanned document images into 11 layout categories such as title, paragraph, table, and footer.| ID | Label | Color |
|---|---|---|
| 0 | Background | Black |
| 1 | Title | Red |
| 2 | Paragraph | Green |
| 3 | Figure | Blue |
| 4 | Table | Yellow |
| 5 | List | Magenta |
| 6 | Header | Cyan |
| 7 | Footer | Dark Red |
| 8 | Page Number | Dark Green |
| 9 | Footnote | Dark Blue |
| 10 | Caption | Olive |
microsoft/dit-basenevernever69/small-DocLayNet-v1.1fp16) on GPU1from transformers import AutoImageProcessor, BeitForSemanticSegmentation
2from PIL import Image
3import torch
4
5# Load model
6model = BeitForSemanticSegmentation.from_pretrained("nevernever69/dit-doclaynet-segmentation")
7image_processor = AutoImageProcessor.from_pretrained("nevernever69/dit-doclaynet-segmentation")
8
9# Load and preprocess image
10image = Image.open("your-image.png").convert("RGB")
11inputs = image_processor(images=image, return_tensors="pt").to("cuda")
12
13# Inference
14model.to("cuda").eval()
15with torch.no_grad():
16 outputs = model(**inputs)
17 logits = outputs.logits
18 upsampled = torch.nn.functional.interpolate(logits, size=image.size[::-1], mode="bilinear", align_corners=False)
19 mask = upsampled.argmax(dim=1).squeeze().cpu().numpy()@nevernever69.1@misc{never2025doclaynetseg,
2 author = {Never},
3 title = {Document Layout Segmentation using DiT-base fine-tuned on DocLayNet},
4 year = {2025},
5 howpublished = {\url{https://huggingface.co/nevernever69/dit-doclaynet-segmentation}}
6}