File size: 836 Bytes
6fec424 53bc9c8 f555450 53bc9c8 |
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 |
---
library_name: transformers
tags: []
---
# Ink detection pipeline using the Grandprize winning model.
### Install the relevant packages using the following command:
```bash
pip install -U vesuvius transformer timesformer-pytorch
vesuvius.accept_terms --yes
```
## Read ancient text and retrieve 2000 year old letters using this simple code snippet:
```python
import vesuvius
import numpy as np
import matplotlib.pyplot as plt
from vesuvius import Volume
from transformers import pipeline
segment = Volume(20230827161847, normalize=True)
classifier = pipeline(model="scrollprize/ink_detection_pipeline", trust_remote_code=True, tile_size=64, stride=32, scale_factor=16)
prediction = classifier(np.transpose(segment[17:43, 200:5600,1000:4600],(1,2,0)).astype(np.float32)) # prediction shape ~ (512,512)
plt.imshow(prediction)
``` |