prithivMLmods commited on
Commit
799f08e
·
verified ·
1 Parent(s): 11099bf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +92 -0
README.md CHANGED
@@ -2,6 +2,9 @@
2
  license: apache-2.0
3
  ---
4
 
 
 
 
5
  ```py
6
  Classification Report:
7
  precision recall f1-score support
@@ -38,3 +41,92 @@ Classification Report:
38
  weighted avg 0.9996 0.9996 0.9996 121769
39
  ```
40
  ![demo.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/AVpi4xPsVq6PV9NzonHoi.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  ---
4
 
5
+ # **Alphabet-Sign-Language-Detection**
6
+ > **Alphabet-Sign-Language-Detection** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to classify images into **sign language alphabet** categories using the **SiglipForImageClassification** architecture.
7
+
8
  ```py
9
  Classification Report:
10
  precision recall f1-score support
 
41
  weighted avg 0.9996 0.9996 0.9996 121769
42
  ```
43
  ![demo.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/AVpi4xPsVq6PV9NzonHoi.png)
44
+
45
+ The model categorizes images into the following 26 classes:
46
+ - **Class 0:** "A"
47
+ - **Class 1:** "B"
48
+ - **Class 2:** "C"
49
+ - **Class 3:** "D"
50
+ - **Class 4:** "E"
51
+ - **Class 5:** "F"
52
+ - **Class 6:** "G"
53
+ - **Class 7:** "H"
54
+ - **Class 8:** "I"
55
+ - **Class 9:** "J"
56
+ - **Class 10:** "K"
57
+ - **Class 11:** "L"
58
+ - **Class 12:** "M"
59
+ - **Class 13:** "N"
60
+ - **Class 14:** "O"
61
+ - **Class 15:** "P"
62
+ - **Class 16:** "Q"
63
+ - **Class 17:** "R"
64
+ - **Class 18:** "S"
65
+ - **Class 19:** "T"
66
+ - **Class 20:** "U"
67
+ - **Class 21:** "V"
68
+ - **Class 22:** "W"
69
+ - **Class 23:** "X"
70
+ - **Class 24:** "Y"
71
+ - **Class 25:** "Z"
72
+
73
+ # **Run with Transformers🤗**
74
+
75
+ ```python
76
+ !pip install -q transformers torch pillow gradio
77
+ ```
78
+
79
+ ```python
80
+ import gradio as gr
81
+ from transformers import AutoImageProcessor
82
+ from transformers import SiglipForImageClassification
83
+ from transformers.image_utils import load_image
84
+ from PIL import Image
85
+ import torch
86
+
87
+ # Load model and processor
88
+ model_name = "prithivMLmods/Alphabet-Sign-Language-Detection"
89
+ model = SiglipForImageClassification.from_pretrained(model_name)
90
+ processor = AutoImageProcessor.from_pretrained(model_name)
91
+
92
+ def sign_language_classification(image):
93
+ """Predicts sign language alphabet category for an image."""
94
+ image = Image.fromarray(image).convert("RGB")
95
+ inputs = processor(images=image, return_tensors="pt")
96
+
97
+ with torch.no_grad():
98
+ outputs = model(**inputs)
99
+ logits = outputs.logits
100
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
101
+
102
+ labels = {
103
+ "0": "A", "1": "B", "2": "C", "3": "D", "4": "E", "5": "F", "6": "G", "7": "H", "8": "I", "9": "J",
104
+ "10": "K", "11": "L", "12": "M", "13": "N", "14": "O", "15": "P", "16": "Q", "17": "R", "18": "S", "19": "T",
105
+ "20": "U", "21": "V", "22": "W", "23": "X", "24": "Y", "25": "Z"
106
+ }
107
+ predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
108
+
109
+ return predictions
110
+
111
+ # Create Gradio interface
112
+ iface = gr.Interface(
113
+ fn=sign_language_classification,
114
+ inputs=gr.Image(type="numpy"),
115
+ outputs=gr.Label(label="Prediction Scores"),
116
+ title="Alphabet Sign Language Detection",
117
+ description="Upload an image to classify it into one of the 26 sign language alphabet categories."
118
+ )
119
+
120
+ # Launch the app
121
+ if __name__ == "__main__":
122
+ iface.launch()
123
+ ```
124
+
125
+ # **Intended Use:**
126
+
127
+ The **Alphabet-Sign-Language-Detection** model is designed for sign language image classification. It helps categorize images of hand signs into predefined alphabet categories. Potential use cases include:
128
+
129
+ - **Sign Language Education:** Assisting learners in recognizing and practicing sign language alphabets.
130
+ - **Accessibility Enhancement:** Supporting applications that improve communication for the hearing impaired.
131
+ - **AI Research:** Advancing computer vision models in sign language recognition.
132
+ - **Gesture Recognition Systems:** Enabling interactive applications with real-time sign language detection.