pub struct SamEncoderConfig {
pub encoder_kind: EncoderKind,
pub embed_dim: usize,
pub depth: usize,
pub num_heads: usize,
pub global_attn_indexes: Vec<usize>,
pub window_size: usize,
pub use_rel_pos: bool,
pub use_abs_pos: bool,
pub qkv_bias: bool,
pub layer_norm_eps: f64,
pub out_chans: usize,
}Expand description
Encoder configuration — ViT-B/L/H or TinyViT variants.
Fields§
§encoder_kind: EncoderKind§embed_dim: usize§depth: usize§num_heads: usize§global_attn_indexes: Vec<usize>Per-block flag: blocks listed here use global attention
(no windowing); all others use windowed attention with
window_size.
window_size: usize§use_rel_pos: bool§use_abs_pos: bool§qkv_bias: bool§layer_norm_eps: f64LayerNorm eps used throughout the encoder.
out_chans: usizeChannel count of the final image embeddings (after the neck).
Implementations§
Source§impl SamEncoderConfig
impl SamEncoderConfig
Sourcepub fn vit_b() -> SamEncoderConfig
pub fn vit_b() -> SamEncoderConfig
SAM ViT-B (default, ~91 M params).
Sourcepub fn vit_l() -> SamEncoderConfig
pub fn vit_l() -> SamEncoderConfig
SAM ViT-L (~308 M params).
Sourcepub fn vit_h() -> SamEncoderConfig
pub fn vit_h() -> SamEncoderConfig
SAM ViT-H (~632 M params).
pub fn head_dim(&self) -> usize
pub fn num_patches_per_side(&self) -> usize
Trait Implementations§
Source§impl Clone for SamEncoderConfig
impl Clone for SamEncoderConfig
Source§fn clone(&self) -> SamEncoderConfig
fn clone(&self) -> SamEncoderConfig
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 SamEncoderConfig
impl Debug for SamEncoderConfig
Source§impl<'de> Deserialize<'de> for SamEncoderConfig
impl<'de> Deserialize<'de> for SamEncoderConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SamEncoderConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SamEncoderConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SamEncoderConfig
impl RefUnwindSafe for SamEncoderConfig
impl Send for SamEncoderConfig
impl Sync for SamEncoderConfig
impl Unpin for SamEncoderConfig
impl UnsafeUnpin for SamEncoderConfig
impl UnwindSafe for SamEncoderConfig
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
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