File size: 1,249 Bytes
7069718
 
 
 
076b19b
8805b36
076b19b
8805b36
7069718
 
 
076b19b
8805b36
076b19b
 
 
 
 
 
 
 
 
8805b36
076b19b
8805b36
076b19b
 
 
 
8805b36
076b19b
 
 
8805b36
076b19b
 
8805b36
076b19b
 
8805b36
076b19b
 
 
 
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
---
base_model:
- microsoft/trocr-base-printed
---
# anuashok/ocr-captcha-1

This model is a fine-tuned version of [microsoft/trocr-base-printed](https://huggingface.co/microsoft/trocr-base-printed) on your custom dataset.


![image/png](https://cdn-uploads.huggingface.co/production/uploads/6569b4be1bac1166939f86b2/9JB_SAnLI9qtwceTlzgqS.png)

## Training Summary

- **CER**: 0.0496031746031746
- **Hyperparameters**:
  - Learning Rate: 3.4123022229050474e-05
  - Batch Size: 8
  - Num Epochs: 6
  - Warmup Ratio: 0.057604550826554274
  - Weight Decay: 0.0716137163865213
  - Num Beams: 5
  - Length Penalty: 0.8270021759785869

## Usage

```python
from transformers import VisionEncoderDecoderModel, TrOCRProcessor
import torch
from PIL import Image

# Load model and processor
processor = TrOCRProcessor.from_pretrained("anuashok/ocr-captcha-1")
model = VisionEncoderDecoderModel.from_pretrained("anuashok/ocr-captcha-1")

# Load image
image = Image.open('path_to_your_image.jpg').convert("RGB")

# Prepare image
pixel_values = processor(image, return_tensors="pt").pixel_values

# Generate text
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_text)