Downloads · 30 days
0
Nhatminh1234/siglip-so400m-ppe-int8
siglip-so400m-ppe-int8 is a zero-shot image classification model from Nhatminh1234. Use it for the zero-shot image classification task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Dynamic INT8 quantization of the SigLIP SO400M image encoder, optimized for CPU inference in the PPE Detection pipeline.
Downloads · 30 days
0
Access
Public
Updated Apr 17, 2026
Repo size
431 MB
Likes
0
Public
Click a slice to open those files.
.onnx431 MB · 100%
From the Hugging Face model README
Dynamic INT8 quantization of the SigLIP SO400M image encoder, optimized for CPU inference in the PPE Detection pipeline.
Only the image tower is exported. Text embeddings are pre-computed at startup from the original PyTorch weights and cached in memory.
| Property | Value |
|---|---|
| Base model | ViT-SO400M-14-SigLIP (webli pretrained, open_clip) |
| Input size | 224 × 224 |
| Embedding dim | 1152 |
| Quantization | Dynamic INT8 (MatMul/Gemm), opset 17 |
| FP32 size | 1632 MB |
| INT8 size | 411 MB |
| Cosine similarity vs FP32 | 0.994 (random image) |
| Decision flip rate | 5.3% (19 real PPE crops) |
Zero-shot PPE classification in the PPE Detection system:
Not intended as a standalone model — requires the text embeddings and logit_scale from the full pipeline.
import onnxruntime as ort
import numpy as np
from huggingface_hub import hf_hub_download
path = hf_hub_download("Nhatminh1234/siglip-so400m-ppe-int8", "siglip_image_encoder.onnx")
session = ort.InferenceSession(path, providers=["CPUExecutionProvider"])
# Input: preprocessed image batch (B, 3, 224, 224) float32, normalized per open_clip preprocess
pixel_values = np.random.randn(1, 3, 224, 224).astype(np.float32)
image_features = session.run(None, {"pixel_values": pixel_values})[0] # (B, 1152)
# Normalize before cosine similarity
image_features /= np.linalg.norm(image_features, axis=-1, keepdims=True)
Dynamic INT8 quantizes only MatMul/Gemm layers (~80% of ViT compute). LayerNorm, softmax, and attention scores remain FP32. Expected cosine similarity vs FP32: 0.990–0.998 for large ViT models.
The logit_scale for this model is 111.54 (i.e., exp(4.714)).
git clone https://github.com/nhatminh-115/PPE-Detection
cd PPE-Detection
python scripts/export_siglip_onnx.py --upload