Update README.md
Browse files
README.md
CHANGED
@@ -2,3 +2,25 @@
|
|
2 |
library_name: transformers
|
3 |
tags: []
|
4 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
library_name: transformers
|
3 |
tags: []
|
4 |
---
|
5 |
+
# Ink detection pipeline using the Grandprize winning model.
|
6 |
+
### Install the relevant packages using the following command:
|
7 |
+
```bash
|
8 |
+
pip install -U vesuvius transformer timesformer-pytorch
|
9 |
+
vesuvius.accept_terms --yes
|
10 |
+
```
|
11 |
+
## Read ancient text and retrieve 2000 year old letters using this simple code snippet:
|
12 |
+
```python
|
13 |
+
import vesuvius
|
14 |
+
import numpy as np
|
15 |
+
import matplotlib.pyplot as plt
|
16 |
+
from vesuvius import Volume
|
17 |
+
from transformers import pipeline
|
18 |
+
|
19 |
+
|
20 |
+
segment = Volume(20230827161847, normalize=True)
|
21 |
+
|
22 |
+
classifier = pipeline(model="YoussefMoNader/ink_detection_pipeline", trust_remote_code=True, tile_size=64, stride=32, scale_factor=16)
|
23 |
+
prediction = classifier(np.transpose(segment[17:43, 200:5600,1000:4600],(1,2,0)).astype(np.float32)) # prediction shape ~ (512,512)
|
24 |
+
|
25 |
+
plt.imshow(prediction)
|
26 |
+
```
|