clip-vit-base-patch32-onnx (vision tower, dynamic int8)

Mirror of the vision tower of OpenAI CLIP ViT-B/32 in ONNX, dynamically quantized to 8 bit. Used by the Ipsilon apps for on-device image similarity (512-d image embeddings). The text tower is not included.

Provenance

File

File Size (bytes) SHA-256
vision_model_quantized.onnx 89,117,001 583fd1110a514667812fee7d684952aaf82a99b959760c8d7dca7e0ab9839299

Graph (checked with onnx.load, onnx 1.20.1)

  • Opset 11 (default domain), IR version 6, producer onnx.quantize
  • Quantization ops: DynamicQuantizeLinear x50, MatMulInteger x73, ConvInteger x1 (CPU execution; NNAPI cannot run these ops)
  • Input: pixel_values, float32, shape [batch_size, num_channels, height, width] (dynamic batch; use [N, 3, 224, 224])
  • Output: image_embeds, float32, shape [batch_size, 512] (not L2-normalised: normalise before cosine similarity)

Required preprocessing (OpenAI CLIP)

  1. Resize the shorter side to 224 (bicubic), centre crop 224 x 224, RGB.
  2. Scale to [0, 1].
  3. Normalise: mean [0.48145466, 0.4578275, 0.40821073], std [0.26862954, 0.26130258, 0.27577711].
  4. Layout NCHW float32.

Usage (ONNX Runtime)

import onnxruntime as ort, numpy as np
s = ort.InferenceSession("vision_model_quantized.onnx")
emb = s.run(["image_embeds"], {"pixel_values": x.astype(np.float32)})[0]   # x: [N,3,224,224]
emb /= np.linalg.norm(emb, axis=1, keepdims=True)
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

Model tree for ipsilondev/clip-vit-base-patch32-onnx

Quantized
(16)
this model