AraMS-Restore / README.md
Diaazg's picture
Upload folder using huggingface_hub
46f5434 verified
|
Raw
History Blame Contribute Delete
4.48 kB
---
language:
- ar
pretty_name: 'AraMS-Restore: Real Damaged Arabic Manuscript Lines'
task_categories:
- image-to-image
tags:
- arabic
- manuscripts
- historical-documents
- document-restoration
- image-restoration
- handwritten-text-recognition
- digital-humanities
size_categories:
- n<1K
---
# AraMS-Restore — Real Damaged Arabic Manuscript Lines
177 line images cropped from **real** damaged pages of a historical Arabic
manuscript (`book_09`), each with its transcription. This is the *evaluation*
input for [AraMS-Restore](https://github.com/ArchaText/AraMS-Restore): the
restoration models are trained on synthetic degradation, and these lines are the
honest test of whether that transfers to genuine manuscript decay.
There are no clean counterparts and no ground-truth restored images — the damage
is what was on the page. Models are therefore scored by **CER before vs. after
restoration**, read by a frozen HATFormer OCR critic, not by PSNR/SSIM.
## Contents
| | |
|---|---|
| Files | 177 PNGs (RGB), every one transcribed |
| Pages | 22, `book_09_page_009``book_09_page_039` (2–13 lines per page, median 10) |
| Size | 20.4 MB |
| Line dimensions | 653–977 px wide, 65–112 px tall (median 887 × 78) |
| Layout | `<page>/line_NN.png`, plus `metadata.csv` |
### metadata.csv
| Column | Meaning |
|---|---|
| `file_name` | path to the image, e.g. `book_09_page_009/line_011.png` |
| `page`, `line_num_file` | source page, and the line number in the filename |
| `page_offset` | correction from the filename number to the corpus line index (see below) |
| `line_id` | the corresponding id in AraMS-28k-HTR |
| `width`, `height` | pixel dimensions |
| `gt_text` | the transcription, already normalized |
## Usage
```bash
huggingface-cli download Archatext/AraMS-Restore --repo-type dataset --local-dir real_damage
```
Run from the root of the [code repo](https://github.com/ArchaText/AraMS-Restore),
this puts the lines exactly where the scripts expect them:
```bash
python scripts/restore_real.py --score # CER before vs. after, both models
python app/server.py # web demo — "Try a random real-damage sample"
```
Or straight into 🤗 Datasets:
```python
from datasets import load_dataset
ds = load_dataset("Archatext/AraMS-Restore", split="test")
```
## Relationship to AraMS-28k-HTR
**These images are not a subset of [AraMS-28k-HTR](https://huggingface.co/datasets/Archatext/AraMS-28k-HTR)
and cannot be reconstructed from it.** The same physical lines appear in both, but
they are cropped differently:
| | this dataset | AraMS-28k-HTR |
|---|---|---|
| Crop | raw bounding box | bounding box padded ~9 px, then **polygon-masked** |
| Neighbouring lines | fragments of the lines above/below remain | masked away |
| Coverage | 177 lines, 22 pages | the whole corpus, 28,595 lines, 14 manuscripts |
The intruding neighbour fragments are a real part of the degradation a restoration
model has to cope with, and polygon masking is not reversible. None of these
images is byte-identical to its corpus counterpart.
## Transcription alignment
`line_id` is derived from the file path, with a per-page correction carried in the
`page_offset` column (implemented as `PAGE_OFFSET` in `scripts/restore_real.py`):
pages 009 and 011 are numbered one ahead of the corpus.
```
book_09_page_010/line_015.png -> book_09__book_09_page_010_line015
book_09_page_009/line_011.png -> book_09__book_09_page_009_line010 (offset -1)
```
Every line here resolves to a transcription. An earlier revision also shipped 11
trailing lines from pages 014, 015, 018, 024, 034 and 037 whose indices fell past
where the corpus's line segmentation stopped for those pages; they carried no
transcription and were dropped, taking pages 034 and 037 with them.
`gt_text` is copied from the corpus so this set can be evaluated on its own — the
corpus remains the source of truth if the two ever disagree.
## Leakage
`book_09` sits in the `test` split of AraMS-28k-HTR — an entire manuscript held
out from restoration training, and never seen by the OCR critic that scores the
output. The before/after CER on these lines is therefore leak-free.
## Citation
<!-- TODO: add your thesis / paper reference -->
## License
<!-- TODO: choose a license and add it as `license:` in the YAML block above.
These are photographs of historical manuscripts — check the holding
institution's terms for the source scans first. -->