Skip to main content

sam2_memory_encoder_forward

Function sam2_memory_encoder_forward 

Source
pub fn sam2_memory_encoder_forward(
    w: &mut Sam2MemoryEncoderWeights,
    pix_feat: &[f32],
    masks: &[f32],
    pix_h: usize,
    pix_w: usize,
    skip_mask_sigmoid: bool,
) -> Result<Sam2MemoryEncoderOutput, Error>
Expand description

Run the SAM 2 memory encoder.

pix_feat: stride-16 features [in_dim, h, w] (typically 256×64×64 from the FpnNeck level 2). masks: mask logits [1, H_full, W_full] (or sigmoid probs, with skip_mask_sigmoid=true). H_full = W_full = SAM2_IMG_SIZE (1024). After MaskDownSampler the masks are at stride total_stride=16, giving shape [in_dim, h, w] matching pix_feat.