| --- |
| library_name: pytorch |
| license: other |
| tags: |
| - foundation |
| - android |
| pipeline_tag: image-classification |
|
|
| --- |
| |
|  |
|
|
| # OpenAI-Clip: Optimized for Qualcomm Devices |
|
|
| Contrastive Language-Image Pre-Training (CLIP) uses a ViT like transformer to get visual features and a causal language model to get the text features. Both the text and visual features can then be used for a variety of zero-shot learning tasks. |
|
|
| This is based on the implementation of OpenAI-Clip found [here](https://github.com/openai/CLIP/). |
| 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/v0.59.0/src/qai_hub_models/models/openai_clip) 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.27.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/openai_clip/releases/v0.59.0/openai_clip-onnx-float.zip) |
| | QNN_DLC | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/openai_clip/releases/v0.59.0/openai_clip-qnn_dlc-float.zip) |
| | TFLITE | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/openai_clip/releases/v0.59.0/openai_clip-tflite-float.zip) |
| |
| For more device-specific assets and performance metrics, visit **[OpenAI-Clip on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/openai_clip)**. |
| |
| |
| ### Option 2: Export with Custom Configurations |
| |
| Use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/v0.59.0/src/qai_hub_models/models/openai_clip) 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 [OpenAI-Clip on GitHub](https://github.com/qualcomm/ai-hub-models/blob/v0.59.0/src/qai_hub_models/models/openai_clip) for usage instructions. |
| |
| ## Model Details |
| |
| **Model Type:** Model_use_case.image_classification |
|
|
| **Model Stats:** |
| - Model checkpoint: ViT-B/16 |
| - Image input resolution: 224x224 |
| - Text context length: 77 |
| - Number of parameters: 150M |
| - Model size (float): 571 MB |
|
|
| ## Performance Summary |
| | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |
| |---|---|---|---|---|---|--- |
| | OpenAI-Clip | ONNX | float | Snapdragon® X2 Elite | 10.399 ms | 2 - 2 MB | NPU |
| | OpenAI-Clip | ONNX | float | Snapdragon® X Elite | 22.242 ms | 294 - 294 MB | NPU |
| | OpenAI-Clip | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 15.078 ms | 1 - 1107 MB | NPU |
| | OpenAI-Clip | ONNX | float | Snapdragon® 8 Gen 1 Mobile | 26.71 ms | 1 - 685 MB | NPU |
| | OpenAI-Clip | ONNX | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 21.487 ms | 0 - 323 MB | NPU |
| | OpenAI-Clip | ONNX | float | Qualcomm® QCS8450 | 26.71 ms | 1 - 685 MB | NPU |
| | OpenAI-Clip | ONNX | float | Qualcomm® Dragonwing™ IQ-9075 | 23.85 ms | 0 - 4 MB | NPU |
| | OpenAI-Clip | ONNX | float | Qualcomm® Dragonwing™ IQ-X7181 | 22.242 ms | 294 - 294 MB | NPU |
| | OpenAI-Clip | ONNX | float | Qualcomm® Dragonwing™ Q-8750 | 11.707 ms | 0 - 869 MB | NPU |
| | OpenAI-Clip | ONNX | float | Snapdragon® 8 Elite Mobile | 11.707 ms | 0 - 869 MB | NPU |
| | OpenAI-Clip | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 9.263 ms | 1 - 584 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Snapdragon® X2 Elite | 9.634 ms | 1 - 1 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Snapdragon® X Elite | 21.473 ms | 1 - 1 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 14.546 ms | 0 - 771 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 24.207 ms | 0 - 609 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® Dragonwing™ QCS8275 | 59.337 ms | 1 - 570 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 20.49 ms | 1 - 3 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® SA8775P | 23.042 ms | 1 - 568 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® SA8650P | 23.042 ms | 1 - 568 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® SA8255P | 23.042 ms | 1 - 568 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® QCS8450 | 24.207 ms | 0 - 609 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-9075 | 23.759 ms | 1 - 3 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-X7181 | 21.473 ms | 1 - 1 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® Dragonwing™ Q-8750 | 11.301 ms | 1 - 586 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® SA7255P | 59.337 ms | 1 - 570 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Qualcomm® SA8295P | 24.606 ms | 1 - 514 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Snapdragon® 8 Elite Mobile | 11.301 ms | 1 - 586 MB | NPU |
| | OpenAI-Clip | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 8.754 ms | 0 - 420 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 14.321 ms | 0 - 778 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Snapdragon® 8 Gen 1 Mobile | 24.195 ms | 0 - 618 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® Dragonwing™ QCS8275 | 59.391 ms | 0 - 565 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 19.987 ms | 0 - 3 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® SA8775P | 23.117 ms | 0 - 566 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® SA8650P | 23.117 ms | 0 - 566 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® SA8255P | 23.117 ms | 0 - 566 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® QCS8450 | 24.195 ms | 0 - 618 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® Dragonwing™ IQ-9075 | 23.088 ms | 0 - 296 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® Dragonwing™ Q-8750 | 11.502 ms | 0 - 598 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® SA7255P | 59.391 ms | 0 - 565 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Qualcomm® SA8295P | 24.505 ms | 0 - 517 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Snapdragon® 8 Elite Mobile | 11.502 ms | 0 - 598 MB | NPU |
| | OpenAI-Clip | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 8.74 ms | 0 - 435 MB | NPU |
| |
| ## License |
| * The license for the original implementation of OpenAI-Clip can be found |
| [here](https://github.com/openai/CLIP/blob/main/LICENSE). |
| |
| ## References |
| * [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) |
| * [Source Model Implementation](https://github.com/openai/CLIP/) |
| |
| ## 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). |
| |