PawanKrGunjan commited on
Commit
b0081fc
1 Parent(s): e159898

License Plate Number

Browse files
Files changed (1) hide show
  1. README.md +85 -40
README.md CHANGED
@@ -1,56 +1,64 @@
1
- ---
2
- base_model: microsoft/trocr-base-handwritten
3
- tags:
4
- - generated_from_trainer
5
- model-index:
6
- - name: license_plate_recognizer
7
- results: []
8
- license: mit
9
- language:
10
- - en
11
- metrics:
12
- - cer
13
- library_name: transformers
14
- pipeline_tag: image-to-text
15
- ---
 
 
 
 
16
 
17
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
18
  should probably proofread and complete it, then remove this comment. -->
19
 
20
  [<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/pawankrgunjan/huggingface/runs/v5cu1qdh)
 
 
21
  # license_plate_recognizer
22
 
23
- This model is a fine-tuned version of [microsoft/trocr-base-handwritten](https://huggingface.co/microsoft/trocr-base-handwritten) on an unknown dataset.
24
- It achieves the following results on the evaluation set:
25
- - Loss: 0.0653
26
- - Cer: 0.0231
27
 
28
- ## Model description
29
 
30
- More information needed
31
 
32
- ## Intended uses & limitations
33
 
34
- More information needed
 
35
 
36
- ## Training and evaluation data
 
 
37
 
38
- More information needed
39
 
40
- ## Training procedure
41
 
42
- ### Training hyperparameters
 
 
43
 
44
  The following hyperparameters were used during training:
45
- - learning_rate: 2e-05
46
- - train_batch_size: 8
47
- - eval_batch_size: 8
48
- - seed: 42
49
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
50
- - lr_scheduler_type: linear
51
- - num_epochs: 7
52
 
53
- ### Training results
54
 
55
  | Training Loss | Epoch | Step | Validation Loss | Cer |
56
  |:-------------:|:-----:|:----:|:---------------:|:------:|
@@ -62,10 +70,47 @@ The following hyperparameters were used during training:
62
  | 0.0021 | 6.0 | 1524 | 0.0567 | 0.0120 |
63
  | 0.0007 | 7.0 | 1778 | 0.0599 | 0.0137 |
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- ### Framework versions
67
 
68
- - Transformers 4.42.3
69
- - Pytorch 2.1.2
70
- - Datasets 2.20.0
71
- - Tokenizers 0.19.1
 
1
+ ---
2
+ base_model: microsoft/trocr-base-handwritten
3
+ tags:
4
+ - trocr
5
+ - image-to-text
6
+ - license-plate-number
7
+ model-index:
8
+ - name: license_plate_recognizer
9
+ results: []
10
+ license: mit
11
+ language:
12
+ - en
13
+ metrics:
14
+ - cer
15
+ library_name: transformers
16
+ pipeline_tag: image-to-text
17
+ datasets:
18
+ - charliexu07/license_plates
19
+ ---
20
 
21
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
22
  should probably proofread and complete it, then remove this comment. -->
23
 
24
  [<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/pawankrgunjan/huggingface/runs/v5cu1qdh)
25
+
26
+
27
  # license_plate_recognizer
28
 
29
+ This model is a fine-tuned version of [microsoft/trocr-base-handwritten](https://huggingface.co/microsoft/trocr-base-handwritten) specifically tailored for recognizing license plate numbers from images. The fine-tuning process has been optimized to accurately decode alphanumeric characters typically found on license plates.
 
 
 
30
 
31
+ ## Model Description
32
 
33
+ The base model, `microsoft/trocr-base-handwritten`, is a Transformer-based OCR model designed for recognizing handwritten text. This fine-tuned version is adapted for license plate recognition, enhancing its ability to read and transcribe license plates from various sources, including images captured under different lighting and angles.
34
 
35
+ ## Intended Uses & Limitations
36
 
37
+ ### Intended Uses
38
+ - **License Plate Recognition:** This model is designed to extract and transcribe alphanumeric characters from images of license plates. It can be used in various applications such as automated toll systems, parking management, and law enforcement.
39
 
40
+ ### Limitations
41
+ - **Character Set:** The model is optimized for the specific alphanumeric characters commonly found on license plates. It may not perform well on text outside this domain.
42
+ - **Environmental Factors:** While robust to typical variations in image quality, extreme conditions like very low light, heavy blurring, or unusual angles may reduce accuracy.
43
 
44
+ ## Training and Evaluation Data
45
 
46
+ The model was fine-tuned on a dataset consisting of license plate images. The dataset includes a diverse set of license plates captured in various environments and lighting conditions, ensuring robustness in real-world applications. However, specific details about the dataset (e.g., size, source) are not provided here.
47
 
48
+ ## Training Procedure
49
+
50
+ ### Training Hyperparameters
51
 
52
  The following hyperparameters were used during training:
53
+ - **learning_rate:** 2e-05
54
+ - **train_batch_size:** 8
55
+ - **eval_batch_size:** 8
56
+ - **seed:** 42
57
+ - **optimizer:** Adam with betas=(0.9, 0.999) and epsilon=1e-08
58
+ - **lr_scheduler_type:** linear
59
+ - **num_epochs:** 7
60
 
61
+ ### Training Results
62
 
63
  | Training Loss | Epoch | Step | Validation Loss | Cer |
64
  |:-------------:|:-----:|:----:|:---------------:|:------:|
 
70
  | 0.0021 | 6.0 | 1524 | 0.0567 | 0.0120 |
71
  | 0.0007 | 7.0 | 1778 | 0.0599 | 0.0137 |
72
 
73
+ ### Final Evaluation Metrics
74
+ - **Loss:** 0.0653
75
+ - **Cer:** 0.0231
76
+
77
+ Certainly! Here’s the updated "How to Use the Model" section with the correct username:
78
+
79
+
80
+ ## How to Use the Model
81
+
82
+ Here is how you can use this fine-tuned model in PyTorch to recognize license plate numbers:
83
+
84
+ ```python
85
+ from transformers import TrOCRProcessor, VisionEncoderDecoderModel
86
+ from PIL import Image
87
+ import requests
88
+
89
+ # Load an image of a license plate
90
+ url = 'https://example.com/path/to/license_plate_image.jpg'
91
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
92
+
93
+ # Initialize the processor and the fine-tuned model
94
+ processor = TrOCRProcessor.from_pretrained('PawanKrGunjan/license_plate_recognizer')
95
+ model = VisionEncoderDecoderModel.from_pretrained('PawanKrGunjan/license_plate_recognizer')
96
+
97
+ # Preprocess the image
98
+ pixel_values = processor(images=image, return_tensors="pt").pixel_values
99
+
100
+ # Generate text (license plate number)
101
+ generated_ids = model.generate(pixel_values)
102
+ generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
103
+
104
+ print("Recognized License Plate Number:", generated_text)
105
+ ```
106
+
107
+ In this example:
108
+ 1. Replace the `url` with the actual URL of an image containing a license plate.
109
+ 2. The model and processor are loaded from your fine-tuned model on the Hugging Face Hub (`PawanKrGunjan/license_plate_recognizer`).
110
 
111
+ ## Framework Versions
112
 
113
+ - **Transformers:** 4.42.3
114
+ - **Pytorch:** 2.1.2
115
+ - **Datasets:** 2.20.0
116
+ - **Tokenizers:** 0.19.1