SparKPretrainHead¶
- class mmpretrain.models.heads.SparKPretrainHead(loss, norm_pix=True, patch_size=32)[源代码]¶
Pre-training head for SparK.
- 参数:
- construct_target(target)[源代码]¶
Construct the reconstruction target.
In addition to splitting images into tokens, this module will also normalize the image according to
norm_pix
. :param target: Image with the shape of B x 3 x H x W :type target: torch.Tensor- 返回:
Tokenized images with the shape of B x L x C
- 返回类型:
- forward(pred, target, active_mask)[源代码]¶
Forward function of MAE head.
- 参数:
pred (torch.Tensor) – The reconstructed image.
target (torch.Tensor) – The target image.
active_mask (torch.Tensor) – The mask of the target image.
- 返回:
The reconstruction loss.
- 返回类型:
- patchify(imgs)[源代码]¶
Split images into non-overlapped patches.
- 参数:
imgs (torch.Tensor) – A batch of images, of shape B x C x H x W.
- 返回:
Patchified images. The shape is B x L x D.
- 返回类型: