prithivMLmods commited on
Commit
d6ba58d
·
verified ·
1 Parent(s): 3639a82

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +100 -1
README.md CHANGED
@@ -18,6 +18,10 @@ tags:
18
 
19
  ![dfvbd.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/SaNubya9pBi7MhLhR8VVL.png)
20
 
 
 
 
 
21
  ```py
22
  Classification Report:
23
  precision recall f1-score support
@@ -45,4 +49,99 @@ Classification Report:
45
  weighted avg 0.9972 0.9972 0.9972 13552
46
  ```
47
 
48
- ![download (2).png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/d7PmqrxLjLfGqQCNmqnB3.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  ![dfvbd.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/SaNubya9pBi7MhLhR8VVL.png)
20
 
21
+ # **Hand-Gesture-2-Robot**
22
+
23
+ > **Hand-Gesture-2-Robot** 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 recognize hand gestures and map them to specific robot commands using the **SiglipForImageClassification** architecture.
24
+
25
  ```py
26
  Classification Report:
27
  precision recall f1-score support
 
49
  weighted avg 0.9972 0.9972 0.9972 13552
50
  ```
51
 
52
+ ![download (2).png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/d7PmqrxLjLfGqQCNmqnB3.png)
53
+
54
+ The model categorizes hand gestures into 17 different robot commands:
55
+ - **Class 0:** "rotate anticlockwise"
56
+ - **Class 1:** "increase"
57
+ - **Class 2:** "release"
58
+ - **Class 3:** "switch"
59
+ - **Class 4:** "look up"
60
+ - **Class 5:** "Terminate"
61
+ - **Class 6:** "decrease"
62
+ - **Class 7:** "move backward"
63
+ - **Class 8:** "point"
64
+ - **Class 9:** "rotate clockwise"
65
+ - **Class 10:** "grasp"
66
+ - **Class 11:** "pause"
67
+ - **Class 12:** "move forward"
68
+ - **Class 13:** "Confirm"
69
+ - **Class 14:** "look down"
70
+ - **Class 15:** "move left"
71
+ - **Class 16:** "move right"
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/Hand-Gesture-2-Robot"
89
+ model = SiglipForImageClassification.from_pretrained(model_name)
90
+ processor = AutoImageProcessor.from_pretrained(model_name)
91
+
92
+ def gesture_classification(image):
93
+ """Predicts the robot command from a hand gesture 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": "rotate anticlockwise",
104
+ "1": "increase",
105
+ "2": "release",
106
+ "3": "switch",
107
+ "4": "look up",
108
+ "5": "Terminate",
109
+ "6": "decrease",
110
+ "7": "move backward",
111
+ "8": "point",
112
+ "9": "rotate clockwise",
113
+ "10": "grasp",
114
+ "11": "pause",
115
+ "12": "move forward",
116
+ "13": "Confirm",
117
+ "14": "look down",
118
+ "15": "move left",
119
+ "16": "move right"
120
+ }
121
+ predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
122
+
123
+ return predictions
124
+
125
+ # Create Gradio interface
126
+ iface = gr.Interface(
127
+ fn=gesture_classification,
128
+ inputs=gr.Image(type="numpy"),
129
+ outputs=gr.Label(label="Prediction Scores"),
130
+ title="Hand Gesture to Robot Command",
131
+ description="Upload an image of a hand gesture to predict the corresponding robot command."
132
+ )
133
+
134
+ # Launch the app
135
+ if __name__ == "__main__":
136
+ iface.launch()
137
+ ```
138
+
139
+ # **Intended Use:**
140
+
141
+ The **Hand-Gesture-2-Robot** model is designed to classify hand gestures into corresponding robot commands. Potential use cases include:
142
+
143
+ - **Human-Robot Interaction:** Enabling intuitive control of robots using hand gestures.
144
+ - **Assistive Technology:** Helping individuals with disabilities communicate commands.
145
+ - **Industrial Automation:** Enhancing robotic operations in manufacturing.
146
+ - **Gaming & VR:** Providing gesture-based controls for immersive experiences.
147
+ - **Security & Surveillance:** Implementing gesture-based access control.