Shortcuts

Note

You are reading the documentation for MMSelfSup 0.x, which will soon be deprecated by the end of 2022. We recommend you upgrade to MMSelfSup 1.0.0rc versions to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check out the changelog, code and documentation of MMSelfSup 1.0.0rc for more details.

Source code for mmselfsup.models.necks.simmim_neck

# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import BaseModule

from ..builder import NECKS


[docs]@NECKS.register_module() class SimMIMNeck(BaseModule): """Pre-train Neck For SimMIM. This neck reconstructs the original image from the shrunk feature map. Args: in_channels (int): Channel dimension of the feature map. encoder_stride (int): The total stride of the encoder. """ def __init__(self, in_channels: int, encoder_stride: int) -> None: super(SimMIMNeck, self).__init__() self.decoder = nn.Sequential( nn.Conv2d( in_channels=in_channels, out_channels=encoder_stride**2 * 3, kernel_size=1), nn.PixelShuffle(encoder_stride), )
[docs] def forward(self, x: torch.Tensor) -> torch.Tensor: x = self.decoder(x) return x
Read the Docs v: 0.x
Versions
latest
stable
1.x
dev-1.x
0.x
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.