Update README.md
Browse files
README.md
CHANGED
|
@@ -2,7 +2,20 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
datasets:
|
| 4 |
- VinayHajare/Marathi-Sign-Language
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
```py
|
| 8 |
Classification Report:
|
|
@@ -55,4 +68,95 @@ Classification Report:
|
|
| 55 |
accuracy 0.9027 50099
|
| 56 |
macro avg 0.9117 0.9039 0.9051 50099
|
| 57 |
weighted avg 0.9107 0.9027 0.9040 50099
|
| 58 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
datasets:
|
| 4 |
- VinayHajare/Marathi-Sign-Language
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model:
|
| 8 |
+
- google/siglip2-base-patch16-224
|
| 9 |
+
pipeline_tag: image-classification
|
| 10 |
+
library_name: transformers
|
| 11 |
+
tags:
|
| 12 |
+
- Marathi-Sign-Language-Detection
|
| 13 |
+
- SigLIP2
|
| 14 |
+
- 93M
|
| 15 |
---
|
| 16 |
+
# Marathi-Sign-Language-Detection
|
| 17 |
+
|
| 18 |
+
> Marathi-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 recognize Marathi sign language hand gestures and map them to corresponding Devanagari characters using the SiglipForImageClassification architecture.
|
| 19 |
|
| 20 |
```py
|
| 21 |
Classification Report:
|
|
|
|
| 68 |
accuracy 0.9027 50099
|
| 69 |
macro avg 0.9117 0.9039 0.9051 50099
|
| 70 |
weighted avg 0.9107 0.9027 0.9040 50099
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
+
|
| 75 |
+
## Label Space: 43 Classes
|
| 76 |
+
|
| 77 |
+
The model classifies a hand sign into one of the following 43 Marathi characters:
|
| 78 |
+
|
| 79 |
+
```json
|
| 80 |
+
"id2label": {
|
| 81 |
+
"0": "अ", "1": "आ", "2": "इ", "3": "ई", "4": "उ", "5": "ऊ",
|
| 82 |
+
"6": "ए", "7": "ऐ", "8": "ओ", "9": "औ", "10": "क", "11": "क्ष",
|
| 83 |
+
"12": "ख", "13": "ग", "14": "घ", "15": "च", "16": "छ", "17": "ज",
|
| 84 |
+
"18": "ज्ञ", "19": "झ", "20": "ट", "21": "ठ", "22": "ड", "23": "ढ",
|
| 85 |
+
"24": "ण", "25": "त", "26": "थ", "27": "द", "28": "ध", "29": "न",
|
| 86 |
+
"30": "प", "31": "फ", "32": "ब", "33": "भ", "34": "म", "35": "य",
|
| 87 |
+
"36": "र", "37": "ल", "38": "ळ", "39": "व", "40": "श", "41": "स", "42": "ह"
|
| 88 |
+
}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Install Dependencies
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
pip install -q transformers torch pillow gradio
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
---
|
| 100 |
+
|
| 101 |
+
## Inference Code
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
import gradio as gr
|
| 105 |
+
from transformers import AutoImageProcessor, SiglipForImageClassification
|
| 106 |
+
from PIL import Image
|
| 107 |
+
import torch
|
| 108 |
+
|
| 109 |
+
# Load model and processor
|
| 110 |
+
model_name = "prithivMLmods/Marathi-Sign-Language-Detection" # Replace with actual path
|
| 111 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 112 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 113 |
+
|
| 114 |
+
# Marathi label mapping
|
| 115 |
+
id2label = {
|
| 116 |
+
"0": "अ", "1": "आ", "2": "इ", "3": "ई", "4": "उ", "5": "ऊ",
|
| 117 |
+
"6": "ए", "7": "ऐ", "8": "ओ", "9": "औ", "10": "क", "11": "क्ष",
|
| 118 |
+
"12": "ख", "13": "ग", "14": "घ", "15": "च", "16": "छ", "17": "ज",
|
| 119 |
+
"18": "ज्ञ", "19": "झ", "20": "ट", "21": "ठ", "22": "ड", "23": "ढ",
|
| 120 |
+
"24": "ण", "25": "त", "26": "थ", "27": "द", "28": "ध", "29": "न",
|
| 121 |
+
"30": "प", "31": "फ", "32": "ब", "33": "भ", "34": "म", "35": "य",
|
| 122 |
+
"36": "र", "37": "ल", "38": "ळ", "39": "व", "40": "श", "41": "स", "42": "ह"
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
def classify_marathi_sign(image):
|
| 126 |
+
image = Image.fromarray(image).convert("RGB")
|
| 127 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 128 |
+
|
| 129 |
+
with torch.no_grad():
|
| 130 |
+
outputs = model(**inputs)
|
| 131 |
+
logits = outputs.logits
|
| 132 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
| 133 |
+
|
| 134 |
+
prediction = {
|
| 135 |
+
id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
return prediction
|
| 139 |
+
|
| 140 |
+
# Gradio Interface
|
| 141 |
+
iface = gr.Interface(
|
| 142 |
+
fn=classify_marathi_sign,
|
| 143 |
+
inputs=gr.Image(type="numpy"),
|
| 144 |
+
outputs=gr.Label(num_top_classes=5, label="Marathi Sign Classification"),
|
| 145 |
+
title="Marathi-Sign-Language-Detection",
|
| 146 |
+
description="Upload an image of a Marathi sign language hand gesture to identify the corresponding character."
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
if __name__ == "__main__":
|
| 150 |
+
iface.launch()
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
+
|
| 155 |
+
## Intended Use
|
| 156 |
+
|
| 157 |
+
Marathi-Sign-Language-Detection can be applied in:
|
| 158 |
+
|
| 159 |
+
* Educational platforms for learning regional sign language.
|
| 160 |
+
* Assistive communication tools for Marathi-speaking users with hearing impairments.
|
| 161 |
+
* Interactive applications that translate signs into text.
|
| 162 |
+
* Research and data collection for sign language development and recognition.
|