qaihm-bot commited on
Commit
bcbf6b9
·
verified ·
1 Parent(s): 971899d

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

Files changed (3) hide show
  1. NASNet_float.tflite +0 -3
  2. README.md +38 -195
  3. tool-versions.yaml +0 -4
NASNet_float.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4f08eb62d0719f956f351e5bdf9564058c06e9bbc91a76094eedaf9490801271
3
- size 354843828
 
 
 
 
README.md CHANGED
@@ -10,228 +10,71 @@ pipeline_tag: image-classification
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/nasnet/web-assets/model_demo.png)
12
 
13
- # NASNet: Optimized for Mobile Deployment
14
- ## Imagenet classifier and general purpose backbone
15
-
16
 
17
  NASNet is a vision transformer model that can classify images from the Imagenet dataset.
18
 
19
- This model is an implementation of NASNet found [here](https://github.com/huggingface/pytorch-image-models/tree/main).
20
-
21
-
22
- This repository provides scripts to run NASNet on Qualcomm® devices.
23
- More details on model performance across various devices, can be found
24
- [here](https://aihub.qualcomm.com/models/nasnet).
25
-
26
-
27
-
28
- ### Model Details
29
-
30
- - **Model Type:** Model_use_case.image_classification
31
- - **Model Stats:**
32
- - Model checkpoint: nasnetalarge.tf_in1k
33
- - Input resolution: 224x224
34
- - GMACs: 5.9
35
- - Activations (M): 19.4
36
- - Number of parameters: 88.7M
37
- - Model size (float): 338 MB
38
-
39
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
40
- |---|---|---|---|---|---|---|---|---|
41
- | NASNet | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 37.007 ms | 0 - 465 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
42
- | NASNet | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 22.82 ms | 0 - 596 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
43
- | NASNet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 7.66 ms | 0 - 4 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
44
- | NASNet | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 10.737 ms | 0 - 467 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
45
- | NASNet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 5.658 ms | 0 - 608 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
46
- | NASNet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 4.794 ms | 2 - 454 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
47
- | NASNet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 4.155 ms | 0 - 453 MB | NPU | [NASNet.tflite](https://huggingface.co/qualcomm/NASNet/blob/main/NASNet.tflite) |
48
-
49
-
50
-
51
-
52
- ## Installation
53
-
54
-
55
- Install the package via pip:
56
- ```bash
57
- # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
58
- pip install "qai-hub-models[nasnet]"
59
- ```
60
-
61
-
62
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
63
-
64
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
65
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
66
-
67
- With this API token, you can configure your client to run models on the cloud
68
- hosted devices.
69
- ```bash
70
- qai-hub configure --api_token API_TOKEN
71
- ```
72
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
73
-
74
-
75
-
76
- ## Demo off target
77
-
78
- The package contains a simple end-to-end demo that downloads pre-trained
79
- weights and runs this model on a sample input.
80
-
81
- ```bash
82
- python -m qai_hub_models.models.nasnet.demo
83
- ```
84
-
85
- The above demo runs a reference implementation of pre-processing, model
86
- inference, and post processing.
87
-
88
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
89
- environment, please add the following to your cell (instead of the above).
90
- ```
91
- %run -m qai_hub_models.models.nasnet.demo
92
- ```
93
-
94
-
95
- ### Run model on a cloud-hosted device
96
-
97
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
98
- device. This script does the following:
99
- * Performance check on-device on a cloud-hosted device
100
- * Downloads compiled assets that can be deployed on-device for Android.
101
- * Accuracy check between PyTorch and on-device outputs.
102
-
103
- ```bash
104
- python -m qai_hub_models.models.nasnet.export
105
- ```
106
 
 
107
 
 
 
108
 
109
- ## How does this work?
110
 
111
- This [export script](https://aihub.qualcomm.com/models/nasnet/qai_hub_models/models/NASNet/export.py)
112
- leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
113
- on-device. Lets go through each step below in detail:
114
 
115
- Step 1: **Compile model for on-device deployment**
 
 
116
 
117
- To compile a PyTorch model for on-device deployment, we first trace the model
118
- in memory using the `jit.trace` and then call the `submit_compile_job` API.
119
 
120
- ```python
121
- import torch
122
 
123
- import qai_hub as hub
124
- from qai_hub_models.models.nasnet import Model
125
 
126
- # Load the model
127
- torch_model = Model.from_pretrained()
 
 
128
 
129
- # Device
130
- device = hub.Device("Samsung Galaxy S25")
131
 
132
- # Trace model
133
- input_shape = torch_model.get_input_spec()
134
- sample_inputs = torch_model.sample_inputs()
135
 
136
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
137
 
138
- # Compile model on a specific device
139
- compile_job = hub.submit_compile_job(
140
- model=pt_model,
141
- device=device,
142
- input_specs=torch_model.get_input_spec(),
143
- )
144
 
145
- # Get target model to run on-device
146
- target_model = compile_job.get_target_model()
147
-
148
- ```
149
-
150
-
151
- Step 2: **Performance profiling on cloud-hosted device**
152
-
153
- After compiling models from step 1. Models can be profiled model on-device using the
154
- `target_model`. Note that this scripts runs the model on a device automatically
155
- provisioned in the cloud. Once the job is submitted, you can navigate to a
156
- provided job URL to view a variety of on-device performance metrics.
157
- ```python
158
- profile_job = hub.submit_profile_job(
159
- model=target_model,
160
- device=device,
161
- )
162
-
163
- ```
164
-
165
- Step 3: **Verify on-device accuracy**
166
-
167
- To verify the accuracy of the model on-device, you can run on-device inference
168
- on sample input data on the same cloud hosted device.
169
- ```python
170
- input_data = torch_model.sample_inputs()
171
- inference_job = hub.submit_inference_job(
172
- model=target_model,
173
- device=device,
174
- inputs=input_data,
175
- )
176
- on_device_output = inference_job.download_output_data()
177
-
178
- ```
179
- With the output of the model, you can compute like PSNR, relative errors or
180
- spot check the output with expected output.
181
-
182
- **Note**: This on-device profiling and inference requires access to Qualcomm®
183
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
184
-
185
-
186
-
187
- ## Run demo on a cloud-hosted device
188
-
189
- You can also run the demo on-device.
190
-
191
- ```bash
192
- python -m qai_hub_models.models.nasnet.demo --eval-mode on-device
193
- ```
194
-
195
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
196
- environment, please add the following to your cell (instead of the above).
197
- ```
198
- %run -m qai_hub_models.models.nasnet.demo -- --eval-mode on-device
199
- ```
200
-
201
-
202
- ## Deploying compiled model to Android
203
-
204
-
205
- The models can be deployed using multiple runtimes:
206
- - TensorFlow Lite (`.tflite` export): [This
207
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
208
- guide to deploy the .tflite model in an Android application.
209
-
210
-
211
- - QNN (`.so` export ): This [sample
212
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
213
- provides instructions on how to use the `.so` shared library in an Android application.
214
-
215
-
216
- ## View on Qualcomm® AI Hub
217
- Get more details on NASNet's performance across various devices [here](https://aihub.qualcomm.com/models/nasnet).
218
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
219
 
 
 
 
 
 
 
 
 
 
 
220
 
221
  ## License
222
  * The license for the original implementation of NASNet can be found
223
  [here](https://github.com/huggingface/pytorch-image-models?tab=Apache-2.0-1-ov-file).
224
 
225
-
226
-
227
  ## References
228
  * [Learning Transferable Architectures for Scalable Image Recognition](https://arxiv.org/abs/1707.07012)
229
  * [Source Model Implementation](https://github.com/huggingface/pytorch-image-models/tree/main)
230
 
231
-
232
-
233
  ## Community
234
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
235
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
236
-
237
-
 
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/nasnet/web-assets/model_demo.png)
12
 
13
+ # NASNet: Optimized for Qualcomm Devices
 
 
14
 
15
  NASNet is a vision transformer model that can classify images from the Imagenet dataset.
16
 
17
+ This is based on the implementation of NASNet found [here](https://github.com/huggingface/pytorch-image-models/tree/main).
18
+ 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/nasnet) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ 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.
21
 
22
+ ## Getting Started
23
+ There are two ways to deploy this model on your device:
24
 
25
+ ### Option 1: Download Pre-Exported Models
26
 
27
+ Below are pre-exported model assets ready for deployment.
 
 
28
 
29
+ | Runtime | Precision | Chipset | SDK Versions | Download |
30
+ |---|---|---|---|---|
31
+ | 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/nasnet/releases/v0.46.1/nasnet-tflite-float.zip)
32
 
33
+ For more device-specific assets and performance metrics, visit **[NASNet on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/nasnet)**.
 
34
 
 
 
35
 
36
+ ### Option 2: Export with Custom Configurations
 
37
 
38
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/nasnet) Python library to compile and export the model with your own:
39
+ - Custom weights (e.g., fine-tuned checkpoints)
40
+ - Custom input shapes
41
+ - Target device and runtime configurations
42
 
43
+ This option is ideal if you need to customize the model beyond the default configuration provided here.
 
44
 
45
+ See our repository for [NASNet on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/nasnet) for usage instructions.
 
 
46
 
47
+ ## Model Details
48
 
49
+ **Model Type:** Model_use_case.image_classification
 
 
 
 
 
50
 
51
+ **Model Stats:**
52
+ - Model checkpoint: nasnetalarge.tf_in1k
53
+ - Input resolution: 224x224
54
+ - GMACs: 5.9
55
+ - Activations (M): 19.4
56
+ - Number of parameters: 88.7M
57
+ - Model size (float): 338 MB
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
+ ## Performance Summary
60
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
61
+ |---|---|---|---|---|---|---
62
+ | NASNet | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 5.589 ms | 0 - 671 MB | NPU
63
+ | NASNet | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 36.767 ms | 0 - 526 MB | NPU
64
+ | NASNet | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 7.663 ms | 0 - 3 MB | NPU
65
+ | NASNet | TFLITE | float | Qualcomm® QCS9075 | 10.262 ms | 0 - 191 MB | NPU
66
+ | NASNet | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 23.477 ms | 0 - 648 MB | NPU
67
+ | NASNet | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 4.596 ms | 0 - 524 MB | NPU
68
+ | NASNet | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 4.11 ms | 0 - 529 MB | NPU
69
 
70
  ## License
71
  * The license for the original implementation of NASNet can be found
72
  [here](https://github.com/huggingface/pytorch-image-models?tab=Apache-2.0-1-ov-file).
73
 
 
 
74
  ## References
75
  * [Learning Transferable Architectures for Scalable Image Recognition](https://arxiv.org/abs/1707.07012)
76
  * [Source Model Implementation](https://github.com/huggingface/pytorch-image-models/tree/main)
77
 
 
 
78
  ## Community
79
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
80
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
 
tool-versions.yaml DELETED
@@ -1,4 +0,0 @@
1
- tool_versions:
2
- tflite:
3
- qairt: 2.41.0.251128145156_191518
4
- tflite: 2.17.0