Downloads · 30 days
0
ketanmore/surya-layout-fine-tune-script
surya-layout-fine-tune-script is a machine learning model from ketanmore. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Downloads · 30 days
0
Access
Public
Updated Sep 4, 2024
Repo size
41.3 MB
Likes
2
Public
Click a slice to open those files.
.zip41.3 MB · 100%
From the Hugging Face model README
This repository contains layout-fine-tune.ipynb file, Please use this file to fine tune Surya Layout Model. This model uses modified architecture of Segformer.
git clone https://github.com/vikp/surya.git
cd surya
git checkout f7c6c04
You can install the required dependencies using the following command:
pip install -r requirements.txt
For image pre-processing we can directly import a function and image processor from surya ocr github repository.
from surya.input.processing import prepare_image_detection
from surya.model.detection.segformer import load_processor
from PIL import Image
image = Image.open("path/to/image")
images = [prepare_image_detection(img=image, processor=load_processor())]
import torch
images = torch.stack(images, dim=0).to(model.dtype).to(model.device)
from surya.model.detection.segformer import load_model
model = load_model("vikp/surya_layout2")
output = model(pixel_values=images)
Surya-layout-Model does not have pre-defined loss function, We have to define it according to our dataset and the Requirements.