pub struct MaskHead { /* private fields */ }Expand description
Mask prediction head for instance segmentation (Mask R-CNN style).
Takes RoI-pooled features [N, H, W, C] and produces binary masks
[N, mask_h, mask_w, num_classes] via a series of conv layers + upsample.
Implementations§
Source§impl MaskHead
impl MaskHead
Sourcepub fn new(
in_channels: usize,
channels: usize,
num_classes: usize,
mask_size: usize,
num_conv: usize,
) -> Result<Self, ModelError>
pub fn new( in_channels: usize, channels: usize, num_classes: usize, mask_size: usize, num_conv: usize, ) -> Result<Self, ModelError>
Create a mask head with num_conv intermediate conv layers.
pub fn num_classes(&self) -> usize
pub fn mask_size(&self) -> usize
pub fn channels(&self) -> usize
Sourcepub fn forward_inference(
&self,
roi_features: &Tensor,
) -> Result<Tensor, ModelError>
pub fn forward_inference( &self, roi_features: &Tensor, ) -> Result<Tensor, ModelError>
Forward pass: conv layers → ReLU → upsample → class prediction.
Trait Implementations§
impl StructuralPartialEq for MaskHead
Auto Trait Implementations§
impl Freeze for MaskHead
impl RefUnwindSafe for MaskHead
impl Send for MaskHead
impl Sync for MaskHead
impl Unpin for MaskHead
impl UnsafeUnpin for MaskHead
impl UnwindSafe for MaskHead
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