Image-to-Text
PyTorch
android

TrOCR: Optimized for Qualcomm Devices

End-to-end text recognition approach with pre-trained image transformer and text transformer models for both image understanding and wordpiece-level text generation.

This is based on the implementation of TrOCR found here. This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the Qualcomm® AI Hub Models library to export with custom configurations. More details on model performance across various devices, can be found here.

Qualcomm AI Hub Models uses Qualcomm AI Hub Workbench to compile, profile, and evaluate this model. Sign up 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.51, ONNX Runtime 1.30.0 Download
QNN_DLC float Universal QAIRT 2.51 Download
TFLITE float Universal QAIRT 2.51 Download

For more device-specific assets and performance metrics, visit TrOCR on Qualcomm® AI Hub.

Option 2: Export with Custom Configurations

Use the Qualcomm® AI Hub Models 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 TrOCR on GitHub for usage instructions.

Model Details

Model Type: Model_use_case.image_to_text

Model Stats:

  • Input resolution: 320x320
  • Model checkpoint: trocr-small-handwritten
  • Model size (decoder) (float): 146 MB
  • Model size (encoder) (float): 87.8 MB
  • Number of parameters (decoder): 38.3M
  • Number of parameters (encoder): 23.0M

Performance Summary

Model Runtime Precision Chipset Inference Time (ms) Peak Memory Range (MB) Primary Compute Unit
decoder ONNX float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 1.29 ms 2 - 181 MB NPU
decoder ONNX float Snapdragon® 8 Elite For Galaxy Mobile 1.252 ms 0 - 193 MB NPU
decoder ONNX float Snapdragon® X2 Elite 1.266 ms 7 - 7 MB NPU
decoder ONNX float Snapdragon® X Elite 2.008 ms 67 - 67 MB NPU
decoder ONNX float Snapdragon® 8 Gen 3 Mobile 1.479 ms 0 - 283 MB NPU
decoder ONNX float Snapdragon® 8 Gen 1 Mobile 2.356 ms 1 - 224 MB NPU
decoder ONNX float Qualcomm® Dragonwing™ IQ-8275 2.545 ms 7 - 18 MB NPU
decoder ONNX float Qualcomm® Dragonwing™ QCS8550 (Proxy) 2.084 ms 0 - 75 MB NPU
decoder ONNX float Qualcomm® QCS8450 2.356 ms 1 - 224 MB NPU
decoder ONNX float Qualcomm® Dragonwing™ IQ-9075 2.57 ms 7 - 17 MB NPU
decoder ONNX float Qualcomm® Dragonwing™ IQ-X7181 2.008 ms 67 - 67 MB NPU
decoder ONNX float Qualcomm® Dragonwing™ Q-8750 1.252 ms 0 - 193 MB NPU
decoder ONNX float Snapdragon® 8 Elite Extreme Gen 6 Mobile 1.244 ms 1 - 195 MB NPU
decoder ONNX float Snapdragon® 8 Elite Gen 6 Mobile 1.231 ms 0 - 109 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 1.266 ms 1 - 177 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite For Galaxy Mobile 1.235 ms 0 - 189 MB NPU
decoder QNN_DLC float Snapdragon® X2 Elite 1.687 ms 7 - 7 MB NPU
decoder QNN_DLC float Snapdragon® X Elite 2.241 ms 7 - 7 MB NPU
decoder QNN_DLC float Snapdragon® 8 Gen 3 Mobile 1.466 ms 0 - 280 MB NPU
decoder QNN_DLC float Snapdragon® 8 Gen 1 Mobile 2.268 ms 2 - 223 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ IQ-8275 2.431 ms 7 - 17 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ QCS8550 (Proxy) 1.982 ms 2 - 4 MB NPU
decoder QNN_DLC float Qualcomm® SA8775P 2.801 ms 1 - 105 MB NPU
decoder QNN_DLC float Qualcomm® SA8650P 2.801 ms 1 - 105 MB NPU
decoder QNN_DLC float Qualcomm® SA8255P 2.801 ms 1 - 105 MB NPU
decoder QNN_DLC float Qualcomm® QCS8450 2.268 ms 2 - 223 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ IQ-9075 2.371 ms 7 - 16 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ IQ-X7181 2.241 ms 7 - 7 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ Q-8750 1.235 ms 0 - 189 MB NPU
decoder QNN_DLC float Qualcomm® SA8295P 2.562 ms 6 - 53 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite Extreme Gen 6 Mobile 1.249 ms 1 - 191 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite Gen 6 Mobile 1.279 ms 1 - 106 MB NPU
decoder TFLITE float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 1.269 ms 0 - 173 MB NPU
decoder TFLITE float Snapdragon® 8 Elite For Galaxy Mobile 1.289 ms 0 - 192 MB NPU
decoder TFLITE float Snapdragon® 8 Gen 3 Mobile 1.437 ms 0 - 282 MB NPU
decoder TFLITE float Snapdragon® 8 Gen 1 Mobile 2.27 ms 0 - 224 MB NPU
decoder TFLITE float Qualcomm® Dragonwing™ IQ-8275 2.411 ms 0 - 84 MB NPU
decoder TFLITE float Qualcomm® Dragonwing™ QCS8550 (Proxy) 2.036 ms 0 - 2 MB NPU
decoder TFLITE float Qualcomm® SA8775P 2.772 ms 0 - 105 MB NPU
decoder TFLITE float Qualcomm® SA8650P 2.772 ms 0 - 105 MB NPU
decoder TFLITE float Qualcomm® SA8255P 2.772 ms 0 - 105 MB NPU
decoder TFLITE float Qualcomm® QCS8450 2.27 ms 0 - 224 MB NPU
decoder TFLITE float Qualcomm® Dragonwing™ IQ-9075 2.341 ms 0 - 84 MB NPU
decoder TFLITE float Qualcomm® Dragonwing™ Q-8750 1.289 ms 0 - 192 MB NPU
decoder TFLITE float Qualcomm® SA7255P 6.765 ms 7 - 20 MB CPU
decoder TFLITE float Qualcomm® SA8295P 2.524 ms 0 - 49 MB NPU
decoder TFLITE float Snapdragon® 8 Elite Extreme Gen 6 Mobile 1.161 ms 0 - 193 MB NPU
decoder TFLITE float Snapdragon® 8 Elite Gen 6 Mobile 1.307 ms 0 - 107 MB NPU
encoder ONNX float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 4.556 ms 14 - 143 MB NPU
encoder ONNX float Snapdragon® 8 Elite For Galaxy Mobile 5.578 ms 15 - 141 MB NPU
encoder ONNX float Snapdragon® X2 Elite 4.949 ms 16 - 16 MB NPU
encoder ONNX float Snapdragon® X Elite 11.872 ms 48 - 48 MB NPU
encoder ONNX float Snapdragon® 8 Gen 3 Mobile 8.089 ms 0 - 206 MB NPU
encoder ONNX float Snapdragon® 8 Gen 1 Mobile 18.989 ms 0 - 317 MB NPU
encoder ONNX float Qualcomm® Dragonwing™ IQ-8275 14.232 ms 15 - 20 MB NPU
encoder ONNX float Qualcomm® Dragonwing™ QCS8550 (Proxy) 11.311 ms 0 - 56 MB NPU
encoder ONNX float Qualcomm® QCS8450 18.989 ms 0 - 317 MB NPU
encoder ONNX float Qualcomm® Dragonwing™ IQ-9075 13.706 ms 15 - 20 MB NPU
encoder ONNX float Qualcomm® Dragonwing™ IQ-X7181 11.872 ms 48 - 48 MB NPU
encoder ONNX float Qualcomm® Dragonwing™ Q-8750 5.578 ms 15 - 141 MB NPU
encoder ONNX float Snapdragon® 8 Elite Extreme Gen 6 Mobile 4.016 ms 1 - 129 MB NPU
encoder ONNX float Snapdragon® 8 Elite Gen 6 Mobile 5.302 ms 15 - 140 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 4.709 ms 2 - 119 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite For Galaxy Mobile 5.711 ms 2 - 116 MB NPU
encoder QNN_DLC float Snapdragon® X2 Elite 5.522 ms 2 - 2 MB NPU
encoder QNN_DLC float Snapdragon® X Elite 12.606 ms 2 - 2 MB NPU
encoder QNN_DLC float Snapdragon® 8 Gen 3 Mobile 7.686 ms 2 - 194 MB NPU
encoder QNN_DLC float Snapdragon® 8 Gen 1 Mobile 19.621 ms 2 - 309 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ IQ-8275 14.502 ms 2 - 13 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ QCS8550 (Proxy) 11.837 ms 2 - 4 MB NPU
encoder QNN_DLC float Qualcomm® SA8775P 14.365 ms 2 - 112 MB NPU
encoder QNN_DLC float Qualcomm® SA8650P 14.365 ms 2 - 112 MB NPU
encoder QNN_DLC float Qualcomm® SA8255P 14.365 ms 2 - 112 MB NPU
encoder QNN_DLC float Qualcomm® QCS8450 19.621 ms 2 - 309 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ IQ-9075 14.13 ms 4 - 15 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ IQ-X7181 12.606 ms 2 - 2 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ Q-8750 5.711 ms 2 - 116 MB NPU
encoder QNN_DLC float Qualcomm® SA8295P 20.083 ms 2 - 225 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite Extreme Gen 6 Mobile 4.121 ms 2 - 117 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite Gen 6 Mobile 5.519 ms 2 - 112 MB NPU
encoder TFLITE float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 4.067 ms 0 - 105 MB NPU
encoder TFLITE float Snapdragon® 8 Elite For Galaxy Mobile 4.951 ms 6 - 115 MB NPU
encoder TFLITE float Snapdragon® 8 Gen 3 Mobile 7.382 ms 5 - 196 MB NPU
encoder TFLITE float Snapdragon® 8 Gen 1 Mobile 16.984 ms 7 - 309 MB NPU
encoder TFLITE float Qualcomm® Dragonwing™ IQ-8275 13.069 ms 7 - 68 MB NPU
encoder TFLITE float Qualcomm® Dragonwing™ QCS8550 (Proxy) 10.141 ms 7 - 10 MB NPU
encoder TFLITE float Qualcomm® SA8775P 12.824 ms 7 - 111 MB NPU
encoder TFLITE float Qualcomm® SA8650P 12.824 ms 7 - 111 MB NPU
encoder TFLITE float Qualcomm® SA8255P 12.824 ms 7 - 111 MB NPU
encoder TFLITE float Qualcomm® QCS8450 16.984 ms 7 - 309 MB NPU
encoder TFLITE float Qualcomm® Dragonwing™ IQ-9075 12.873 ms 6 - 66 MB NPU
encoder TFLITE float Qualcomm® Dragonwing™ Q-8750 4.951 ms 6 - 115 MB NPU
encoder TFLITE float Qualcomm® SA7255P 353.772 ms 8 - 21 MB CPU
encoder TFLITE float Qualcomm® SA8295P 18.208 ms 7 - 222 MB NPU
encoder TFLITE float Snapdragon® 8 Elite Extreme Gen 6 Mobile 3.608 ms 0 - 109 MB NPU
encoder TFLITE float Snapdragon® 8 Elite Gen 6 Mobile 4.822 ms 6 - 114 MB NPU

License

  • The license for the original implementation of TrOCR can be found here.

References

Community

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using qualcomm/TrOCR 1

Paper for qualcomm/TrOCR