relu-clip / preprocessing.json
jiaheguo521's picture
Initial commit
412856b
Raw History Blame Contribute Delete
1.75 kB
{
"model": "relu-clip efflite4 distilled from CLIP ViT-L/14",
"input": {
"size": 224,
"layout": "NHWC",
"channels": "RGB",
"resize": "shortest side to 224, bicubic; long side = int(224 * long / short), TRUNCATED not rounded",
"crop": "center 224x224; offset = int(round((dim - 224) / 2)), ROUNDED not floored",
"scale": "divide by 255 to [0,1], then (x - mean) / std",
"mean": [
0.48145466,
0.4578275,
0.40821073
],
"std": [
0.26862954,
0.26130258,
0.27577711
],
"quantization": {
"dtype": "int8",
"scale": 0.015443762764334679,
"zero_point": -12,
"formula": "q = clip(round(x / scale + zero_point), -128, 127)"
}
},
"output": {
"embed_dim": 768,
"normalised": false,
"note": "L2 normalisation is deliberately left out of the graph so the accelerator subgraph stays free of reductions; do it on the host after dequantising.",
"quantization": {
"dtype": "int8",
"scale": 0.3109022378921509,
"zero_point": -5,
"formula": "x = (q - zero_point) * scale"
}
},
"text_embeddings": {
"imagenet1k_text_emb_vitl14.npz": {
"keys": [
"embs",
"labels"
],
"shape": [
1000,
768
],
"normalised": false,
"note": "average over the 80 OpenAI ImageNet templates; row norms 0.81-0.93, normalise before use"
},
"demo_prompt_emb_vitl14.npz": {
"keys": [
"text_emb",
"labels"
],
"shape": [
11,
768
],
"normalised": true,
"note": "prompts encoded verbatim, no templating"
}
},
"classification": "cosine(L2norm(image_emb), L2norm(text_emb)) -> argmax"
}