From 382c06d993113de4f931aa99b983860871f1de7a Mon Sep 17 00:00:00 2001 From: Yue Zhou <592267829@qq.com> Date: Wed, 20 Apr 2022 19:50:05 +0800 Subject: [PATCH] [Fix] 'RoIAlignRotated' object has no attribute 'output_size' (#213) * Update rotate_single_level_roi_extractor.py * Update rotate_single_level_roi_extractor.py --- .../roi_extractors/rotate_single_level_roi_extractor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmrotate/models/roi_heads/roi_extractors/rotate_single_level_roi_extractor.py b/mmrotate/models/roi_heads/roi_extractors/rotate_single_level_roi_extractor.py index 542a9c4e1..7f18138ba 100644 --- a/mmrotate/models/roi_heads/roi_extractors/rotate_single_level_roi_extractor.py +++ b/mmrotate/models/roi_heads/roi_extractors/rotate_single_level_roi_extractor.py @@ -99,7 +99,9 @@ def forward(self, feats, rois, roi_scale_factor=None): Returns: torch.Tensor: Scaled RoI features. """ - if isinstance(self.roi_layers[0], ops.RiRoIAlignRotated): + from mmrotate import digit_version, mmcv_version + if isinstance(self.roi_layers[0], ops.RiRoIAlignRotated + ) or mmcv_version == digit_version('1.4.5'): out_size = nn.modules.utils._pair(self.roi_layers[0].out_size) else: out_size = self.roi_layers[0].output_size