Sneriko commited on
Commit
1f5451b
·
verified ·
1 Parent(s): a91f6a8

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +126 -0
README.md ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - Riksarkivet/trolldomskommissionen_seg
4
+ - Riksarkivet/svea_hovratt_seg
5
+ - Riksarkivet/krigshovrattens_dombocker_seg
6
+ - Riksarkivet/jonkopings_radhusratts_och_magistrat_seg
7
+ - Riksarkivet/gota_hovratt_seg
8
+ - Riksarkivet/frihetstidens_utskottshandlingar_seg
9
+ - Riksarkivet/bergskollegium_relationer_och_skrivelser_seg
10
+ - Riksarkivet/bergskollegium_advokatfiskalskontoret_seg
11
+ tags:
12
+ - instance segmentation
13
+ - handwritten
14
+ - htr
15
+ - text lines
16
+ ---
17
+ # Yolov9-lines-within-regions-handwritten
18
+
19
+ <!-- Provide a quick summary of what the model is/does. -->
20
+
21
+ 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
22
+
23
+
24
+ ## Model Details
25
+
26
+ ### Model Description
27
+
28
+ 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.
29
+ 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.
30
+
31
+ - **Developed by:** The Swedish National Archives
32
+ - **Model type:** yolov9
33
+ - **License:** [More Information Needed]
34
+
35
+ ### Model Sources
36
+
37
+ - **Repository:** [yolov9-lines_within_regions-1](https://huggingface.co/Riksarkivet/yolov9-lines-within-regions-1)
38
+ - **Paper:** [YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information](https://arxiv.org/abs/2402.13616)
39
+
40
+ ## Uses
41
+
42
+
43
+ ### Direct Use
44
+
45
+ Segment text-lines within text-regions as part of an HTR-pipeline for handwritten running-text documents
46
+
47
+ ### Downstream Use [optional]
48
+
49
+ 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)
50
+ for example usage with the [HTRflow package](https://github.com/AI-Riksarkivet/htrflow)
51
+
52
+
53
+ ## How to Get Started with the Model
54
+
55
+ ### How to Load and Use the YOLOv9 Instance Segmentation Model
56
+
57
+ Below is the Python code to load and use the trained YOLOv9 instance segmentation model using the Ultralytics repo:
58
+
59
+ ```python
60
+ import torch
61
+ from ultralytics import YOLO
62
+ # Load the trained YOLOv9 model
63
+ model = YOLO('path/to/your/model.pt') # Update with the correct path to your trained model
64
+ # Load an image
65
+ img = 'path/to/your/image.jpg' # Update with the path to the image you want to use
66
+ # Perform instance segmentation
67
+ results = model(img)
68
+ # Display results
69
+ results.show() # Show image with predicted masks
70
+ # To get the raw predictions (bounding boxes, masks, etc.)
71
+ for result in results:
72
+ print(result.boxes) # Bounding boxes
73
+ print(result.masks) # Segmentation masks
74
+ ```
75
+
76
+ ### Usage with the HTRflow package
77
+
78
+ See the model card for [Swedish Lion Libre](https://huggingface.co/Riksarkivet/trocr-base-handwritten-hist-swe-2)
79
+ for example usage with the [HTRflow package](https://github.com/AI-Riksarkivet/htrflow), or refer to the documentation for
80
+ [HTRflow](https://github.com/AI-Riksarkivet/htrflow)
81
+
82
+ ## Training Details
83
+
84
+ ### Training Data
85
+
86
+ [Trolldomskommissionen](https://huggingface.co/datasets/Riksarkivet/trolldomskommissionen_seg)
87
+ [Svea Hovrätt](https://huggingface.co/datasets/Riksarkivet/svea_hovratt_seg)
88
+ [Krigshovrättens domböcker](https://huggingface.co/datasets/Riksarkivet/krigshovrattens_dombocker_seg)
89
+ [Jönköpings rådhusrätt och magistrat](https://huggingface.co/datasets/Riksarkivet/jonkopings_radhusratts_och_magistrat_seg)
90
+ [Göta hovrätt](https://huggingface.co/datasets/Riksarkivet/gota_hovratt_seg)
91
+ [Frihetstidens utskottshandlingar](https://huggingface.co/datasets/Riksarkivet/frihetstidens_utskottshandlingar_seg)
92
+ [Bergskollegium relationer och skrivelser](https://huggingface.co/datasets/Riksarkivet/bergskollegium_relationer_och_skrivelser_seg)
93
+ [Bergskollegium advokatfiskalkontoret](https://huggingface.co/datasets/Riksarkivet/bergskollegium_advokatfiskalskontoret_seg)
94
+
95
+
96
+ ### Training Procedure
97
+
98
+
99
+ #### Training Hyperparameters
100
+
101
+ See [training config](https://huggingface.co/Riksarkivet/yolov9-lines-within-regions/blob/main/args.yaml) at model repo
102
+
103
+
104
+ ## Evaluation
105
+
106
+ See [training results](https://huggingface.co/Riksarkivet/yolov9-lines-within-regions-1/blob/main/results.csv)
107
+
108
+
109
+ #### Metrics
110
+
111
+ Standard metrics for instance segmentation. Note that evaluation of segmentation as part of an HTR-pipeline should be measured by what effect it
112
+ 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](https://github.com/AI-Riksarkivet/htrflow),
113
+ the Swedish National Archive's open-source package for HTR and OCR projects.
114
+
115
+
116
+ ### Model Architecture and Objective
117
+
118
+ yolov9
119
+
120
+ #### Software
121
+
122
+ [Ultralytics](https://github.com/ultralytics)
123
+
124
+ ## Citation [optional]
125
+
126
+ [YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information](https://arxiv.org/abs/2402.13616)