mirror of
https://github.com/open-mmlab/mmselfsup.git
synced 2025-06-03 14:59:38 +08:00
* [Feature]: Add MaskfeatMaskGenerator Pipeline * [Feature]: Add MaskFeatMaskGenerator Pipeline * [Feature]: Add Backbone of MaskFeat * [Feature]: Add HogLayerC for MaskFeat * [Feature]: Add Loss of MaskFeat * [Feature]: Add Head of MaskFeat * [Feature]: Add Algorithms of MaskFeat * [Feature]: Add Config of MaskFeat * [Fix] fix ut of MaskFeatMaskGenerator * refine configs * update * refactor to support hog generator * update config * update * update config and metafiel * update maskfeat model link * fix ut * refine codes * fix lint * refine docstring * refactor maskfeat head * update model links * fix ut * refine docstring * update model-index * using BEiTMaskGenerator * refine configs * update ut * fix lint Co-authored-by: fangyixiao18 <fangyx18@hotmail.com>
21 lines
582 B
Python
21 lines
582 B
Python
# Copyright (c) OpenMMLab. All rights reserved.
|
|
import platform
|
|
|
|
import pytest
|
|
import torch
|
|
|
|
from mmselfsup.models.backbones import MaskFeatViT
|
|
|
|
backbone = dict(arch='b', patch_size=16)
|
|
|
|
|
|
@pytest.mark.skipif(platform.system() == 'Windows', reason='Windows mem limit')
|
|
def test_maskfeat_vit():
|
|
maskfeat_backbone = MaskFeatViT(**backbone)
|
|
maskfeat_backbone.init_weights()
|
|
fake_inputs = torch.randn((2, 3, 224, 224))
|
|
fake_mask = torch.randn((2, 14, 14))
|
|
fake_outputs = maskfeat_backbone(fake_inputs, fake_mask)
|
|
|
|
assert list(fake_outputs.shape) == [2, 197, 768]
|