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: usize4 = 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_prediction_use_sigmoid: booliou_prediction_use_sigmoid flag (true in the published YAML).
use_object_pointer: boolSAM 2 emits an additional object-pointer token. Always true for the published video configs.
use_mlp_for_obj_ptr_proj: boolIf true, obj_ptr_proj is a 3-layer MLP; else a plain Linear.
True in every published config.
pred_obj_scores: boolPredict an object-score logit (whether an object is present). True in every published config.
pred_obj_scores_mlp: boolIf true, pred_obj_score_head is a 3-layer MLP; else a Linear.
True in every published config.
use_multimask_token_for_obj_ptr: boolWhen 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: boolUse the FpnNeck’s stride-4 + stride-8 features to refine the upscaled mask. True in every published config.
dynamic_multimask_via_stability: boolFall 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: f64Trait Implementations§
Source§impl Clone for Sam2DecoderConfig
impl Clone for Sam2DecoderConfig
Source§fn clone(&self) -> Sam2DecoderConfig
fn clone(&self) -> Sam2DecoderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Sam2DecoderConfig
impl Debug for Sam2DecoderConfig
Source§impl Default for Sam2DecoderConfig
impl Default for Sam2DecoderConfig
Source§fn default() -> Sam2DecoderConfig
fn default() -> Sam2DecoderConfig
Auto Trait Implementations§
impl Freeze for Sam2DecoderConfig
impl RefUnwindSafe for Sam2DecoderConfig
impl Send for Sam2DecoderConfig
impl Sync for Sam2DecoderConfig
impl Unpin for Sam2DecoderConfig
impl UnsafeUnpin for Sam2DecoderConfig
impl UnwindSafe for Sam2DecoderConfig
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
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>
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>
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