Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
type='DetDataPreprocessor',
mean=[103.530, 116.280, 123.675],
std=[57.375, 57.120, 58.395],
to_rgb=False,
bgr_to_rgb=False,
pad_size_divisor=32),
backbone=dict(
type='ResNeXt',
Expand Down
2 changes: 1 addition & 1 deletion configs/cascade_rcnn/cascade-rcnn_r50-caffe_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
type='DetDataPreprocessor',
mean=[103.530, 116.280, 123.675],
std=[1.0, 1.0, 1.0],
to_rgb=False,
bgr_to_rgb=False,
pad_size_divisor=32),
backbone=dict(
norm_cfg=dict(requires_grad=False),
Expand Down
10 changes: 5 additions & 5 deletions configs/dcnv2/metafile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Collections:
Models:
- Name: faster-rcnn_r50_fpn_mdconv_c3-c5_1x_coco
In Collection: Deformable Convolutional Networks v2
Config: configs/dcn/faster-rcnn_r50-mdconv-c3-c5_fpn_1x_coco.py
Config: configs/dcnv2/faster-rcnn_r50-mdconv-c3-c5_fpn_1x_coco.py
Metadata:
Training Memory (GB): 4.1
inference time (ms/im):
Expand All @@ -39,7 +39,7 @@ Models:

- Name: faster-rcnn_r50_fpn_mdconv_c3-c5_group4_1x_coco
In Collection: Deformable Convolutional Networks v2
Config: configs/dcn/faster-rcnn_r50-mdconv-group4-c3-c5_fpn_1x_coco.py
Config: configs/dcnv2/faster-rcnn_r50-mdconv-group4-c3-c5_fpn_1x_coco.py
Metadata:
Training Memory (GB): 4.2
inference time (ms/im):
Expand All @@ -59,7 +59,7 @@ Models:

- Name: faster-rcnn_r50_fpn_mdpool_1x_coco
In Collection: Deformable Convolutional Networks v2
Config: configs/dcn/faster-rcnn_r50_fpn_mdpool_1x_coco.py
Config: configs/dcnv2/faster-rcnn_r50_fpn_mdpool_1x_coco.py
Metadata:
Training Memory (GB): 5.8
inference time (ms/im):
Expand All @@ -79,7 +79,7 @@ Models:

- Name: mask-rcnn_r50_fpn_mdconv_c3-c5_1x_coco
In Collection: Deformable Convolutional Networks v2
Config: configs/dcn/mask-rcnn_r50-mdconv-c3-c5_fpn_1x_coco.py
Config: configs/dcnv2/mask-rcnn_r50-mdconv-c3-c5_fpn_1x_coco.py
Metadata:
Training Memory (GB): 4.5
inference time (ms/im):
Expand All @@ -103,7 +103,7 @@ Models:

- Name: mask-rcnn_r50_fpn_fp16_mdconv_c3-c5_1x_coco
In Collection: Deformable Convolutional Networks v2
Config: configs/dcn/mask-rcnn_r50-mdconv-c3-c5_fpn_amp-1x_coco.py
Config: configs/dcnv2/mask-rcnn_r50-mdconv-c3-c5_fpn_amp-1x_coco.py
Metadata:
Training Memory (GB): 3.1
Training Techniques:
Expand Down
16 changes: 14 additions & 2 deletions configs/mask2former/mask2former_r50_8xb2-lsj-50e_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = ['./mask2former_r50_8xb2-lsj-50e_coco-panoptic.py']

file_client_args = dict(backend='disk')
num_things_classes = 80
num_stuff_classes = 0
num_classes = num_things_classes + num_stuff_classes
Expand Down Expand Up @@ -56,6 +56,17 @@
dict(type='PackDetInputs')
]

test_pipeline = [
dict(type='LoadImageFromFile', file_client_args=file_client_args),
dict(type='Resize', scale=(1333, 800), keep_ratio=True),
# If you don't have a gt annotation, delete the pipeline
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
'scale_factor'))
]

dataset_type = 'CocoDataset'
data_root = 'data/coco/'

Expand All @@ -70,7 +81,8 @@
dataset=dict(
type=dataset_type,
ann_file='annotations/instances_val2017.json',
data_prefix=dict(img='val2017/')))
data_prefix=dict(img='val2017/'),
pipeline=test_pipeline))
test_dataloader = val_dataloader

val_evaluator = dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
dataset=dict(
type=dataset_type,
ann_file='challenge2019/challenge-2019-validation-detection-bbox.txt',
data_prefix=dict(img='OpenImages/'),
label_file='challenge2019/cls-label-description.csv',
hierarchy_file='challenge2019/class_label_tree.np',
meta_file='challenge2019/challenge-2019-validation-metas.pkl',
Expand Down
7 changes: 5 additions & 2 deletions configs/retinanet/retinanet_r101-caffe_fpn_ms-3x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
_base_ = './retinanet_r50-caffe_fpn_ms-3x_coco.py'
# learning policy
model = dict(
pretrained='open-mmlab://detectron2/resnet101_caffe',
backbone=dict(depth=101))
backbone=dict(
depth=101,
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet101_caffe')))
6 changes: 5 additions & 1 deletion configs/retinanet/retinanet_r101_fpn_ms-640-800-3x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
_base_ = ['../_base_/models/retinanet_r50_fpn.py', '../common/ms_3x_coco.py']
# optimizer
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
optim_wrapper = dict(
optimizer=dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001))
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
_base_ = ['../_base_/models/retinanet_r50_fpn.py', '../common/ms_3x_coco.py']
# optimizer
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(type='ResNeXt', depth=101, groups=64, base_width=4))
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')))
optim_wrapper = dict(optimizer=dict(type='SGD', lr=0.01))
8 changes: 4 additions & 4 deletions configs/seesaw_loss/metafile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Collections:
Models:
- Name: mask-rcnn_r50_fpn_random_seesaw_loss_mstrain_2x_lvis_v1
In Collection: Seesaw Loss
Config: seesaw_loss/mask-rcnn_r50_fpn_seesaw-loss_random-ms-2x_lvis-v1.py
Config: configs/seesaw_loss/mask-rcnn_r50_fpn_seesaw-loss_random-ms-2x_lvis-v1.py
Metadata:
Epochs: 24
Results:
Expand All @@ -38,7 +38,7 @@ Models:
Weights: https://download.openmmlab.com/mmdetection/v2.0/seesaw_loss/mask_rcnn_r50_fpn_random_seesaw_loss_mstrain_2x_lvis_v1-a698dd3d.pth
- Name: mask-rcnn_r50_fpn_random_seesaw_loss_normed_mask_mstrain_2x_lvis_v1
In Collection: Seesaw Loss
Config: seesaw_loss/mask-rcnn_r50_fpn_seesaw-loss-normed-mask_random-ms-2x_lvis-v1.py
Config: configs/seesaw_loss/mask-rcnn_r50_fpn_seesaw-loss-normed-mask_random-ms-2x_lvis-v1.py
Metadata:
Epochs: 24
Results:
Expand All @@ -53,7 +53,7 @@ Models:
Weights: https://download.openmmlab.com/mmdetection/v2.0/seesaw_loss/mask_rcnn_r50_fpn_random_seesaw_loss_normed_mask_mstrain_2x_lvis_v1-a1c11314.pth
- Name: mask-rcnn_r101_fpn_seesaw-loss_random-ms-2x_lvis-v1
In Collection: Seesaw Loss
Config: seesaw_loss/mask-rcnn_r101_fpn_seesaw-loss_random-ms-2x_lvis-v1.py
Config: configs/seesaw_loss/mask-rcnn_r101_fpn_seesaw-loss_random-ms-2x_lvis-v1.py
Metadata:
Epochs: 24
Results:
Expand All @@ -68,7 +68,7 @@ Models:
Weights: https://download.openmmlab.com/mmdetection/v2.0/seesaw_loss/mask_rcnn_r101_fpn_random_seesaw_loss_mstrain_2x_lvis_v1-8e6e6dd5.pth
- Name: mask-rcnn_r101_fpn_seesaw-loss-normed-mask_random-ms-2x_lvis-v1
In Collection: Seesaw Loss
Config: seesaw_loss/mask-rcnn_r101_fpn_seesaw-loss-normed-mask_random-ms-2x_lvis-v1.py
Config: configs/seesaw_loss/mask-rcnn_r101_fpn_seesaw-loss-normed-mask_random-ms-2x_lvis-v1.py
Metadata:
Epochs: 24
Results:
Expand Down
3 changes: 2 additions & 1 deletion mmdet/models/dense_heads/anchor_free_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def _load_from_state_dict(self, state_dict: dict, prefix: str,
strict, missing_keys, unexpected_keys,
error_msgs)

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor], List[Tensor]]:
def forward(self, x: Tuple[Tensor],
*args) -> Tuple[List[Tensor], List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/anchor_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def forward_single(self, x: Tensor) -> Tuple[Tensor, Tensor]:
bbox_pred = self.conv_reg(x)
return cls_score, bbox_pred

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, x: Tuple[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/atss_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _init_layers(self) -> None:
self.scales = nn.ModuleList(
[Scale(1.0) for _ in self.prior_generator.strides])

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, x: Tuple[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/centernet_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def init_weights(self) -> None:
if isinstance(m, nn.Conv2d):
normal_init(m, std=0.001)

def forward(self, x: Tuple[Tensor, ...]) -> Tuple[List[Tensor]]:
def forward(self, x: Tuple[Tensor, ...], *args) -> Tuple[List[Tensor]]:
"""Forward features. Notice CenterNet head does not use FPN.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/corner_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def init_weights(self) -> None:
self.tl_emb[i][-1].conv.reset_parameters()
self.br_emb[i][-1].conv.reset_parameters()

def forward(self, feats: Tuple[Tensor]) -> tuple:
def forward(self, feats: Tuple[Tensor], *args) -> tuple:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/ddod_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def init_weights(self) -> None:
bias_cls = bias_init_with_prob(0.01)
normal_init(self.atss_cls, std=0.01, bias=bias_cls)

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, x: Tuple[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
3 changes: 1 addition & 2 deletions mmdet/models/dense_heads/deformable_detr_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ def forward(self, x: Tuple[Tensor],
enc_outputs_class, \
enc_outputs_coord.sigmoid()
else:
return outputs_classes, outputs_coords, \
None, None
return outputs_classes, outputs_coords

def loss_by_feat(
self,
Expand Down
5 changes: 2 additions & 3 deletions mmdet/models/dense_heads/fcos_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ def _init_layers(self) -> None:
self.conv_centerness = nn.Conv2d(self.feat_channels, 1, 3, padding=1)
self.scales = nn.ModuleList([Scale(1.0) for _ in self.strides])

def forward(
self, x: Tuple[Tensor]
) -> Tuple[List[Tensor], List[Tensor], List[Tensor]]:
def forward(self, x: Tuple[Tensor],
*args) -> Tuple[List[Tensor], List[Tensor], List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/gfl_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _init_layers(self) -> None:
self.scales = nn.ModuleList(
[Scale(1.0) for _ in self.prior_generator.strides])

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, x: Tuple[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/guided_anchor_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def forward_single(self, x: Tensor) -> Tuple[Tensor]:
bbox_pred = self.conv_reg(x, mask)
return cls_score, bbox_pred, shape_pred, loc_pred

def forward(self, x: List[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, x: List[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network."""
return multi_apply(self.forward_single, x)

Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/reppoints_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def gen_grid_from_reg(self, reg: Tensor,
], 1)
return grid_yx, regressed_bbox

def forward(self, feats: Tuple[Tensor]) -> Tuple[Tensor]:
def forward(self, feats: Tuple[Tensor], *args) -> Tuple[Tensor]:
return multi_apply(self.forward_single, feats)

def forward_single(self, x: Tensor) -> Tuple[Tensor]:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/retina_sepbn_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def init_weights(self) -> None:
normal_init(self.retina_cls, std=0.01, bias=bias_cls)
normal_init(self.retina_reg, std=0.01)

def forward(self, feats: Tuple[Tensor]) -> tuple:
def forward(self, feats: Tuple[Tensor], *args) -> tuple:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/sabl_retina_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def forward_single(self, x: Tensor) -> Tuple[Tensor, Tensor]:
bbox_pred = (bbox_cls_pred, bbox_reg_pred)
return cls_score, bbox_pred

def forward(self, feats: List[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, feats: List[Tensor], *args) -> Tuple[List[Tensor]]:
return multi_apply(self.forward_single, feats)

def get_anchors(
Expand Down
3 changes: 2 additions & 1 deletion mmdet/models/dense_heads/ssd_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def _init_layers(self) -> None:
self.cls_convs.append(nn.Sequential(*cls_layers))
self.reg_convs.append(nn.Sequential(*reg_layers))

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor], List[Tensor]]:
def forward(self, x: Tuple[Tensor],
*args) -> Tuple[List[Tensor], List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/tood_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def init_weights(self) -> None:
normal_init(self.tood_cls, std=0.01, bias=bias_cls)
normal_init(self.tood_reg, std=0.01)

def forward(self, feats: Tuple[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, feats: Tuple[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/vfnet_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _init_layers(self) -> None:
self.vfnet_cls = nn.Conv2d(
self.feat_channels, self.cls_out_channels, 3, padding=1)

def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor]]:
def forward(self, x: Tuple[Tensor], *args) -> Tuple[List[Tensor]]:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/yolo_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def init_weights(self) -> None:
bias_init_with_prob(8 / (608 / stride)**2))
nn.init.constant_(bias.data[:, 5:], bias_init_with_prob(0.01))

def forward(self, x: Tuple[Tensor, ...]) -> tuple:
def forward(self, x: Tuple[Tensor, ...], *args) -> tuple:
"""Forward features from the upstream network.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/models/dense_heads/yolox_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def forward_single(self, x: Tensor, cls_convs: nn.Module,

return cls_score, bbox_pred, objectness

def forward(self, x: Tuple[Tensor]) -> Tuple[List]:
def forward(self, x: Tuple[Tensor], *args) -> Tuple[List]:
"""Forward features from the upstream network.

Args:
Expand Down
8 changes: 7 additions & 1 deletion mmdet/models/detectors/single_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,18 @@ def _forward(

Args:
batch_inputs (Tensor): Inputs with shape (N, C, H, W).
batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
the meta information of each image and corresponding
annotations.

Returns:
tuple[list]: A tuple of features from ``bbox_head`` forward.
"""
x = self.extract_feat(batch_inputs)
results = self.bbox_head.forward(x)
batch_img_metas = [
data_samples.metainfo for data_samples in batch_data_samples
]
results = self.bbox_head.forward(x, batch_img_metas)
return results

def extract_feat(self, batch_inputs: Tensor) -> Tuple[Tensor]:
Expand Down
7 changes: 5 additions & 2 deletions mmdet/models/detectors/two_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def _forward(self, batch_inputs: Tensor,

Args:
batch_inputs (Tensor): Inputs with shape (N, C, H, W).
batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
the meta information of each image and corresponding
annotations.

Returns:
tuple: A tuple of features from ``rpn_head`` and ``roi_head``
Expand All @@ -135,8 +138,8 @@ def _forward(self, batch_inputs: Tensor,
rpn_results_list = [
data_sample.proposals for data_sample in batch_data_samples
]

roi_outs = self.roi_head.forward(x, rpn_results_list)
roi_outs = self.roi_head.forward(x, rpn_results_list,
batch_data_samples)
results = results + (roi_outs, )
return results

Expand Down
Loading