Updated README.md
Browse files
README.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
tags:
|
| 3 |
- ultralytics
|
| 4 |
- yolov8
|
| 5 |
-
- object-detection
|
| 6 |
- pytorch
|
|
|
|
| 7 |
library_name: ultralytics
|
| 8 |
library_version: 8.0.198
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
# YOLOv8 model to detect import texts on an Aadhar Card
|
| 11 |
|
|
@@ -15,7 +19,14 @@ Aadhaar Card text detection is the process of identifying and extracting text fr
|
|
| 15 |
|
| 16 |
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.
|
| 17 |
|
| 18 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
### Install Dependencies
|
| 21 |
|
|
@@ -28,7 +39,56 @@ $ pip install ultralytics huggingface_hub supervision
|
|
| 28 |
```python
|
| 29 |
from ultralytics import YOLO
|
| 30 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
tags:
|
| 4 |
- ultralytics
|
| 5 |
- yolov8
|
|
|
|
| 6 |
- pytorch
|
| 7 |
+
pipelline_tag: object-detection
|
| 8 |
library_name: ultralytics
|
| 9 |
library_version: 8.0.198
|
| 10 |
+
metrics:
|
| 11 |
+
- recall
|
| 12 |
+
- precision
|
| 13 |
---
|
| 14 |
# YOLOv8 model to detect import texts on an Aadhar Card
|
| 15 |
|
|
|
|
| 19 |
|
| 20 |
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.
|
| 21 |
|
| 22 |
+
## Inference
|
| 23 |
+
|
| 24 |
+
### Supported Labels
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
# label_id: label_name
|
| 28 |
+
{0: "AADHAR_NUMBER", 1: "DATE_OF_BIRTH", 2: "GENDER", 3: "NAME", 4: "ADDRESS"}
|
| 29 |
+
```
|
| 30 |
|
| 31 |
### Install Dependencies
|
| 32 |
|
|
|
|
| 39 |
```python
|
| 40 |
from ultralytics import YOLO
|
| 41 |
from huggingface_hub import hf_hub_download
|
| 42 |
+
from supervision import Detections
|
| 43 |
+
|
| 44 |
+
# repo details
|
| 45 |
+
repo_config = dict(
|
| 46 |
+
repo_id = "arnabdhar/YOLOv8-nano-aadhar-card",
|
| 47 |
+
filename = "model.pt",
|
| 48 |
+
local_dir = "./models"
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# load model
|
| 52 |
+
model = YOLO(hf_hub_download(**repo_config))
|
| 53 |
+
|
| 54 |
+
# get id to label mapping
|
| 55 |
+
id2label = model.names
|
| 56 |
+
print(id2label)
|
| 57 |
+
|
| 58 |
+
# Perform Inference
|
| 59 |
+
image_url = "https://i.pinimg.com/originals/08/6d/82/086d820550f34066764f4047ddc263ca.jpg"
|
| 60 |
+
|
| 61 |
+
detections = Detections.from_ultralytics(model.predict(image_url)[0])
|
| 62 |
+
|
| 63 |
+
print(detections)
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Fine Tuning
|
| 68 |
+
|
| 69 |
+
The following hyperparameters were used to finetune the model
|
| 70 |
+
|
| 71 |
+
```yaml
|
| 72 |
+
model: yolov8n.pt
|
| 73 |
+
batch: 4
|
| 74 |
+
epochs: 100
|
| 75 |
+
optimizer: AdamW
|
| 76 |
+
warmup_epochs: 15
|
| 77 |
+
seed: 42
|
| 78 |
+
imgsz: 640
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
The following evaluation metrics were achieved by `best.pt` for bounding box predictions:
|
| 82 |
+
|
| 83 |
+
```yaml
|
| 84 |
+
recall: 0.962
|
| 85 |
+
precision: 0.973
|
| 86 |
+
mAP50: 0.963
|
| 87 |
+
mAP50_95: 0.748
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
|
| 91 |
+
## Dataset
|
| 92 |
|
| 93 |
+
+ __Source__: Roboflow Universe
|
| 94 |
+
+ __Dataset URL__: https://universe.roboflow.com/jizo/aadhar-card-entity-detection
|