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
# label_id: label_name
{0: "AADHAR_NUMBER", 1: "DATE_OF_BIRTH", 2: "GENDER", 3: "NAME", 4: "ADDRESS"}
Install Dependencies
$ pip install ultralytics huggingface_hub supervision
Load the model
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
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:
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
- Downloads last month
- 40
Inference API (serverless) does not yet support ultralytics models for this pipeline type.
Evaluation results
- mAP@50self-reported0.963
- mAP@50-95self-reported0.748