ImageEncoderViT_FT
- class lightning_pose.models.backbones.vit_img_encoder.ImageEncoderViT_FT[source]
Bases:
ImageEncoderViTMethods Summary
forward(x)Define the computation performed at every call.
Methods Documentation
- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- __init__(img_size: int = 1024, finetune_img_size: int = 1024, patch_size: int = 16, in_chans: int = 3, embed_dim: int = 768, depth: int = 12, num_heads: int = 12, mlp_ratio: float = 4.0, out_chans: int = 256, qkv_bias: bool = True, norm_layer: ~typing.Type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.normalization.LayerNorm'>, act_layer: ~typing.Type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.GELU'>, use_abs_pos: bool = True, use_rel_pos: bool = False, rel_pos_zero_init: bool = True, window_size: int = 0, global_attn_indexes: ~typing.Tuple[int, ...] = ()) None[source]
- Parameters:
img_size (int) – Input image size of pretrained ViT backbone checkpoint.
finetune_img_size (int) – Input image size for lightning-pose training.
patch_size (int) – Patch size.
in_chans (int) – Number of input image channels.
embed_dim (int) – Patch embedding dimension.
depth (int) – Depth of ViT.
num_heads (int) – Number of attention heads in each ViT block.
mlp_ratio (float) – Ratio of mlp hidden dim to embedding dim.
qkv_bias (bool) – If True, add a learnable bias to query, key, value.
norm_layer (nn.Module) – Normalization layer.
act_layer (nn.Module) – Activation layer.
use_abs_pos (bool) – If True, use absolute positional embeddings.
use_rel_pos (bool) – If True, add relative positional embeddings to the attention map.
rel_pos_zero_init (bool) – If True, zero initialize relative positional parameters.
window_size (int) – Window size for window attention blocks.
global_attn_indexes (list) – Indexes for blocks using global attention.
- __new__(**kwargs)