CLIPGenerator¶
- class mmpretrain.models.selfsup.CLIPGenerator(tokenizer_path)[源代码]¶
Get the features and attention from the last layer of CLIP.
This module is used to generate target features in masked image modeling.
- 参数:
tokenizer_path (str) – The path of the checkpoint of CLIP.
- forward(x)[源代码]¶
Get the features and attention from the last layer of CLIP.
- 参数:
x (torch.Tensor) – The input image, which is of shape (N, 3, H, W).
- 返回:
The features and attention from the last layer of CLIP, which are of shape (N, L, C) and (N, L, L), respectively.
- 返回类型:
Tuple[torch.Tensor, torch.Tensor]