Aves smart search models
On-device image embedding models for smart search in Aves, an Android gallery app: searching photos by describing them ("dog on a beach"), and finding similar images ("More like this"). Everything runs on the device; photos are never uploaded.
These are int8-quantized conversions of existing CLIP-style models to the ONNX Runtime ORT format, for Android devices with 2–4 GB of RAM.
| Folder | Source model | License | Image input | Embedding | Files |
|---|---|---|---|---|---|
openclip-vitb32-laion2b-v1 |
OpenCLIP ViT-B/32, laion2b_s34b_b79k |
MIT | 224×224, short side resize + center crop | 512 | 96 MB image, 68 MB text |
pe-core-b16-224-v1 |
Meta Perception Encoder PE-Core-B16-224 (OpenCLIP version) | Apache-2.0 | 224×224, squash resize | 1024 | 99 MB image, 370 MB text |
pe-core-s16-384-v1 |
Meta Perception Encoder PE-Core-S16-384 (OpenCLIP version) | Apache-2.0 | 384×384, squash resize | 512 | 33 MB image, 68 MB text |
Each folder contains:
image.ort: image encoder, inputpixel_valuesfloat32[1, 3, H, W](RGB, normalized), outputembeddingfloat32[1, dim](dimension in the table above), L2-normalized,text.ort: text encoder, inputinput_idsint64[1, context](77 for ViT-B/32, 32 for PE-Core models), outputembeddingfloat32[1, dim], L2-normalized,bpe_simple_vocab_16e6.txt.gz: the OpenAI CLIP BPE merges used by both tokenizers (MIT, © OpenAI).
Preprocessing:
- ViT-B/32: mean
[0.48145466, 0.4578275, 0.40821073], std[0.26862954, 0.26130258, 0.27577711], - PE-Core models: mean and std
[0.5, 0.5, 0.5].
Modifications
The models were modified from their sources (see scripts/convert.py, which reproduces them):
- export of the OpenCLIP image and text towers to ONNX (opset 18), with L2 normalization of the outputs,
and end-of-text pooling computed with a float
ArgMax(ONNX Runtime has no int64ArgMaxkernel), - dynamic int8 per-channel quantization of
MatMul/Gemm(image and text) andGather(text), except the text encoderresblocks.0/mlp/c_projprojection, kept in float32: its activation outliers otherwise break text embeddings, - conversion to ORT format, optimized for ARM (
--optimization_style Fixed --target_platform arm).
No weights were retrained or fine-tuned.
Reproducibility: with the versions listed in scripts/convert.py, the ViT-B/32 files are byte-identical across runs.
The PE-Core files have identical weights and outputs across runs, but their serialization order may differ.
PE-Core-B16-224 is converted with python convert.py pe-core-b16-224-v1 'hf-hub:timm/PE-Core-B-16' out/.
Evaluation
Flickr30k 1k test split, text→image retrieval (5,000 captions), images first downscaled to a thumbnail as the app does:
| Model | fp32 R@1 | these files R@1 | R@5 |
|---|---|---|---|
| ViT-B/32 | 0.662 | 0.662 | 0.879 |
| PE-Core-S16-384 | 0.724 (full resolution) | 0.700 | 0.907 |
| PE-Core-B16-224 | 0.803 | 0.797 | 0.951 |
Naive int8 quantization of the ViT-B/32 text encoder (without the c_proj exception) gives R@1 0.41.
Speed with ONNX Runtime 1.30 on an Amazon Fire Max 11 (MediaTek MT8188), restricted to its Cortex-A55 cores:
| Model | Image, 4 threads | Image, 2 threads | Image, 2 threads, weight prepacking off (low RAM) | Text query, 4 threads |
|---|---|---|---|---|
| ViT-B/32 | 139 ms | 241 ms | 354 ms | 106 ms |
| PE-Core-S16-384 | – | 1,398 ms | – | 49 ms |
ViT-B/32 as a 32-bit (armeabi-v7a) app on the same cores: 426 ms with 4 threads, 609 ms with 2 threads.
Limitations
- The models were trained on English captions: queries in other languages work poorly.
- CLIP-style models reflect biases of their web-scale training data, and can produce offensive or wrong matches.
- The upstream OpenCLIP/LAION model card states that deployed use cases are out of its intended scope without thorough in-domain testing. Here results are only a ranking of the user's own photos, on their own device.
Licenses and attribution
See LICENSE and the licenses/ folder:
openclip-vitb32-laion2b-v1: OpenCLIP weights by LAION / the OpenCLIP authors, MIT (licenses/OpenCLIP-LICENSE), architecture and tokenizer by OpenAI, MIT (licenses/OpenAI-CLIP-LICENSE).pe-core-b16-224-v1andpe-core-s16-384-v1: Perception Encoder by Meta, Apache-2.0 (licenses/PE-LICENSE); modified as described above.bpe_simple_vocab_16e6.txt.gz: OpenAI, MIT (licenses/OpenAI-CLIP-LICENSE).scripts/convert.py: BSD-3-Clause, like Aves.
Citations:
- Cherti et al., Reproducible scaling laws for contrastive language-image learning, CVPR 2023 (OpenCLIP, LAION-2B).
- Radford et al., Learning Transferable Visual Models From Natural Language Supervision, ICML 2021 (CLIP).
- Bolya et al., Perception Encoder: The best visual embeddings are not at the output of the network, 2025.
Checksums
The app verifies every file against these SHA-256 hashes (SHA256SUMS):
924691ac288e54409236115652ad4aa250f48203de50a9e4722a6ecd48d6804a openclip-vitb32-laion2b-v1/bpe_simple_vocab_16e6.txt.gz
ab85a2e04732c61f426e47f48e2b152f014346205d13a6d491264de6a6e34bad openclip-vitb32-laion2b-v1/image.ort
6a1ac8363ed68f4b11132dd28c5cb2cb69cca8068647c368be40f304fc6957bc openclip-vitb32-laion2b-v1/text.ort
924691ac288e54409236115652ad4aa250f48203de50a9e4722a6ecd48d6804a pe-core-b16-224-v1/bpe_simple_vocab_16e6.txt.gz
b177ed44ac762805459487ef40b88d0de23c987613416d4f62c4120f292dd656 pe-core-b16-224-v1/image.ort
51257ebc3d96c0e9b4ec311325b157387118e8d55261f34d86900c3c3fa24430 pe-core-b16-224-v1/text.ort
924691ac288e54409236115652ad4aa250f48203de50a9e4722a6ecd48d6804a pe-core-s16-384-v1/bpe_simple_vocab_16e6.txt.gz
afcbf6ea23871879d9333b8839e6a09d950e5314cf67b37bc97c614e2cb58f99 pe-core-s16-384-v1/image.ort
c8f399148a872c81a6a9ba5c659b3ce0ef08b68d282a07a5a3d768f72f8f51aa pe-core-s16-384-v1/text.ort