Initial feature extraction using overlapped convolutions. Unlike standard patch embeddings that use non-overlapping patches, this approach maintains spatial continuity through 3x3 convolutions. Args: spatial_dims: Number of spatial dimensions (2D or 3D) in_channels: Numb
| 59 | |
| 60 | |
| 61 | class OverlapPatchEmbed(Convolution): |
| 62 | """Initial feature extraction using overlapped convolutions. |
| 63 | Unlike standard patch embeddings that use non-overlapping patches, |
| 64 | this approach maintains spatial continuity through 3x3 convolutions. |
| 65 | |
| 66 | Args: |
| 67 | spatial_dims: Number of spatial dimensions (2D or 3D) |
| 68 | in_channels: Number of input channels |
| 69 | embed_dim: Dimension of embedded features. Defaults to 48. |
| 70 | bias: Whether to use bias in convolution layer. Defaults to False. |
| 71 | """ |
| 72 | |
| 73 | def __init__(self, spatial_dims: int, in_channels: int = 3, embed_dim: int = 48, bias: bool = False): |
| 74 | super().__init__( |
| 75 | spatial_dims=spatial_dims, |
| 76 | in_channels=in_channels, |
| 77 | out_channels=embed_dim, |
| 78 | kernel_size=3, |
| 79 | strides=1, |
| 80 | padding=1, |
| 81 | bias=bias, |
| 82 | conv_only=True, |
| 83 | ) |
| 84 | |
| 85 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 86 | x = super().forward(x) |
| 87 | return x |
| 88 | |
| 89 | |
| 90 | class Restormer(nn.Module): |
no outgoing calls
searching dependent graphs…