Views
No views yet

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.
1Classification Report:
2 precision recall f1-score support
3
4 अ 0.9881 0.9911 0.9896 1009
5 आ 0.9926 0.9237 0.9569 1022
6 इ 0.8132 0.9609 0.8809 1101
7 ई 0.9424 0.8894 0.9151 1103
8 उ 0.9477 0.9073 0.9271 1198
9 ऊ 0.9436 1.0000 0.9710 1071
10 ए 0.9153 0.9378 0.9264 1141
11 ऐ 0.7790 0.8871 0.8295 1089
12 ओ 0.9188 0.9581 0.9381 1075
13 औ 1.0000 0.9226 0.9598 1021
14 क 0.9566 0.9160 0.9358 1083
15 क्ष 0.9287 0.9667 0.9473 1200
16 ख 0.9913 1.0000 0.9956 1140
17 ग 0.9753 0.9982 0.9866 1109
18 घ 0.8398 0.7908 0.8146 1200
19 च 0.9388 0.9016 0.9198 1158
20 छ 0.9764 0.8127 0.8870 1169
21 ज 0.9599 0.9967 0.9779 1200
22 ज्ञ 0.9878 0.9483 0.9677 1200
23 झ 0.9939 0.9567 0.9749 1200
24 ट 0.8917 0.8992 0.8954 1200
25 ठ 0.9075 0.8425 0.8738 1200
26 ड 0.9354 0.9900 0.9619 1200
27 ढ 0.8616 0.9025 0.8816 1200
28 ण 0.9114 0.9425 0.9267 1200
29 त 0.9280 0.9025 0.9151 1200
30 थ 0.9388 0.9717 0.9550 1200
31 द 0.8648 0.9275 0.8951 1200
32 ध 0.9876 0.9917 0.9896 1200
33 न 0.7256 0.8967 0.8021 1200
34 प 0.9991 0.9683 0.9835 1200
35 फ 0.8909 0.8575 0.8739 1200
36 ब 0.9814 0.7917 0.8764 1200
37 भ 0.9758 0.8383 0.9018 1200
38 म 0.8121 0.8142 0.8132 1200
39 य 0.5726 0.9133 0.7039 1200
40 र 0.7635 0.7339 0.7484 1210
41 ल 0.9239 0.8800 0.9014 1200
42 ळ 0.8950 0.7533 0.8181 1200
43 व 0.9597 0.7542 0.8446 1200
44 श 0.8829 0.8667 0.8747 1200
45 स 0.8449 0.8758 0.8601 1200
46 ह 0.9604 0.8883 0.9229 1200
47
48 accuracy 0.9027 50099
49 macro avg 0.9117 0.9039 0.9051 50099
50weighted avg 0.9107 0.9027 0.9040 500991"id2label": {
2 "0": "अ", "1": "आ", "2": "इ", "3": "ई", "4": "उ", "5": "ऊ",
3 "6": "ए", "7": "ऐ", "8": "ओ", "9": "औ", "10": "क", "11": "क्ष",
4 "12": "ख", "13": "ग", "14": "घ", "15": "च", "16": "छ", "17": "ज",
5 "18": "ज्ञ", "19": "झ", "20": "ट", "21": "ठ", "22": "ड", "23": "ढ",
6 "24": "ण", "25": "त", "26": "थ", "27": "द", "28": "ध", "29": "न",
7 "30": "प", "31": "फ", "32": "ब", "33": "भ", "34": "म", "35": "य",
8 "36": "र", "37": "ल", "38": "ळ", "39": "व", "40": "श", "41": "स", "42": "ह"
9}pip install -q transformers torch pillow gradio1import gradio as gr
2from transformers import AutoImageProcessor, SiglipForImageClassification
3from PIL import Image
4import torch
5
6# Load model and processor
7model_name = "prithivMLmods/Marathi-Sign-Language-Detection" # Replace with actual path
8model = SiglipForImageClassification.from_pretrained(model_name)
9processor = AutoImageProcessor.from_pretrained(model_name)
10
11# Marathi label mapping
12id2label = {
13 "0": "अ", "1": "आ", "2": "इ", "3": "ई", "4": "उ", "5": "ऊ",
14 "6": "ए", "7": "ऐ", "8": "ओ", "9": "औ", "10": "क", "11": "क्ष",
15 "12": "ख", "13": "ग", "14": "घ", "15": "च", "16": "छ", "17": "ज",
16 "18": "ज्ञ", "19": "झ", "20": "ट", "21": "ठ", "22": "ड", "23": "ढ",
17 "24": "ण", "25": "त", "26": "थ", "27": "द", "28": "ध", "29": "न",
18 "30": "प", "31": "फ", "32": "ब", "33": "भ", "34": "म", "35": "य",
19 "36": "र", "37": "ल", "38": "ळ", "39": "व", "40": "श", "41": "स", "42": "ह"
20}
21
22def classify_marathi_sign(image):
23 image = Image.fromarray(image).convert("RGB")
24 inputs = processor(images=image, return_tensors="pt")
25
26 with torch.no_grad():
27 outputs = model(**inputs)
28 logits = outputs.logits
29 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
30
31 prediction = {
32 id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
33 }
34
35 return prediction
36
37# Gradio Interface
38iface = gr.Interface(
39 fn=classify_marathi_sign,
40 inputs=gr.Image(type="numpy"),
41 outputs=gr.Label(num_top_classes=5, label="Marathi Sign Classification"),
42 title="Marathi-Sign-Language-Detection",
43 description="Upload an image of a Marathi sign language hand gesture to identify the corresponding character."
44)
45
46if __name__ == "__main__":
47 iface.launch()