Instructions to use Arm/swin-tiny-int8-litert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use Arm/swin-tiny-int8-litert with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Swin-Tiny Patch4-Window7-224 optimized for Arm-based mobile CPUs with SME2
Swin-Tiny Patch4-Window7-224 optimized with INT8 dynamic post-training quantization for image classification, exported to LiteRT .tflite format for efficient inference on Arm-based mobile CPUs with SME2.
Summary
This repository contains an Arm-optimized version of microsoft/swin-tiny-patch4-window7-224 for image classification, quantized to INT8 via dynamic post-training quantization — per-channel symmetric INT8 weights, with activations quantized to INT8 dynamically at inference. The model is provided in LiteRT .tflite format, targeting Mobile CPU systems.
Swin-Tiny is a hierarchical vision transformer that applies self-attention within shifted local windows, which keeps compute linear in image size. It accepts 224x224 RGB inputs and produces logits for 1,000 ImageNet-1k classes.
This version is intended to demonstrate efficient inference on Arm-based platforms while preserving the original model's intended behavior. Arm has evaluated this model on ImageNet-1k and measured performance on a representative evaluation target.
Key results
| Area | Result |
|---|---|
| Model format | LiteRT .tflite |
| Target device class | Mobile CPU |
| Reference device | vivo X300 (C1-Ultra, C1-Premium, C1-Pro, Android 16 / OriginOS 6) |
| Example environment | AWS Graviton, Ubuntu arm64 |
| Primary performance result | p50 latency of 37.65 ms at 1 thread — 0.80x the FP32 baseline, i.e. slower (see Limitations) |
| Accuracy result | Top-1 accuracy of 81.12 percent (+0.03 pp vs baseline) |
| Size / memory result | 30.20 MB (3.66x smaller) and 86.35 MB peak memory (2.85x less) |
Original model
| Field | Value |
|---|---|
| Original model | microsoft/swin-tiny-patch4-window7-224 |
| Original source | Hugging Face |
| Original developer | Microsoft |
| Original model card | microsoft/swin-tiny-patch4-window7-224 |
| Original license | Apache-2.0 |
Model files
| File | Description |
|---|---|
microsoft__swin-tiny-patch4-window7-224_android_litert_optimized.tflite |
Arm-optimized INT8 model for deployment |
example.py |
Minimal inference example |
pyproject.toml |
Pinned runtime dependencies for example.py, resolved with uv |
uv.lock |
Locked dependency resolution for pyproject.toml |
config.yaml |
Model I/O contract used by the example |
sample_input.jpg |
Sample image used by the example |
benchmarks/ |
FP32 baseline and Arm-optimized benchmark records |
Performance
Performance was measured on the vivo X300 reference configuration below. The Graviton environment documented for example.py verifies portability of the inference flow but does not provide or imply equivalent Graviton performance.
Reference configuration
| Field | Value |
|---|---|
| Device / platform | vivo X300 |
| CPU / accelerator | C1-Ultra, C1-Premium, C1-Pro (8-core aarch64) |
| OS | android, Android 16 / OriginOS 6 |
| Runtime | LiteRT |
| Backend / delegate | XNNPACK, KleidiAI |
| Batch size | 1 |
| Threads | 1 |
| Precision | INT8 dynamic PTQ — per-channel symmetric weights, activations quantized to INT8 dynamically at inference |
| Runs | 100 measured runs, 20 warmup runs |
Performance results
| Metric | Original / baseline | Arm-optimized | Improvement |
|---|---|---|---|
| p50 latency | 30.00 ms | 37.65 ms | 0.80x |
| p90 latency | 31.81 ms | 41.03 ms | 0.78x |
| Model load time | 166.76 ms | 94.44 ms | 1.77x faster |
| Time to first inference | 37.81 ms | 45.44 ms | 0.83x |
| Frames per second | 33.33 FPS | 26.56 FPS | 0.80x |
| Model size | 110.39 MB | 30.20 MB | 3.66x smaller |
| Peak memory | 246.31 MB | 86.35 MB | 2.85x less |
Accuracy
Accuracy was evaluated using the same preprocessing, input resolution, and evaluation protocol described below. Where possible, the optimized model is compared against the original model under the same evaluation conditions.
Evaluation setup
| Field | Value |
|---|---|
| Dataset | ImageNet-1k |
| Split | val |
| Number of samples | 50000 |
| Metric(s) | Top-1 accuracy, Top-5 accuracy |
| Evaluation runtime | LiteRT |
Accuracy results
| Metric | Original / baseline | Arm-optimized | Change |
|---|---|---|---|
| Top-1 accuracy | 81.09% | 81.12% | +0.03 pp |
| Top-5 accuracy | 95.54% | 95.54% | +0.00 pp |
Accuracy was measured using the evaluation setup described above. Users should re-evaluate the model on their own data before production use.
Arm optimization approach
Arm optimized this model for efficient inference on Arm-based platforms using a hardware-aware conversion and validation flow.
For this release, Arm used:
| Optimization area | Applied? | Notes |
|---|---|---|
| Model conversion | Yes | Converted to LiteRT .tflite |
| Quantization | Yes | Dynamic PTQ with INT8 per-channel symmetric weights; activations are quantized to INT8 dynamically at inference, so no calibration data is required |
| Runtime/backend selection | Yes | Selected XNNPACK and KleidiAI |
| Graph/runtime compatibility updates | Yes | Performed as part of the LiteRT export pipeline |
| Accuracy validation | Yes | Compared against the original model or published baseline |
| Performance validation | Yes | Measured on the reference Arm platform |
The goal of this process is to improve deployment characteristics such as latency, memory use, model size, and runtime compatibility while preserving the model's intended behavior. Detailed conversion scripts, calibration configuration, or backend-specific implementation details may be provided separately where appropriate.
Using this model
Install dependencies
Dependencies are declared in pyproject.toml, which ships with this repository. Resolve and install them into a local virtual environment with uv:
uv python install
uv sync --frozen
Run the example
uv run example.py
The example loads the optimized .tflite weight and sample_input.jpg from its own directory, prints the top-5 predictions, and writes predictions.json and sample_output.jpg beside itself.
Note: The Python/uv example runs on AWS Graviton (Ubuntu arm64) to confirm runtime compatibility only, and is intended as a guideline for building an equivalent run script on Mobile CPU systems.
Expected input
| Property | Value |
|---|---|
| Input shape | 1x3x224x224 |
| Input type | float32 |
| Input range | 0.0 to 1.0 |
| Preprocessing | Resize shorter edge to 232 (bilinear), center crop to 224x224, convert to tensor, normalize with ImageNet mean/std |
Expected output
| Property | Value |
|---|---|
| Output shape | 1x1000 |
| Output type | Raw classification logits (unnormalized), one score per ImageNet-1k class |
| Postprocessing | Softmax followed by top-5 selection |
Intended use
This model is intended for developers evaluating image classification workloads on Arm-based platforms. It is suitable as a reference implementation for benchmarking, prototyping, and integration exploration.
Limitations
- Performance depends on the target device, runtime version, backend/delegate support, memory configuration, and system load.
- Accuracy was evaluated on ImageNet-1k val and may not generalize to all domains.
- This release preserves the original model's intended task and behavior, but users should validate it for their own application, data, and deployment environment.
- This repository is not a replacement for the original model documentation.
- The export is fixed at 224x224 input resolution, and it targets the CPU backend.
- Performance was measured on a vivo X300; other Arm devices may run slower or faster and may have different XNNPACK or KleidiAI delegation coverage.
Additional notes
- Sample input:
sample_input.jpgis derived from Samoyed on Beach by Appleinfl, via Wikimedia Commons (public domain).
About this version
Original Model: microsoft/swin-tiny-patch4-window7-224 by Microsoft - Repository
Optimization/conversion: Arm-Optimized version for execution on Arm-based platforms.
Converted/optimized by: Arm
License: The Original Model and the Optimized Model are subject to Apache-2.0.
This repository contains a converted or optimized version of the Original Model (the “Optimized Model”). The Original Model has been converted or optimized as described above for execution on Arm-based platforms.
No retraining or fine-tuning of the Original Model was performed as part of the conversion or optimization. The conversion or optimization was not intended to change the Original Model’s behavior or intended use.
Original Model and Documentation
For information about the Original Model, including its development, training data, intended uses, limitations and other relevant information, please refer to the Original Model repository. Information in that repository was provided by the original developer or other third parties and, unless expressly stated otherwise, has not been independently verified by Arm.
Licenses and Third-Party Terms
Use of the Original Model and the Optimized Model is subject to the applicable licenses, usage restrictions and other terms identified above and in the relevant repositories. Publication of the Optimized Model does not grant any rights beyond those provided under the applicable license terms.
You are responsible for reviewing those terms and ensuring that your use of the Original Model and the Optimized Model is permitted.
Purpose of this Release
The Optimized Model is provided as a reference implementation to demonstrate and evaluate execution and performance on Arm-based systems. It is not a production-ready or supported solution.
Arm’s publication of the Optimized Model does not constitute an endorsement or certification of the Original Model or a representation that the Optimized Model is suitable for production use or any particular purpose.
To the fullest extent permitted by applicable law (i) the Optimized Model is provided “as is.” Arm makes no representations or warranties that the Original Model, the Optimized Model or their outputs are accurate, safe, secure, non-infringing, legally compliant, suitable for production use or fit for any particular purpose; and (ii) Arm will not be liable for any loss or damage arising from or in connection with the Optimized Model, its use or its outputs.
You are responsible for independently evaluating the Optimized Model, its outputs and its suitability for your intended use, including compliance with applicable legal, regulatory, safety and security requirements.
Arm does not commit to provide ongoing support, maintenance or updates for the Optimized Model. Any use of or reliance on the Optimized Model or its outputs is at your own risk.
- Downloads last month
- 5
Model tree for Arm/swin-tiny-int8-litert
Base model
microsoft/swin-tiny-patch4-window7-224