File size: 8,130 Bytes
9c276df
 
18a7a5b
9c276df
9741599
9c276df
bd53dee
9c276df
 
 
 
 
e18760c
9c276df
 
 
e18760c
25be77e
e18760c
 
 
 
 
 
 
 
 
 
 
 
25be77e
 
 
 
 
 
 
e18760c
 
 
 
 
 
25be77e
e18760c
 
 
 
 
 
25be77e
e18760c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25be77e
5f48a93
 
 
 
 
 
25be77e
5f48a93
 
 
 
 
 
 
 
25be77e
5f48a93
 
 
 
 
 
 
 
 
25be77e
5f48a93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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/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.42, ONNX Runtime 1.24.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.0/levit-onnx-float.zip)
| ONNX | w8a16 | Universal | QAIRT 2.42, ONNX Runtime 1.24.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.0/levit-onnx-w8a16.zip)
| ONNX | w8a16_mixed_int16 | Universal | QAIRT 2.42, ONNX Runtime 1.24.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.0/levit-onnx-w8a16_mixed_int16.zip)
| QNN_DLC | float | Universal | QAIRT 2.43 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.0/levit-qnn_dlc-float.zip)
| QNN_DLC | w8a16 | Universal | QAIRT 2.43 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.0/levit-qnn_dlc-w8a16.zip)
| QNN_DLC | w8a16_mixed_int16 | Universal | QAIRT 2.43 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.0/levit-qnn_dlc-w8a16_mixed_int16.zip)
| TFLITE | float | Universal | QAIRT 2.43, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/levit/releases/v0.48.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/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/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.69 ms | 16 - 16 MB | NPU
| LeViT | ONNX | float | Snapdragon® X Elite | 1.462 ms | 16 - 16 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 0.877 ms | 0 - 101 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS8550 (Proxy) | 1.252 ms | 0 - 22 MB | NPU
| LeViT | ONNX | float | Qualcomm® QCS9075 | 1.65 ms | 1 - 3 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.704 ms | 0 - 67 MB | NPU
| LeViT | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.653 ms | 1 - 76 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® X2 Elite | 1.009 ms | 1 - 1 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® X Elite | 1.824 ms | 1 - 1 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 1.084 ms | 0 - 83 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 3.833 ms | 1 - 58 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 1.595 ms | 1 - 2 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS9075 | 1.882 ms | 3 - 5 MB | NPU
| LeViT | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 2.374 ms | 0 - 80 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.847 ms | 0 - 62 MB | NPU
| LeViT | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.75 ms | 1 - 62 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® X2 Elite | 0.865 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® X Elite | 1.673 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 8 Gen 3 Mobile | 1.016 ms | 0 - 61 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS8275 (Proxy) | 2.98 ms | 0 - 40 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS8550 (Proxy) | 1.452 ms | 0 - 26 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCS9075 | 1.727 ms | 0 - 2 MB | NPU
| LeViT | QNN_DLC | w8a16 | Qualcomm® QCM6690 | 5.836 ms | 0 - 164 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 0.747 ms | 0 - 41 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 7 Gen 4 Mobile | 1.47 ms | 0 - 39 MB | NPU
| LeViT | QNN_DLC | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 0.639 ms | 0 - 42 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® X2 Elite | 0.903 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® X Elite | 1.7 ms | 0 - 0 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 8 Gen 3 Mobile | 1.046 ms | 0 - 63 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS8275 (Proxy) | 3.027 ms | 0 - 40 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS8550 (Proxy) | 1.485 ms | 0 - 2 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCS9075 | 1.738 ms | 0 - 2 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Qualcomm® QCM6690 | 6.101 ms | 0 - 166 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 8 Elite For Galaxy Mobile | 0.753 ms | 0 - 42 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 7 Gen 4 Mobile | 1.507 ms | 0 - 39 MB | NPU
| LeViT | QNN_DLC | w8a16_mixed_int16 | Snapdragon® 8 Elite Gen 5 Mobile | 0.649 ms | 0 - 41 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 1.058 ms | 0 - 96 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 4.059 ms | 0 - 66 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 1.556 ms | 0 - 2 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS9075 | 1.869 ms | 0 - 19 MB | NPU
| LeViT | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 2.356 ms | 0 - 83 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.807 ms | 0 - 66 MB | NPU
| LeViT | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.679 ms | 0 - 72 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).