Depth Anything V2 S

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

Depth Anything V2 SRelative inverse depth, native eval, input 3 × 518 × 518. Shapes exclude batch.LibreYOLODepth Anything V2 SRelative inverse depth, native eval, input 3 × 518 × 518. Shapes exclude batch.DINOv2 image encoderRGB + ImageNet normalization3 × 518 × 518Conv2d patch embedding 14×143 to 384; stride14; 37 × 37 gridPrepend CLS + add learned positions1370 × 384; no register tokensTransformer blocks, n=3End at zero-based block 2; 6 headsLayerNorm; remove CLST1: 384 × 37 × 37Transformer blocks, n=3End at zero-based block 5; 6 headsLayerNorm; remove CLST2: 384 × 37 × 37Transformer blocks, n=3End at zero-based block 8; 6 headsLayerNorm; remove CLST3: 384 × 37 × 37Transformer blocks, n=3End at zero-based block 11; 6 headsLayerNorm; remove CLST4: 384 × 37 × 37Tap normalization does not replace the ongoing token stream.CLS is returned by the backbone but ignored by this DPT head.s/b/l use GELU MLP; g uses SwiGLU width4096.Learned position grid is already37×37 at this input size.All LayerScale parameters initialize to1.0.DPT adapters and fusionTap T1384 × 37 × 37Conv2d 1×1384 to 48ConvTranspose2d 4×4s4,p0; 48 channelsConv2d 3×348 to 64; 148 × 148; bias=FalseL164 chTap T2384 × 37 × 37Conv2d 1×1384 to 96ConvTranspose2d 2×2s2,p0; 96 channelsConv2d 3×396 to 64; 74 × 74; bias=FalseL264 chTap T3384 × 37 × 37Conv2d 1×1384 to 192Identity192 channelsConv2d 3×3192 to 64; 37 × 37; bias=FalseL364 chTap T4384 × 37 × 37Conv2d 1×1384 to 384Conv2d 3×3s2,p1; 384 channelsConv2d 3×3384 to 64; 19 × 19; bias=FalseL464 chFeatureFusionBlock 464 channels; output 37 × 37L464 channelsFeatureFusionBlock 364 channels; output 74 × 74L364 channelsFeatureFusionBlock 264 channels; output 148 × 148L264 channelsFeatureFusionBlock 164 channels; output 296 × 296L164 channelsL1...L4 are named continuations of the independent adapted feature maps.First fusion resizes to the exact next grid, including odd-grid rounding.Transformer blockInput tokens1370 × 384LayerNorm384 channels; epsilon1e-6Multihead self-attention6 heads; head width64LayerScale384 learned channel scalars+LayerNorm384 channels; epsilon1e-6Linear384 to 1536GELULinear1536 to 384LayerScale384 learned channel scalars+Output tokens1370 × 384Self-attention primitivesFused QKV linear384 to 1152; biases enabledSplit Q, K and V6 heads; 1370 tokens;64 channels/headQ × transpose(K) / 81370 × 1370 per headValues V64/headSoftmax over keysAttention weights × V6 heads;64 output channels/headConcat heads1370 × 384Output linear384 to 384No causal mask. Dropout and stochastic depth are inactive in eval.DPT output headConv2d 3×364 to 32; 296 × 296Bilinear resize518 × 518; align_corners=TrueConv2d 3×332 to32; s1,p1ReLUConv2d 1×132 to1ReLU + final ReLUNonnegative inverse depthRelative inverse depth1 × 518 × 518ResidualConvUnitInput64 channelsReLUConv2d 3×364 to 64; s1,p1,bias=TrueReLUConv2d 3×364 to 64; s1,p1,bias=True+No BatchNorm in these DPT fusion units.FeatureFusionBlock with lateral inputTop-down feature64 channelsLateral feature64 channelsResidualConvUnit64 channels+ResidualConvUnit64 channelsBilinear resizeTarget size shown at each occurrence; align_corners=TrueConv2d 1×164 to 64; bias=TrueDeepest block has no lateral input and skips the first RCU/add.Source: libreyolo/models/depth_anything/nn.py and model.py. Revision a4d0ecc9e17f.libreyolo.com