cxfajar197 commited on
Commit
6cd68d6
·
verified ·
1 Parent(s): a4a44a2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -228
README.md CHANGED
@@ -1,228 +1 @@
1
- ---
2
- library_name: transformers
3
- language:
4
- - ur
5
- pipeline_tag: image-to-text
6
- ---
7
-
8
- # Model Card for Model ID
9
-
10
- <!-- Provide a quick summary of what the model is/does. -->
11
-
12
-
13
- This is an Urdu OCR model designed for handwriting recognition tasks. It utilizes a VisionEncoderDecoderModel with a ViT-based encoder and a BERT-based decoder, fine-tuned on a custom dataset for robust and accurate text extraction from images.
14
-
15
-
16
-
17
- ## Model Details
18
-
19
- ### Model Description
20
-
21
- <!-- Provide a longer summary of what this model is. -->
22
-
23
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
24
-
25
- - **Developed by:** Fajar Pervaiz
26
- - **Model type:** VisionEncoderDecoderModel
27
- - **Language(s) (NLP):** Urdu (ur)
28
- - **Finetuned from model [optional]:** facebook/deit-base-distilled-patch16-384, bert-base-multilingual-cased
29
-
30
- ### Model Sources [optional]
31
-
32
- <!-- Provide the basic links for the model. -->
33
-
34
- - **Repository:** [More Information Needed]
35
- - **Paper [optional]:** [More Information Needed]
36
- - **Demo [optional]:** [More Information Needed]
37
-
38
- ## Uses
39
-
40
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
41
-
42
- ### Direct Use
43
-
44
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
45
- This model can be directly used for Urdu handwriting recognition tasks, particularly for extracting text from scanned documents or handwritten notes.
46
-
47
-
48
- ### Downstream Use [optional]
49
-
50
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
51
- This model can be fine-tuned further for specific handwriting datasets or integrated into larger OCR systems for Urdu or multilingual text recognition.
52
-
53
-
54
-
55
- ### Out-of-Scope Use
56
-
57
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
58
- The model is not suitable for languages other than Urdu or domains with highly noisy or distorted images without further fine-tuning.
59
-
60
- ## Bias, Risks, and Limitations
61
-
62
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
63
- The model may exhibit biases inherent in the training data. Misrecognition of complex or ambiguous handwriting is possible. Users should carefully evaluate its performance in their specific use case.
64
-
65
-
66
-
67
- ### Recommendations
68
-
69
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
70
-
71
- Users should test the model thoroughly on their specific dataset and consider additional fine-tuning if required. Misuse in sensitive applications (e.g., legal or medical document OCR) should be avoided without rigorous evaluation.
72
- ## How to Get Started with the Model
73
-
74
- Use the code below to get started with the model.
75
-
76
- from transformers import VisionEncoderDecoderModel, TrOCRProcessor
77
- processor = TrOCRProcessor.from_pretrained("path/to/processor")
78
- model = VisionEncoderDecoderModel.from_pretrained("path/to/model")
79
-
80
-
81
-
82
-
83
- ## Training Details
84
-
85
-
86
- ### Training Data
87
-
88
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
89
- The training data comprises 46,742 image-text pairs from a custom dataset of Urdu handwritten texts.
90
-
91
-
92
-
93
- ### Training Procedure
94
-
95
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
96
- Images were resized to 384x384 pixels and normalized. Augmentations such as Elastic Transform and Gaussian Blur were applied to enhance robustness.
97
-
98
- #### Preprocessing [optional]
99
-
100
-
101
-
102
-
103
- #### Training Hyperparameters
104
-
105
- - **Training regime:** <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
106
- - Training regime: Mixed precision (fp16)
107
- - Learning rate: 4e-5
108
- - Batch size: 8
109
- - Epochs: 12
110
- - Optimizer: AdamW
111
- - Scheduler: Linear decay
112
-
113
- #### Speeds, Sizes, Times [optional]
114
-
115
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
116
-
117
-
118
- ## Evaluation
119
-
120
- <!-- This section describes the evaluation protocols and provides the results. -->
121
-
122
- ### Testing Data, Factors & Metrics
123
-
124
- #### Testing Data
125
-
126
- <!-- This should link to a Dataset Card if possible. -->
127
- A subset of 4,675 image-text pairs was used for evaluation.
128
-
129
-
130
-
131
- #### Factors
132
-
133
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
134
- The model was tested on handwritten text images with varying font styles and complexities.
135
-
136
-
137
-
138
-
139
-
140
- #### Metrics
141
-
142
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
143
-
144
-
145
-
146
- ### Results
147
-
148
-
149
-
150
- #### Summary
151
-
152
-
153
-
154
- ## Model Examination [optional]
155
-
156
- <!-- Relevant interpretability work for the model goes here -->
157
-
158
-
159
-
160
- ## Environmental Impact
161
-
162
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
163
-
164
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
165
-
166
- - **Hardware Type:** NVIDIA GPU
167
- - **Hours used:** [More Information Needed]
168
- - **Cloud Provider:** [More Information Needed]
169
- - **Compute Region:** [More Information Needed]
170
- - **Carbon Emitted:** [More Information Needed]
171
-
172
- ## Technical Specifications [optional]
173
-
174
- ### Model Architecture and Objective
175
-
176
- The model uses a VisionEncoderDecoder architecture combining a ViT encoder and a BERT decoder.
177
-
178
-
179
- ### Compute Infrastructure
180
-
181
-
182
-
183
- #### Hardware
184
-
185
- NVIDIA GPU (e.g., A100)
186
-
187
-
188
- #### Software
189
-
190
-
191
- Python, PyTorch, Hugging Face Transformers
192
-
193
-
194
-
195
- ## Citation [optional]
196
-
197
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
198
-
199
- **BibTeX:**
200
-
201
- [More Information Needed]
202
-
203
- **APA:**
204
-
205
-
206
-
207
- ## Glossary [optional]
208
-
209
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
210
- CER: Character Error Rate
211
- WER: Word Error Rate
212
- OCR: Optical Character Recognition
213
-
214
-
215
-
216
- ## More Information [optional]
217
-
218
- [More Information Needed]
219
-
220
- ## Model Card Authors [optional]
221
-
222
-
223
- Fajar Pervaiz
224
-
225
- ## Model Card Contact
226
-
227
-
228
 
1
+ This model, `cxfajar197/urdu-ocr`, is trained on Urdu data specifically designed for OCR tasks. It works best with single-line Urdu text images, primarily focusing on printed text. The model is optimized for extracting accurate Urdu text from such images and can be easily utilized using the Hugging Face pipeline API.