EdgeTAM edge
Fit diagram
Read at 100%
Clear selection
Download SVG
Download PNG
Click a block to read its description, or select it with Tab and Enter.
EdgeTAM edge
Image segmentation, 1024 × 1024 input, one box, multimask output. RepViT backend boundary; verified prompt and decoder internals.
LibreYOLO
EdgeTAM edge
Image segmentation, 1024 × 1024 input, one box, multimask output. RepViT backend boundary; verified prompt and decoder internals.
Image encoder interface
RGB input
3 × 1,024 × 1,024
Bilinear square resize
1,024 × 1,024, ImageNet normalization
RepViT-m1 backend
External timm feature extractor
Four backbone feature maps
48, 96, 192, 384 channels
Image feature pyramid
Three independent image-head feature outputs
High-res s0 projection
32 × 256 × 256
High-res s1 projection
64 × 128 × 128
Main image embedding
256 × 64 × 64, add no-memory vector
RepViT internal operators are not present
in this source checkout or installed runtime.
Box prompt encoder
One box
2 corner coordinates × 2
Shift pixel centers
Add 0.5 to x and y
Normalize coordinates
Divide by 1024, map to [-1,1]
MatMul random Fourier matrix
2 coords to 128 frequencies
Multiply by 2 pi
2 × 128
Sin
2 × 128
Cos
2 × 128
Concat sin and cos
2 × 256
Corner type
2 learned × 256
+
Sparse prompt embeddings
2 × 256
Learned no-mask embedding
Broadcast to 256 × 64 × 64
Selected input: one box, no mask prompt.
Points use the same Fourier encoding, plus
positive/negative or not-a-point embeddings.
Dense image position: this encoding evaluated
on the centers of the 64 × 64 feature grid.
Mask decoder inputs
Image embedding
256 × 64 × 64
Dense prompt
256 × 64 × 64
+
Flatten image features
4,096 × 256
Learned output tokens
Object + IoU + 4 mask = 6 × 256
Sparse prompts
2 × 256
Concat output and prompt tokens
8 × 256
Two-way block 1
8 queries, 4,096 image tokens
Two-way block 2
8 queries, 4,096 image tokens
Final token-to-image attention
Q+Q0, K+P, V=updated image
+
Final LayerNorm on queries
8 × 256
Q0 is the original token sequence.
P is fixed Fourier image position.
4,096 image tokens feed block 1 keys/values.
Masks and quality outputs
Updated query tokens
1 IoU + 4 mask tokens + 1 object token
Updated image tokens
4,096 × 256
Reshape to image
256 × 64 × 64
ConvTranspose2d 2×2 / 2
256 to 64; 64 × 128 × 128
Channel LayerNorm
64 × 128 × 128
GELU
64 × 128 × 128
ConvTranspose2d 2×2 / 2
64 to 32; 32 × 256 × 256
GELU
32 × 256 × 256
Select four mask tokens
4 × 256
Four independent Linear layers
Each 256 to 256
ReLU
4 × 256
Four independent Linear layers
Each 256 to 256
ReLU
4 × 256
Four independent Linear layers
Each 256 to 32
MatMul mask coefficients × upscaled image
4 × 32 times 32 × 65,536; reshape to 4 × 256 × 256
Select masks 1 to 3
3 × 256 × 256
Mask logits are resized to the input canvas,
then unpadded/resized to the original image.
multimask_output=True is drawn.
False selects mask/score 0 instead.
Object token: Linear 256, ReLU, Linear 256,
ReLU, Linear 1 produces object-score logit.
+
High-res feature s1
64 × 128 × 128
+
High-res feature s0
32 × 256 × 256
Select IoU token 1
256
Linear
256 to 256
ReLU
256
Linear
256 to 256
ReLU
256
Linear
256 to 4
Sigmoid
4 mask-quality scores
Select scores 1 to 3
3 quality scores
Select object token 0
256
Linear
256 to 256
ReLU
256
Linear
256 to 256
ReLU
256
Linear
256 to 1 object-score logit
Two-way block 1
Query state
8 × 256
Image state
4,096 × 256
Token self-attention
8 heads, 32 channels per head
First self-attention has no PE or residual.
LayerNorm
8 × 256
Original tokens Q0
8 × 256
+
Image position P
4,096 × 256
+
Token-to-image attention
Q=8, K/V=4,096; 8 heads × 16
+
LayerNorm
8 × 256
Linear
256 to 2,048
ReLU
8 × 2,048
Linear
2,048 to 256
+
LayerNorm
8 × 256
Original tokens Q0
8 × 256
+
Image-to-token attention
Q=4,096, K/V=8; 8 heads × 16
+
LayerNorm on image state
4,096 × 256
Updated queries: 8 × 256
Two-way block 2
Query state
8 × 256
Image state
4,096 × 256
Token self-attention
8 heads, 32 channels per head
Original tokens Q0
8 × 256
+
Self-attention Q/K include Q0.
+
LayerNorm
8 × 256
Original tokens Q0
8 × 256
+
Image position P
4,096 × 256
+
Token-to-image attention
Q=8, K/V=4,096; 8 heads × 16
+
LayerNorm
8 × 256
Linear
256 to 2,048
ReLU
8 × 2,048
Linear
2,048 to 256
+
LayerNorm
8 × 256
Original tokens Q0
8 × 256
+
Image-to-token attention
Q=4,096, K/V=8; 8 heads × 16
+
LayerNorm on image state
4,096 × 256
Updated queries: 8 × 256
Token self-attention
Query input
8 × 256
Key/value input
8 × 256
Linear Q
256 to 256
Reshape heads
8 × 8 × 32
Linear K
256 to 256
Reshape heads
8 × 8 × 32
Linear V
256 to 256
Reshape heads
8 × 8 × 32
MatMul Q K-transpose
8 × 8 × 8
Scale
Divide by sqrt(32)
Softmax over keys
8 × 8 × 8
MatMul attention × V
8 × 8 × 32
Merge heads
8 × 256
Linear output
256 to 256
Token-to-image attention
Query input
8 × 256
Key/value input
4096 × 256
Linear Q
256 to 128
Reshape heads
8 × 8 × 16
Linear K
256 to 128
Reshape heads
8 × 4096 × 16
Linear V
256 to 128
Reshape heads
8 × 4096 × 16
MatMul Q K-transpose
8 × 8 × 4096
Scale
Divide by sqrt(16)
Softmax over keys
8 × 8 × 4096
MatMul attention × V
8 × 8 × 16
Merge heads
8 × 128
Linear output
128 to 256
Image-to-token attention
Query input
4096 × 256
Key/value input
8 × 256
Linear Q
256 to 128
Reshape heads
8 × 4096 × 16
Linear K
256 to 128
Reshape heads
8 × 8 × 16
Linear V
256 to 128
Reshape heads
8 × 8 × 16
MatMul Q K-transpose
8 × 4096 × 8
Scale
Divide by sqrt(16)
Softmax over keys
8 × 4096 × 8
MatMul attention × V
8 × 4096 × 16
Merge heads
4096 × 128
Linear output
128 to 256
Image-mode decoder
Q0: original eight output/prompt tokens; P: Fourier image position.
Final cross-attention uses the token-to-image equation, with residual and LayerNorm.
Features s0 and s1 are computed once, then added at the two upscaling steps.
The no-memory embedding is added to the 64×64 image feature.
This is image inference. Video memory attention and memory encoder do not run.
multimask_output=True selects mask/IoU slots 1, 2 and 3.
Single-mask eval can fall back to the best multimask using stability thresholds.
Image feature pyramid
Stage 1 map
48 × 256 × 256
Lateral Conv2d 1×1
48 to 256, bias=True
High-res Conv2d 1×1
256 to 32
s0: 32 × 256 × 256
Stage 2 map
96 × 128 × 128
Lateral Conv2d 1×1
96 to 256, bias=True
High-res Conv2d 1×1
256 to 64
s1: 64 × 128 × 128
Stage 3 map
192 × 64 × 64
Lateral Conv2d 1×1
192 to 256, bias=True
+
Add no-memory embedding
256 × 64 × 64
Main image embedding: 256 × 64 × 64
Stage 4 map
384 × 32 × 32
Lateral Conv2d 1×1
384 to 256, bias=True
Nearest upsample ×2
256 × 64 × 64
Only the 32×32 to 64×64 top-down addition runs for fpn_top_down_levels=[2,3].
The 128×128 and 256×256 lateral outputs remain independent. The 32×32 output is not passed to the mask decoder.
Backend verification boundary
The library selects repvit_m1 through an embedded TimmWrapperConfig.
Its configured backbone widths are 48, 96, 192 and 384.
The RepViT architecture is not inferred from those four numbers.
Prompt encoder, two-way decoder, output MLPs and high-resolution additions are fully drawn.
The installed Apache-2.0 EdgeTamMaskDecoder passed a no-weight meta forward.
Image mode does not run the video memory encoder, memory attention or perceiver resampler.
Configuration source: LibreYOLO/LibreEdgeTAM, revision c81728930ecc.
Source: libreyolo/models/sam/edgetam.py. Revision a4d0ecc9e17f.
libreyolo.com