cyto_dl.nn.vits.blocks.patchify.patchify module#

class cyto_dl.nn.vits.blocks.patchify.patchify.Patchify(patch_size: List[int], emb_dim: int, n_patches: List[int], spatial_dims: int = 3, context_pixels: List[int] = [0, 0, 0], input_channels: int = 1, tasks: List[str] | None = [], learnable_pos_embedding: bool = True)[source]#

Bases: PatchifyBase

Class for converting images to a masked sequence of patches with positional embeddings.

create_img2token()[source]#

Rearranges the image tensor to a sequence of patches.

extract_visible_tokens(tokens, forward_indexes, n_visible_patches)[source]#
get_mask_args(mask_ratio)[source]#
property img2token#