2.png

Hindi-Sign-Language-Detection

Hindi-Sign-Language-Detection is a vision-language model fine-tuned from google/siglip2-base-patch16-224 for multi-class image classification. It is trained to detect and classify Hindi sign language hand gestures into corresponding Devanagari characters using the SiglipForImageClassification architecture.

Classification Report:
              precision    recall  f1-score   support

           ऋ     0.9832    0.9121    0.9463       5120.9433    0.9357    0.9395       4980.9694    0.9589    0.9641       4620.9961    0.8996    0.9454       5680.8990    0.9784    0.9370       4640.9758    0.9869    0.9813       6120.9223    0.9519    0.9368       5610.9226    0.9597    0.9408       5710.9346    0.9709    0.9524       4120.9051    0.9978    0.9492       4490.9670    0.8998    0.9322       4890.8992    0.9954    0.9449       4390.9392    0.9984    0.9679       6340.9102    0.9383    0.9240       6480.8167    0.9938    0.8966       6500.9720    0.9616    0.9668       6510.8162    0.9185    0.8643       3190.9711    0.8971    0.9327       5250.9642    0.9360    0.9499       7190.9847    0.7700    0.8642       5000.9447    0.9364    0.9406       5660.8779    0.9656    0.9197       5810.9968    0.9920    0.9944       6240.9600    0.9829    0.9713       5860.9613    0.9268    0.9437       7240.9719    0.8993    0.9342       5760.9619    0.8547    0.9052       7091.0000    0.9721    0.9859       5020.9899    0.9441    0.9665       626

    accuracy                         0.9425     16177
   macro avg     0.9433    0.9426    0.9413     16177
weighted avg     0.9457    0.9425    0.9425     16177

Label Space: 29 Classes

The model classifies a hand sign into one of the following 29 Hindi characters:

"id2label": {
  "0": "ऋ",
  "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": "ह"
}

Install Dependencies

pip install -q transformers torch pillow gradio

Inference Code

import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch

# Load model and processor
model_name = "prithivMLmods/Hindi-Sign-Language-Detection"  # Replace with actual path
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)

# Hindi label mapping
id2label = {
    "0": "ऋ", "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": "ह"
}

def classify_hindi_sign(image):
    image = Image.fromarray(image).convert("RGB")
    inputs = processor(images=image, return_tensors="pt")

    with torch.no_grad():
        outputs = model(**inputs)
        logits = outputs.logits
        probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()

    prediction = {
        id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
    }

    return prediction

# Gradio Interface
iface = gr.Interface(
    fn=classify_hindi_sign,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Label(num_top_classes=3, label="Hindi Sign Classification"),
    title="Hindi-Sign-Language-Detection",
    description="Upload an image of a Hindi sign language hand gesture to identify the corresponding character."
)

if __name__ == "__main__":
    iface.launch()

Intended Use

Hindi-Sign-Language-Detection can be used in:

  • Educational tools for learning Indian sign language.
  • Assistive technology for hearing and speech-impaired individuals.
  • Real-time sign-to-text translation applications.
  • Human-computer interaction for Hindi users.
Downloads last month
5
Safetensors
Model size
92.9M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for prithivMLmods/Hindi-Sign-Language-Detection

Finetuned
(90)
this model

Dataset used to train prithivMLmods/Hindi-Sign-Language-Detection

Collection including prithivMLmods/Hindi-Sign-Language-Detection