Skip to content

Commit 562b93b

Browse files
committed
mmcv-full support
1 parent a799dd0 commit 562b93b

31 files changed

+38
-4590
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This project is released under the [Apache 2.0 license](LICENSE).
3030

3131
## Update
3232

33+
- (**2021-11-29**) Discard mmcv-0.6.2 and support mmcv-full.
3334
- (**2021-09-18**) Implement [Double Head OBB](configs/obb/double_heads_obb) in the OBBDetection.
3435
- (**2021-09-01**) Implement [FCOS OBB](configs/obb/fcos_obb) in the OBBDetection.
3536
- (**2021-08-21**) Reimplement the [PolyIoULoss](configs/obb/poly_iou_loss).

docs/install.md

+17-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- PyTorch 1.3+
88
- CUDA 9.2+ (If you build PyTorch from source, CUDA 9.0 is also compatible)
99
- GCC 5+
10-
- [mmcv 0.6.2](https://github.com/open-mmlab/mmcv)
10+
- [mmcv > 1.3](https://github.com/open-mmlab/mmcv)
1111
- [BboxToolkit 1.0](https://github.com/jbwang1997/BboxToolkit)
1212

1313
### Install OBBDetection
@@ -54,16 +54,28 @@ cd OBBDetection
5454

5555
d. Install build requirements and then install OBBDetection.
5656

57+
- install the BboxToolkit
58+
5759
```shell
58-
# install the BboxToolkit
5960
cd BboxToolkit
6061
pip install -v -e . # or "python setup.py develop"
6162
cd ..
63+
```
64+
65+
- install mmcv-full
66+
67+
Please refer to [mmcv-full](https://github.com/open-mmlab/mmcv) to select a compatible version of mmcv-full
68+
```shell
69+
# example
70+
pip install mmcv-full==1.3.9 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
71+
# Here, the version of cuda and torch should be the same with your environment.
72+
```
6273

63-
# install the OBBDetection
74+
- install OBBDetection
75+
76+
```
6477
pip install -r requirements/build.txt
6578
pip install mmpycocotools
66-
pip install mmcv==0.6.2
6779
pip install -v -e . # or "python setup.py develop"
6880
```
6981

@@ -106,4 +118,4 @@ However some functionality is gone in this mode:
106118
- sigmoid_focal_loss_cuda
107119

108120
So if you try to run inference with a model containing deformable convolution you will get an error.
109-
Note: We set `use_torchvision=True` on-the-fly in CPU mode for `RoIPool` and `RoIAlign`
121+
Note: We set `use_torchvision=True` on-the-fly in CPU mode for `RoIPool` and `RoIAlign`

mmdet/models/dense_heads/fovea_head.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from mmcv.cnn import ConvModule, normal_init
44

55
from mmdet.core import multi_apply, multiclass_nms
6-
from mmdet.ops import DeformConv
6+
from mmcv.ops import DeformConv2d
77
from ..builder import HEADS
88
from .anchor_free_head import AnchorFreeHead
99

@@ -21,12 +21,12 @@ def __init__(self,
2121
offset_channels = kernel_size * kernel_size * 2
2222
self.conv_offset = nn.Conv2d(
2323
4, deformable_groups * offset_channels, 1, bias=False)
24-
self.conv_adaption = DeformConv(
24+
self.conv_adaption = DeformConv2d(
2525
in_channels,
2626
out_channels,
2727
kernel_size=kernel_size,
2828
padding=(kernel_size - 1) // 2,
29-
deformable_groups=deformable_groups)
29+
deform_groups=deformable_groups)
3030
self.relu = nn.ReLU(inplace=True)
3131

3232
def init_weights(self):

mmdet/models/dense_heads/guided_anchor_head.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
build_assigner, build_bbox_coder, build_sampler,
77
calc_region, force_fp32, images_to_levels, multi_apply,
88
multiclass_nms, unmap)
9-
from mmdet.ops import DeformConv, MaskedConv2d
9+
from mmcv.ops import DeformConv2d, MaskedConv2d
1010
from ..builder import HEADS, build_loss
1111
from .anchor_head import AnchorHead
1212

@@ -34,12 +34,12 @@ def __init__(self,
3434
offset_channels = kernel_size * kernel_size * 2
3535
self.conv_offset = nn.Conv2d(
3636
2, deformable_groups * offset_channels, 1, bias=False)
37-
self.conv_adaption = DeformConv(
37+
self.conv_adaption = DeformConv2d(
3838
in_channels,
3939
out_channels,
4040
kernel_size=kernel_size,
4141
padding=(kernel_size - 1) // 2,
42-
deformable_groups=deformable_groups)
42+
deform_groups=deformable_groups)
4343
self.relu = nn.ReLU(inplace=True)
4444

4545
def init_weights(self):

mmdet/models/dense_heads/reppoints_head.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from mmdet.core import (PointGenerator, build_assigner, build_sampler,
77
images_to_levels, multi_apply, multiclass_nms, unmap)
8-
from mmdet.ops import DeformConv
8+
from mmcv.ops import DeformConv2d
99
from ..builder import HEADS, build_loss
1010
from .anchor_free_head import AnchorFreeHead
1111

@@ -130,20 +130,20 @@ def _init_layers(self):
130130
conv_cfg=self.conv_cfg,
131131
norm_cfg=self.norm_cfg))
132132
pts_out_dim = 4 if self.use_grid_points else 2 * self.num_points
133-
self.reppoints_cls_conv = DeformConv(self.feat_channels,
134-
self.point_feat_channels,
135-
self.dcn_kernel, 1, self.dcn_pad)
133+
self.reppoints_cls_conv = DeformConv2d(self.feat_channels,
134+
self.point_feat_channels,
135+
self.dcn_kernel, 1, self.dcn_pad)
136136
self.reppoints_cls_out = nn.Conv2d(self.point_feat_channels,
137137
self.cls_out_channels, 1, 1, 0)
138138
self.reppoints_pts_init_conv = nn.Conv2d(self.feat_channels,
139139
self.point_feat_channels, 3,
140140
1, 1)
141141
self.reppoints_pts_init_out = nn.Conv2d(self.point_feat_channels,
142142
pts_out_dim, 1, 1, 0)
143-
self.reppoints_pts_refine_conv = DeformConv(self.feat_channels,
144-
self.point_feat_channels,
145-
self.dcn_kernel, 1,
146-
self.dcn_pad)
143+
self.reppoints_pts_refine_conv = DeformConv2d(self.feat_channels,
144+
self.point_feat_channels,
145+
self.dcn_kernel, 1,
146+
self.dcn_pad)
147147
self.reppoints_pts_refine_out = nn.Conv2d(self.point_feat_channels,
148148
pts_out_dim, 1, 1, 0)
149149

mmdet/models/necks/fpn_carafe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import torch.nn as nn
22
from mmcv.cnn import ConvModule, build_upsample_layer, xavier_init
33

4-
from mmdet.ops.carafe import CARAFEPack
4+
from mmcv.ops.carafe import CARAFEPack
55
from ..builder import NECKS
66

77

mmdet/models/roi_heads/mask_heads/fcn_mask_head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from mmdet.core import auto_fp16, force_fp32, mask_target
99
from mmdet.models.builder import HEADS, build_loss
1010
from mmdet.ops import Conv2d
11-
from mmdet.ops.carafe import CARAFEPack
11+
from mmcv.ops.carafe import CARAFEPack
1212

1313
BYTES_PER_FLOAT = 4
1414
# TODO: This memory limit may be too much or too little. It would be better to

mmdet/ops/__init__.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
from .context_block import ContextBlock
2-
from .conv_ws import ConvWS2d, conv_ws_2d
32
from .corner_pool import CornerPool
4-
from .dcn import (DeformConv, DeformConvPack, DeformRoIPooling,
5-
DeformRoIPoolingPack, ModulatedDeformConv,
6-
ModulatedDeformConvPack, ModulatedDeformRoIPoolingPack,
7-
deform_conv, deform_roi_pooling, modulated_deform_conv)
83
from .generalized_attention import GeneralizedAttention
94
from .masked_conv import MaskedConv2d
105
from .nms import batched_nms, nms, nms_match, soft_nms
@@ -14,7 +9,6 @@
149
rel_roi_point_to_rel_img_point)
1510
from .roi_align import RoIAlign, roi_align
1611
from .roi_pool import RoIPool, roi_pool
17-
from .saconv import SAConv2d
1812
from .sigmoid_focal_loss import SigmoidFocalLoss, sigmoid_focal_loss
1913
from .utils import get_compiler_version, get_compiling_cuda_version
2014
from .wrappers import Conv2d, ConvTranspose2d, Linear, MaxPool2d
@@ -26,16 +20,11 @@
2620

2721
__all__ = [
2822
'nms', 'soft_nms', 'RoIAlign', 'roi_align', 'RoIPool', 'roi_pool',
29-
'DeformConv', 'DeformConvPack', 'DeformRoIPooling', 'DeformRoIPoolingPack',
30-
'ModulatedDeformRoIPoolingPack', 'ModulatedDeformConv',
31-
'ModulatedDeformConvPack', 'deform_conv', 'modulated_deform_conv',
32-
'deform_roi_pooling', 'SigmoidFocalLoss', 'sigmoid_focal_loss',
33-
'MaskedConv2d', 'ContextBlock', 'GeneralizedAttention', 'NonLocal2D',
34-
'get_compiler_version', 'get_compiling_cuda_version', 'ConvWS2d',
35-
'conv_ws_2d', 'build_plugin_layer', 'batched_nms', 'Conv2d',
23+
'SigmoidFocalLoss', 'sigmoid_focal_loss', 'MaskedConv2d', 'ContextBlock',
24+
'GeneralizedAttention', 'NonLocal2D', 'get_compiler_version',
25+
'get_compiling_cuda_version', 'build_plugin_layer', 'batched_nms', 'Conv2d',
3626
'ConvTranspose2d', 'MaxPool2d', 'Linear', 'nms_match', 'CornerPool',
3727
'point_sample', 'rel_roi_point_to_rel_img_point', 'SimpleRoIAlign',
38-
'SAConv2d',
3928

4029
'roi_align_rotated', 'RoIAlignRotated', 'obb_nms', 'BT_nms',
4130
'arb_batched_nms', 'obb_overlaps', 'convex_sort'

mmdet/ops/carafe/__init__.py

-3
This file was deleted.

0 commit comments

Comments
 (0)