| --- |
| library_name: pytorch |
| license: other |
| tags: |
| - backbone |
| - bu_auto |
| - android |
| pipeline_tag: image-classification |
|
|
| --- |
| |
|  |
|
|
| # DenseNet-121: Optimized for Qualcomm Devices |
|
|
| 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. |
|
|
| This is based on the implementation of DenseNet-121 found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py). |
| 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/densenet121) 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.3 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.51.0/densenet121-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/densenet121/releases/v0.51.0/densenet121-qnn_dlc-float.zip) |
| | QNN_DLC | w8a8_mixed_int16 | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.51.0/densenet121-qnn_dlc-w8a8_mixed_int16.zip) |
| | TFLITE | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/densenet121/releases/v0.51.0/densenet121-tflite-float.zip) |
|
|
| For more device-specific assets and performance metrics, visit **[DenseNet-121 on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/densenet121)**. |
|
|
|
|
| ### 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/densenet121) 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 [DenseNet-121 on GitHub](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/densenet121) for usage instructions. |
|
|
| ## Model Details |
|
|
| **Model Type:** Model_use_case.image_classification |
| |
| **Model Stats:** |
| - Model checkpoint: Imagenet |
| - Input resolution: 224x224 |
| - Number of parameters: 7.99M |
| - Model size (float): 30.5 MB |
| - Model size (w8a16): 8.72 MB |
| - Model size (w8a8): 8.30 MB |
| |
| ## Performance Summary |
| | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |
| |---|---|---|---|---|---|--- |
| | DenseNet-121 | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.675 ms | 0 - 46 MB | NPU |
| | DenseNet-121 | ONNX | float | Snapdragon® X2 Elite | 0.741 ms | 16 - 16 MB | NPU |
| | DenseNet-121 | ONNX | float | Snapdragon® X Elite | 1.744 ms | 15 - 15 MB | NPU |
| | DenseNet-121 | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 1.077 ms | 0 - 88 MB | NPU |
| | DenseNet-121 | ONNX | float | Qualcomm® QCS8550 (Proxy) | 1.519 ms | 0 - 17 MB | NPU |
| | DenseNet-121 | ONNX | float | Qualcomm® QCS9075 | 2.61 ms | 1 - 3 MB | NPU |
| | DenseNet-121 | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.787 ms | 0 - 46 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.722 ms | 1 - 42 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Snapdragon® X2 Elite | 0.955 ms | 1 - 1 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Snapdragon® X Elite | 2.038 ms | 1 - 1 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 1.212 ms | 0 - 76 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 7.883 ms | 1 - 38 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 1.816 ms | 1 - 2 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® SA8775P | 2.683 ms | 1 - 40 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS9075 | 2.782 ms | 3 - 5 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 3.294 ms | 0 - 75 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® SA7255P | 7.883 ms | 1 - 38 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Qualcomm® SA8295P | 3.081 ms | 0 - 35 MB | NPU |
| | DenseNet-121 | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.881 ms | 0 - 38 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Snapdragon® 8 Elite Gen 5 Mobile | 1.162 ms | 0 - 69 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Snapdragon® X2 Elite | 1.493 ms | 0 - 0 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Snapdragon® X Elite | 3.218 ms | 0 - 0 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Snapdragon® 8 Gen 3 Mobile | 2.089 ms | 0 - 84 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Qualcomm® QCS8275 (Proxy) | 5.945 ms | 0 - 61 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Qualcomm® QCS8550 (Proxy) | 2.965 ms | 0 - 29 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Qualcomm® SA8775P | 3.271 ms | 0 - 63 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Qualcomm® QCS9075 | 3.255 ms | 0 - 2 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Qualcomm® SA7255P | 5.945 ms | 0 - 61 MB | NPU |
| | DenseNet-121 | QNN_DLC | w8a8_mixed_int16 | Snapdragon® 8 Elite For Galaxy Mobile | 1.555 ms | 0 - 61 MB | NPU |
| | DenseNet-121 | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 0.721 ms | 0 - 56 MB | NPU |
| | DenseNet-121 | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 1.208 ms | 0 - 89 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 7.939 ms | 0 - 52 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 1.828 ms | 0 - 3 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® SA8775P | 2.713 ms | 0 - 56 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® QCS9075 | 2.81 ms | 0 - 18 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 3.304 ms | 0 - 87 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® SA7255P | 7.939 ms | 0 - 52 MB | NPU |
| | DenseNet-121 | TFLITE | float | Qualcomm® SA8295P | 3.062 ms | 0 - 49 MB | NPU |
| | DenseNet-121 | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 0.881 ms | 0 - 50 MB | NPU |
| |
| ## License |
| * The license for the original implementation of DenseNet-121 can be found |
| [here](https://github.com/pytorch/vision/blob/main/LICENSE). |
| |
| ## References |
| * [Densely Connected Convolutional Networks](https://arxiv.org/abs/1608.06993) |
| * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py) |
| |
| ## 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). |
| |