[Fix] Fix ut (#422)

* add register all modules

* add scope
This commit is contained in:
Yixiao Fang 2022-08-19 14:36:26 +08:00 committed by GitHub
parent c176fdad6e
commit 3c51e86d44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 53 additions and 3 deletions

View File

@ -94,7 +94,8 @@ class TestDenseCLHook(TestCase):
custom_hooks=[densecl_hook], custom_hooks=[densecl_hook],
default_hooks=dict(logger=None), default_hooks=dict(logger=None),
log_processor=dict(window_size=1), log_processor=dict(window_size=1),
experiment_name='test_densecl_hook') experiment_name='test_densecl_hook',
default_scope='mmselfsup')
runner.train() runner.train()

View File

@ -104,7 +104,8 @@ class TestSimSiamHook(TestCase):
custom_hooks=[simsiam_hook], custom_hooks=[simsiam_hook],
default_hooks=dict(logger=None), default_hooks=dict(logger=None),
log_processor=dict(window_size=1), log_processor=dict(window_size=1),
experiment_name='test_simsiam_hook') experiment_name='test_simsiam_hook',
default_scope='mmselfsup')
runner.train() runner.train()

View File

@ -107,7 +107,8 @@ class TestSwAVHook(TestCase):
custom_hooks=[swav_hook], custom_hooks=[swav_hook],
default_hooks=dict(logger=None), default_hooks=dict(logger=None),
log_processor=dict(window_size=1), log_processor=dict(window_size=1),
experiment_name='test_swav_hook') experiment_name='test_swav_hook',
default_scope='mmselfsup')
runner.train() runner.train()

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models.algorithms.barlowtwins import BarlowTwins from mmselfsup.models.algorithms.barlowtwins import BarlowTwins
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',

View File

@ -7,7 +7,9 @@ import torch
from mmselfsup.models.algorithms.byol import BYOL from mmselfsup.models.algorithms.byol import BYOL
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',
depth=18, depth=18,

View File

@ -7,6 +7,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms import CAE from mmselfsup.models.algorithms import CAE
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
# model settings # model settings
backbone = dict(type='CAEViT', arch='b', patch_size=16, init_values=0.1) backbone = dict(type='CAEViT', arch='b', patch_size=16, init_values=0.1)

View File

@ -8,6 +8,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms import DeepCluster from mmselfsup.models.algorithms import DeepCluster
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
num_classes = 5 num_classes = 5
with_sobel = True, with_sobel = True,

View File

@ -9,6 +9,9 @@ import torch
import mmselfsup import mmselfsup
from mmselfsup.models.algorithms.densecl import DenseCL from mmselfsup.models.algorithms.densecl import DenseCL
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
queue_len = 32 queue_len = 32
feat_dim = 2 feat_dim = 2

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models.algorithms.mae import MAE from mmselfsup.models.algorithms.mae import MAE
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict(type='MAEViT', arch='b', patch_size=16, mask_ratio=0.75) backbone = dict(type='MAEViT', arch='b', patch_size=16, mask_ratio=0.75)
neck = dict( neck = dict(

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models.algorithms import MoCo from mmselfsup.models.algorithms import MoCo
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
queue_len = 32 queue_len = 32
feat_dim = 2 feat_dim = 2

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models import MoCoV3 from mmselfsup.models import MoCoV3
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='MoCoV3ViT', type='MoCoV3ViT',

View File

@ -8,6 +8,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms import NPID from mmselfsup.models.algorithms import NPID
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',

View File

@ -8,6 +8,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms import ODC from mmselfsup.models.algorithms import ODC
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
num_classes = 5 num_classes = 5
backbone = dict( backbone = dict(

View File

@ -7,6 +7,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms.relative_loc import RelativeLoc from mmselfsup.models.algorithms.relative_loc import RelativeLoc
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',

View File

@ -8,6 +8,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms.rotation_pred import RotationPred from mmselfsup.models.algorithms.rotation_pred import RotationPred
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models.algorithms.simclr import SimCLR from mmselfsup.models.algorithms.simclr import SimCLR
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',

View File

@ -7,6 +7,9 @@ from mmengine.data import InstanceData
from mmselfsup.models.algorithms import SimMIM from mmselfsup.models.algorithms import SimMIM
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
@pytest.mark.skipif(platform.system() == 'Windows', reason='Windows mem limit') @pytest.mark.skipif(platform.system() == 'Windows', reason='Windows mem limit')

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models.algorithms import SimSiam from mmselfsup.models.algorithms import SimSiam
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
backbone = dict( backbone = dict(
type='ResNet', type='ResNet',

View File

@ -7,6 +7,9 @@ import torch
from mmselfsup.models.algorithms.swav import SwAV from mmselfsup.models.algorithms.swav import SwAV
from mmselfsup.structures import SelfSupDataSample from mmselfsup.structures import SelfSupDataSample
from mmselfsup.utils import register_all_modules
register_all_modules()
nmb_crops = [2, 6] nmb_crops = [2, 6]
backbone = dict( backbone = dict(