Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -37,64 +37,64 @@ More details on model performance across various devices, can be found
|
|
37 |
|
38 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
39 |
|---|---|---|---|---|---|---|---|---|
|
40 |
-
|
|
41 |
-
|
|
42 |
-
|
|
43 |
-
|
|
44 |
-
|
|
45 |
-
|
|
46 |
-
|
|
47 |
-
|
|
48 |
-
|
|
49 |
-
|
|
50 |
-
|
|
51 |
-
|
|
52 |
-
|
|
53 |
-
|
|
54 |
-
|
|
55 |
-
|
|
56 |
-
|
|
57 |
-
|
|
58 |
-
|
|
59 |
-
|
|
60 |
-
|
|
61 |
-
|
|
62 |
-
|
|
63 |
-
|
|
64 |
-
|
|
65 |
-
|
|
66 |
-
|
|
67 |
-
|
|
68 |
-
|
|
69 |
-
|
|
70 |
-
|
|
71 |
-
|
|
72 |
-
|
|
73 |
-
|
|
74 |
-
|
|
75 |
-
|
|
76 |
-
|
|
77 |
-
|
|
78 |
-
|
|
79 |
-
|
|
80 |
-
|
|
81 |
-
|
|
82 |
-
|
|
83 |
-
|
|
84 |
-
|
|
85 |
-
|
|
86 |
-
|
|
87 |
-
|
|
88 |
-
|
|
89 |
-
|
|
90 |
-
|
|
91 |
-
|
|
92 |
-
|
|
93 |
-
|
|
94 |
-
|
|
95 |
-
|
|
96 |
-
|
|
97 |
-
|
|
98 |
|
99 |
|
100 |
|
@@ -155,20 +155,20 @@ python -m qai_hub_models.models.mediapipe_face.export
|
|
155 |
```
|
156 |
Profiling Results
|
157 |
------------------------------------------------------------
|
158 |
-
|
159 |
Device : Samsung Galaxy S23 (13)
|
160 |
Runtime : TFLITE
|
161 |
-
Estimated inference time (ms) : 0.
|
162 |
Estimated peak memory usage (MB): [0, 6]
|
163 |
Total # Ops : 111
|
164 |
Compute Unit(s) : NPU (111 ops)
|
165 |
|
166 |
------------------------------------------------------------
|
167 |
-
|
168 |
Device : Samsung Galaxy S23 (13)
|
169 |
Runtime : TFLITE
|
170 |
Estimated inference time (ms) : 0.2
|
171 |
-
Estimated peak memory usage (MB): [0,
|
172 |
Total # Ops : 100
|
173 |
Compute Unit(s) : NPU (100 ops)
|
174 |
```
|
@@ -192,43 +192,26 @@ import qai_hub as hub
|
|
192 |
from qai_hub_models.models.mediapipe_face import Model
|
193 |
|
194 |
# Load the model
|
195 |
-
|
196 |
-
face_detector_model = model.face_detector
|
197 |
-
face_landmark_detector_model = model.face_landmark_detector
|
198 |
|
199 |
# Device
|
200 |
-
device = hub.Device("Samsung Galaxy
|
201 |
|
202 |
# Trace model
|
203 |
-
|
204 |
-
|
205 |
|
206 |
-
|
207 |
|
208 |
# Compile model on a specific device
|
209 |
-
|
210 |
-
model=
|
211 |
device=device,
|
212 |
-
input_specs=
|
213 |
)
|
214 |
|
215 |
# Get target model to run on-device
|
216 |
-
|
217 |
-
# Trace model
|
218 |
-
face_landmark_detector_input_shape = face_landmark_detector_model.get_input_spec()
|
219 |
-
face_landmark_detector_sample_inputs = face_landmark_detector_model.sample_inputs()
|
220 |
-
|
221 |
-
traced_face_landmark_detector_model = torch.jit.trace(face_landmark_detector_model, [torch.tensor(data[0]) for _, data in face_landmark_detector_sample_inputs.items()])
|
222 |
-
|
223 |
-
# Compile model on a specific device
|
224 |
-
face_landmark_detector_compile_job = hub.submit_compile_job(
|
225 |
-
model=traced_face_landmark_detector_model ,
|
226 |
-
device=device,
|
227 |
-
input_specs=face_landmark_detector_model.get_input_spec(),
|
228 |
-
)
|
229 |
-
|
230 |
-
# Get target model to run on-device
|
231 |
-
face_landmark_detector_target_model = face_landmark_detector_compile_job.get_target_model()
|
232 |
|
233 |
```
|
234 |
|
@@ -240,15 +223,11 @@ After compiling models from step 1. Models can be profiled model on-device using
|
|
240 |
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
241 |
provided job URL to view a variety of on-device performance metrics.
|
242 |
```python
|
243 |
-
|
244 |
-
model=
|
245 |
-
device=device,
|
246 |
-
)
|
247 |
-
face_landmark_detector_profile_job = hub.submit_profile_job(
|
248 |
-
model=face_landmark_detector_target_model,
|
249 |
device=device,
|
250 |
)
|
251 |
-
|
252 |
```
|
253 |
|
254 |
Step 3: **Verify on-device accuracy**
|
@@ -256,20 +235,13 @@ Step 3: **Verify on-device accuracy**
|
|
256 |
To verify the accuracy of the model on-device, you can run on-device inference
|
257 |
on sample input data on the same cloud hosted device.
|
258 |
```python
|
259 |
-
|
260 |
-
|
261 |
-
model=
|
262 |
-
device=device,
|
263 |
-
inputs=face_detector_input_data,
|
264 |
-
)
|
265 |
-
face_detector_inference_job.download_output_data()
|
266 |
-
face_landmark_detector_input_data = face_landmark_detector_model.sample_inputs()
|
267 |
-
face_landmark_detector_inference_job = hub.submit_inference_job(
|
268 |
-
model=face_landmark_detector_target_model,
|
269 |
device=device,
|
270 |
-
inputs=
|
271 |
)
|
272 |
-
|
273 |
|
274 |
```
|
275 |
With the output of the model, you can compute like PSNR, relative errors or
|
|
|
37 |
|
38 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
39 |
|---|---|---|---|---|---|---|---|---|
|
40 |
+
| FaceDetector | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.551 ms | 0 - 6 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
41 |
+
| FaceDetector | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 0.537 ms | 1 - 3 MB | FP16 | NPU | [MediaPipe-Face-Detection.so](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.so) |
|
42 |
+
| FaceDetector | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 0.838 ms | 0 - 7 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.onnx) |
|
43 |
+
| FaceDetector | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.403 ms | 0 - 29 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
44 |
+
| FaceDetector | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.383 ms | 1 - 21 MB | FP16 | NPU | [MediaPipe-Face-Detection.so](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.so) |
|
45 |
+
| FaceDetector | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 0.579 ms | 0 - 26 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.onnx) |
|
46 |
+
| FaceDetector | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.344 ms | 0 - 24 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
47 |
+
| FaceDetector | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.465 ms | 1 - 21 MB | FP16 | NPU | Use Export Script |
|
48 |
+
| FaceDetector | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.593 ms | 1 - 21 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.onnx) |
|
49 |
+
| FaceDetector | SA7255P ADP | SA7255P | TFLITE | 18.69 ms | 0 - 14 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
50 |
+
| FaceDetector | SA7255P ADP | SA7255P | QNN | 18.639 ms | 1 - 9 MB | FP16 | NPU | Use Export Script |
|
51 |
+
| FaceDetector | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.545 ms | 0 - 4 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
52 |
+
| FaceDetector | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.533 ms | 1 - 3 MB | FP16 | NPU | Use Export Script |
|
53 |
+
| FaceDetector | SA8295P ADP | SA8295P | TFLITE | 1.154 ms | 0 - 19 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
54 |
+
| FaceDetector | SA8295P ADP | SA8295P | QNN | 1.057 ms | 0 - 18 MB | FP16 | NPU | Use Export Script |
|
55 |
+
| FaceDetector | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.551 ms | 0 - 6 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
56 |
+
| FaceDetector | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.528 ms | 0 - 2 MB | FP16 | NPU | Use Export Script |
|
57 |
+
| FaceDetector | SA8775P ADP | SA8775P | TFLITE | 1.25 ms | 0 - 14 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
58 |
+
| FaceDetector | SA8775P ADP | SA8775P | QNN | 1.205 ms | 0 - 10 MB | FP16 | NPU | Use Export Script |
|
59 |
+
| FaceDetector | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 18.69 ms | 0 - 14 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
60 |
+
| FaceDetector | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 18.639 ms | 1 - 9 MB | FP16 | NPU | Use Export Script |
|
61 |
+
| FaceDetector | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.546 ms | 0 - 6 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
62 |
+
| FaceDetector | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.543 ms | 1 - 5 MB | FP16 | NPU | Use Export Script |
|
63 |
+
| FaceDetector | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 1.25 ms | 0 - 14 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
64 |
+
| FaceDetector | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 1.205 ms | 0 - 10 MB | FP16 | NPU | Use Export Script |
|
65 |
+
| FaceDetector | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.827 ms | 0 - 21 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.tflite) |
|
66 |
+
| FaceDetector | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.868 ms | 1 - 28 MB | FP16 | NPU | Use Export Script |
|
67 |
+
| FaceDetector | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.669 ms | 1 - 1 MB | FP16 | NPU | Use Export Script |
|
68 |
+
| FaceDetector | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.845 ms | 2 - 2 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceDetector.onnx) |
|
69 |
+
| FaceLandmarkDetector | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.19 ms | 0 - 8 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
70 |
+
| FaceLandmarkDetector | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 0.216 ms | 0 - 2 MB | FP16 | NPU | [MediaPipe-Face-Detection.so](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.so) |
|
71 |
+
| FaceLandmarkDetector | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 0.373 ms | 0 - 8 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.onnx) |
|
72 |
+
| FaceLandmarkDetector | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.146 ms | 0 - 26 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
73 |
+
| FaceLandmarkDetector | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.156 ms | 0 - 21 MB | FP16 | NPU | [MediaPipe-Face-Detection.so](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.so) |
|
74 |
+
| FaceLandmarkDetector | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 0.266 ms | 0 - 21 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.onnx) |
|
75 |
+
| FaceLandmarkDetector | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.127 ms | 0 - 19 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
76 |
+
| FaceLandmarkDetector | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.17 ms | 0 - 15 MB | FP16 | NPU | Use Export Script |
|
77 |
+
| FaceLandmarkDetector | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.293 ms | 0 - 20 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.onnx) |
|
78 |
+
| FaceLandmarkDetector | SA7255P ADP | SA7255P | TFLITE | 3.548 ms | 0 - 13 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
79 |
+
| FaceLandmarkDetector | SA7255P ADP | SA7255P | QNN | 3.543 ms | 0 - 10 MB | FP16 | NPU | Use Export Script |
|
80 |
+
| FaceLandmarkDetector | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.205 ms | 0 - 8 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
81 |
+
| FaceLandmarkDetector | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.222 ms | 0 - 4 MB | FP16 | NPU | Use Export Script |
|
82 |
+
| FaceLandmarkDetector | SA8295P ADP | SA8295P | TFLITE | 0.569 ms | 0 - 18 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
83 |
+
| FaceLandmarkDetector | SA8295P ADP | SA8295P | QNN | 0.613 ms | 0 - 18 MB | FP16 | NPU | Use Export Script |
|
84 |
+
| FaceLandmarkDetector | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.198 ms | 0 - 7 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
85 |
+
| FaceLandmarkDetector | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.217 ms | 0 - 2 MB | FP16 | NPU | Use Export Script |
|
86 |
+
| FaceLandmarkDetector | SA8775P ADP | SA8775P | TFLITE | 0.501 ms | 0 - 12 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
87 |
+
| FaceLandmarkDetector | SA8775P ADP | SA8775P | QNN | 0.519 ms | 0 - 10 MB | FP16 | NPU | Use Export Script |
|
88 |
+
| FaceLandmarkDetector | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 3.548 ms | 0 - 13 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
89 |
+
| FaceLandmarkDetector | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 3.543 ms | 0 - 10 MB | FP16 | NPU | Use Export Script |
|
90 |
+
| FaceLandmarkDetector | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.19 ms | 0 - 8 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
91 |
+
| FaceLandmarkDetector | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.219 ms | 0 - 4 MB | FP16 | NPU | Use Export Script |
|
92 |
+
| FaceLandmarkDetector | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 0.501 ms | 0 - 12 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
93 |
+
| FaceLandmarkDetector | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 0.519 ms | 0 - 10 MB | FP16 | NPU | Use Export Script |
|
94 |
+
| FaceLandmarkDetector | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.348 ms | 0 - 26 MB | FP16 | NPU | [MediaPipe-Face-Detection.tflite](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.tflite) |
|
95 |
+
| FaceLandmarkDetector | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.366 ms | 0 - 21 MB | FP16 | NPU | Use Export Script |
|
96 |
+
| FaceLandmarkDetector | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.309 ms | 0 - 0 MB | FP16 | NPU | Use Export Script |
|
97 |
+
| FaceLandmarkDetector | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.36 ms | 1 - 1 MB | FP16 | NPU | [MediaPipe-Face-Detection.onnx](https://huggingface.co/qualcomm/MediaPipe-Face-Detection/blob/main/FaceLandmarkDetector.onnx) |
|
98 |
|
99 |
|
100 |
|
|
|
155 |
```
|
156 |
Profiling Results
|
157 |
------------------------------------------------------------
|
158 |
+
FaceDetector
|
159 |
Device : Samsung Galaxy S23 (13)
|
160 |
Runtime : TFLITE
|
161 |
+
Estimated inference time (ms) : 0.6
|
162 |
Estimated peak memory usage (MB): [0, 6]
|
163 |
Total # Ops : 111
|
164 |
Compute Unit(s) : NPU (111 ops)
|
165 |
|
166 |
------------------------------------------------------------
|
167 |
+
FaceLandmarkDetector
|
168 |
Device : Samsung Galaxy S23 (13)
|
169 |
Runtime : TFLITE
|
170 |
Estimated inference time (ms) : 0.2
|
171 |
+
Estimated peak memory usage (MB): [0, 8]
|
172 |
Total # Ops : 100
|
173 |
Compute Unit(s) : NPU (100 ops)
|
174 |
```
|
|
|
192 |
from qai_hub_models.models.mediapipe_face import Model
|
193 |
|
194 |
# Load the model
|
195 |
+
torch_model = Model.from_pretrained()
|
|
|
|
|
196 |
|
197 |
# Device
|
198 |
+
device = hub.Device("Samsung Galaxy S24")
|
199 |
|
200 |
# Trace model
|
201 |
+
input_shape = torch_model.get_input_spec()
|
202 |
+
sample_inputs = torch_model.sample_inputs()
|
203 |
|
204 |
+
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
205 |
|
206 |
# Compile model on a specific device
|
207 |
+
compile_job = hub.submit_compile_job(
|
208 |
+
model=pt_model,
|
209 |
device=device,
|
210 |
+
input_specs=torch_model.get_input_spec(),
|
211 |
)
|
212 |
|
213 |
# Get target model to run on-device
|
214 |
+
target_model = compile_job.get_target_model()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
```
|
217 |
|
|
|
223 |
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
224 |
provided job URL to view a variety of on-device performance metrics.
|
225 |
```python
|
226 |
+
profile_job = hub.submit_profile_job(
|
227 |
+
model=target_model,
|
|
|
|
|
|
|
|
|
228 |
device=device,
|
229 |
)
|
230 |
+
|
231 |
```
|
232 |
|
233 |
Step 3: **Verify on-device accuracy**
|
|
|
235 |
To verify the accuracy of the model on-device, you can run on-device inference
|
236 |
on sample input data on the same cloud hosted device.
|
237 |
```python
|
238 |
+
input_data = torch_model.sample_inputs()
|
239 |
+
inference_job = hub.submit_inference_job(
|
240 |
+
model=target_model,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
device=device,
|
242 |
+
inputs=input_data,
|
243 |
)
|
244 |
+
on_device_output = inference_job.download_output_data()
|
245 |
|
246 |
```
|
247 |
With the output of the model, you can compute like PSNR, relative errors or
|