qaihm-bot commited on
Commit
beb4ea9
·
verified ·
1 Parent(s): b98f55a

See https://github.com/quic/ai-hub-models/releases/v0.41.2 for changelog.

.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ DEPLOYMENT_MODEL_LICENSE.pdf filter=lfs diff=lfs merge=lfs -text
37
+ EyeGaze_float.dlc filter=lfs diff=lfs merge=lfs -text
DEPLOYMENT_MODEL_LICENSE.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4409f93b0e82531303b3e10f52f1fdfb56467a25f05b7441c6bbd8bb8a64b42c
3
+ size 109629
EyeGaze_float.dlc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81665b8fa17ebd9daa40ae43ab8f51dc23139351e2c9268b48d949db6742b17f
3
+ size 10496460
EyeGaze_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99c35c1452efdd36f16357a17b513b0e33c9a0bfec02f8d008f4007d7834ed60
3
+ size 9295227
EyeGaze_float.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39672da8dd555f08ed2ce384898f6639c48c8ee270671f5410896dc8edea3cf1
3
+ size 10079496
EyeGaze_w8a16.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:633ef17406fb537789439e8f284d99175751333d73a220e4766a64830607555b
3
+ size 3516939
LICENSE ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ The license of the original trained model can be found at https://github.com/quic/ai-hub-models/blob/main/LICENSE.
2
+ The license for the deployable model files (.tflite, .onnx, .dlc, .bin, etc.) can be found in DEPLOYMENT_MODEL_LICENSE.pdf.
README.md ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: other
4
+ tags:
5
+ - real_time
6
+ - android
7
+ pipeline_tag: gaze-estimation
8
+
9
+ ---
10
+
11
+ ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/eyegaze/web-assets/model_demo.png)
12
+
13
+ # EyeGaze: Optimized for Mobile Deployment
14
+ ## Eye gaze estimation from cropped eye images
15
+
16
+
17
+ Predicts gaze direction (pitch, yaw) from 96x160 grayscale eye images using the EyeNet model.
18
+
19
+ This model is an implementation of EyeGaze found [here](https://github.com/david-wb/gaze-estimation).
20
+
21
+
22
+ This repository provides scripts to run EyeGaze on Qualcomm® devices.
23
+ More details on model performance across various devices, can be found
24
+ [here](https://aihub.qualcomm.com/models/eyegaze).
25
+
26
+
27
+
28
+ ### Model Details
29
+
30
+ - **Model Type:** Model_use_case.gaze_estimation
31
+ - **Model Stats:**
32
+ - Model checkpoint: checkpoint.pt
33
+ - Input resolution: 96x160
34
+ - Number of parameters: 2.58M
35
+ - Model size (float): 9.6MB
36
+ - Model size (w8a16): 3.3 MB
37
+
38
+ | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
39
+ |---|---|---|---|---|---|---|---|---|
40
+ | EyeGaze | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 30.665 ms | 3 - 13 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
41
+ | EyeGaze | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 82.703 ms | 38 - 50 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
42
+ | EyeGaze | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 21.118 ms | 3 - 20 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
43
+ | EyeGaze | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 67.891 ms | 38 - 63 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
44
+ | EyeGaze | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 18.86 ms | 0 - 3 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
45
+ | EyeGaze | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 46.184 ms | 38 - 43 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
46
+ | EyeGaze | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 25.739 ms | 49 - 52 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.onnx.zip) |
47
+ | EyeGaze | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 26.898 ms | 3 - 12 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
48
+ | EyeGaze | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 51.261 ms | 38 - 50 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
49
+ | EyeGaze | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 30.665 ms | 3 - 13 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
50
+ | EyeGaze | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 82.703 ms | 38 - 50 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
51
+ | EyeGaze | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | TFLITE | 18.795 ms | 3 - 5 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
52
+ | EyeGaze | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | QNN_DLC | 46.904 ms | 37 - 42 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
53
+ | EyeGaze | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 17.265 ms | 3 - 19 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
54
+ | EyeGaze | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 44.87 ms | 38 - 59 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
55
+ | EyeGaze | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | TFLITE | 18.952 ms | 3 - 6 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
56
+ | EyeGaze | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | QNN_DLC | 49.783 ms | 36 - 41 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
57
+ | EyeGaze | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 26.898 ms | 3 - 12 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
58
+ | EyeGaze | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 51.261 ms | 38 - 50 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
59
+ | EyeGaze | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 16.794 ms | 3 - 26 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
60
+ | EyeGaze | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 34.825 ms | 38 - 61 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
61
+ | EyeGaze | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 22.375 ms | 50 - 70 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.onnx.zip) |
62
+ | EyeGaze | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 13.752 ms | 3 - 15 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
63
+ | EyeGaze | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 40.366 ms | 38 - 53 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
64
+ | EyeGaze | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 21.12 ms | 50 - 66 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.onnx.zip) |
65
+ | EyeGaze | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | TFLITE | 12.532 ms | 3 - 13 MB | CPU | [EyeGaze.tflite](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.tflite) |
66
+ | EyeGaze | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | QNN_DLC | 25.006 ms | 37 - 51 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
67
+ | EyeGaze | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | ONNX | 20.456 ms | 50 - 62 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.onnx.zip) |
68
+ | EyeGaze | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 65.476 ms | 13 - 13 MB | CPU | [EyeGaze.dlc](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.dlc) |
69
+ | EyeGaze | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 10.115 ms | 67 - 67 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze.onnx.zip) |
70
+ | EyeGaze | w8a16 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 43.815 ms | 69 - 73 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
71
+ | EyeGaze | w8a16 | RB3 Gen 2 (Proxy) | Qualcomm® QCS6490 (Proxy) | ONNX | 66.667 ms | 69 - 83 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
72
+ | EyeGaze | w8a16 | RB5 (Proxy) | Qualcomm® QCS8250 (Proxy) | ONNX | 55.317 ms | 63 - 76 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
73
+ | EyeGaze | w8a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 31.679 ms | 71 - 100 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
74
+ | EyeGaze | w8a16 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 27.328 ms | 71 - 86 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
75
+ | EyeGaze | w8a16 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | ONNX | 27.052 ms | 68 - 83 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
76
+ | EyeGaze | w8a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 17.767 ms | 100 - 100 MB | CPU | [EyeGaze.onnx.zip](https://huggingface.co/qualcomm/EyeGaze/blob/main/EyeGaze_w8a16.onnx.zip) |
77
+
78
+
79
+
80
+
81
+ ## Installation
82
+
83
+
84
+ Install the package via pip:
85
+ ```bash
86
+ pip install qai-hub-models
87
+ ```
88
+
89
+
90
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
91
+
92
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
93
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
94
+
95
+ With this API token, you can configure your client to run models on the cloud
96
+ hosted devices.
97
+ ```bash
98
+ qai-hub configure --api_token API_TOKEN
99
+ ```
100
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
101
+
102
+
103
+
104
+ ## Demo off target
105
+
106
+ The package contains a simple end-to-end demo that downloads pre-trained
107
+ weights and runs this model on a sample input.
108
+
109
+ ```bash
110
+ python -m qai_hub_models.models.eyegaze.demo
111
+ ```
112
+
113
+ The above demo runs a reference implementation of pre-processing, model
114
+ inference, and post processing.
115
+
116
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
117
+ environment, please add the following to your cell (instead of the above).
118
+ ```
119
+ %run -m qai_hub_models.models.eyegaze.demo
120
+ ```
121
+
122
+
123
+ ### Run model on a cloud-hosted device
124
+
125
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
126
+ device. This script does the following:
127
+ * Performance check on-device on a cloud-hosted device
128
+ * Downloads compiled assets that can be deployed on-device for Android.
129
+ * Accuracy check between PyTorch and on-device outputs.
130
+
131
+ ```bash
132
+ python -m qai_hub_models.models.eyegaze.export
133
+ ```
134
+
135
+
136
+
137
+ ## How does this work?
138
+
139
+ This [export script](https://aihub.qualcomm.com/models/eyegaze/qai_hub_models/models/EyeGaze/export.py)
140
+ leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
141
+ on-device. Lets go through each step below in detail:
142
+
143
+ Step 1: **Compile model for on-device deployment**
144
+
145
+ To compile a PyTorch model for on-device deployment, we first trace the model
146
+ in memory using the `jit.trace` and then call the `submit_compile_job` API.
147
+
148
+ ```python
149
+ import torch
150
+
151
+ import qai_hub as hub
152
+ from qai_hub_models.models.eyegaze import Model
153
+
154
+ # Load the model
155
+ torch_model = Model.from_pretrained()
156
+
157
+ # Device
158
+ device = hub.Device("Samsung Galaxy S25")
159
+
160
+ # Trace model
161
+ input_shape = torch_model.get_input_spec()
162
+ sample_inputs = torch_model.sample_inputs()
163
+
164
+ pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
165
+
166
+ # Compile model on a specific device
167
+ compile_job = hub.submit_compile_job(
168
+ model=pt_model,
169
+ device=device,
170
+ input_specs=torch_model.get_input_spec(),
171
+ )
172
+
173
+ # Get target model to run on-device
174
+ target_model = compile_job.get_target_model()
175
+
176
+ ```
177
+
178
+
179
+ Step 2: **Performance profiling on cloud-hosted device**
180
+
181
+ After compiling models from step 1. Models can be profiled model on-device using the
182
+ `target_model`. Note that this scripts runs the model on a device automatically
183
+ provisioned in the cloud. Once the job is submitted, you can navigate to a
184
+ provided job URL to view a variety of on-device performance metrics.
185
+ ```python
186
+ profile_job = hub.submit_profile_job(
187
+ model=target_model,
188
+ device=device,
189
+ )
190
+
191
+ ```
192
+
193
+ Step 3: **Verify on-device accuracy**
194
+
195
+ To verify the accuracy of the model on-device, you can run on-device inference
196
+ on sample input data on the same cloud hosted device.
197
+ ```python
198
+ input_data = torch_model.sample_inputs()
199
+ inference_job = hub.submit_inference_job(
200
+ model=target_model,
201
+ device=device,
202
+ inputs=input_data,
203
+ )
204
+ on_device_output = inference_job.download_output_data()
205
+
206
+ ```
207
+ With the output of the model, you can compute like PSNR, relative errors or
208
+ spot check the output with expected output.
209
+
210
+ **Note**: This on-device profiling and inference requires access to Qualcomm®
211
+ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
212
+
213
+
214
+
215
+ ## Run demo on a cloud-hosted device
216
+
217
+ You can also run the demo on-device.
218
+
219
+ ```bash
220
+ python -m qai_hub_models.models.eyegaze.demo --eval-mode on-device
221
+ ```
222
+
223
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
224
+ environment, please add the following to your cell (instead of the above).
225
+ ```
226
+ %run -m qai_hub_models.models.eyegaze.demo -- --eval-mode on-device
227
+ ```
228
+
229
+
230
+ ## Deploying compiled model to Android
231
+
232
+
233
+ The models can be deployed using multiple runtimes:
234
+ - TensorFlow Lite (`.tflite` export): [This
235
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
236
+ guide to deploy the .tflite model in an Android application.
237
+
238
+
239
+ - QNN (`.so` export ): This [sample
240
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
241
+ provides instructions on how to use the `.so` shared library in an Android application.
242
+
243
+
244
+ ## View on Qualcomm® AI Hub
245
+ Get more details on EyeGaze's performance across various devices [here](https://aihub.qualcomm.com/models/eyegaze).
246
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
247
+
248
+
249
+ ## License
250
+ * The license for the original implementation of EyeGaze can be found
251
+ [here](https://github.com/quic/ai-hub-models/blob/main/LICENSE).
252
+ * The license for the compiled assets for on-device deployment can be found [here](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/Qualcomm+AI+Hub+Proprietary+License.pdf)
253
+
254
+
255
+
256
+ ## References
257
+ * [Source Model Implementation](https://github.com/david-wb/gaze-estimation)
258
+
259
+
260
+
261
+ ## Community
262
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
263
+ * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
264
+
265
+
tool-versions.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tool_versions:
2
+ onnx:
3
+ onnx_runtime: 1.23.0