qaihm-bot commited on
Commit
5f385a4
·
verified ·
1 Parent(s): 635949f

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

DenseNet-121_float.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:c793fa27c24ccbdf08da3e6de0626a50a2fde2a8950c57ac3d5e9ce6203e85fb
3
- size 32374772
 
 
 
 
DenseNet-121_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4b6b3188d51c44c0ecca146cf2224caa7be871ef8fcb524461ff981b5c048716
3
- size 30311850
 
 
 
 
DenseNet-121_float.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9a0149266705e9772c0bcee4d026a874650107db71ff983ec4073bdd36ef65f3
3
- size 31974640
 
 
 
 
DenseNet-121_w8a16.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4dc3e10da5c1f8ec79b8c688672d58a8550d2e76f3e9dd5e961e7d52f4d3fa54
3
- size 9245924
 
 
 
 
DenseNet-121_w8a8.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d9530858bdff32ba6dea51ff1c8b65dd8dfab625a60a3cfd2a0b2c95717b187e
3
- size 9245916
 
 
 
 
DenseNet-121_w8a8.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3a7f9af4ec74526bed04d83a41d7685d8fea7d14b45a953c6d877a39996851e5
3
- size 8649200
 
 
 
 
README.md CHANGED
@@ -11,280 +11,130 @@ pipeline_tag: image-classification
11
 
12
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/web-assets/model_demo.png)
13
 
14
- # DenseNet-121: Optimized for Mobile Deployment
15
- ## Imagenet classifier and general purpose backbone
16
-
17
 
18
  Densenet is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.
19
 
20
- This model is an implementation of DenseNet-121 found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py).
21
-
22
-
23
- This repository provides scripts to run DenseNet-121 on Qualcomm® devices.
24
- More details on model performance across various devices, can be found
25
- [here](https://aihub.qualcomm.com/models/densenet121).
26
-
27
-
28
-
29
- ### Model Details
30
-
31
- - **Model Type:** Model_use_case.image_classification
32
- - **Model Stats:**
33
- - Model checkpoint: Imagenet
34
- - Input resolution: 224x224
35
- - Number of parameters: 7.99M
36
- - Model size (float): 30.5 MB
37
- - Model size (w8a16): 8.72 MB
38
- - Model size (w8a8): 8.30 MB
39
-
40
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
41
- |---|---|---|---|---|---|---|---|---|
42
- | DenseNet-121 | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 7.972 ms | 0 - 144 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
43
- | DenseNet-121 | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 7.967 ms | 1 - 130 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
44
- | DenseNet-121 | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 3.198 ms | 0 - 185 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
45
- | DenseNet-121 | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 3.177 ms | 1 - 171 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
46
- | DenseNet-121 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 1.754 ms | 0 - 2 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
47
- | DenseNet-121 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 1.754 ms | 1 - 2 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
48
- | DenseNet-121 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 1.742 ms | 0 - 18 MB | NPU | [DenseNet-121.onnx.zip](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.onnx.zip) |
49
- | DenseNet-121 | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 2.755 ms | 0 - 144 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
50
- | DenseNet-121 | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 2.738 ms | 1 - 130 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
51
- | DenseNet-121 | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 7.972 ms | 0 - 144 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
52
- | DenseNet-121 | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 7.967 ms | 1 - 130 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
53
- | DenseNet-121 | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 3.026 ms | 0 - 152 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
54
- | DenseNet-121 | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 3.032 ms | 0 - 136 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
55
- | DenseNet-121 | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 2.755 ms | 0 - 144 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
56
- | DenseNet-121 | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 2.738 ms | 1 - 130 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
57
- | DenseNet-121 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 1.206 ms | 0 - 188 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
58
- | DenseNet-121 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 1.201 ms | 1 - 173 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
59
- | DenseNet-121 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 1.212 ms | 0 - 156 MB | NPU | [DenseNet-121.onnx.zip](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.onnx.zip) |
60
- | DenseNet-121 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 0.867 ms | 0 - 147 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
61
- | DenseNet-121 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 0.866 ms | 0 - 133 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
62
- | DenseNet-121 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 0.924 ms | 0 - 109 MB | NPU | [DenseNet-121.onnx.zip](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.onnx.zip) |
63
- | DenseNet-121 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 0.713 ms | 0 - 150 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.tflite) |
64
- | DenseNet-121 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 0.709 ms | 1 - 134 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
65
- | DenseNet-121 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 0.812 ms | 1 - 109 MB | NPU | [DenseNet-121.onnx.zip](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.onnx.zip) |
66
- | DenseNet-121 | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 1.997 ms | 1 - 1 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.dlc) |
67
- | DenseNet-121 | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 1.725 ms | 15 - 15 MB | NPU | [DenseNet-121.onnx.zip](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121.onnx.zip) |
68
- | DenseNet-121 | w8a16 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 6.221 ms | 0 - 151 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
69
- | DenseNet-121 | w8a16 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 5.003 ms | 0 - 181 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
70
- | DenseNet-121 | w8a16 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 3.118 ms | 0 - 2 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
71
- | DenseNet-121 | w8a16 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 15.196 ms | 0 - 151 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
72
- | DenseNet-121 | w8a16 | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 6.221 ms | 0 - 151 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
73
- | DenseNet-121 | w8a16 | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 5.514 ms | 0 - 160 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
74
- | DenseNet-121 | w8a16 | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 15.196 ms | 0 - 151 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
75
- | DenseNet-121 | w8a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 2.136 ms | 0 - 180 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
76
- | DenseNet-121 | w8a16 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 1.744 ms | 0 - 147 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
77
- | DenseNet-121 | w8a16 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 1.217 ms | 0 - 160 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
78
- | DenseNet-121 | w8a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 3.448 ms | 0 - 0 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a16.dlc) |
79
- | DenseNet-121 | w8a8 | Dragonwing RB3 Gen 2 Vision Kit | Qualcomm® QCS6490 | TFLITE | 84.759 ms | 6 - 34 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
80
- | DenseNet-121 | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 4.633 ms | 0 - 148 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
81
- | DenseNet-121 | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 4.959 ms | 0 - 148 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
82
- | DenseNet-121 | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 2.445 ms | 0 - 175 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
83
- | DenseNet-121 | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 2.697 ms | 0 - 170 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
84
- | DenseNet-121 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 2.256 ms | 0 - 2 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
85
- | DenseNet-121 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 2.415 ms | 0 - 2 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
86
- | DenseNet-121 | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 2.637 ms | 0 - 148 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
87
- | DenseNet-121 | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 11.916 ms | 0 - 147 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
88
- | DenseNet-121 | w8a8 | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 4.633 ms | 0 - 148 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
89
- | DenseNet-121 | w8a8 | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 4.959 ms | 0 - 148 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
90
- | DenseNet-121 | w8a8 | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 3.144 ms | 0 - 157 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
91
- | DenseNet-121 | w8a8 | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 3.322 ms | 0 - 155 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
92
- | DenseNet-121 | w8a8 | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 2.637 ms | 0 - 148 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
93
- | DenseNet-121 | w8a8 | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 11.916 ms | 0 - 147 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
94
- | DenseNet-121 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 1.623 ms | 0 - 171 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
95
- | DenseNet-121 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 1.697 ms | 0 - 172 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
96
- | DenseNet-121 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 1.012 ms | 0 - 151 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
97
- | DenseNet-121 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 1.043 ms | 0 - 152 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
98
- | DenseNet-121 | w8a8 | Snapdragon 7 Gen 4 QRD | Snapdragon® 7 Gen 4 Mobile | TFLITE | 26.527 ms | 5 - 152 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
99
- | DenseNet-121 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 0.872 ms | 0 - 153 MB | NPU | [DenseNet-121.tflite](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.tflite) |
100
- | DenseNet-121 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 0.926 ms | 0 - 153 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
101
- | DenseNet-121 | w8a8 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 2.682 ms | 0 - 0 MB | NPU | [DenseNet-121.dlc](https://huggingface.co/qualcomm/DenseNet-121/blob/main/DenseNet-121_w8a8.dlc) |
102
-
103
-
104
-
105
-
106
- ## Installation
107
-
108
-
109
- Install the package via pip:
110
- ```bash
111
- pip install qai-hub-models
112
- ```
113
-
114
-
115
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
116
-
117
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
118
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
119
-
120
- With this API token, you can configure your client to run models on the cloud
121
- hosted devices.
122
- ```bash
123
- qai-hub configure --api_token API_TOKEN
124
- ```
125
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
126
-
127
-
128
-
129
- ## Demo off target
130
-
131
- The package contains a simple end-to-end demo that downloads pre-trained
132
- weights and runs this model on a sample input.
133
-
134
- ```bash
135
- python -m qai_hub_models.models.densenet121.demo
136
- ```
137
-
138
- The above demo runs a reference implementation of pre-processing, model
139
- inference, and post processing.
140
-
141
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
142
- environment, please add the following to your cell (instead of the above).
143
- ```
144
- %run -m qai_hub_models.models.densenet121.demo
145
- ```
146
-
147
-
148
- ### Run model on a cloud-hosted device
149
-
150
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
151
- device. This script does the following:
152
- * Performance check on-device on a cloud-hosted device
153
- * Downloads compiled assets that can be deployed on-device for Android.
154
- * Accuracy check between PyTorch and on-device outputs.
155
-
156
- ```bash
157
- python -m qai_hub_models.models.densenet121.export
158
- ```
159
-
160
-
161
-
162
- ## How does this work?
163
-
164
- This [export script](https://aihub.qualcomm.com/models/densenet121/qai_hub_models/models/DenseNet-121/export.py)
165
- leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
166
- on-device. Lets go through each step below in detail:
167
-
168
- Step 1: **Compile model for on-device deployment**
169
-
170
- To compile a PyTorch model for on-device deployment, we first trace the model
171
- in memory using the `jit.trace` and then call the `submit_compile_job` API.
172
-
173
- ```python
174
- import torch
175
-
176
- import qai_hub as hub
177
- from qai_hub_models.models.densenet121 import Model
178
-
179
- # Load the model
180
- torch_model = Model.from_pretrained()
181
-
182
- # Device
183
- device = hub.Device("Samsung Galaxy S25")
184
-
185
- # Trace model
186
- input_shape = torch_model.get_input_spec()
187
- sample_inputs = torch_model.sample_inputs()
188
-
189
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
190
-
191
- # Compile model on a specific device
192
- compile_job = hub.submit_compile_job(
193
- model=pt_model,
194
- device=device,
195
- input_specs=torch_model.get_input_spec(),
196
- )
197
-
198
- # Get target model to run on-device
199
- target_model = compile_job.get_target_model()
200
-
201
- ```
202
-
203
-
204
- Step 2: **Performance profiling on cloud-hosted device**
205
-
206
- After compiling models from step 1. Models can be profiled model on-device using the
207
- `target_model`. Note that this scripts runs the model on a device automatically
208
- provisioned in the cloud. Once the job is submitted, you can navigate to a
209
- provided job URL to view a variety of on-device performance metrics.
210
- ```python
211
- profile_job = hub.submit_profile_job(
212
- model=target_model,
213
- device=device,
214
- )
215
-
216
- ```
217
-
218
- Step 3: **Verify on-device accuracy**
219
-
220
- To verify the accuracy of the model on-device, you can run on-device inference
221
- on sample input data on the same cloud hosted device.
222
- ```python
223
- input_data = torch_model.sample_inputs()
224
- inference_job = hub.submit_inference_job(
225
- model=target_model,
226
- device=device,
227
- inputs=input_data,
228
- )
229
- on_device_output = inference_job.download_output_data()
230
-
231
- ```
232
- With the output of the model, you can compute like PSNR, relative errors or
233
- spot check the output with expected output.
234
-
235
- **Note**: This on-device profiling and inference requires access to Qualcomm®
236
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
237
-
238
-
239
-
240
- ## Run demo on a cloud-hosted device
241
-
242
- You can also run the demo on-device.
243
-
244
- ```bash
245
- python -m qai_hub_models.models.densenet121.demo --eval-mode on-device
246
- ```
247
-
248
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
249
- environment, please add the following to your cell (instead of the above).
250
- ```
251
- %run -m qai_hub_models.models.densenet121.demo -- --eval-mode on-device
252
- ```
253
-
254
-
255
- ## Deploying compiled model to Android
256
-
257
-
258
- The models can be deployed using multiple runtimes:
259
- - TensorFlow Lite (`.tflite` export): [This
260
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
261
- guide to deploy the .tflite model in an Android application.
262
-
263
-
264
- - QNN (`.so` export ): This [sample
265
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
266
- provides instructions on how to use the `.so` shared library in an Android application.
267
-
268
-
269
- ## View on Qualcomm® AI Hub
270
- Get more details on DenseNet-121's performance across various devices [here](https://aihub.qualcomm.com/models/densenet121).
271
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
272
-
273
 
274
  ## License
275
  * The license for the original implementation of DenseNet-121 can be found
276
  [here](https://github.com/pytorch/vision/blob/main/LICENSE).
277
 
278
-
279
-
280
  ## References
281
  * [Densely Connected Convolutional Networks](https://arxiv.org/abs/1608.06993)
282
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py)
283
 
284
-
285
-
286
  ## Community
287
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
288
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
289
-
290
-
 
11
 
12
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/web-assets/model_demo.png)
13
 
14
+ # DenseNet-121: Optimized for Qualcomm Devices
 
 
15
 
16
  Densenet is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.
17
 
18
+ This is based on the implementation of DenseNet-121 found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py).
19
+ This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/densenet121) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
20
+
21
+ Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) to run these models on a hosted Qualcomm® device.
22
+
23
+ ## Getting Started
24
+ There are two ways to deploy this model on your device:
25
+
26
+ ### Option 1: Download Pre-Exported Models
27
+
28
+ Below are pre-exported model assets ready for deployment.
29
+
30
+ | Runtime | Precision | Chipset | SDK Versions | Download |
31
+ |---|---|---|---|---|
32
+ | ONNX | float | Universal | QAIRT 2.37, ONNX Runtime 1.23.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.46.1/densenet121-onnx-float.zip)
33
+ | QNN_DLC | float | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.46.1/densenet121-qnn_dlc-float.zip)
34
+ | QNN_DLC | w8a16 | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.46.1/densenet121-qnn_dlc-w8a16.zip)
35
+ | QNN_DLC | w8a8 | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.46.1/densenet121-qnn_dlc-w8a8.zip)
36
+ | TFLITE | float | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.46.1/densenet121-tflite-float.zip)
37
+ | TFLITE | w8a8 | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.46.1/densenet121-tflite-w8a8.zip)
38
+
39
+ For more device-specific assets and performance metrics, visit **[DenseNet-121 on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/densenet121)**.
40
+
41
+
42
+ ### Option 2: Export with Custom Configurations
43
+
44
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/densenet121) Python library to compile and export the model with your own:
45
+ - Custom weights (e.g., fine-tuned checkpoints)
46
+ - Custom input shapes
47
+ - Target device and runtime configurations
48
+
49
+ This option is ideal if you need to customize the model beyond the default configuration provided here.
50
+
51
+ See our repository for [DenseNet-121 on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/densenet121) for usage instructions.
52
+
53
+ ## Model Details
54
+
55
+ **Model Type:** Model_use_case.image_classification
56
+
57
+ **Model Stats:**
58
+ - Model checkpoint: Imagenet
59
+ - Input resolution: 224x224
60
+ - Number of parameters: 7.99M
61
+ - Model size (float): 30.5 MB
62
+ - Model size (w8a16): 8.72 MB
63
+ - Model size (w8a8): 8.30 MB
64
+
65
+ ## Performance Summary
66
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
67
+ |---|---|---|---|---|---|---
68
+ | DenseNet-121 | ONNX | float | Snapdragon® X Elite | 1.741 ms | 15 - 15 MB | NPU
69
+ | DenseNet-121 | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 1.298 ms | 0 - 155 MB | NPU
70
+ | DenseNet-121 | ONNX | float | Qualcomm® QCS8550 (Proxy) | 1.788 ms | 0 - 37 MB | NPU
71
+ | DenseNet-121 | ONNX | float | Qualcomm® QCS9075 | 2.872 ms | 1 - 3 MB | NPU
72
+ | DenseNet-121 | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.957 ms | 0 - 110 MB | NPU
73
+ | DenseNet-121 | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.83 ms | 0 - 109 MB | NPU
74
+ | DenseNet-121 | QNN_DLC | float | Snapdragon® X Elite | 2.077 ms | 1 - 1 MB | NPU
75
+ | DenseNet-121 | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 1.24 ms | 0 - 79 MB | NPU
76
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 7.958 ms | 1 - 39 MB | NPU
77
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 1.835 ms | 1 - 2 MB | NPU
78
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® SA8775P | 2.786 ms | 1 - 43 MB | NPU
79
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS9075 | 2.754 ms | 1 - 3 MB | NPU
80
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 3.28 ms | 0 - 75 MB | NPU
81
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® SA7255P | 7.958 ms | 1 - 39 MB | NPU
82
+ | DenseNet-121 | QNN_DLC | float | Qualcomm® SA8295P | 3.147 ms | 0 - 36 MB | NPU
83
+ | DenseNet-121 | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.884 ms | 0 - 43 MB | NPU
84
+ | DenseNet-121 | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.71 ms | 1 - 44 MB | NPU
85
+ | DenseNet-121 | QNN_DLC | w8a16 | Snapdragon® X Elite | 3.433 ms | 0 - 0 MB | NPU
86
+ | DenseNet-121 | QNN_DLC | w8a16 | Snapdragon® 8 Gen 3 Mobile | 2.134 ms | 0 - 88 MB | NPU
87
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® QCS8275 (Proxy) | 6.217 ms | 0 - 62 MB | NPU
88
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® QCS8550 (Proxy) | 3.126 ms | 0 - 2 MB | NPU
89
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® SA8775P | 3.489 ms | 0 - 65 MB | NPU
90
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® QCS9075 | 3.39 ms | 0 - 2 MB | NPU
91
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® QCS8450 (Proxy) | 5.014 ms | 0 - 86 MB | NPU
92
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® SA7255P | 6.217 ms | 0 - 62 MB | NPU
93
+ | DenseNet-121 | QNN_DLC | w8a16 | Qualcomm® SA8295P | 5.535 ms | 0 - 61 MB | NPU
94
+ | DenseNet-121 | QNN_DLC | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 1.755 ms | 0 - 59 MB | NPU
95
+ | DenseNet-121 | QNN_DLC | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 1.218 ms | 0 - 72 MB | NPU
96
+ | DenseNet-121 | QNN_DLC | w8a8 | Snapdragon® X Elite | 2.663 ms | 0 - 0 MB | NPU
97
+ | DenseNet-121 | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.717 ms | 0 - 81 MB | NPU
98
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 4.99 ms | 0 - 58 MB | NPU
99
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 2.394 ms | 0 - 2 MB | NPU
100
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® SA8775P | 2.736 ms | 0 - 60 MB | NPU
101
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 2.558 ms | 2 - 4 MB | NPU
102
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 2.942 ms | 0 - 77 MB | NPU
103
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® SA7255P | 4.99 ms | 0 - 58 MB | NPU
104
+ | DenseNet-121 | QNN_DLC | w8a8 | Qualcomm® SA8295P | 3.519 ms | 0 - 56 MB | NPU
105
+ | DenseNet-121 | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 1.038 ms | 0 - 59 MB | NPU
106
+ | DenseNet-121 | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.925 ms | 0 - 64 MB | NPU
107
+ | DenseNet-121 | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 1.244 ms | 36 - 132 MB | NPU
108
+ | DenseNet-121 | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 7.977 ms | 0 - 56 MB | NPU
109
+ | DenseNet-121 | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 1.807 ms | 0 - 2 MB | NPU
110
+ | DenseNet-121 | TFLITE | float | Qualcomm® SA8775P | 2.762 ms | 0 - 58 MB | NPU
111
+ | DenseNet-121 | TFLITE | float | Qualcomm® QCS9075 | 2.805 ms | 0 - 18 MB | NPU
112
+ | DenseNet-121 | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 3.325 ms | 0 - 97 MB | NPU
113
+ | DenseNet-121 | TFLITE | float | Qualcomm® SA7255P | 7.977 ms | 0 - 56 MB | NPU
114
+ | DenseNet-121 | TFLITE | float | Qualcomm® SA8295P | 3.163 ms | 0 - 52 MB | NPU
115
+ | DenseNet-121 | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.887 ms | 0 - 53 MB | NPU
116
+ | DenseNet-121 | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.712 ms | 0 - 59 MB | NPU
117
+ | DenseNet-121 | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.611 ms | 0 - 86 MB | NPU
118
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® QCS6490 | 63.536 ms | 6 - 34 MB | NPU
119
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 4.674 ms | 0 - 60 MB | NPU
120
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 2.228 ms | 0 - 3 MB | NPU
121
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® SA8775P | 2.621 ms | 0 - 62 MB | NPU
122
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® QCS9075 | 2.419 ms | 0 - 11 MB | NPU
123
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 2.635 ms | 0 - 80 MB | NPU
124
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® SA7255P | 4.674 ms | 0 - 60 MB | NPU
125
+ | DenseNet-121 | TFLITE | w8a8 | Qualcomm® SA8295P | 3.352 ms | 0 - 57 MB | NPU
126
+ | DenseNet-121 | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 1.008 ms | 0 - 63 MB | NPU
127
+ | DenseNet-121 | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 27.248 ms | 6 - 171 MB | NPU
128
+ | DenseNet-121 | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.875 ms | 0 - 66 MB | NPU
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  ## License
131
  * The license for the original implementation of DenseNet-121 can be found
132
  [here](https://github.com/pytorch/vision/blob/main/LICENSE).
133
 
 
 
134
  ## References
135
  * [Densely Connected Convolutional Networks](https://arxiv.org/abs/1608.06993)
136
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py)
137
 
 
 
138
  ## Community
139
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
140
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
 
tool-versions.yaml DELETED
@@ -1,3 +0,0 @@
1
- tool_versions:
2
- qnn_dlc:
3
- qairt: 2.41.0.251128145156_191518