SigLIP2 b16 classify

Click a block to read its description, or select it with Tab and Enter.

SigLIP2 b16 classifyImage input 256 × 256; text length 64. Classify example: 3 classes, one prompt each. Fixed-resolution SigLIP graph.LibreYOLOSigLIP2 b16 classifyImage input 256 × 256; text length 64. Classify example: 3 classes, one prompt each. Fixed-resolution SigLIP graph.Image towerImage3 × 256 × 256Conv2d 16×16 / 16768 × 16 × 16, bias=TrueFlatten and transpose256 × 768Position embedding256 × 768+Vision encoder block256 × 768, repeats=12LayerNorm after encoder256 × 768Attention pooling head256 tokens to 1 tokenSelect pooled token768L2 normalize768No CLS token. Convolution uses valid padding.so400m uses 27 × 27 patches at 384 px.Text towerText token IDs64 IDs, vocabulary 256,000Token embedding64 × 768Embedded sequence64 × 768Position embedding64 × 768+Text encoder block64 × 768, repeats=12Final LayerNorm64 × 768Select last token768Linear projection768 to 768, bias=TrueL2 normalize768Bidirectional attention, no padding mask.Task outputImage vector768Class matrix3 × 768MatMul cosine similarity3 scoresScale and add learned biasexp(logit_scale) × cosine + logit_biasPostprocess: softmax by default; optional multi_label=True applies sigmoid.Image vector: task outputText vector: task outputAttention pooling headLearned probe1 × 768Cross-attentionQ: probe; K/V: 256 image tokensLayerNorm1 × 768Linear768 to 3072GELU (tanh)1 × 3072Linear3072 to 768+Select token 0768Pooling cross-attentionQuery input1 × 768Key/value input256 × 768Linear Q768 to 768Reshape heads12 × 1 × 64Linear K768 to 768Reshape heads12 × 256 × 64Linear V768 to 768Reshape heads12 × 256 × 64MatMul Q K-transpose12 × 1 × 256ScaleDivide by sqrt(64)Softmax over keys12 × 1 × 256MatMul attention × V12 × 1 × 64Merge heads1 × 768Linear output768 to 768Vision encoder blockInput 256 × 768LayerNorm256 × 768Multi-head self-attention12 heads+LayerNorm256 × 768Linear768 to 3072GELU (tanh)256 × 3072Linear3072 to 768+Output 256 × 768Vision self-attentionQuery input256 × 768Key/value input256 × 768Linear Q768 to 768Reshape heads12 × 256 × 64Linear K768 to 768Reshape heads12 × 256 × 64Linear V768 to 768Reshape heads12 × 256 × 64MatMul Q K-transpose12 × 256 × 256ScaleDivide by sqrt(64)Softmax over keys12 × 256 × 256MatMul attention × V12 × 256 × 64Merge heads256 × 768Linear output768 to 768Text encoder blockInput 64 × 768LayerNorm64 × 768Multi-head self-attention12 heads+LayerNorm64 × 768Linear768 to 3072GELU (tanh)64 × 3072Linear3072 to 768+Output 64 × 768Text self-attentionQuery input64 × 768Key/value input64 × 768Linear Q768 to 768Reshape heads12 × 64 × 64Linear K768 to 768Reshape heads12 × 64 × 64Linear V768 to 768Reshape heads12 × 64 × 64MatMul Q K-transpose12 × 64 × 64ScaleDivide by sqrt(64)Softmax over keys12 × 64 × 64MatMul attention × V12 × 64 × 64Merge heads64 × 768Linear output768 to 768Variant valuesSizeSPNE = DnhMHead widthb16256162567681212307264so400m3841472911522716430472S: image size. P: patch size. N: image tokens. E/D: tower/output width. n: repeats in each tower. h: heads. M: MLP width.Source: libreyolo/models/siglip2/nn.py. Revision a4d0ecc9e17f.libreyolo.com