Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -38,64 +38,64 @@ More details on model performance across various devices, can be found
|
|
| 38 |
|
| 39 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
| 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 |
|
| 101 |
|
|
@@ -156,20 +156,20 @@ python -m qai_hub_models.models.deepbox.export
|
|
| 156 |
```
|
| 157 |
Profiling Results
|
| 158 |
------------------------------------------------------------
|
| 159 |
-
|
| 160 |
Device : Samsung Galaxy S23 (13)
|
| 161 |
Runtime : TFLITE
|
| 162 |
-
Estimated inference time (ms) :
|
| 163 |
-
Estimated peak memory usage (MB): [0,
|
| 164 |
-
Total # Ops :
|
| 165 |
-
Compute Unit(s) : NPU (
|
| 166 |
|
| 167 |
------------------------------------------------------------
|
| 168 |
-
|
| 169 |
Device : Samsung Galaxy S23 (13)
|
| 170 |
Runtime : TFLITE
|
| 171 |
Estimated inference time (ms) : 4.7
|
| 172 |
-
Estimated peak memory usage (MB): [0,
|
| 173 |
Total # Ops : 40
|
| 174 |
Compute Unit(s) : NPU (40 ops)
|
| 175 |
```
|
|
@@ -193,43 +193,26 @@ import qai_hub as hub
|
|
| 193 |
from qai_hub_models.models.deepbox import Model
|
| 194 |
|
| 195 |
# Load the model
|
| 196 |
-
|
| 197 |
-
bbox2D_dectector_model = model.bbox2D_dectector
|
| 198 |
-
bbox3D_dectector_model = model.bbox3D_dectector
|
| 199 |
|
| 200 |
# Device
|
| 201 |
-
device = hub.Device("Samsung Galaxy
|
| 202 |
|
| 203 |
# Trace model
|
| 204 |
-
|
| 205 |
-
|
| 206 |
|
| 207 |
-
|
| 208 |
|
| 209 |
# Compile model on a specific device
|
| 210 |
-
|
| 211 |
-
model=
|
| 212 |
device=device,
|
| 213 |
-
input_specs=
|
| 214 |
)
|
| 215 |
|
| 216 |
# Get target model to run on-device
|
| 217 |
-
|
| 218 |
-
# Trace model
|
| 219 |
-
bbox3D_dectector_input_shape = bbox3D_dectector_model.get_input_spec()
|
| 220 |
-
bbox3D_dectector_sample_inputs = bbox3D_dectector_model.sample_inputs()
|
| 221 |
-
|
| 222 |
-
traced_bbox3D_dectector_model = torch.jit.trace(bbox3D_dectector_model, [torch.tensor(data[0]) for _, data in bbox3D_dectector_sample_inputs.items()])
|
| 223 |
-
|
| 224 |
-
# Compile model on a specific device
|
| 225 |
-
bbox3D_dectector_compile_job = hub.submit_compile_job(
|
| 226 |
-
model=traced_bbox3D_dectector_model ,
|
| 227 |
-
device=device,
|
| 228 |
-
input_specs=bbox3D_dectector_model.get_input_spec(),
|
| 229 |
-
)
|
| 230 |
-
|
| 231 |
-
# Get target model to run on-device
|
| 232 |
-
bbox3D_dectector_target_model = bbox3D_dectector_compile_job.get_target_model()
|
| 233 |
|
| 234 |
```
|
| 235 |
|
|
@@ -241,15 +224,11 @@ After compiling models from step 1. Models can be profiled model on-device using
|
|
| 241 |
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
| 242 |
provided job URL to view a variety of on-device performance metrics.
|
| 243 |
```python
|
| 244 |
-
|
| 245 |
-
model=
|
| 246 |
-
device=device,
|
| 247 |
-
)
|
| 248 |
-
bbox3D_dectector_profile_job = hub.submit_profile_job(
|
| 249 |
-
model=bbox3D_dectector_target_model,
|
| 250 |
device=device,
|
| 251 |
)
|
| 252 |
-
|
| 253 |
```
|
| 254 |
|
| 255 |
Step 3: **Verify on-device accuracy**
|
|
@@ -257,20 +236,13 @@ Step 3: **Verify on-device accuracy**
|
|
| 257 |
To verify the accuracy of the model on-device, you can run on-device inference
|
| 258 |
on sample input data on the same cloud hosted device.
|
| 259 |
```python
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
model=
|
| 263 |
-
device=device,
|
| 264 |
-
inputs=bbox2D_dectector_input_data,
|
| 265 |
-
)
|
| 266 |
-
bbox2D_dectector_inference_job.download_output_data()
|
| 267 |
-
bbox3D_dectector_input_data = bbox3D_dectector_model.sample_inputs()
|
| 268 |
-
bbox3D_dectector_inference_job = hub.submit_inference_job(
|
| 269 |
-
model=bbox3D_dectector_target_model,
|
| 270 |
device=device,
|
| 271 |
-
inputs=
|
| 272 |
)
|
| 273 |
-
|
| 274 |
|
| 275 |
```
|
| 276 |
With the output of the model, you can compute like PSNR, relative errors or
|
|
|
|
| 38 |
|
| 39 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
| 40 |
|---|---|---|---|---|---|---|---|---|
|
| 41 |
+
| Yolo2DDetection | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 22.84 ms | 0 - 136 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 42 |
+
| Yolo2DDetection | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 2.437 ms | 2 - 4 MB | FP16 | NPU | [3D-Deep-BOX.so](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.so) |
|
| 43 |
+
| Yolo2DDetection | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 4.822 ms | 3 - 57 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.onnx) |
|
| 44 |
+
| Yolo2DDetection | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 16.285 ms | 0 - 58 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 45 |
+
| Yolo2DDetection | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 1.755 ms | 0 - 18 MB | FP16 | NPU | [3D-Deep-BOX.so](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.so) |
|
| 46 |
+
| Yolo2DDetection | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 3.318 ms | 0 - 27 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.onnx) |
|
| 47 |
+
| Yolo2DDetection | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 17.442 ms | 0 - 33 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 48 |
+
| Yolo2DDetection | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 1.653 ms | 2 - 19 MB | FP16 | NPU | Use Export Script |
|
| 49 |
+
| Yolo2DDetection | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 4.132 ms | 2 - 17 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.onnx) |
|
| 50 |
+
| Yolo2DDetection | SA7255P ADP | SA7255P | TFLITE | 67.55 ms | 0 - 29 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 51 |
+
| Yolo2DDetection | SA7255P ADP | SA7255P | QNN | 34.614 ms | 1 - 10 MB | FP16 | NPU | Use Export Script |
|
| 52 |
+
| Yolo2DDetection | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 22.35 ms | 0 - 129 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 53 |
+
| Yolo2DDetection | SA8255 (Proxy) | SA8255P Proxy | QNN | 2.435 ms | 2 - 5 MB | FP16 | NPU | Use Export Script |
|
| 54 |
+
| Yolo2DDetection | SA8295P ADP | SA8295P | TFLITE | 24.002 ms | 0 - 31 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 55 |
+
| Yolo2DDetection | SA8295P ADP | SA8295P | QNN | 3.484 ms | 0 - 18 MB | FP16 | NPU | Use Export Script |
|
| 56 |
+
| Yolo2DDetection | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 22.3 ms | 0 - 141 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 57 |
+
| Yolo2DDetection | SA8650 (Proxy) | SA8650P Proxy | QNN | 2.44 ms | 2 - 12 MB | FP16 | NPU | Use Export Script |
|
| 58 |
+
| Yolo2DDetection | SA8775P ADP | SA8775P | TFLITE | 28.223 ms | 0 - 29 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 59 |
+
| Yolo2DDetection | SA8775P ADP | SA8775P | QNN | 3.868 ms | 2 - 12 MB | FP16 | NPU | Use Export Script |
|
| 60 |
+
| Yolo2DDetection | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 67.55 ms | 0 - 29 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 61 |
+
| Yolo2DDetection | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 34.614 ms | 1 - 10 MB | FP16 | NPU | Use Export Script |
|
| 62 |
+
| Yolo2DDetection | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 22.221 ms | 0 - 126 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 63 |
+
| Yolo2DDetection | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 2.435 ms | 2 - 4 MB | FP16 | NPU | Use Export Script |
|
| 64 |
+
| Yolo2DDetection | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 28.223 ms | 0 - 29 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 65 |
+
| Yolo2DDetection | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 3.868 ms | 2 - 12 MB | FP16 | NPU | Use Export Script |
|
| 66 |
+
| Yolo2DDetection | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 22.239 ms | 0 - 59 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.tflite) |
|
| 67 |
+
| Yolo2DDetection | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 3.322 ms | 2 - 23 MB | FP16 | NPU | Use Export Script |
|
| 68 |
+
| Yolo2DDetection | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 2.637 ms | 2 - 2 MB | FP16 | NPU | Use Export Script |
|
| 69 |
+
| Yolo2DDetection | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 5.49 ms | 3 - 3 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/Yolo2DDetection.onnx) |
|
| 70 |
+
| VGG3DDetection | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 4.728 ms | 0 - 674 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 71 |
+
| VGG3DDetection | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 4.777 ms | 1 - 3 MB | FP16 | NPU | [3D-Deep-BOX.so](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.so) |
|
| 72 |
+
| VGG3DDetection | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 5.127 ms | 0 - 451 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.onnx) |
|
| 73 |
+
| VGG3DDetection | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 3.555 ms | 0 - 125 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 74 |
+
| VGG3DDetection | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 3.754 ms | 0 - 18 MB | FP16 | NPU | [3D-Deep-BOX.so](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.so) |
|
| 75 |
+
| VGG3DDetection | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 3.956 ms | 0 - 83 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.onnx) |
|
| 76 |
+
| VGG3DDetection | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 3.451 ms | 0 - 79 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 77 |
+
| VGG3DDetection | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 3.43 ms | 1 - 76 MB | FP16 | NPU | Use Export Script |
|
| 78 |
+
| VGG3DDetection | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 3.792 ms | 1 - 80 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.onnx) |
|
| 79 |
+
| VGG3DDetection | SA7255P ADP | SA7255P | TFLITE | 257.868 ms | 0 - 73 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 80 |
+
| VGG3DDetection | SA7255P ADP | SA7255P | QNN | 257.837 ms | 1 - 11 MB | FP16 | NPU | Use Export Script |
|
| 81 |
+
| VGG3DDetection | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 4.727 ms | 0 - 663 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 82 |
+
| VGG3DDetection | SA8255 (Proxy) | SA8255P Proxy | QNN | 4.782 ms | 1 - 3 MB | FP16 | NPU | Use Export Script |
|
| 83 |
+
| VGG3DDetection | SA8295P ADP | SA8295P | TFLITE | 9.744 ms | 0 - 76 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 84 |
+
| VGG3DDetection | SA8295P ADP | SA8295P | QNN | 9.927 ms | 1 - 18 MB | FP16 | NPU | Use Export Script |
|
| 85 |
+
| VGG3DDetection | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 4.732 ms | 0 - 666 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 86 |
+
| VGG3DDetection | SA8650 (Proxy) | SA8650P Proxy | QNN | 4.785 ms | 1 - 3 MB | FP16 | NPU | Use Export Script |
|
| 87 |
+
| VGG3DDetection | SA8775P ADP | SA8775P | TFLITE | 10.781 ms | 0 - 73 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 88 |
+
| VGG3DDetection | SA8775P ADP | SA8775P | QNN | 10.68 ms | 1 - 10 MB | FP16 | NPU | Use Export Script |
|
| 89 |
+
| VGG3DDetection | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 257.868 ms | 0 - 73 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 90 |
+
| VGG3DDetection | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 257.837 ms | 1 - 11 MB | FP16 | NPU | Use Export Script |
|
| 91 |
+
| VGG3DDetection | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 4.722 ms | 0 - 666 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 92 |
+
| VGG3DDetection | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 4.777 ms | 1 - 3 MB | FP16 | NPU | Use Export Script |
|
| 93 |
+
| VGG3DDetection | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 10.781 ms | 0 - 73 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 94 |
+
| VGG3DDetection | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 10.68 ms | 1 - 10 MB | FP16 | NPU | Use Export Script |
|
| 95 |
+
| VGG3DDetection | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 8.457 ms | 0 - 125 MB | FP16 | NPU | [3D-Deep-BOX.tflite](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.tflite) |
|
| 96 |
+
| VGG3DDetection | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 8.718 ms | 1 - 83 MB | FP16 | NPU | Use Export Script |
|
| 97 |
+
| VGG3DDetection | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 5.011 ms | 1 - 1 MB | FP16 | NPU | Use Export Script |
|
| 98 |
+
| VGG3DDetection | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 4.982 ms | 89 - 89 MB | FP16 | NPU | [3D-Deep-BOX.onnx](https://huggingface.co/qualcomm/3D-Deep-BOX/blob/main/VGG3DDetection.onnx) |
|
| 99 |
|
| 100 |
|
| 101 |
|
|
|
|
| 156 |
```
|
| 157 |
Profiling Results
|
| 158 |
------------------------------------------------------------
|
| 159 |
+
Yolo2DDetection
|
| 160 |
Device : Samsung Galaxy S23 (13)
|
| 161 |
Runtime : TFLITE
|
| 162 |
+
Estimated inference time (ms) : 22.8
|
| 163 |
+
Estimated peak memory usage (MB): [0, 136]
|
| 164 |
+
Total # Ops : 129
|
| 165 |
+
Compute Unit(s) : NPU (129 ops)
|
| 166 |
|
| 167 |
------------------------------------------------------------
|
| 168 |
+
VGG3DDetection
|
| 169 |
Device : Samsung Galaxy S23 (13)
|
| 170 |
Runtime : TFLITE
|
| 171 |
Estimated inference time (ms) : 4.7
|
| 172 |
+
Estimated peak memory usage (MB): [0, 674]
|
| 173 |
Total # Ops : 40
|
| 174 |
Compute Unit(s) : NPU (40 ops)
|
| 175 |
```
|
|
|
|
| 193 |
from qai_hub_models.models.deepbox import Model
|
| 194 |
|
| 195 |
# Load the model
|
| 196 |
+
torch_model = Model.from_pretrained()
|
|
|
|
|
|
|
| 197 |
|
| 198 |
# Device
|
| 199 |
+
device = hub.Device("Samsung Galaxy S24")
|
| 200 |
|
| 201 |
# Trace model
|
| 202 |
+
input_shape = torch_model.get_input_spec()
|
| 203 |
+
sample_inputs = torch_model.sample_inputs()
|
| 204 |
|
| 205 |
+
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
| 206 |
|
| 207 |
# Compile model on a specific device
|
| 208 |
+
compile_job = hub.submit_compile_job(
|
| 209 |
+
model=pt_model,
|
| 210 |
device=device,
|
| 211 |
+
input_specs=torch_model.get_input_spec(),
|
| 212 |
)
|
| 213 |
|
| 214 |
# Get target model to run on-device
|
| 215 |
+
target_model = compile_job.get_target_model()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
```
|
| 218 |
|
|
|
|
| 224 |
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
| 225 |
provided job URL to view a variety of on-device performance metrics.
|
| 226 |
```python
|
| 227 |
+
profile_job = hub.submit_profile_job(
|
| 228 |
+
model=target_model,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
device=device,
|
| 230 |
)
|
| 231 |
+
|
| 232 |
```
|
| 233 |
|
| 234 |
Step 3: **Verify on-device accuracy**
|
|
|
|
| 236 |
To verify the accuracy of the model on-device, you can run on-device inference
|
| 237 |
on sample input data on the same cloud hosted device.
|
| 238 |
```python
|
| 239 |
+
input_data = torch_model.sample_inputs()
|
| 240 |
+
inference_job = hub.submit_inference_job(
|
| 241 |
+
model=target_model,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
device=device,
|
| 243 |
+
inputs=input_data,
|
| 244 |
)
|
| 245 |
+
on_device_output = inference_job.download_output_data()
|
| 246 |
|
| 247 |
```
|
| 248 |
With the output of the model, you can compute like PSNR, relative errors or
|