File size: 12,158 Bytes
9c276df
 
18a7a5b
9c276df
9741599
9c276df
bd53dee
9c276df
 
 
 
 
e18760c
9c276df
 
 
e18760c
5dd4efd
e18760c
 
 
 
 
 
 
 
 
 
 
 
96de3c7
 
 
 
 
 
 
e18760c
 
 
 
 
 
5dd4efd
e18760c
 
 
 
 
 
5dd4efd
e18760c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96de3c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6fc799b
96de3c7
 
6fc799b
96de3c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6fc799b
96de3c7
9c276df
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
library_name: pytorch
license: other
tags:
- bu_auto
- android
pipeline_tag: image-classification

---

![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/web-assets/model_demo.png)

# LeViT: Optimized for Qualcomm Devices

LeViT is a vision transformer model that can classify images from the Imagenet dataset.

This is based on the implementation of LeViT found [here](https://github.com/facebookresearch/LeViT).
This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/levit) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).

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.

## Getting Started
There are two ways to deploy this model on your device:

### Option 1: Download Pre-Exported Models

Below are pre-exported model assets ready for deployment.

| Runtime | Precision | Chipset | SDK Versions | Download |
|---|---|---|---|---|
| ONNX | float | Universal | QAIRT 2.45, ONNX Runtime 1.25.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-onnx-float.zip)
| ONNX | w8a16 | Universal | QAIRT 2.45, ONNX Runtime 1.25.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-onnx-w8a16.zip)
| ONNX | w8a16_mixed_int16 | Universal | QAIRT 2.45, ONNX Runtime 1.25.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-onnx-w8a16_mixed_int16.zip)
| QNN_DLC | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-qnn_dlc-float.zip)
| QNN_DLC | w8a16 | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-qnn_dlc-w8a16.zip)
| QNN_DLC | w8a16_mixed_int16 | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-qnn_dlc-w8a16_mixed_int16.zip)
| TFLITE | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.56.0/levit-tflite-float.zip)

For more device-specific assets and performance metrics, visit **[LeViT on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/levit)**.


### Option 2: Export with Custom Configurations

Use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/levit) Python library to compile and export the model with your own:
- Custom weights (e.g., fine-tuned checkpoints)
- Custom input shapes
- Target device and runtime configurations

This option is ideal if you need to customize the model beyond the default configuration provided here.

See our repository for [LeViT on GitHub](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/levit) for usage instructions.

## Model Details

**Model Type:** Model_use_case.image_classification

**Model Stats:**
- Model checkpoint: LeViT-128S
- Input resolution: 224x224
- Number of parameters: 7.82M
- Model size (float): 29.9 MB
- Model size (w8a16): 8.83 MB

## Performance Summary
| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
|---|---|---|---|---|---|---
| LeViT | ONNX | float | Snapdragon® X2 Elite | 0.687 ms | 212 - 212 MB | NPU
| LeViT | ONNX | float | Snapdragon® X Elite | 1.318 ms | 181 - 181 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 0.866 ms | 1 - 74 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Gen 1 Mobile | 1.589 ms | 1 - 74 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS8550 (Proxy) | 1.278 ms | 0 - 35 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS8450 | 1.589 ms | 1 - 74 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Elite Mobile | 0.704 ms | 0 - 57 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.651 ms | 1 - 52 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS9075 | 1.62 ms | 1 - 46 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS8750 | 0.704 ms | 0 - 57 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS7181 | 1.318 ms | 181 - 181 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® X2 Elite | 0.486 ms | 212 - 212 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® X Elite | 1.057 ms | 149 - 149 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 0.696 ms | 0 - 77 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® 8 Gen 1 Mobile | 1.258 ms | 0 - 75 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS6490 | 2.878 ms | 0 - 45 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 1.025 ms | 0 - 13 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS8450 | 1.258 ms | 0 - 75 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 0.474 ms | 0 - 53 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® 8 Elite Mobile | 0.52 ms | 0 - 54 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS9075 | 1.231 ms | 0 - 45 MB | NPU
| LeViT | ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 1.013 ms | 0 - 52 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCM6690 | 4.323 ms | 0 - 175 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS7790 | 1.013 ms | 0 - 52 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS8750 | 0.52 ms | 0 - 54 MB | NPU
| LeViT | ONNX | w8a16 | Qualcomm® QCS7181 | 1.057 ms | 149 - 149 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Snapdragon® X2 Elite | 0.507 ms | 213 - 213 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Snapdragon® X Elite | 1.12 ms | 149 - 149 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Snapdragon® 8 Gen 3 Mobile | 0.732 ms | 0 - 77 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Qualcomm® QCS8550 (Proxy) | 1.054 ms | 0 - 18 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Qualcomm® QCM6690 | 4.775 ms | 0 - 179 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Snapdragon® 8 Elite Gen 5 Mobile | 0.498 ms | 0 - 59 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Qualcomm® QCS9075 | 1.313 ms | 0 - 45 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Snapdragon® 8 Elite Mobile | 0.545 ms | 0 - 59 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Snapdragon® 7 Gen 4 Mobile | 1.062 ms | 0 - 55 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Qualcomm® QCS7790 | 1.062 ms | 0 - 55 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Qualcomm® QCS8750 | 0.545 ms | 0 - 59 MB | NPU
| LeViT | ONNX | w8a16_mixed_int16 | Qualcomm® QCS7181 | 1.12 ms | 149 - 149 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® X2 Elite | 0.974 ms | 1 - 1 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® X Elite | 1.835 ms | 1 - 1 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 1.077 ms | 0 - 86 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 2.372 ms | 1 - 84 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8275 | 3.801 ms | 1 - 58 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 1.599 ms | 1 - 2 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8450 | 2.372 ms | 1 - 84 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Elite Mobile | 0.831 ms | 0 - 58 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® SA7255P | 3.801 ms | 1 - 58 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® SA8295P | 2.362 ms | 0 - 52 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.722 ms | 1 - 62 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS9075 | 1.882 ms | 3 - 5 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8750 | 0.831 ms | 0 - 58 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS7181 | 1.835 ms | 1 - 1 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® X2 Elite | 0.807 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® X Elite | 1.61 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 8 Gen 3 Mobile | 0.939 ms | 0 - 71 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS8275 | 2.783 ms | 0 - 50 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS8550 (Proxy) | 1.389 ms | 0 - 14 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 0.57 ms | 0 - 52 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 8 Elite Mobile | 0.663 ms | 0 - 47 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS9075 | 1.716 ms | 0 - 2 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 7 Gen 4 Mobile | 1.416 ms | 0 - 50 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCM6690 | 5.192 ms | 0 - 174 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® SA7255P | 2.783 ms | 0 - 50 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS7790 | 1.416 ms | 0 - 50 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS8750 | 0.663 ms | 0 - 47 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS7181 | 1.61 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® X2 Elite | 0.812 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® X Elite | 1.654 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 8 Gen 3 Mobile | 0.979 ms | 0 - 72 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS8275 | 2.896 ms | 0 - 51 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS8550 (Proxy) | 1.468 ms | 0 - 30 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCM6690 | 5.957 ms | 0 - 178 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 8 Elite Gen 5 Mobile | 0.613 ms | 0 - 53 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS9075 | 1.7 ms | 0 - 2 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 8 Elite Mobile | 0.698 ms | 0 - 54 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 7 Gen 4 Mobile | 1.436 ms | 0 - 51 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® SA7255P | 2.896 ms | 0 - 51 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS7790 | 1.436 ms | 0 - 51 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS8750 | 0.698 ms | 0 - 54 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS7181 | 1.654 ms | 0 - 0 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 1.027 ms | 19 - 111 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Gen 1 Mobile | 2.361 ms | 0 - 84 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS8275 | 4.011 ms | 0 - 62 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 1.514 ms | 0 - 3 MB | NPU
| LeViT | TFLITE | float | Qualcomm® SA8775P | 7.832 ms | 1 - 7 MB | CPU
| LeViT | TFLITE | float | Qualcomm® SA8650P | 7.832 ms | 1 - 7 MB | CPU
| LeViT | TFLITE | float | Qualcomm® SA8255P | 7.832 ms | 1 - 7 MB | CPU
| LeViT | TFLITE | float | Qualcomm® QCS8450 | 2.361 ms | 0 - 84 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Elite Mobile | 0.783 ms | 0 - 67 MB | NPU
| LeViT | TFLITE | float | Qualcomm® SA7255P | 4.011 ms | 0 - 62 MB | NPU
| LeViT | TFLITE | float | Qualcomm® SA8295P | 2.36 ms | 0 - 53 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.661 ms | 0 - 61 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS9075 | 1.857 ms | 0 - 19 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS8750 | 0.783 ms | 0 - 67 MB | NPU

## License
* The license for the original implementation of LeViT can be found
  [here](https://github.com/facebookresearch/LeViT?tab=Apache-2.0-1-ov-file).

## References
* [LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference](https://arxiv.org/abs/2104.01136)
* [Source Model Implementation](https://github.com/facebookresearch/LeViT)

## Community
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).