Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ci #9647

Merged
merged 1 commit into from
Jan 19, 2023
Merged

fix ci #9647

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mmdet/models/detectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from .atss import ATSS
from .autoassign import AutoAssign
from .base import BaseDetector
from .boxinst import BoxInst
from .base_detr import DetectionTransformer
from .boxinst import BoxInst
from .cascade_rcnn import CascadeRCNN
from .centernet import CenterNet
from .condinst import CondInst
Expand Down
4 changes: 2 additions & 2 deletions tests/test_models/test_detectors/test_conditional_detr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from mmengine.structures import InstanceData

from mmdet.models import build_detector
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmdet.testing import get_detector_cfg
from mmdet.utils import register_all_modules
Expand Down Expand Up @@ -32,7 +32,7 @@ def test_conditional_detr_head_loss(self):
config = get_detector_cfg(
'conditional_detr/conditional-detr_r50_8xb2-50e_coco.py')

model = build_detector(config)
model = MODELS.build(config)
model.init_weights()
random_image = torch.rand(1, 3, s, s)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_models/test_detectors/test_dab_detr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from mmengine.structures import InstanceData

from mmdet.models import build_detector
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmdet.testing import get_detector_cfg
from mmdet.utils import register_all_modules
Expand All @@ -31,7 +31,7 @@ def test_dab_detr_head_loss(self):

config = get_detector_cfg('dab_detr/dab-detr_r50_8xb2-50e_coco.py')

model = build_detector(config)
model = MODELS.build(config)
model.init_weights()
random_image = torch.rand(1, 3, s, s)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_models/test_detectors/test_deformable_detr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from mmengine.structures import InstanceData

from mmdet.models import build_detector
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmdet.testing import get_detector_cfg
from mmdet.utils import register_all_modules
Expand Down Expand Up @@ -41,7 +41,7 @@ def test_deformable_detr_head_loss(self):
]

for config in configs:
model = build_detector(config)
model = MODELS.build(config)
model.init_weights()
random_image = torch.rand(1, 3, s, s)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_models/test_detectors/test_detr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from mmengine.structures import InstanceData

from mmdet.models import build_detector
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmdet.testing import get_detector_cfg
from mmdet.utils import register_all_modules
Expand All @@ -31,7 +31,7 @@ def test_detr_head_loss(self):

config = get_detector_cfg('detr/detr_r50_8xb2-150e_coco.py')

model = build_detector(config)
model = MODELS.build(config)
model.init_weights()
random_image = torch.rand(1, 3, s, s)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_models/test_detectors/test_dino.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from mmengine.structures import InstanceData

from mmdet.models import build_detector
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmdet.testing import get_detector_cfg
from mmdet.utils import register_all_modules
Expand All @@ -30,7 +30,7 @@ def test_dino_head_loss(self):
configs = [get_detector_cfg('dino/dino-4scale_r50_8xb2-12e_coco.py')]

for config in configs:
model = build_detector(config)
model = MODELS.build(config)
model.init_weights()
random_image = torch.rand(1, 3, s, s)

Expand Down
18 changes: 9 additions & 9 deletions tests/test_models/test_detectors/test_maskformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from parameterized import parameterized

from mmdet.models import build_detector
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmdet.testing._utils import demo_mm_inputs, get_detector_cfg
from mmdet.utils import register_all_modules
Expand Down Expand Up @@ -49,15 +49,15 @@ def _create_model_cfg(self):

def test_init(self):
model_cfg = self._create_model_cfg()
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)
detector.init_weights()
assert detector.backbone
assert detector.panoptic_head

@parameterized.expand([('cpu', ), ('cuda', )])
def test_forward_loss_mode(self, device):
model_cfg = self._create_model_cfg()
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)

if device == 'cuda' and not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
Expand All @@ -77,7 +77,7 @@ def test_forward_loss_mode(self, device):
@parameterized.expand([('cpu', ), ('cuda', )])
def test_forward_predict_mode(self, device):
model_cfg = self._create_model_cfg()
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)
if device == 'cuda' and not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
detector = detector.to(device)
Expand All @@ -98,7 +98,7 @@ def test_forward_predict_mode(self, device):
@parameterized.expand([('cpu', ), ('cuda', )])
def test_forward_tensor_mode(self, device):
model_cfg = self._create_model_cfg()
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)
if device == 'cuda' and not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
detector = detector.to(device)
Expand Down Expand Up @@ -153,7 +153,7 @@ def _create_model_cfg(self, cfg_path):
def test_init(self):
model_cfg = self._create_model_cfg(
'mask2former/mask2former_r50_8xb2-lsj-50e_coco-panoptic.py')
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)
detector.init_weights()
assert detector.backbone
assert detector.panoptic_head
Expand All @@ -168,7 +168,7 @@ def test_forward_loss_mode(self, device, cfg_path):
print(device, cfg_path)
with_semantic = 'panoptic' in cfg_path
model_cfg = self._create_model_cfg(cfg_path)
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)

if device == 'cuda' and not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
Expand All @@ -194,7 +194,7 @@ def test_forward_loss_mode(self, device, cfg_path):
def test_forward_predict_mode(self, device, cfg_path):
with_semantic = 'panoptic' in cfg_path
model_cfg = self._create_model_cfg(cfg_path)
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)
if device == 'cuda' and not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
detector = detector.to(device)
Expand All @@ -221,7 +221,7 @@ def test_forward_predict_mode(self, device, cfg_path):
def test_forward_tensor_mode(self, device, cfg_path):
with_semantic = 'panoptic' in cfg_path
model_cfg = self._create_model_cfg(cfg_path)
detector = build_detector(model_cfg)
detector = MODELS.build(model_cfg)
if device == 'cuda' and not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
detector = detector.to(device)
Expand Down