Skip to content

Commit

Permalink
Merge branch 'dev_benchmark' of https://github.com/Justice-Eternal/mm…
Browse files Browse the repository at this point in the history
…rotate into dev_benchmark
  • Loading branch information
zytx121 committed Oct 23, 2022
2 parents f1136f3 + 9576feb commit f05a726
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 39 deletions.
2 changes: 1 addition & 1 deletion configs/convnext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DOTA1.0
- ConvNeXt backbone needs to install [MMClassification](https://github.com/open-mmlab/mmclassification) first, which has abundant backbones for downstream tasks.

```shell
pip install mmcls>=0.22.0
pip install "mmcls>=1.0.0rc0"
```

- The performance may be unstable according to mmdetection's experience.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'../kld/rotated-retinanet-rbox-le90_r50_fpn_kld-stable_adamw-1x_dota.py'
]

# please install mmcls>=0.22.0
# please install mmcls>=1.0.0rc0
# import mmcls.models to trigger register_module in mmcls
custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth' # noqa
Expand Down
18 changes: 10 additions & 8 deletions configs/kld/r3det-oc_r50_fpn_kld-stable_1x_dota.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angle_version = 'oc'
model = dict(
bbox_head=dict(
bbox_head_init=dict(
reg_decoded_bbox=True,
loss_bbox=dict(
_delete_=True,
Expand All @@ -12,26 +12,28 @@
tau=1.0,
sqrt=False,
loss_weight=5.0)),
refine_heads=[
bbox_head_refine=[
dict(
type='RotatedRetinaRefineHead',
type='R3RefineHead',
num_classes=15,
in_channels=256,
stacked_convs=4,
feat_channels=256,
assign_by_circumhbbox=None,
frm_cfg=dict(
type='FRM', feat_channels=256, strides=[8, 16, 32, 64, 128]),
anchor_generator=dict(
type='PseudoAnchorGenerator', strides=[8, 16, 32, 64, 128]),
type='PseudoRotatedAnchorGenerator',
strides=[8, 16, 32, 64, 128]),
bbox_coder=dict(
type='DeltaXYWHAOBBoxCoder',
angle_range=angle_version,
type='DeltaXYWHTRBBoxCoder',
angle_version=angle_version,
norm_factor=None,
edge_swap=False,
proj_xy=False,
target_means=(0.0, 0.0, 0.0, 0.0, 0.0),
target_stds=(1.0, 1.0, 1.0, 1.0, 1.0)),
loss_cls=dict(
type='FocalLoss',
type='mmdet.FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
Expand Down
18 changes: 10 additions & 8 deletions configs/kld/r3det-oc_r50_fpn_kld_1x_dota.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angle_version = 'oc'
model = dict(
bbox_head=dict(
bbox_head_init=dict(
reg_decoded_bbox=True,
loss_bbox=dict(
_delete_=True,
Expand All @@ -11,26 +11,28 @@
fun='log1p',
tau=1.0,
loss_weight=1.0)),
refine_heads=[
bbox_head_refine=[
dict(
type='RotatedRetinaRefineHead',
type='R3RefineHead',
num_classes=15,
in_channels=256,
stacked_convs=4,
feat_channels=256,
assign_by_circumhbbox=None,
frm_cfg=dict(
type='FRM', feat_channels=256, strides=[8, 16, 32, 64, 128]),
anchor_generator=dict(
type='PseudoAnchorGenerator', strides=[8, 16, 32, 64, 128]),
type='PseudoRotatedAnchorGenerator',
strides=[8, 16, 32, 64, 128]),
bbox_coder=dict(
type='DeltaXYWHAOBBoxCoder',
angle_range=angle_version,
type='DeltaXYWHTRBBoxCoder',
angle_version=angle_version,
norm_factor=None,
edge_swap=False,
proj_xy=False,
target_means=(0.0, 0.0, 0.0, 0.0, 0.0),
target_stds=(1.0, 1.0, 1.0, 1.0, 1.0)),
loss_cls=dict(
type='FocalLoss',
type='mmdet.FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
Expand Down
18 changes: 10 additions & 8 deletions configs/kld/r3det-tiny-oc_r50_fpn_kld_1x_dota.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angle_version = 'oc'
model = dict(
bbox_head=dict(
bbox_head_init=dict(
reg_decoded_bbox=True,
loss_bbox=dict(
_delete_=True,
Expand All @@ -11,26 +11,28 @@
fun='log1p',
tau=1.0,
loss_weight=1.0)),
refine_heads=[
bbox_head_refine=[
dict(
type='RotatedRetinaRefineHead',
type='R3RefineHead',
num_classes=15,
in_channels=256,
stacked_convs=2,
feat_channels=256,
assign_by_circumhbbox=None,
frm_cfg=dict(
type='FRM', feat_channels=256, strides=[8, 16, 32, 64, 128]),
anchor_generator=dict(
type='PseudoAnchorGenerator', strides=[8, 16, 32, 64, 128]),
type='PseudoRotatedAnchorGenerator',
strides=[8, 16, 32, 64, 128]),
bbox_coder=dict(
type='DeltaXYWHAOBBoxCoder',
angle_range=angle_version,
type='DeltaXYWHTRBBoxCoder',
angle_version=angle_version,
norm_factor=None,
edge_swap=False,
proj_xy=False,
target_means=(0.0, 0.0, 0.0, 0.0, 0.0),
target_stds=(1.0, 1.0, 1.0, 1.0, 1.0)),
loss_cls=dict(
type='FocalLoss',
type='mmdet.FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_base_ = '../rotated_retinanet/rotated_retinanet-hbox-oc_r50_fpn_1x_dota.py'
_base_ = '../rotated_retinanet/rotated-retinanet-hbox-oc_r50_fpn_1x_dota.py'

model = dict(
bbox_head=dict(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_base_ = './rotated_retinanet-rbox-le90_r50_fpn_kld-stable_1x_dota.py'
_base_ = './rotated-retinanet-rbox-le90_r50_fpn_kld-stable_1x_dota.py'

optim_wrapper = dict(
optimizer=dict(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = './oriented-rcnn-le90_r50_fpn_1x_dota.py'

optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
optim_wrapper = dict(type='AmpOptimWrapper')
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
model = dict(
backbone=dict(
_delete_=True,
type='SwinTransformer',
type='mmdet.SwinTransformer',
embed_dims=96,
depths=depths,
num_heads=[3, 6, 12, 24],
Expand Down
1 change: 1 addition & 0 deletions configs/redet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Notes:
- `MS` means multiple scale image split.
- `RR` means random rotation.
- Please download pretrained weight of ReResNet from [ReDet](https://github.com/csuhan/ReDet), and put it on `work_dirs/pretrain`. BTW, it is normal for `missing keys in source state_dict: xxx.filter ` to appear in the log. Don't worry!
- Please use distributed training, there are some bug when use `train.py`.

## Citation

Expand Down
2 changes: 1 addition & 1 deletion configs/redet/redet-le90_re50_refpn_amp-1x_dota.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = './redet-le90_re50_refpn_1x_dota.py'

optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
optim_wrapper = dict(type='AmpOptimWrapper')
2 changes: 1 addition & 1 deletion configs/roi_trans/roi-trans-le90_r50_fpn_amp-1x_dota.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = './roi-trans-le90_r50_fpn_1x_dota.py'

optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
optim_wrapper = dict(type='AmpOptimWrapper')
2 changes: 1 addition & 1 deletion configs/roi_trans/roi-trans-le90_swin-tiny_fpn_1x_dota.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
model = dict(
backbone=dict(
_delete_=True,
type='SwinTransformer',
type='mmet.SwinTransformer',
embed_dims=96,
depths=depths,
num_heads=[3, 6, 12, 24],
Expand Down
4 changes: 2 additions & 2 deletions configs/rotated_reppoints/metafile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Collections:
README: configs/cfa/README.md

Models:
- Name: rotated_reppoints_r50_fpn_1x_dota_oc
- Name: rotated-reppoints-qbox_r50_fpn_1x_dota
In Collection: rotated_reppoints
Config: configs/rotated_reppoints/rotated_reppoints_r50_fpn_1x_dota_oc.py
Config: configs/rotated_reppoints/rotated-reppoints-qbox_r50_fpn_1x_dota.py
Metadata:
Training Data: DOTAv1.0
Results:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = ['./rotated-retinanet-rbox-le90_r50_fpn_1x_dota.py']

optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
optim_wrapper = dict(type='AmpOptimWrapper')
2 changes: 1 addition & 1 deletion mmrotate/models/backbones/re_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def __init__(self,
zero_init_residual: bool = True,
init_cfg: OptMultiConfig = None) -> None:
super().__init__(init_cfg=init_cfg)
self.in_type = build_enn_trivial_feature(3)
self.in_type = build_enn_trivial_feature(in_channels)

if depth not in self.arch_settings:
raise KeyError(f'invalid depth {depth} for resnet')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def forward(self, feats, rois, roi_scale_factor=None):
Returns:
torch.Tensor: Scaled RoI features.
"""
rois = rois.type_as(feats[0])
from mmrotate import digit_version, mmcv_version
if isinstance(self.roi_layers[0], ops.RiRoIAlignRotated
) or mmcv_version == digit_version('1.4.5'):
Expand Down
4 changes: 2 additions & 2 deletions mmrotate/structures/bbox/rotated_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,10 @@ def overlaps(boxes1: BaseBoxes,
Returns:
Tensor: shape (m, n) if ``is_aligned`` is False else shape (m,)
"""
from ..iou_calculators import rbox_overlaps
from mmrotate.structures.bbox import rbbox_overlaps
boxes1 = boxes1.convert_to('rbox')
boxes2 = boxes2.convert_to('rbox')
return rbox_overlaps(
return rbbox_overlaps(
boxes1.tensor,
boxes2.tensor,
mode=mode,
Expand Down

0 comments on commit f05a726

Please sign in to comment.