@@ -45,7 +45,7 @@ def _get_detector_cfg(fname):
45
45
def test_sparse_rcnn_forward ():
46
46
config_path = 'sparse_rcnn/sparse_rcnn_r50_fpn_1x_coco.py'
47
47
model = _get_detector_cfg (config_path )
48
- model [ 'pretrained' ] = None
48
+ model . backbone . init_cfg = None
49
49
from mmdet .models import build_detector
50
50
detector = build_detector (model )
51
51
detector .init_weights ()
@@ -54,8 +54,6 @@ def test_sparse_rcnn_forward():
54
54
imgs = mm_inputs .pop ('imgs' )
55
55
img_metas = mm_inputs .pop ('img_metas' )
56
56
# Test forward train with non-empty truth batch
57
- detector = detector
58
- imgs = imgs
59
57
detector .train ()
60
58
gt_bboxes = mm_inputs ['gt_bboxes' ]
61
59
gt_bboxes = [item for item in gt_bboxes ]
@@ -75,7 +73,6 @@ def test_sparse_rcnn_forward():
75
73
# Test forward train with an empty truth batch
76
74
mm_inputs = _demo_mm_inputs (input_shape , num_items = [0 ])
77
75
imgs = mm_inputs .pop ('imgs' )
78
- imgs = imgs
79
76
img_metas = mm_inputs .pop ('img_metas' )
80
77
gt_bboxes = mm_inputs ['gt_bboxes' ]
81
78
gt_bboxes = [item for item in gt_bboxes ]
@@ -105,7 +102,7 @@ def test_sparse_rcnn_forward():
105
102
106
103
def test_rpn_forward ():
107
104
model = _get_detector_cfg ('rpn/rpn_r50_fpn_1x_coco.py' )
108
- model [ 'pretrained' ] = None
105
+ model . backbone . init_cfg = None
109
106
110
107
from mmdet .models import build_detector
111
108
detector = build_detector (model )
@@ -151,7 +148,7 @@ def test_single_stage_forward_gpu(cfg_file):
151
148
pytest .skip ('test requires GPU and torch+cuda' )
152
149
153
150
model = _get_detector_cfg (cfg_file )
154
- model [ 'pretrained' ] = None
151
+ model . backbone . init_cfg = None
155
152
156
153
from mmdet .models import build_detector
157
154
detector = build_detector (model )
@@ -188,7 +185,7 @@ def test_single_stage_forward_gpu(cfg_file):
188
185
def test_faster_rcnn_ohem_forward ():
189
186
model = _get_detector_cfg (
190
187
'faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py' )
191
- model [ 'pretrained' ] = None
188
+ model . backbone . init_cfg = None
192
189
193
190
from mmdet .models import build_detector
194
191
detector = build_detector (model )
@@ -250,7 +247,7 @@ def test_two_stage_forward(cfg_file):
250
247
with_semantic = False
251
248
252
249
model = _get_detector_cfg (cfg_file )
253
- model [ 'pretrained' ] = None
250
+ model . backbone . init_cfg = None
254
251
255
252
# Save cost
256
253
if cfg_file in [
@@ -305,7 +302,7 @@ def test_two_stage_forward(cfg_file):
305
302
'cfg_file' , ['ghm/retinanet_ghm_r50_fpn_1x_coco.py' , 'ssd/ssd300_coco.py' ])
306
303
def test_single_stage_forward_cpu (cfg_file ):
307
304
model = _get_detector_cfg (cfg_file )
308
- model [ 'pretrained' ] = None
305
+ model . backbone . init_cfg = None
309
306
310
307
from mmdet .models import build_detector
311
308
detector = build_detector (model )
@@ -417,7 +414,7 @@ def _demo_mm_inputs(input_shape=(1, 3, 300, 300),
417
414
418
415
def test_yolact_forward ():
419
416
model = _get_detector_cfg ('yolact/yolact_r50_1x8_coco.py' )
420
- model [ 'pretrained' ] = None
417
+ model . backbone . init_cfg = None
421
418
422
419
from mmdet .models import build_detector
423
420
detector = build_detector (model )
@@ -456,7 +453,7 @@ def test_yolact_forward():
456
453
457
454
def test_detr_forward ():
458
455
model = _get_detector_cfg ('detr/detr_r50_8x2_150e_coco.py' )
459
- model [ 'pretrained' ] = None
456
+ model . backbone . init_cfg = None
460
457
461
458
from mmdet .models import build_detector
462
459
detector = build_detector (model )
@@ -511,7 +508,7 @@ def test_detr_forward():
511
508
512
509
def test_kd_single_stage_forward ():
513
510
model = _get_detector_cfg ('ld/ld_r18_gflv1_r101_fpn_coco_1x.py' )
514
- model [ 'pretrained' ] = None
511
+ model . backbone . init_cfg = None
515
512
516
513
from mmdet .models import build_detector
517
514
detector = build_detector (model )
@@ -573,7 +570,6 @@ def test_inference_detector():
573
570
num_class = 3
574
571
model_dict = dict (
575
572
type = 'RetinaNet' ,
576
- pretrained = None ,
577
573
backbone = dict (
578
574
type = 'ResNet' ,
579
575
depth = 18 ,
0 commit comments