/ Модель

Характеристики

Лицензия
Apache 2.0
Базовая модель
siglip2-base-patch16-224
Библиотека
unity-sentis
Опубликована
3 ноя 2026

com.sky.sentis.siglip2-base16

Классификация изображений без дообученияИзображение, текст → label3 профессии
20скачиваний за 30 дней0лайковвеса обновлены3 ноя 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Портированная в Unity модель SigLIP 2 сопоставляет текстовые описания с изображениями и их фрагментами для поиска без отдельного обучения.

Это адаптированная для Unity Inference Engine (Sentis) 2.6.1 версия визуально-текстовой модели Google SigLIP 2 Base/16 с входным разрешением 224 × 224 и весами Float16. Модель преобразует изображения или их фрагменты и текстовые запросы в векторы размерности 768; сходство пары оценивается косинусом, а для независимой оценки соответствия можно использовать вероятность SigLIP. Текстовый контекст ограничен 64 токенами.

Модель предназначена для поиска объектов и сцен по текстовым описаниям, в том числе по фрагментам изображения, заданным рамками детектора. Пакет включает обёртку Unity для эмбеддингов текста и кропов, а также обработку изображений и токенизацию. В README приведены проверки численного соответствия исходной модели и замеры производительности на Apple M5 Max; они не гарантируют таких же показателей на других устройствах. Требуются Unity и зависимость com.unity.ai.inference версии 2.6.1. Лицензия — Apache-2.0.

Сценарии применения

  • поиск людей или предметов по текстовому описанию на кадрах
  • сопоставление описаний с рамками объектов от детектора
  • ранжирование изображений по сходству с текстовыми запросами
  • оценка соответствия изображения запросу с помощью вероятности SigLIP

Ограничения

Входное изображение приводится к размеру 224 × 224, а текст обрезается до 64 токенов; качество и скорость зависят от устройства и Unity backend. Косинусные оценки малы по абсолютной величине, поэтому для порога соответствия следует использовать вероятность SigLIP, а не softmax по меткам.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

com.sky.sentis.siglip2-base16

Google SigLIP 2 Base/16 (224 x 224) (google/siglip2-base-patch16-224) converted to Unity Inference Engine (Sentis) 2.6.1 with Float16 weights. Text and image crops become 768-d unit-length vectors; their dot product is the cosine similarity, for zero-shot search ("a person wearing a red jacket") over detector boxes.

Install as a UPM package (git URL, or copy the folder into Packages/); depends on com.unity.ai.inference 2.6.1.

Files

Models~/siglip2_b16_vision_fp16.sentis       185 MB  pixels [1, 3, 224, 224] RGB 0-1      -> image_embeds [1, 768]
Models~/siglip2_b16_text_fp16.sentis         172 MB  token_embeds [1, 64, 768]            -> text_embeds  [1, 768]
Models~/siglip2_b16_token_embed_fp16.bin     393 MB  token-embedding table [256000, 768], raw little-endian float16
Models~/tokenizer.json                        34 MB  upstream Gemma tokenizer (unmodified)
Runtime/Siglip2Base16.cs                             self-contained inference wrapper (namespace SentisModels)

Usage

using SentisModels;
using Unity.InferenceEngine;

var siglip = new Siglip2Base16(BackendType.GPUCompute);   // falls back to CPU without compute shaders
siglip.Load(Path.GetFullPath("Packages/com.sky.sentis.siglip2-base16/Models~"));
siglip.Warmup();

float[] query = siglip.EmbedText("a photo of a person wearing a red jacket");    // blocking, once per query
float[][] crops = await siglip.EmbedCropsAsync(frameTexture, personBoxes);         // boxes in source pixels, top-left origin
float score = Siglip2Base16.Dot(query, crops[0]);                                  // cosine similarity
float p = Siglip2Base16.Probability(query, crops[0]);                              // SigLIP's calibrated sigmoid
Member
Dim = 768, InputSize = 224, ContextLength = 64
EmbedText(string)unit-length text embedding (blocking)
EmbedCropsAsync(Texture, Rect[])unit-length embedding per box; one crop scheduled per frame, callback AsyncGPUReadback
LastCropsMswall time of the last EmbedCropsAsync (first schedule to result)
Tokenize(string)the 64 token ids the text tower sees
LogitScale = 112.6689, LogitBias = -16.7717the model's learned logit_scale.exp() / logit_bias
Probability(text, image)sigmoid(LogitScale * cos + LogitBias)

Scores: cosine vs probability

SigLIP is trained with a sigmoid loss, not a softmax over a batch: each image-text pair gets an independent logit logit_scale.exp() * cos + logit_bias = 112.67 * cos - 16.77, and sigmoid(logit) is the model's own probability that the pair matches. Cosines are small in absolute terms (a good match is ~0.12-0.18 here) because of that large scale; the ranking is identical whether you sort by cosine or by probability. Use Probability when you need an absolute threshold (e.g. "is there anyone lying on the ground at all?"); it reaches 0.5 at cos ≈ 0.149. Unlike CLIP, do not softmax the cosines across candidate labels.

Preprocessing (done by the wrapper)

Vision. Each box is widened by 15% of its width on each side and 5% of its height top and bottom, clamped to the texture, then letterboxed (aspect kept, centred, mid-grey 0.5 padding) into the 224 x 224 input on the GPU (sRGB render texture, TextureTransform().SetCoordOrigin(CoordOrigin.TopLeft)). The SigLIP normalisation (x - 0.5) / 0.5 is baked into the graph, so the input is plain RGB in [0, 1]. (The upstream processor squashes the whole image to 224 x 224; letterboxing keeps people's proportions in tall boxes.) The padding is cleared with s_Pad.linear in a Linear colour-space project: GL.Clear takes its colour as linear and sRGB-encodes it into the canvas, so a plain 0.5 would reach the model as 0.737. Measured pad value: 0.4980 (Linear), 0.5020 (Gamma).

Text. As the SigLIP 2 processor expects:

  • lowercase the text (tokenizer_config.json has do_lower_case: true; the model was trained on lowercased text, and the transformers GemmaTokenizer does not apply it by itself),
  • Gemma SentencePiece-BPE (256k vocab, byte fallback) via Unity's built-in HuggingFaceParser on the upstream tokenizer.json, <eos> (id 1) appended, no <bos>,
  • truncate to 64 tokens keeping <eos> last, pad with <pad> (id 0) to exactly 64 (padding="max_length"). The text tower has no attention mask and pools the last position, so the padding is part of the input: always 64.

The token-embedding table (256000 x 768, 197M of the text tower's 282M parameters) is kept out of the graph: the wrapper reads the 64 needed rows from siglip2_b16_token_embed_fp16.bin with a FileStream and feeds [1, 64, 768] to the text graph, which adds the position embeddings and runs the encoder, final LayerNorm and head. This keeps 0.8 GB of mostly unused weights off the GPU: Sentis Float16 weights are cast back to fp32 at run time, so an in-graph table would also need a full fp32 copy on every query.

Measured (Unity 6000.3, Sentis 2.6.1, Apple M5 Max, editor)

Parity, cosine (min over 5 crops from the police demo recordings / 5 sentences, same input bytes on every path):

EdgeVisionText
A: PyTorch (transformers) vs ONNX Runtime1.000000 (max abs 2.5e-5)1.000000 (max abs 1.5e-5)
fp16 token table vs fp32 table (PyTorch)1.000000 (max abs 1.0e-3)
B: ORT vs Sentis fp32, CPU / GPUCompute1.000000 / 1.0000001.000000 / 1.000000
B: ORT vs Sentis fp16 (shipped), CPU / GPUCompute0.999996 / 0.9999961.000000 / 1.000000

Tokenizer: 0 mismatching ids over 14 strings (punctuation, double / leading spaces, tabs and newlines, Korean, accents, emoji, all caps, digits, a 100-word string that truncates) vs transformers GemmaTokenizer.

Zero-shot through the package API (EmbedText + EmbedCropsAsync on 1920 x 1080 recording frames, Linear colour-space project like the police demo), cosine:

red jacketlyingwhite carblue carblonde walker
a photo of a person wearing a red jacket+0.120+0.044+0.032+0.029+0.079
a photo of a person lying on the ground+0.102+0.158+0.062+0.054+0.106
a photo of a white car+0.023+0.023+0.123+0.104+0.016
a photo of a blue car+0.028+0.029+0.093+0.126+0.034
a photo of a person with blonde hair, walking+0.134+0.134+0.061+0.054+0.179

Same ranking on CPU and GPUCompute, and in a Gamma project (all within ±0.006 of these). The GPU letterbox (bilinear, no mipmaps) differs slightly from a PIL resize of the same box (cosine 0.976-0.993 between the two image embeddings); rankings are unchanged.

Warm timings (average of 20 calls after Warmup, Linear project):

GPUComputeCPU
EmbedText per sentence (incl. tokenize 0.1 ms + table lookup)13.1 ms67.5 ms
EmbedCropsAsync, 1 box (schedule to readback)17.8 ms166 ms
EmbedCropsAsync, 4 boxes (one per frame)66 ms663 ms
Load (two workers + 34 MB tokenizer.json parse)2.0 s1.6 s
Warmup0.16 s (17 s on the first run after a colour-space switch: shader compilation)0.26 s

Conversion notes

  • Source: google/siglip2-base-patch16-224 (transformers SiglipModel, attn_implementation="eager"), safetensors sha256 612923381c76…fadee6a0b.
  • Vision graph = vision_model(pixel_values=(x - 0.5) / 0.5).pooler_output (MAP attention-pooling head). Text graph = position embeddings + encoder + final_layer_norm + head on the last position, taking token embeddings as input. Both exported with torch.onnx.export(dynamo=False, opset_version=17), fixed shapes, weights inline; the gelu_pytorch_tanh activations decompose into primitives at opset 17 (no Gelu(approximate="tanh") node, which Sentis would run as exact-erf GELU). No graph surgery.
  • Imported into Sentis, ModelQuantizer.QuantizeWeights(QuantizationType.Float16) and saved with ModelWriter.Save.
  • The vision tower takes a single 224 x 224 image (the fixed-resolution SigLIP 2 checkpoint, not NaFlex).

License & attribution

Model weights: Apache-2.0, © Google LLC — google/siglip2-base-patch16-224, paper SigLIP 2 (arXiv:2502.14786). The files under Models~ are converted (not retrained) from those weights; see LICENSE.md for the modifications. The wrapper code is MIT, © 2026 Sky Kim.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · unity-sentis

Нельзя запустить

Библиотека «unity-sentis» рантаймом не поддерживается.

Ревизия весов
3288d9f

0 моделей