File size: 2,440 Bytes
d4cd784
5e36791
d4cd784
35d1523
d4cd784
 
 
35d1523
 
d4cd784
 
35d1523
 
 
 
 
 
 
 
 
 
 
d5f938d
35d1523
d4cd784
 
 
 
 
 
 
 
 
5e36791
 
 
 
 
 
 
 
d4cd784
 
 
 
 
 
 
 
 
 
 
 
5e36791
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4cd784
5e36791
d4cd784
5e36791
d5f938d
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
license: apache-2.0
tags:
- object-detection
- ultralytics
- yolov8
- pytorch
- pickle
pipeline_tag: object-detection
library_name: ultralytics
library_version: 8.0.198
model-index:
    - name: arnabdhar/YOLOv8-nano-aadhar-card
      results:
        - task:
            type: object-detection
          metrics:
            - type: precision
              value: 0.963
              name: mAP@50
            - type: precision
              value: 0.748 
              name: mAP@50-95

---
# YOLOv8 model to detect import texts on an Aadhar Card

## Overview

Aadhaar Card text detection is the process of identifying and extracting text from Aadhaar Card images. This can be useful for a variety of applications, such as automatic data entry, fraud detection, and document verification.

One approach to Aadhaar Card text detection is to use YOLOv8, a state-of-the-art object detection model. YOLOv8 can be trained to detect a variety of object classes, including text. Once trained, YOLOv8 can be used to detect text in Aadhaar Card images and extract the text to a text file or other format.

## Inference

### Supported Labels

```python
# label_id: label_name
{0: "AADHAR_NUMBER", 1: "DATE_OF_BIRTH", 2: "GENDER", 3: "NAME", 4: "ADDRESS"}
```

### Install Dependencies

```bash
$ pip install ultralytics huggingface_hub supervision
```

### Load the model

```python
from ultralytics import YOLO
from huggingface_hub import hf_hub_download
from supervision import Detections

# repo details
repo_config = dict(
    repo_id = "arnabdhar/YOLOv8-nano-aadhar-card",
    filename = "model.pt",
    local_dir = "./models"
)

# load model
model = YOLO(hf_hub_download(**repo_config))

# get id to label mapping
id2label = model.names
print(id2label)

# Perform Inference
image_url = "https://i.pinimg.com/originals/08/6d/82/086d820550f34066764f4047ddc263ca.jpg"

detections = Detections.from_ultralytics(model.predict(image_url)[0])

print(detections)

```

## Fine Tuning

 The following hyperparameters were used to finetune the model

```yaml
model: yolov8n.pt
batch: 4
epochs: 100
optimizer: AdamW
warmup_epochs: 15
seed: 42
imgsz: 640
```

The following evaluation metrics were achieved by `best.pt` for bounding box predictions:

```yaml
recall: 0.962
precision: 0.973
mAP50: 0.963
mAP50_95: 0.748 
```


## Dataset

+ __Source__: Roboflow Universe
+ __Dataset URL__: https://universe.roboflow.com/jizo/aadhar-card-entity-detection