Yolov9-lines-within-regions-handwritten

A yolov9 instance segmentation model for segmenting text-lines within text-regions. To be used after text-regions segmentation as part of an HTR-pipeline

Model Details

Model Description

This model was developed for segmenting text-lines within text-regions in handwritten running-text documents. It wont work on full pages but only on cropped text-regions. It is meant to be implemented in an HTR-pipeline where one first segment text-regions, then text-lines within the regions, and then feed these text-lines to an HTR-model.

  • Developed by: The Swedish National Archives
  • Model type: yolov9
  • License: [More Information Needed]

Model Sources

Uses

Direct Use

Segment text-lines within text-regions as part of an HTR-pipeline for handwritten running-text documents

Downstream Use

As part of an HTR-pipeline for transcribing entire pages of handwritten running-text documents. See Swedish Lion Libre for example usage with the HTRflow package

How to Get Started with the Model

How to Load and Use the YOLOv9 Instance Segmentation Model

Below is the Python code to load and use the trained YOLOv9 instance segmentation model using the Ultralytics repo:

import torch
from ultralytics import YOLO
# Load the trained YOLOv9 model
model = YOLO('path/to/your/model.pt')  # Update with the correct path to your trained model
# Load an image
img = 'path/to/your/image.jpg'  # Update with the path to the image you want to use
# Perform instance segmentation
results = model(img)
# Display results
results.show()  # Show image with predicted masks
# To get the raw predictions (bounding boxes, masks, etc.)
for result in results:
    print(result.boxes)  # Bounding boxes
    print(result.masks)  # Segmentation masks

Usage with the HTRflow package

See the model card for Swedish Lion Libre for example usage with the HTRflow package, or refer to the documentation for HTRflow

Training Details

Training Data

Trolldomskommissionen
Svea Hovrätt
Krigshovrättens domböcker
Jönköpings rådhusrätt och magistrat
Göta hovrätt
Frihetstidens utskottshandlingar
Bergskollegium relationer och skrivelser
Bergskollegium advokatfiskalkontoret

Training Procedure

Training Hyperparameters

See training config at model repo

Evaluation

See training results

Metrics

Standard metrics for instance segmentation. Note that evaluation of segmentation as part of an HTR-pipeline should be measured by what effect it has on the following HTR, that is, CER and WER for the entire page. For implementation and evaluation of entire HTR-pipelines, please check out HTRflow, the Swedish National Archive's open-source package for HTR and OCR projects.

Model Architecture and Objective

yolov9

Software

Ultralytics

Citation

YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information

Downloads last month
4
Inference API
Unable to determine this model’s pipeline type. Check the docs .

Collection including Riksarkivet/yolov9-lines-within-regions-1