Skip to main content

Sam2MaskDecoderWeights

Struct Sam2MaskDecoderWeights 

Source
pub struct Sam2MaskDecoderWeights {
Show 27 fields pub iou_token: Vec<f32>, pub mask_tokens: Vec<f32>, pub obj_score_token: Option<Vec<f32>>, pub transformer: Sam2TwoWayTransformerWeights, pub upscale_conv1_w: Vec<f32>, pub upscale_conv1_b: Vec<f32>, pub upscale_ln_g: Vec<f32>, pub upscale_ln_b: Vec<f32>, pub upscale_conv2_w: Vec<f32>, pub upscale_conv2_b: Vec<f32>, pub conv_s0_w: Option<Vec<f32>>, pub conv_s0_b: Option<Vec<f32>>, pub conv_s1_w: Option<Vec<f32>>, pub conv_s1_b: Option<Vec<f32>>, pub hyper_mlps: Vec<Sam2HypernetMlp>, pub iou_head: Sam2HypernetMlp, pub iou_use_sigmoid: bool, pub obj_score_head: Option<Sam2HypernetMlp>, pub obj_ptr_proj: Option<Sam2HypernetMlp>, pub transformer_dim: usize, pub num_mask_tokens: usize, pub use_high_res_features: bool, pub pred_obj_scores: bool, pub use_multimask_token_for_obj_ptr: bool, pub dynamic_multimask_via_stability: bool, pub dynamic_multimask_stability_delta: f32, pub dynamic_multimask_stability_thresh: f32,
}

Fields§

§iou_token: Vec<f32>§mask_tokens: Vec<f32>§obj_score_token: Option<Vec<f32>>

Optional object-score token, populated when pred_obj_scores=true.

§transformer: Sam2TwoWayTransformerWeights§upscale_conv1_w: Vec<f32>

ConvTranspose2d in=transformer_dim, out=transformer_dim/4, k=2, s=2.

§upscale_conv1_b: Vec<f32>§upscale_ln_g: Vec<f32>§upscale_ln_b: Vec<f32>§upscale_conv2_w: Vec<f32>

ConvTranspose2d in=transformer_dim/4, out=transformer_dim/8.

§upscale_conv2_b: Vec<f32>§conv_s0_w: Option<Vec<f32>>

Optional high-res fusion 1×1 convs.

  • conv_s0: stride-4 features → transformer_dim/8 channels
  • conv_s1: stride-8 features → transformer_dim/4 channels
§conv_s0_b: Option<Vec<f32>>§conv_s1_w: Option<Vec<f32>>§conv_s1_b: Option<Vec<f32>>§hyper_mlps: Vec<Sam2HypernetMlp>

num_mask_tokens × 3-layer ReLU MLPs producing transformer_dim/8 per mask token.

§iou_head: Sam2HypernetMlp

IoU prediction head: 3-layer ReLU MLP transformer_dim → iou_head_hidden_dim → iou_head_hidden_dim → num_mask_tokens.

§iou_use_sigmoid: bool

iou_prediction_use_sigmoid flag.

§obj_score_head: Option<Sam2HypernetMlp>

Optional object-score prediction head (3-layer MLP when the pred_obj_scores_mlp flag is set; otherwise a plain Linear).

§obj_ptr_proj: Option<Sam2HypernetMlp>

Optional object-pointer projection MLP. Reference shape: MLP(transformer_dim, transformer_dim, transformer_dim, 3) if use_mlp_for_obj_ptr_proj=True, otherwise Linear(...).

§transformer_dim: usize§num_mask_tokens: usize§use_high_res_features: bool§pred_obj_scores: bool§use_multimask_token_for_obj_ptr: bool§dynamic_multimask_via_stability: bool§dynamic_multimask_stability_delta: f32§dynamic_multimask_stability_thresh: f32

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> 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, 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