pull/1875/merge
Ashutosh Singh 2024-11-01 14:45:56 +03:00 committed by GitHub
commit 4ce1fcecf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions
mmpretrain/models/necks

View File

@ -15,14 +15,18 @@ class SimMIMLinearDecoder(BaseModule):
Args: Args:
in_channels (int): Channel dimension of the feature map. in_channels (int): Channel dimension of the feature map.
encoder_stride (int): The total stride of the encoder. encoder_stride (int): The total stride of the encoder.
target_channels (int): Channel dimensions of original image.
""" """
def __init__(self, in_channels: int, encoder_stride: int) -> None: def __init__(self,
in_channels: int,
encoder_stride: int,
target_channels: int = 3) -> None:
super().__init__() super().__init__()
self.decoder = nn.Sequential( self.decoder = nn.Sequential(
nn.Conv2d( nn.Conv2d(
in_channels=in_channels, in_channels=in_channels,
out_channels=encoder_stride**2 * 3, out_channels=encoder_stride**2 * target_channels,
kernel_size=1), kernel_size=1),
nn.PixelShuffle(encoder_stride), nn.PixelShuffle(encoder_stride),
) )