v0.38.0
Browse filesSee https://github.com/quic/ai-hub-models/releases/v0.38.0 for changelog.
- .gitattributes +2 -0
- DDColor_float.dlc +3 -0
- DDColor_float.onnx.zip +3 -0
- DDColor_float.tflite +3 -0
- DDColor_w8a8.onnx.zip +3 -0
- DDColor_w8a8.tflite +3 -0
- DEPLOYMENT_MODEL_LICENSE.pdf +3 -0
- LICENSE +2 -0
- README.md +272 -0
- tool-versions.yaml +4 -0
.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 |
+
DDColor_float.dlc filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
DEPLOYMENT_MODEL_LICENSE.pdf filter=lfs diff=lfs merge=lfs -text
|
DDColor_float.dlc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02ff60c235b78cca8208a73170f5eb9bd7f9aaab8e02c32b21b0f170bc47460c
|
| 3 |
+
size 225982228
|
DDColor_float.onnx.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1bb5e05a8f00ddb7d5acc47ef165f80d1056ae497ab3a2232423a2e9caba3d9f
|
| 3 |
+
size 206443876
|
DDColor_float.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f5877143aed72e501726b13b8a6727a88fd82c9464e705c5f2838ac48b0f191
|
| 3 |
+
size 225521268
|
DDColor_w8a8.onnx.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:287ed8031f01531675ca5e09241acd95fcfb2c44be9106f551bc69490a4dd7b7
|
| 3 |
+
size 164761245
|
DDColor_w8a8.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:18285bafea35525b6206d9c2ce93378c7d81e4a3e627a632301d233b9d29f0c8
|
| 3 |
+
size 57450520
|
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
|
LICENSE
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The license of the original trained model can be found at https://github.com/piddnad/DDColor/blob/master/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,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
license: other
|
| 4 |
+
tags:
|
| 5 |
+
- android
|
| 6 |
+
pipeline_tag: image-to-image
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+

|
| 11 |
+
|
| 12 |
+
# DDColor: Optimized for Mobile Deployment
|
| 13 |
+
## Colorize image from the black-and-white image
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
DDColor is a coloring algorithm that produces natural, vivid color results from incoming black and white images.
|
| 17 |
+
|
| 18 |
+
This model is an implementation of DDColor found [here](https://github.com/piddnad/DDColor/).
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
This repository provides scripts to run DDColor on Qualcomm® devices.
|
| 22 |
+
More details on model performance across various devices, can be found
|
| 23 |
+
[here](https://aihub.qualcomm.com/models/ddcolor).
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
### Model Details
|
| 28 |
+
|
| 29 |
+
- **Model Type:** Model_use_case.image_editing
|
| 30 |
+
- **Model Stats:**
|
| 31 |
+
- Model checkpoint: ddcolor_paper_tiny.pth
|
| 32 |
+
- Input resolution: 224x224
|
| 33 |
+
- Number of parameters: 56.3M
|
| 34 |
+
- Model size (float): 215 MB
|
| 35 |
+
- Model size (w8a8): 54.8 MB
|
| 36 |
+
|
| 37 |
+
| Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
|
| 38 |
+
|---|---|---|---|---|---|---|---|---|
|
| 39 |
+
| DDColor | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 277.458 ms | 0 - 365 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 40 |
+
| DDColor | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 183.714 ms | 1 - 305 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 41 |
+
| DDColor | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 1248.776 ms | 1 - 257 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 42 |
+
| DDColor | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 171.409 ms | 0 - 46 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 43 |
+
| DDColor | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 1118.851 ms | 0 - 44 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 44 |
+
| DDColor | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 1118.703 ms | 0 - 167 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.onnx.zip) |
|
| 45 |
+
| DDColor | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 175.104 ms | 1 - 364 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 46 |
+
| DDColor | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 1111.959 ms | 0 - 650 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 47 |
+
| DDColor | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 277.458 ms | 0 - 365 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 48 |
+
| DDColor | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | TFLITE | 173.301 ms | 0 - 43 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 49 |
+
| DDColor | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | QNN_DLC | 1121.61 ms | 0 - 42 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 50 |
+
| DDColor | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 190.875 ms | 0 - 262 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 51 |
+
| DDColor | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 1240.178 ms | 1 - 262 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 52 |
+
| DDColor | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | TFLITE | 170.399 ms | 0 - 46 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 53 |
+
| DDColor | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | QNN_DLC | 1125.275 ms | 0 - 42 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 54 |
+
| DDColor | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 175.104 ms | 1 - 364 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 55 |
+
| DDColor | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 1111.959 ms | 0 - 650 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 56 |
+
| DDColor | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 123.876 ms | 1 - 384 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 57 |
+
| DDColor | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 841.212 ms | 1 - 1063 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 58 |
+
| DDColor | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 846.408 ms | 1 - 370 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.onnx.zip) |
|
| 59 |
+
| DDColor | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 100.104 ms | 1 - 361 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.tflite) |
|
| 60 |
+
| DDColor | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 846.703 ms | 148 - 745 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 61 |
+
| DDColor | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 865.453 ms | 1 - 337 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.onnx.zip) |
|
| 62 |
+
| DDColor | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 1160.679 ms | 142 - 142 MB | NPU | [DDColor.dlc](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.dlc) |
|
| 63 |
+
| DDColor | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 1163.214 ms | 113 - 113 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor.onnx.zip) |
|
| 64 |
+
| DDColor | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 3114.062 ms | 0 - 251 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 65 |
+
| DDColor | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 3537.092 ms | 0 - 283 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 66 |
+
| DDColor | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 1645.578 ms | 0 - 31 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 67 |
+
| DDColor | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 2894.452 ms | 95 - 314 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.onnx.zip) |
|
| 68 |
+
| DDColor | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 1666.302 ms | 0 - 252 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 69 |
+
| DDColor | w8a8 | RB3 Gen 2 (Proxy) | Qualcomm® QCS6490 (Proxy) | TFLITE | 585.134 ms | 94 - 398 MB | CPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 70 |
+
| DDColor | w8a8 | RB3 Gen 2 (Proxy) | Qualcomm® QCS6490 (Proxy) | ONNX | 645.245 ms | 166 - 190 MB | CPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.onnx.zip) |
|
| 71 |
+
| DDColor | w8a8 | RB5 (Proxy) | Qualcomm® QCS8250 (Proxy) | TFLITE | 814.334 ms | 62 - 99 MB | CPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 72 |
+
| DDColor | w8a8 | RB5 (Proxy) | Qualcomm® QCS8250 (Proxy) | ONNX | 622.076 ms | 287 - 344 MB | CPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.onnx.zip) |
|
| 73 |
+
| DDColor | w8a8 | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 3114.062 ms | 0 - 251 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 74 |
+
| DDColor | w8a8 | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | TFLITE | 1647.516 ms | 0 - 25 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 75 |
+
| DDColor | w8a8 | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 4014.446 ms | 0 - 267 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 76 |
+
| DDColor | w8a8 | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | TFLITE | 1645.3 ms | 0 - 23 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 77 |
+
| DDColor | w8a8 | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 1666.302 ms | 0 - 252 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 78 |
+
| DDColor | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 1248.823 ms | 0 - 263 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 79 |
+
| DDColor | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 2145.344 ms | 111 - 918 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.onnx.zip) |
|
| 80 |
+
| DDColor | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 1038.25 ms | 0 - 250 MB | NPU | [DDColor.tflite](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.tflite) |
|
| 81 |
+
| DDColor | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 1857.94 ms | 115 - 530 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.onnx.zip) |
|
| 82 |
+
| DDColor | w8a8 | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 2988.582 ms | 199 - 199 MB | NPU | [DDColor.onnx.zip](https://huggingface.co/qualcomm/DDColor/blob/main/DDColor_w8a8.onnx.zip) |
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
## Installation
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
Install the package via pip:
|
| 91 |
+
```bash
|
| 92 |
+
pip install "qai-hub-models[ddcolor]"
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
| 97 |
+
|
| 98 |
+
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
| 99 |
+
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
| 100 |
+
|
| 101 |
+
With this API token, you can configure your client to run models on the cloud
|
| 102 |
+
hosted devices.
|
| 103 |
+
```bash
|
| 104 |
+
qai-hub configure --api_token API_TOKEN
|
| 105 |
+
```
|
| 106 |
+
Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
## Demo off target
|
| 111 |
+
|
| 112 |
+
The package contains a simple end-to-end demo that downloads pre-trained
|
| 113 |
+
weights and runs this model on a sample input.
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
python -m qai_hub_models.models.ddcolor.demo
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
The above demo runs a reference implementation of pre-processing, model
|
| 120 |
+
inference, and post processing.
|
| 121 |
+
|
| 122 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
| 123 |
+
environment, please add the following to your cell (instead of the above).
|
| 124 |
+
```
|
| 125 |
+
%run -m qai_hub_models.models.ddcolor.demo
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
### Run model on a cloud-hosted device
|
| 130 |
+
|
| 131 |
+
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
| 132 |
+
device. This script does the following:
|
| 133 |
+
* Performance check on-device on a cloud-hosted device
|
| 134 |
+
* Downloads compiled assets that can be deployed on-device for Android.
|
| 135 |
+
* Accuracy check between PyTorch and on-device outputs.
|
| 136 |
+
|
| 137 |
+
```bash
|
| 138 |
+
python -m qai_hub_models.models.ddcolor.export
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
## How does this work?
|
| 144 |
+
|
| 145 |
+
This [export script](https://aihub.qualcomm.com/models/ddcolor/qai_hub_models/models/DDColor/export.py)
|
| 146 |
+
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
| 147 |
+
on-device. Lets go through each step below in detail:
|
| 148 |
+
|
| 149 |
+
Step 1: **Compile model for on-device deployment**
|
| 150 |
+
|
| 151 |
+
To compile a PyTorch model for on-device deployment, we first trace the model
|
| 152 |
+
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
| 153 |
+
|
| 154 |
+
```python
|
| 155 |
+
import torch
|
| 156 |
+
|
| 157 |
+
import qai_hub as hub
|
| 158 |
+
from qai_hub_models.models.ddcolor import Model
|
| 159 |
+
|
| 160 |
+
# Load the model
|
| 161 |
+
torch_model = Model.from_pretrained()
|
| 162 |
+
|
| 163 |
+
# Device
|
| 164 |
+
device = hub.Device("Samsung Galaxy S25")
|
| 165 |
+
|
| 166 |
+
# Trace model
|
| 167 |
+
input_shape = torch_model.get_input_spec()
|
| 168 |
+
sample_inputs = torch_model.sample_inputs()
|
| 169 |
+
|
| 170 |
+
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
| 171 |
+
|
| 172 |
+
# Compile model on a specific device
|
| 173 |
+
compile_job = hub.submit_compile_job(
|
| 174 |
+
model=pt_model,
|
| 175 |
+
device=device,
|
| 176 |
+
input_specs=torch_model.get_input_spec(),
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
# Get target model to run on-device
|
| 180 |
+
target_model = compile_job.get_target_model()
|
| 181 |
+
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
Step 2: **Performance profiling on cloud-hosted device**
|
| 186 |
+
|
| 187 |
+
After compiling models from step 1. Models can be profiled model on-device using the
|
| 188 |
+
`target_model`. Note that this scripts runs the model on a device automatically
|
| 189 |
+
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
| 190 |
+
provided job URL to view a variety of on-device performance metrics.
|
| 191 |
+
```python
|
| 192 |
+
profile_job = hub.submit_profile_job(
|
| 193 |
+
model=target_model,
|
| 194 |
+
device=device,
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
Step 3: **Verify on-device accuracy**
|
| 200 |
+
|
| 201 |
+
To verify the accuracy of the model on-device, you can run on-device inference
|
| 202 |
+
on sample input data on the same cloud hosted device.
|
| 203 |
+
```python
|
| 204 |
+
input_data = torch_model.sample_inputs()
|
| 205 |
+
inference_job = hub.submit_inference_job(
|
| 206 |
+
model=target_model,
|
| 207 |
+
device=device,
|
| 208 |
+
inputs=input_data,
|
| 209 |
+
)
|
| 210 |
+
on_device_output = inference_job.download_output_data()
|
| 211 |
+
|
| 212 |
+
```
|
| 213 |
+
With the output of the model, you can compute like PSNR, relative errors or
|
| 214 |
+
spot check the output with expected output.
|
| 215 |
+
|
| 216 |
+
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
| 217 |
+
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
## Run demo on a cloud-hosted device
|
| 222 |
+
|
| 223 |
+
You can also run the demo on-device.
|
| 224 |
+
|
| 225 |
+
```bash
|
| 226 |
+
python -m qai_hub_models.models.ddcolor.demo --eval-mode on-device
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
| 230 |
+
environment, please add the following to your cell (instead of the above).
|
| 231 |
+
```
|
| 232 |
+
%run -m qai_hub_models.models.ddcolor.demo -- --eval-mode on-device
|
| 233 |
+
```
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
## Deploying compiled model to Android
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
The models can be deployed using multiple runtimes:
|
| 240 |
+
- TensorFlow Lite (`.tflite` export): [This
|
| 241 |
+
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
| 242 |
+
guide to deploy the .tflite model in an Android application.
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
- QNN (`.so` export ): This [sample
|
| 246 |
+
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
| 247 |
+
provides instructions on how to use the `.so` shared library in an Android application.
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
## View on Qualcomm® AI Hub
|
| 251 |
+
Get more details on DDColor's performance across various devices [here](https://aihub.qualcomm.com/models/ddcolor).
|
| 252 |
+
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
## License
|
| 256 |
+
* The license for the original implementation of DDColor can be found
|
| 257 |
+
[here](https://github.com/piddnad/DDColor/blob/master/LICENSE).
|
| 258 |
+
* 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)
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
## References
|
| 263 |
+
* [DDColor: Towards Photo-Realistic Image Colorization via Dual Decoders](https://arxiv.org/abs/2201.03545)
|
| 264 |
+
* [Source Model Implementation](https://github.com/piddnad/DDColor/)
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
## Community
|
| 269 |
+
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
|
| 270 |
+
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
|
| 271 |
+
|
| 272 |
+
|
tool-versions.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tool_versions:
|
| 2 |
+
onnx:
|
| 3 |
+
qairt: 2.37.1.250807093845_124904
|
| 4 |
+
onnx_runtime: 1.22.2
|