pub struct SamConfig {
pub in_chans: usize,
pub img_size: usize,
pub patch_size: usize,
pub embed_dim: usize,
pub enc_depth: usize,
pub enc_heads: usize,
pub enc_mlp_ratio: usize,
pub dec_depth: usize,
pub dec_heads: usize,
pub dec_mlp_dim: usize,
pub n_mask: usize,
}Expand description
SAM hyper-parameters.
Fields§
§in_chans: usizeInput image channels.
img_size: usizeSquare input size.
patch_size: usizePatch size of the image encoder.
embed_dim: usizeEmbedding dimension (shared across encoder / prompt / decoder).
enc_depth: usizeEncoder transformer depth.
enc_heads: usizeEncoder attention heads.
enc_mlp_ratio: usizeEncoder MLP ratio.
dec_depth: usizeDecoder two-way transformer depth.
dec_heads: usizeDecoder attention heads.
dec_mlp_dim: usizeDecoder MLP hidden dimension.
n_mask: usizeNumber of output mask tokens.
Implementations§
Source§impl SamConfig
impl SamConfig
Sourcepub fn new(
in_chans: usize,
img_size: usize,
patch_size: usize,
embed_dim: usize,
enc_depth: usize,
enc_heads: usize,
enc_mlp_ratio: usize,
dec_depth: usize,
dec_heads: usize,
dec_mlp_dim: usize,
n_mask: usize,
) -> VisionResult<Self>
pub fn new( in_chans: usize, img_size: usize, patch_size: usize, embed_dim: usize, enc_depth: usize, enc_heads: usize, enc_mlp_ratio: usize, dec_depth: usize, dec_heads: usize, dec_mlp_dim: usize, n_mask: usize, ) -> VisionResult<Self>
Create and validate a configuration.
§Errors
VisionError::InvalidEmbedDimifembed_dimis 0 or odd.VisionError::InvalidPatchSizeifpatch_sizedoes not divideimg_size.VisionError::HeadDimMismatchif a head count does not divideembed_dim.VisionError::EmptyInputifn_mask == 0.
Trait Implementations§
impl StructuralPartialEq for SamConfig
Auto Trait Implementations§
impl Freeze for SamConfig
impl RefUnwindSafe for SamConfig
impl Send for SamConfig
impl Sync for SamConfig
impl Unpin for SamConfig
impl UnsafeUnpin for SamConfig
impl UnwindSafe for SamConfig
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