File size: 4,737 Bytes
a792aa8 e06650b a792aa8 b28c9f4 a792aa8 b28c9f4 a792aa8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
---
datasets:
- Riksarkivet/trolldomskommissionen_seg
- Riksarkivet/svea_hovratt_seg
- Riksarkivet/krigshovrattens_dombocker_seg
- Riksarkivet/jonkopings_radhusratts_och_magistrat_seg
- Riksarkivet/gota_hovratt_seg
- Riksarkivet/frihetstidens_utskottshandlingar_seg
- Riksarkivet/bergskollegium_relationer_och_skrivelser_seg
- Riksarkivet/bergskollegium_advokatfiskalskontoret_seg
tags:
- instance segmentation
- text regions
- handwritten
- htr
library_name: htrflow
---
# Yolov9-textregions-handwritten
<!-- Provide a quick summary of what the model is/does. -->
A yolov9 instance segmentation model for segmenting text-regions in handwritten running-text documents
## Model Details
### Model Description
This model was developed for segmenting text-regions in handwritten running-text documents. 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 [optional]
- **Repository:** [yolov9-regions-1](https://huggingface.co/Riksarkivet/yolov9-regions-1)
- **Paper:** [YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information](https://arxiv.org/abs/2402.13616)
## Uses
### Direct Use
Segment text-regions in handwritten running-text documents
### Downstream Use [optional]
As part of an HTR-pipeline for transcribing entire pages of handwritten running-text documents. See [Swedish Lion Libre](https://huggingface.co/Riksarkivet/trocr-base-handwritten-hist-swe-2)
for example usage with the [HTRflow package](https://github.com/AI-Riksarkivet/htrflow)
## 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:
```python
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](https://huggingface.co/Riksarkivet/trocr-base-handwritten-hist-swe-2)
for example usage with the [HTRflow package](https://github.com/AI-Riksarkivet/htrflow), or refer to the documentation for
[HTRflow](https://github.com/AI-Riksarkivet/htrflow)
## Training Details
### Training Data
[Trolldomskommissionen](https://huggingface.co/datasets/Riksarkivet/trolldomskommissionen_seg)
[Svea Hovrätt](https://huggingface.co/datasets/Riksarkivet/svea_hovratt_seg)
[Krigshovrättens domböcker](https://huggingface.co/datasets/Riksarkivet/krigshovrattens_dombocker_seg)
[Jönköpings rådhusrätt och magistrat](https://huggingface.co/datasets/Riksarkivet/jonkopings_radhusratts_och_magistrat_seg)
[Göta hovrätt](https://huggingface.co/datasets/Riksarkivet/gota_hovratt_seg)
[Frihetstidens utskottshandlingar](https://huggingface.co/datasets/Riksarkivet/frihetstidens_utskottshandlingar_seg)
[Bergskollegium relationer och skrivelser](https://huggingface.co/datasets/Riksarkivet/bergskollegium_relationer_och_skrivelser_seg)
[Bergskollegium advokatfiskalkontoret](https://huggingface.co/datasets/Riksarkivet/bergskollegium_advokatfiskalskontoret_seg)
### Training Procedure
#### Training Hyperparameters
See [training config](https://huggingface.co/Riksarkivet/yolov9-regions-1/blob/main/args.yaml) at model repo
## Evaluation
See [training results](https://huggingface.co/Riksarkivet/yolov9-regions-1/blob/main/results.csv)
#### 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 implementation and evaluation of entire HTR-pipelines, please check out [HTRflow](https://github.com/AI-Riksarkivet/htrflow),
the Swedish National Archive's open-source package for HTR and OCR projects.
### Model Architecture and Objective
yolov9
#### Software
[Ultralytics](https://github.com/ultralytics)
## Citation [optional]
[YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information](https://arxiv.org/abs/2402.13616) |