Skip to main content

Sam2DecoderConfig

Struct Sam2DecoderConfig 

Source
pub struct Sam2DecoderConfig {
Show 18 fields pub transformer_dim: usize, pub transformer_depth: usize, pub transformer_num_heads: usize, pub transformer_mlp_dim: usize, pub num_mask_tokens: usize, pub iou_head_depth: usize, pub iou_head_hidden_dim: usize, pub iou_prediction_use_sigmoid: bool, pub use_object_pointer: bool, pub use_mlp_for_obj_ptr_proj: bool, pub pred_obj_scores: bool, pub pred_obj_scores_mlp: bool, pub use_multimask_token_for_obj_ptr: bool, pub use_high_res_features: bool, pub dynamic_multimask_via_stability: bool, pub dynamic_multimask_stability_delta: f32, pub dynamic_multimask_stability_thresh: f32, pub layer_norm_eps: f64,
}
Expand description

Mask decoder configuration. Field names + defaults mirror sam2/modeling/sam/mask_decoder.py::MaskDecoder.__init__ and the published sam2_hiera_*.yaml model.sam_mask_decoder_extra_args.

Fields§

§transformer_dim: usize§transformer_depth: usize§transformer_num_heads: usize§transformer_mlp_dim: usize§num_mask_tokens: usize

4 = 1 best-mask token + 3 multimask tokens (num_multimask_outputs=3 in the YAML; total tokens = num_multimask_outputs + 1).

§iou_head_depth: usize§iou_head_hidden_dim: usize§iou_prediction_use_sigmoid: bool

iou_prediction_use_sigmoid flag (true in the published YAML).

§use_object_pointer: bool

SAM 2 emits an additional object-pointer token. Always true for the published video configs.

§use_mlp_for_obj_ptr_proj: bool

If true, obj_ptr_proj is a 3-layer MLP; else a plain Linear. True in every published config.

§pred_obj_scores: bool

Predict an object-score logit (whether an object is present). True in every published config.

§pred_obj_scores_mlp: bool

If true, pred_obj_score_head is a 3-layer MLP; else a Linear. True in every published config.

§use_multimask_token_for_obj_ptr: bool

When multimask is selected, use the three multimask tokens (rather than the best-mask token) for the object pointer. True in every published config.

§use_high_res_features: bool

Use the FpnNeck’s stride-4 + stride-8 features to refine the upscaled mask. True in every published config.

§dynamic_multimask_via_stability: bool

Fall back to the best multimask output when the single-mask token’s stability score is below threshold. True in every published video config (dynamic_multimask_via_stability=True).

§dynamic_multimask_stability_delta: f32§dynamic_multimask_stability_thresh: f32§layer_norm_eps: f64

Trait Implementations§

Source§

impl Clone for Sam2DecoderConfig

Source§

fn clone(&self) -> Sam2DecoderConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sam2DecoderConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Sam2DecoderConfig

Source§

fn default() -> Sam2DecoderConfig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V