pub struct Sam2MemoryEncoderConfig {Show 15 fields
pub in_dim: usize,
pub out_dim: usize,
pub mask_downsampler_kernel: usize,
pub mask_downsampler_stride: usize,
pub mask_downsampler_padding: usize,
pub mask_downsampler_total_stride: usize,
pub fuser_num_layers: usize,
pub fuser_dim: usize,
pub fuser_kernel: usize,
pub fuser_padding: usize,
pub fuser_layer_scale_init_value: f32,
pub fuser_use_dwconv: bool,
pub fuser_input_projection: bool,
pub pe_num_pos_feats: usize,
pub pe_temperature: f32,
}Expand description
Memory-encoder configuration. Mirrors
sam2/modeling/memory_encoder.py::MemoryEncoder + its
MaskDownSampler and Fuser. Defaults match every published
sam2_hiera_*.yaml memory_encoder: block.
Fields§
§in_dim: usizeInput feature dim from the FpnNeck stride-16 level.
out_dim: usizeOutput memory token dim (smaller than in_dim in published
configs: 64 vs 256, so memory bank tokens are cheap to store).
mask_downsampler_kernel: usizeMaskDownSampler: per-step kernel/stride/padding + total stride.
total_stride must be a power of stride; reference uses
kernel=3 stride=2 padding=1 total=16 → 4 down-sampling levels.
mask_downsampler_stride: usize§mask_downsampler_padding: usize§mask_downsampler_total_stride: usize§fuser_num_layers: usizeFuser: num_layers × CXBlock(dim, kernel, padding, ls_init).
fuser_dim: usize§fuser_kernel: usize§fuser_padding: usize§fuser_layer_scale_init_value: f32§fuser_use_dwconv: bool§fuser_input_projection: bool§pe_num_pos_feats: usizeMemory-encoder output PE: num_pos_feats * 2 is the channel
count of the emitted position encoding.
pe_temperature: f32Trait Implementations§
Source§impl Clone for Sam2MemoryEncoderConfig
impl Clone for Sam2MemoryEncoderConfig
Source§fn clone(&self) -> Sam2MemoryEncoderConfig
fn clone(&self) -> Sam2MemoryEncoderConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Sam2MemoryEncoderConfig
impl Debug for Sam2MemoryEncoderConfig
Source§impl Default for Sam2MemoryEncoderConfig
impl Default for Sam2MemoryEncoderConfig
Source§fn default() -> Sam2MemoryEncoderConfig
fn default() -> Sam2MemoryEncoderConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Sam2MemoryEncoderConfig
impl RefUnwindSafe for Sam2MemoryEncoderConfig
impl Send for Sam2MemoryEncoderConfig
impl Sync for Sam2MemoryEncoderConfig
impl Unpin for Sam2MemoryEncoderConfig
impl UnsafeUnpin for Sam2MemoryEncoderConfig
impl UnwindSafe for Sam2MemoryEncoderConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more